replace some usages of uint16/uint32 with just int

This commit is contained in:
UnknownShadow200 2018-10-07 15:03:30 +11:00
parent f9eea60daf
commit 28e1a2378d
19 changed files with 70 additions and 66 deletions

View File

@ -20,7 +20,7 @@ void DrawTextArgs_MakeEmpty(struct DrawTextArgs* args, FontDesc* font, bool useS
args->UseShadow = useShadow; args->UseShadow = useShadow;
} }
void Drawer2D_MakeFont(FontDesc* desc, uint16_t size, uint16_t style) { void Drawer2D_MakeFont(FontDesc* desc, int size, int style) {
if (Drawer2D_BitmappedText) { if (Drawer2D_BitmappedText) {
desc->Handle = NULL; desc->Handle = NULL;
desc->Size = size; desc->Size = size;

View File

@ -11,7 +11,7 @@ struct Texture;
void DrawTextArgs_Make(struct DrawTextArgs* args, STRING_REF const String* text, FontDesc* font, bool useShadow); void DrawTextArgs_Make(struct DrawTextArgs* args, STRING_REF const String* text, FontDesc* font, bool useShadow);
void DrawTextArgs_MakeEmpty(struct DrawTextArgs* args, FontDesc* font, bool useShadow); void DrawTextArgs_MakeEmpty(struct DrawTextArgs* args, FontDesc* font, bool useShadow);
NOINLINE_ void Drawer2D_MakeFont(FontDesc* desc, uint16_t size, uint16_t style); NOINLINE_ void Drawer2D_MakeFont(FontDesc* desc, int size, int style);
/* Whether chat text should be drawn and measuring using the currently bitmapped font, /* Whether chat text should be drawn and measuring using the currently bitmapped font,
false uses the font supplied as the DrawTextArgs argument supplied to the function. */ false uses the font supplied as the DrawTextArgs argument supplied to the function. */

View File

@ -514,7 +514,7 @@ static void ShadowComponent_DrawCircle(VertexP3fT2fC4b** vertices, struct Entity
Vector3 min = Block_MinBB[data[0].Block], max = Block_MaxBB[data[0].Block]; Vector3 min = Block_MinBB[data[0].Block], max = Block_MaxBB[data[0].Block];
ShadowComponent_DrawCoords(vertices, entity, &data[0], x + min.X, z + min.Z, x + max.X, z + max.Z); ShadowComponent_DrawCoords(vertices, entity, &data[0], x + min.X, z + min.Z, x + max.X, z + max.Z);
UInt32 i; int i;
for (i = 1; i < 4; i++) { for (i = 1; i < 4; i++) {
if (data[i].Block == BLOCK_AIR) return; if (data[i].Block == BLOCK_AIR) return;
Vector3 nMin = Block_MinBB[data[i].Block], nMax = Block_MaxBB[data[i].Block]; Vector3 nMin = Block_MinBB[data[i].Block], nMax = Block_MaxBB[data[i].Block];

View File

@ -2,7 +2,7 @@
#include "ErrorHandler.h" #include "ErrorHandler.h"
static void Event_RegisterImpl(struct Event_Void* handlers, void* obj, Event_Void_Callback handler) { static void Event_RegisterImpl(struct Event_Void* handlers, void* obj, Event_Void_Callback handler) {
UInt32 i; int i;
for (i = 0; i < handlers->Count; i++) { for (i = 0; i < handlers->Count; i++) {
if (handlers->Handlers[i] == handler && handlers->Objs[i] == obj) { if (handlers->Handlers[i] == handler && handlers->Objs[i] == obj) {
ErrorHandler_Fail("Attempt to register event handler that was already registered"); ErrorHandler_Fail("Attempt to register event handler that was already registered");
@ -19,7 +19,7 @@ static void Event_RegisterImpl(struct Event_Void* handlers, void* obj, Event_Voi
} }
static void Event_UnregisterImpl(struct Event_Void* handlers, void* obj, Event_Void_Callback handler) { static void Event_UnregisterImpl(struct Event_Void* handlers, void* obj, Event_Void_Callback handler) {
UInt32 i, j; int i, j;
for (i = 0; i < handlers->Count; i++) { for (i = 0; i < handlers->Count; i++) {
if (handlers->Handlers[i] != handler || handlers->Objs[i] != obj) continue; if (handlers->Handlers[i] != handler || handlers->Objs[i] != obj) continue;
@ -38,7 +38,7 @@ static void Event_UnregisterImpl(struct Event_Void* handlers, void* obj, Event_V
} }
void Event_RaiseVoid(struct Event_Void* handlers) { void Event_RaiseVoid(struct Event_Void* handlers) {
UInt32 i; int i;
for (i = 0; i < handlers->Count; i++) { for (i = 0; i < handlers->Count; i++) {
handlers->Handlers[i](handlers->Objs[i]); handlers->Handlers[i](handlers->Objs[i]);
} }
@ -51,7 +51,7 @@ void Event_UnregisterVoid(struct Event_Void* handlers, void* obj, Event_Void_Cal
} }
void Event_RaiseInt(struct Event_Int* handlers, int arg) { void Event_RaiseInt(struct Event_Int* handlers, int arg) {
UInt32 i; int i;
for (i = 0; i < handlers->Count; i++) { for (i = 0; i < handlers->Count; i++) {
handlers->Handlers[i](handlers->Objs[i], arg); handlers->Handlers[i](handlers->Objs[i], arg);
} }
@ -64,7 +64,7 @@ void Event_UnregisterInt(struct Event_Int* handlers, void* obj, Event_Int_Callba
} }
void Event_RaiseFloat(struct Event_Float* handlers, float arg) { void Event_RaiseFloat(struct Event_Float* handlers, float arg) {
UInt32 i; int i;
for (i = 0; i < handlers->Count; i++) { for (i = 0; i < handlers->Count; i++) {
handlers->Handlers[i](handlers->Objs[i], arg); handlers->Handlers[i](handlers->Objs[i], arg);
} }
@ -78,7 +78,7 @@ void Event_UnregisterFloat(struct Event_Float* handlers, void* obj, Event_Float_
} }
void Event_RaiseEntry(struct Event_Entry* handlers, struct Stream* stream, const String* name) { void Event_RaiseEntry(struct Event_Entry* handlers, struct Stream* stream, const String* name) {
UInt32 i; int i;
for (i = 0; i < handlers->Count; i++) { for (i = 0; i < handlers->Count; i++) {
handlers->Handlers[i](handlers->Objs[i], stream, name); handlers->Handlers[i](handlers->Objs[i], stream, name);
} }
@ -91,7 +91,7 @@ void Event_UnregisterEntry(struct Event_Entry* handlers, void* obj, Event_Entry_
} }
void Event_RaiseBlock(struct Event_Block* handlers, Vector3I coords, BlockID oldBlock, BlockID block) { void Event_RaiseBlock(struct Event_Block* handlers, Vector3I coords, BlockID oldBlock, BlockID block) {
UInt32 i; int i;
for (i = 0; i < handlers->Count; i++) { for (i = 0; i < handlers->Count; i++) {
handlers->Handlers[i](handlers->Objs[i], coords, oldBlock, block); handlers->Handlers[i](handlers->Objs[i], coords, oldBlock, block);
} }
@ -104,7 +104,7 @@ void Event_UnregisterBlock(struct Event_Block* handlers, void* obj, Event_Block_
} }
void Event_RaiseMouseMove(struct Event_MouseMove* handlers, int xDelta, int yDelta) { void Event_RaiseMouseMove(struct Event_MouseMove* handlers, int xDelta, int yDelta) {
UInt32 i; int i;
for (i = 0; i < handlers->Count; i++) { for (i = 0; i < handlers->Count; i++) {
handlers->Handlers[i](handlers->Objs[i], xDelta, yDelta); handlers->Handlers[i](handlers->Objs[i], xDelta, yDelta);
} }
@ -117,7 +117,7 @@ void Event_UnregisterMouseMove(struct Event_MouseMove* handlers, void* obj, Even
} }
void Event_RaiseChat(struct Event_Chat* handlers, const String* msg, int msgType) { void Event_RaiseChat(struct Event_Chat* handlers, const String* msg, int msgType) {
UInt32 i; int i;
for (i = 0; i < handlers->Count; i++) { for (i = 0; i < handlers->Count; i++) {
handlers->Handlers[i](handlers->Objs[i], msg, msgType); handlers->Handlers[i](handlers->Objs[i], msg, msgType);
} }

View File

@ -13,43 +13,43 @@ struct Stream;
typedef void (*Event_Void_Callback)(void* obj); typedef void (*Event_Void_Callback)(void* obj);
struct Event_Void { struct Event_Void {
Event_Void_Callback Handlers[EVENT_MAX_CALLBACKS]; Event_Void_Callback Handlers[EVENT_MAX_CALLBACKS];
void* Objs[EVENT_MAX_CALLBACKS]; UInt32 Count; void* Objs[EVENT_MAX_CALLBACKS]; int Count;
}; };
typedef void (*Event_Int_Callback)(void* obj, int argument); typedef void (*Event_Int_Callback)(void* obj, int argument);
struct Event_Int { struct Event_Int {
Event_Int_Callback Handlers[EVENT_MAX_CALLBACKS]; Event_Int_Callback Handlers[EVENT_MAX_CALLBACKS];
void* Objs[EVENT_MAX_CALLBACKS]; UInt32 Count; void* Objs[EVENT_MAX_CALLBACKS]; int Count;
}; };
typedef void (*Event_Float_Callback)(void* obj, float argument); typedef void (*Event_Float_Callback)(void* obj, float argument);
struct Event_Float { struct Event_Float {
Event_Float_Callback Handlers[EVENT_MAX_CALLBACKS]; Event_Float_Callback Handlers[EVENT_MAX_CALLBACKS];
void* Objs[EVENT_MAX_CALLBACKS]; UInt32 Count; void* Objs[EVENT_MAX_CALLBACKS]; int Count;
}; };
typedef void (*Event_Entry_Callback)(void* obj, struct Stream* stream, const String* name); typedef void (*Event_Entry_Callback)(void* obj, struct Stream* stream, const String* name);
struct Event_Entry { struct Event_Entry {
Event_Entry_Callback Handlers[EVENT_MAX_CALLBACKS]; Event_Entry_Callback Handlers[EVENT_MAX_CALLBACKS];
void* Objs[EVENT_MAX_CALLBACKS]; UInt32 Count; void* Objs[EVENT_MAX_CALLBACKS]; int Count;
}; };
typedef void (*Event_Block_Callback)(void* obj, Vector3I coords, BlockID oldBlock, BlockID block); typedef void (*Event_Block_Callback)(void* obj, Vector3I coords, BlockID oldBlock, BlockID block);
struct Event_Block { struct Event_Block {
Event_Block_Callback Handlers[EVENT_MAX_CALLBACKS]; Event_Block_Callback Handlers[EVENT_MAX_CALLBACKS];
void* Objs[EVENT_MAX_CALLBACKS]; UInt32 Count; void* Objs[EVENT_MAX_CALLBACKS]; int Count;
}; };
typedef void (*Event_MouseMove_Callback)(void* obj, int xDelta, int yDelta); typedef void (*Event_MouseMove_Callback)(void* obj, int xDelta, int yDelta);
struct Event_MouseMove { struct Event_MouseMove {
Event_MouseMove_Callback Handlers[EVENT_MAX_CALLBACKS]; Event_MouseMove_Callback Handlers[EVENT_MAX_CALLBACKS];
void* Objs[EVENT_MAX_CALLBACKS]; UInt32 Count; void* Objs[EVENT_MAX_CALLBACKS]; int Count;
}; };
typedef void (*Event_Chat_Callback)(void* obj, const String* msg, int msgType); typedef void (*Event_Chat_Callback)(void* obj, const String* msg, int msgType);
struct Event_Chat { struct Event_Chat {
Event_Chat_Callback Handlers[EVENT_MAX_CALLBACKS]; Event_Chat_Callback Handlers[EVENT_MAX_CALLBACKS];
void* Objs[EVENT_MAX_CALLBACKS]; UInt32 Count; void* Objs[EVENT_MAX_CALLBACKS]; int Count;
}; };
void Event_RaiseVoid(struct Event_Void* handlers); void Event_RaiseVoid(struct Event_Void* handlers);

View File

@ -219,6 +219,7 @@ struct NbtTag {
union { union {
uint8_t Value_U8; uint8_t Value_U8;
int16_t Value_I16; int16_t Value_I16;
uint16_t Value_U16;
int32_t Value_I32; int32_t Value_I32;
float Value_F32; float Value_F32;
uint8_t DataSmall[NBT_SMALL_SIZE]; uint8_t DataSmall[NBT_SMALL_SIZE];
@ -236,6 +237,11 @@ static int16_t NbtTag_I16(struct NbtTag* tag) {
return tag->Value_I16; return tag->Value_I16;
} }
static uint16_t NbtTag_U16(struct NbtTag* tag) {
if (tag->TagID != NBT_I16) ErrorHandler_Fail("Expected I16 NBT tag");
return tag->Value_U16;
}
static float NbtTag_F32(struct NbtTag* tag) { static float NbtTag_F32(struct NbtTag* tag) {
if (tag->TagID != NBT_F32) ErrorHandler_Fail("Expected F32 NBT tag"); if (tag->TagID != NBT_F32) ErrorHandler_Fail("Expected F32 NBT tag");
return tag->Value_F32; return tag->Value_F32;
@ -359,9 +365,9 @@ static bool IsTag(struct NbtTag* tag, const char* tagName) {
*--------------------------------------------------ClassicWorld format----------------------------------------------------* *--------------------------------------------------ClassicWorld format----------------------------------------------------*
*#########################################################################################################################*/ *#########################################################################################################################*/
static bool Cw_Callback_1(struct NbtTag* tag) { static bool Cw_Callback_1(struct NbtTag* tag) {
if (IsTag(tag, "X")) { World_Width = (uint16_t)NbtTag_I16(tag); return true; } if (IsTag(tag, "X")) { World_Width = NbtTag_U16(tag); return true; }
if (IsTag(tag, "Y")) { World_Height = (uint16_t)NbtTag_I16(tag); return true; } if (IsTag(tag, "Y")) { World_Height = NbtTag_U16(tag); return true; }
if (IsTag(tag, "Z")) { World_Length = (uint16_t)NbtTag_I16(tag); return true; } if (IsTag(tag, "Z")) { World_Length = NbtTag_U16(tag); return true; }
if (IsTag(tag, "UUID")) { if (IsTag(tag, "UUID")) {
if (tag->DataSize != sizeof(World_Uuid)) ErrorHandler_Fail("Map UUID must be 16 bytes"); if (tag->DataSize != sizeof(World_Uuid)) ErrorHandler_Fail("Map UUID must be 16 bytes");
@ -395,15 +401,13 @@ static bool Cw_Callback_2(struct NbtTag* tag) {
} }
BlockID cw_curID; BlockID cw_curID;
int16_t cw_colR, cw_colG, cw_colB; uint16_t cw_colR, cw_colG, cw_colB;
static PackedCol Cw_ParseCol(PackedCol defValue) { static PackedCol Cw_ParseCol(PackedCol defValue) {
int16_t r = cw_colR, g = cw_colG, b = cw_colB; uint16_t r = cw_colR, g = cw_colG, b = cw_colB;
if (r < 0 || r > 255 || g < 0 || g > 255 || b < 0 || b > 255) { if (r > 255 || g > 255 || b > 255) return defValue;
return defValue;
} else { PackedCol col = PACKEDCOL_CONST((uint8_t)r, (uint8_t)g, (uint8_t)b, 255);
PackedCol col = PACKEDCOL_CONST((uint8_t)r, (uint8_t)g, (uint8_t)b, 255); return col;
return col;
}
} }
static bool Cw_Callback_4(struct NbtTag* tag) { static bool Cw_Callback_4(struct NbtTag* tag) {
@ -412,7 +416,7 @@ static bool Cw_Callback_4(struct NbtTag* tag) {
struct LocalPlayer*p = &LocalPlayer_Instance; struct LocalPlayer*p = &LocalPlayer_Instance;
if (IsTag(tag->Parent, "ClickDistance")) { if (IsTag(tag->Parent, "ClickDistance")) {
if (IsTag(tag, "Distance")) { p->ReachDistance = NbtTag_I16(tag) / 32.0f; return true; } if (IsTag(tag, "Distance")) { p->ReachDistance = NbtTag_U16(tag) / 32.0f; return true; }
} }
if (IsTag(tag->Parent, "EnvWeatherType")) { if (IsTag(tag->Parent, "EnvWeatherType")) {
if (IsTag(tag, "WeatherType")) { Env_SetWeather(NbtTag_U8(tag)); return true; } if (IsTag(tag, "WeatherType")) { Env_SetWeather(NbtTag_U8(tag)); return true; }
@ -477,9 +481,9 @@ static bool Cw_Callback_5(struct NbtTag* tag) {
if (!IsTag(tag->Parent->Parent->Parent->Parent, "Metadata")) return false; if (!IsTag(tag->Parent->Parent->Parent->Parent, "Metadata")) return false;
if (IsTag(tag->Parent->Parent, "EnvColors")) { if (IsTag(tag->Parent->Parent, "EnvColors")) {
if (IsTag(tag, "R")) { cw_colR = NbtTag_I16(tag); return true; } if (IsTag(tag, "R")) { cw_colR = NbtTag_U16(tag); return true; }
if (IsTag(tag, "G")) { cw_colG = NbtTag_I16(tag); return true; } if (IsTag(tag, "G")) { cw_colG = NbtTag_U16(tag); return true; }
if (IsTag(tag, "B")) { cw_colB = NbtTag_I16(tag); return true; } if (IsTag(tag, "B")) { cw_colB = NbtTag_U16(tag); return true; }
} }
if (IsTag(tag->Parent->Parent, "BlockDefinitions") && Game_AllowCustomBlocks) { if (IsTag(tag->Parent->Parent, "BlockDefinitions") && Game_AllowCustomBlocks) {
@ -608,7 +612,7 @@ struct JFieldDesc {
struct JClassDesc { struct JClassDesc {
char ClassName[JNAME_SIZE]; char ClassName[JNAME_SIZE];
uint16_t FieldsCount; int FieldsCount;
struct JFieldDesc Fields[22]; struct JFieldDesc Fields[22];
}; };
@ -659,7 +663,7 @@ static ReturnCode Dat_ReadClassDesc(struct Stream* stream, struct JClassDesc* de
desc->FieldsCount = Stream_GetU16_BE(tmp); desc->FieldsCount = Stream_GetU16_BE(tmp);
if (desc->FieldsCount > Array_Elems(desc->Fields)) return DAT_ERR_JCLASS_FIELDS; if (desc->FieldsCount > Array_Elems(desc->Fields)) return DAT_ERR_JCLASS_FIELDS;
Int32 i; int i;
for (i = 0; i < desc->FieldsCount; i++) { for (i = 0; i < desc->FieldsCount; i++) {
if ((res = Dat_ReadFieldDesc(stream, &desc->Fields[i]))) return res; if ((res = Dat_ReadFieldDesc(stream, &desc->Fields[i]))) return res;
} }
@ -758,7 +762,7 @@ ReturnCode Dat_Load(struct Stream* stream) {
struct JClassDesc obj; struct JClassDesc obj;
if ((res = Dat_ReadClassDesc(&compStream, &obj))) return res; if ((res = Dat_ReadClassDesc(&compStream, &obj))) return res;
Int32 i; int i;
Vector3* spawn = &LocalPlayer_Instance.Spawn; Vector3* spawn = &LocalPlayer_Instance.Spawn;
for (i = 0; i < obj.FieldsCount; i++) { for (i = 0; i < obj.FieldsCount; i++) {
struct JFieldDesc* field = &obj.Fields[i]; struct JFieldDesc* field = &obj.Fields[i];

View File

@ -110,7 +110,7 @@ struct TextAtlas {
struct Texture Tex; struct Texture Tex;
int Offset, CurX, FontSize; int Offset, CurX, FontSize;
float uScale; float uScale;
Int32 Widths[TEXTATLAS_MAX_WIDTHS]; int16_t Widths[TEXTATLAS_MAX_WIDTHS];
}; };
void TextAtlas_Make(struct TextAtlas* atlas, const String* chars, FontDesc* font, const String* prefix); void TextAtlas_Make(struct TextAtlas* atlas, const String* chars, FontDesc* font, const String* prefix);
void TextAtlas_Free(struct TextAtlas* atlas); void TextAtlas_Free(struct TextAtlas* atlas);

View File

@ -1913,7 +1913,7 @@ static void MenuOptionsScreen_GetFPS(String* raw) {
String_AppendConst(raw, FpsLimit_Names[Game_FpsLimit]); String_AppendConst(raw, FpsLimit_Names[Game_FpsLimit]);
} }
static void MenuOptionsScreen_SetFPS(const String* raw) { static void MenuOptionsScreen_SetFPS(const String* raw) {
UInt32 method = Utils_ParseEnum(raw, FpsLimit_VSync, FpsLimit_Names, Array_Elems(FpsLimit_Names)); int method = Utils_ParseEnum(raw, FpsLimit_VSync, FpsLimit_Names, Array_Elems(FpsLimit_Names));
Game_SetFpsLimit(method); Game_SetFpsLimit(method);
String value = String_FromReadonly(FpsLimit_Names[method]); String value = String_FromReadonly(FpsLimit_Names[method]);
@ -2125,13 +2125,13 @@ static void MenuOptionsScreen_Enum(void* screen, void* widget) {
struct MenuInputValidator* v = &s->Validators[index]; struct MenuInputValidator* v = &s->Validators[index];
const char** names = v->Meta_Enum.Names; const char** names = v->Meta_Enum.Names;
UInt32 count = v->Meta_Enum.Count; int count = v->Meta_Enum.Count;
char valueBuffer[STRING_SIZE]; char valueBuffer[STRING_SIZE];
String value = String_FromArray(valueBuffer); String value = String_FromArray(valueBuffer);
btn->GetValue(&value); btn->GetValue(&value);
UInt32 raw = (Utils_ParseEnum(&value, 0, names, count) + 1) % count; int raw = (Utils_ParseEnum(&value, 0, names, count) + 1) % count;
String newValue = String_FromReadonly(names[raw]); String newValue = String_FromReadonly(names[raw]);
MenuOptionsScreen_Set(s, index, &newValue); MenuOptionsScreen_Set(s, index, &newValue);
} }
@ -2221,7 +2221,7 @@ static void ClassicOptionsScreen_GetViewDist(String* v) {
} }
} }
static void ClassicOptionsScreen_SetViewDist(const String* v) { static void ClassicOptionsScreen_SetViewDist(const String* v) {
UInt32 raw = Utils_ParseEnum(v, 0, ViewDist_Names, ViewDist_Count); int raw = Utils_ParseEnum(v, 0, ViewDist_Names, ViewDist_Count);
int dist = raw == ViewDist_Far ? 512 : (raw == ViewDist_Normal ? 128 : (raw == ViewDist_Short ? 32 : 8)); int dist = raw == ViewDist_Far ? 512 : (raw == ViewDist_Normal ? 128 : (raw == ViewDist_Short ? 32 : 8));
Game_UserSetViewDistance(dist); Game_UserSetViewDistance(dist);
} }
@ -2322,7 +2322,7 @@ static void EnvSettingsScreen_SetShadowCol(const String* v) { Env_SetShadowCol(M
static void EnvSettingsScreen_GetWeather(String* v) { String_AppendConst(v, Weather_Names[Env_Weather]); } static void EnvSettingsScreen_GetWeather(String* v) { String_AppendConst(v, Weather_Names[Env_Weather]); }
static void EnvSettingsScreen_SetWeather(const String* v) { static void EnvSettingsScreen_SetWeather(const String* v) {
UInt32 raw = Utils_ParseEnum(v, 0, Weather_Names, Array_Elems(Weather_Names)); int raw = Utils_ParseEnum(v, 0, Weather_Names, Array_Elems(Weather_Names));
Env_SetWeather(raw); Env_SetWeather(raw);
} }

View File

@ -100,7 +100,7 @@ float Options_GetFloat(const char* key, float min, float max, float defValue) {
return value; return value;
} }
UInt32 Options_GetEnum(const char* key, UInt32 defValue, const char** names, UInt32 namesCount) { int Options_GetEnum(const char* key, int defValue, const char** names, int namesCount) {
String str; String str;
if (!Options_TryGetValue(key, &str)) return defValue; if (!Options_TryGetValue(key, &str)) return defValue;
return Utils_ParseEnum(&str, defValue, names, namesCount); return Utils_ParseEnum(&str, defValue, names, namesCount);

View File

@ -76,11 +76,11 @@ StringsBuffer Options_Values;
NOINLINE_ bool Options_HasAnyChanged(void); NOINLINE_ bool Options_HasAnyChanged(void);
NOINLINE_ void Options_Free(void); NOINLINE_ void Options_Free(void);
NOINLINE_ void Options_Get(const char* key, String* value, const char* defValue); NOINLINE_ void Options_Get(const char* key, String* value, const char* defValue);
NOINLINE_ int Options_GetInt(const char* key, int min, int max, int defValue); NOINLINE_ int Options_GetInt(const char* key, int min, int max, int defValue);
NOINLINE_ bool Options_GetBool(const char* key, bool defValue); NOINLINE_ bool Options_GetBool(const char* key, bool defValue);
NOINLINE_ float Options_GetFloat(const char* key, float min, float max, float defValue); NOINLINE_ float Options_GetFloat(const char* key, float min, float max, float defValue);
NOINLINE_ UInt32 Options_GetEnum(const char* key, UInt32 defValue, const char** names, UInt32 namesCount); NOINLINE_ int Options_GetEnum(const char* key, int defValue, const char** names, int namesCount);
NOINLINE_ void Options_SetBool(const char* keyRaw, bool value); NOINLINE_ void Options_SetBool(const char* keyRaw, bool value);
NOINLINE_ void Options_SetInt(const char* keyRaw, int value); NOINLINE_ void Options_SetInt(const char* keyRaw, int value);

View File

@ -726,7 +726,7 @@ void Font_GetNames(StringsBuffer* buffer) {
} }
} }
void Font_Make(FontDesc* desc, const String* fontName, uint16_t size, uint16_t style) { void Font_Make(FontDesc* desc, const String* fontName, int size, int style) {
desc->Size = size; desc->Size = size;
desc->Style = style; desc->Style = style;
if (!norm_fonts.Count) Font_Init(); if (!norm_fonts.Count) Font_Init();

View File

@ -87,7 +87,7 @@ void Waitable_Wait(void* handle);
void Waitable_WaitFor(void* handle, UInt32 milliseconds); void Waitable_WaitFor(void* handle, UInt32 milliseconds);
NOINLINE_ void Font_GetNames(StringsBuffer* buffer); NOINLINE_ void Font_GetNames(StringsBuffer* buffer);
NOINLINE_ void Font_Make(FontDesc* desc, const String* fontName, uint16_t size, uint16_t style); NOINLINE_ void Font_Make(FontDesc* desc, const String* fontName, int size, int style);
NOINLINE_ void Font_Free(FontDesc* desc); NOINLINE_ void Font_Free(FontDesc* desc);
NOINLINE_ Size2D Platform_TextMeasure(struct DrawTextArgs* args); NOINLINE_ Size2D Platform_TextMeasure(struct DrawTextArgs* args);
NOINLINE_ Size2D Platform_TextDraw(struct DrawTextArgs* args, Bitmap* bmp, int x, int y, PackedCol col); NOINLINE_ Size2D Platform_TextDraw(struct DrawTextArgs* args, Bitmap* bmp, int x, int y, PackedCol col);

View File

@ -1268,7 +1268,7 @@ static bool HUDScreen_MouseDown(void* screen, int x, int y, MouseButton btn) {
static void HUDScreen_Init(void* screen) { static void HUDScreen_Init(void* screen) {
struct HUDScreen* s = screen; struct HUDScreen* s = screen;
uint16_t size = Drawer2D_BitmappedText ? 16 : 11; int size = Drawer2D_BitmappedText ? 16 : 11;
Drawer2D_MakeFont(&s->PlayerFont, size, FONT_STYLE_NORMAL); Drawer2D_MakeFont(&s->PlayerFont, size, FONT_STYLE_NORMAL);
ChatScreen_MakeInstance(); ChatScreen_MakeInstance();

View File

@ -459,7 +459,7 @@ static void MPConnection_Tick(struct ScheduledTask* task) {
net_ticks++; net_ticks++;
} }
void Net_Set(uint8_t opcode, Net_Handler handler, uint16_t packetSize) { void Net_Set(uint8_t opcode, Net_Handler handler, int packetSize) {
Net_Handlers[opcode] = handler; Net_Handlers[opcode] = handler;
Net_PacketSizes[opcode] = packetSize; Net_PacketSizes[opcode] = packetSize;
} }

View File

@ -72,6 +72,6 @@ void ServerConnection_MakeComponent(struct IGameComponent* comp);
typedef void (*Net_Handler)(uint8_t* data); typedef void (*Net_Handler)(uint8_t* data);
uint16_t Net_PacketSizes[OPCODE_COUNT]; uint16_t Net_PacketSizes[OPCODE_COUNT];
Net_Handler Net_Handlers[OPCODE_COUNT]; Net_Handler Net_Handlers[OPCODE_COUNT];
void Net_Set(uint8_t opcode, Net_Handler handler, uint16_t size); void Net_Set(uint8_t opcode, Net_Handler handler, int size);
void Net_SendPacket(void); void Net_SendPacket(void);
#endif #endif

View File

@ -98,8 +98,8 @@ void DateTime_HttpDate(TimeMS ms, String* str) {
String_Format3(str, " %p2:%p2:%p2 GMT", &hour, &min, &sec); String_Format3(str, " %p2:%p2:%p2 GMT", &hour, &min, &sec);
} }
UInt32 Utils_ParseEnum(const String* text, UInt32 defValue, const char** names, UInt32 namesCount) { int Utils_ParseEnum(const String* text, int defValue, const char** names, int namesCount) {
UInt32 i; int i;
for (i = 0; i < namesCount; i++) { for (i = 0; i < namesCount; i++) {
if (String_CaselessEqualsConst(text, names[i])) return i; if (String_CaselessEqualsConst(text, names[i])) return i;
} }

View File

@ -22,7 +22,7 @@ TimeMS DateTime_TotalMs(DateTime* time);
void DateTime_FromTotalMs(DateTime* time, TimeMS ms); void DateTime_FromTotalMs(DateTime* time, TimeMS ms);
void DateTime_HttpDate(TimeMS ms, String* str); void DateTime_HttpDate(TimeMS ms, String* str);
UInt32 Utils_ParseEnum(const String* text, UInt32 defValue, const char** names, UInt32 namesCount); NOINLINE_ int Utils_ParseEnum(const String* text, int defValue, const char** names, int namesCount);
bool Utils_IsValidInputChar(char c, bool supportsCP437); bool Utils_IsValidInputChar(char c, bool supportsCP437);
bool Utils_IsUrlPrefix(const String* value, int index); bool Utils_IsUrlPrefix(const String* value, int index);

View File

@ -1399,7 +1399,7 @@ struct MenuInputValidator MenuInputValidator_Path(void) {
return v; return v;
} }
struct MenuInputValidator MenuInputValidator_Enum(const char** names, UInt32 namesCount) { struct MenuInputValidator MenuInputValidator_Enum(const char** names, int namesCount) {
struct MenuInputValidator v; struct MenuInputValidator v;
v.VTABLE = NULL; v.VTABLE = NULL;
v.Meta_Enum.Names = names; v.Meta_Enum.Names = names;
@ -1934,7 +1934,7 @@ static void PlayerListWidget_DeleteGroup(struct PlayerListWidget* w, int* i) {
(*i)--; (*i)--;
} }
static void PlayerListWidget_AddGroup(struct PlayerListWidget* w, uint16_t id, int* index) { static void PlayerListWidget_AddGroup(struct PlayerListWidget* w, int id, int* index) {
int i; int i;
for (i = Array_Elems(w->IDs) - 1; i > (*index); i--) { for (i = Array_Elems(w->IDs) - 1; i > (*index); i--) {
w->IDs[i] = w->IDs[i - 1]; w->IDs[i] = w->IDs[i - 1];
@ -1949,7 +1949,7 @@ static void PlayerListWidget_AddGroup(struct PlayerListWidget* w, uint16_t id, i
w->NamesCount++; w->NamesCount++;
} }
static int PlayerListWidget_GetGroupCount(struct PlayerListWidget* w, uint16_t id, int idx) { static int PlayerListWidget_GetGroupCount(struct PlayerListWidget* w, int id, int idx) {
String group = TabList_UNSAFE_GetGroup(id); String group = TabList_UNSAFE_GetGroup(id);
int count = 0; int count = 0;
@ -2029,7 +2029,7 @@ static void PlayerListWidget_SortEntries(struct PlayerListWidget* w) {
i = 0; i = 0;
List_SortCompare = PlayerListWidget_PlayerCompare; List_SortCompare = PlayerListWidget_PlayerCompare;
while (i < w->NamesCount) { while (i < w->NamesCount) {
uint16_t id = w->IDs[i]; int id = w->IDs[i];
PlayerListWidget_AddGroup(w, id, &i); PlayerListWidget_AddGroup(w, id, &i);
int count = PlayerListWidget_GetGroupCount(w, id, i); int count = PlayerListWidget_GetGroupCount(w, id, i);
PlayerListWidget_QuickSort(i, i + (count - 1)); PlayerListWidget_QuickSort(i, i + (count - 1));

View File

@ -25,7 +25,7 @@ typedef void (*Button_Set)(const String* raw);
struct ButtonWidget { struct ButtonWidget {
Widget_Layout Widget_Layout
struct Texture Texture; struct Texture Texture;
uint16_t MinWidth; int MinWidth;
const char* OptName; const char* OptName;
Button_Get GetValue; Button_Get GetValue;
@ -93,12 +93,12 @@ struct InputWidget {
Size2D LineSizes[INPUTWIDGET_MAX_LINES]; /* size of each line in pixels */ Size2D LineSizes[INPUTWIDGET_MAX_LINES]; /* size of each line in pixels */
struct Texture InputTex; struct Texture InputTex;
String Prefix; String Prefix;
uint16_t PrefixWidth, PrefixHeight; int PrefixWidth, PrefixHeight;
bool ConvertPercents; bool ConvertPercents;
uint8_t Padding; uint8_t Padding;
bool ShowCaret; bool ShowCaret;
uint16_t CaretWidth; int CaretWidth;
int CaretX, CaretY; /* Coordinates of caret in lines */ int CaretX, CaretY; /* Coordinates of caret in lines */
int CaretPos; /* Position of caret, -1 for at end of string */ int CaretPos; /* Position of caret, -1 for at end of string */
PackedCol CaretCol; PackedCol CaretCol;
@ -122,7 +122,7 @@ struct MenuInputValidatorVTABLE {
struct MenuInputValidator { struct MenuInputValidator {
struct MenuInputValidatorVTABLE* VTABLE; struct MenuInputValidatorVTABLE* VTABLE;
union { union {
struct { const char** Names; UInt32 Count; } Meta_Enum; struct { const char** Names; int Count; } Meta_Enum;
struct { int Min, Max; } Meta_Int; struct { int Min, Max; } Meta_Int;
struct { float Min, Max; } Meta_Float; struct { float Min, Max; } Meta_Float;
}; };
@ -133,7 +133,7 @@ struct MenuInputValidator MenuInputValidator_Int(int min, int max);
struct MenuInputValidator MenuInputValidator_Seed(void); struct MenuInputValidator MenuInputValidator_Seed(void);
struct MenuInputValidator MenuInputValidator_Float(float min, float max); struct MenuInputValidator MenuInputValidator_Float(float min, float max);
struct MenuInputValidator MenuInputValidator_Path(void); struct MenuInputValidator MenuInputValidator_Path(void);
struct MenuInputValidator MenuInputValidator_Enum(const char** names, UInt32 namesCount); struct MenuInputValidator MenuInputValidator_Enum(const char** names, int namesCount);
struct MenuInputValidator MenuInputValidator_String(void); struct MenuInputValidator MenuInputValidator_String(void);
struct MenuInputWidget { struct MenuInputWidget {