Port Hotkeys to C.

This commit is contained in:
UnknownShadow200 2017-11-29 08:55:16 +11:00
parent 0e3dcf4aff
commit e1da165c2a
17 changed files with 258 additions and 55 deletions

View File

@ -483,7 +483,7 @@ BlockID AutoRotate_RotateVertical(BlockID block, String* name, Vector3 offset) {
BlockID AutoRotate_RotateOther(BlockID block, String* name, Vector3 offset) {
/* Fence type blocks */
if (AutoRotate_Find(BLOCK_Invalid, name, "-UD") == BLOCK_Invalid) {
if (AutoRotate_Find(BLOCK_INVALID, name, "-UD") == BLOCK_INVALID) {
Real32 headY = LocalPlayer_Instance.Base.Base.HeadY;
headY = LocationUpdate_Clamp(headY);
@ -622,7 +622,7 @@ UInt8 DefaultSet_StepSound(BlockID b) {
}
UInt8 DefaultSet_Draw(BlockID b) {
if (b == BLOCK_AIR || b == BLOCK_Invalid) return DRAW_GAS;
if (b == BLOCK_AIR || b == BLOCK_INVALID) return DRAW_GAS;
if (b == BLOCK_LEAVES) return DRAW_TRANSPARENT_THICK;
if (b == BLOCK_ICE || b == BLOCK_WATER || b == BLOCK_STILL_WATER)

View File

@ -96,5 +96,5 @@
" ForestGreen Brown DeepBlue Turquoise Ice CeramicTile Magma Pillar Crate StoneBrick"
#define BLOCK_COUNT (BLOCK_MAX_DEFINED + 1)
#define BLOCK_Invalid BLOCK_MAX_DEFINED
#define BLOCK_INVALID BLOCK_MAX_DEFINED
#endif

View File

@ -357,31 +357,21 @@ void ChunkUpdater_BuildChunk(ChunkInfo* info, Int32* chunkUpdates) {
}
void ChunkUpdater_QuickSort(Int32 left, Int32 right) {
ChunkInfo** values = MapRenderer_SortedChunks;
Int32* keys = ChunkUpdater_Distances;
ChunkInfo** values = MapRenderer_SortedChunks; ChunkInfo* value;
Int32* keys = ChunkUpdater_Distances; Int32 key;
while (left < right) {
Int32 i = left, j = right;
Int32 pivot = keys[(i + j) / 2];
/* partition the list */
while (i <= j) {
while (pivot > keys[i]) i++;
while (pivot < keys[j]) j--;
if (i <= j) {
Int32 key = keys[i]; keys[i] = keys[j]; keys[j] = key;
ChunkInfo* value = values[i]; values[i] = values[j]; values[j] = value;
i++; j--;
}
QuickSort_Swap_KV_Maybe();
}
/* recurse into the smaller subset */
if (j - left <= right - i) {
if (left < j) ChunkUpdater_QuickSort(left, j);
left = i;
} else {
if (i < right) ChunkUpdater_QuickSort(i, right);
right = j;
}
QuickSort_Recurse(ChunkUpdater_QuickSort)
}
}

View File

@ -203,6 +203,7 @@
<ClInclude Include="Deflate.h" />
<ClInclude Include="GameMode.h" />
<ClInclude Include="Gui.h" />
<ClInclude Include="Hotkeys.h" />
<ClInclude Include="IModel.h" />
<ClInclude Include="Input.h" />
<ClInclude Include="Intersection.h" />
@ -276,6 +277,7 @@
<ClCompile Include="Game.c" />
<ClCompile Include="GameMode.c" />
<ClCompile Include="Gui.c" />
<ClCompile Include="Hotkeys.c" />
<ClCompile Include="Inventory.c" />
<ClCompile Include="MapGenerator.c" />
<ClCompile Include="FrustumCulling.c" />

View File

@ -375,6 +375,9 @@
<ClInclude Include="Event.h">
<Filter>Header Files\Game</Filter>
</ClInclude>
<ClInclude Include="Hotkeys.h">
<Filter>Header Files\Game</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Noise.c">
@ -584,5 +587,8 @@
<ClCompile Include="Event.c">
<Filter>Source Files\Game</Filter>
</ClCompile>
<ClCompile Include="Hotkeys.c">
<Filter>Source Files\Game</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@ -7,7 +7,7 @@
*/
/* returns a bit mask for the nth bit in an integer */
#define bit(x) (1 << x)
#define bit(x) (1 << (x))
/* returns smallest of two numbers */
#define min(x, y) ((x) < (y) ? (x) : (y))
/* returns largest of two numbers */
@ -19,4 +19,26 @@
bool Char_IsUpper(UInt8 c);
/* Converts uppercase letter to lowercase */
UInt8 Char_ToLower(UInt8 c);
#define QuickSort_Swap_Maybe()\
if (i <= j) {\
key = keys[i]; keys[i] = keys[j]; keys[j] = key;\
i++; j--;\
}
#define QuickSort_Swap_KV_Maybe()\
if (i <= j) {\
key = keys[i]; keys[i] = keys[j]; keys[j] = key;\
value = values[i]; values[i] = values[j]; values[j] = value;\
i++; j--;\
}
#define QuickSort_Recurse(quickSort)\
if (j - left <= right - i) {\
if (left < j) { quickSort(left, j); }\
left = i;\
} else {\
if (i < right) { quickSort(i, right); }\
right = j;\
}
#endif

163
src/Client/Hotkeys.c Normal file
View File

@ -0,0 +1,163 @@
#include "Hotkeys.h"
#include "Options.h"
#include "Constants.h"
#include "Utils.h"
#include "Funcs.h"
#include "ErrorHandler.h"
UInt8 Hotkeys_LWJGL[256] = {
0, Key_Escape, Key_1, Key_2, Key_3, Key_4, Key_5, Key_6, Key_7, Key_8, Key_9, Key_0, Key_Minus, Key_Plus, Key_BackSpace, Key_Tab,
Key_Q, Key_W, Key_E, Key_R, Key_T, Key_Y, Key_U, Key_I, Key_O, Key_P, Key_BracketLeft, Key_BracketRight, Key_Enter, Key_ControlLeft, Key_A, Key_S,
Key_D, Key_F, Key_G, Key_H, Key_J, Key_K, Key_L, Key_Semicolon, Key_Quote, Key_Tilde, Key_ShiftLeft, Key_BackSlash, Key_Z, Key_X, Key_C, Key_V,
Key_B, Key_N, Key_M, Key_Comma, Key_Period, Key_Slash, Key_ShiftRight, 0, Key_AltLeft, Key_Space, Key_CapsLock, Key_F1, Key_F2, Key_F3, Key_F4, Key_F5,
Key_F6, Key_F7, Key_F8, Key_F9, Key_F10, Key_NumLock, Key_ScrollLock, Key_Keypad7, Key_Keypad8, Key_Keypad9, Key_KeypadSubtract, Key_Keypad4, Key_Keypad5, Key_Keypad6, Key_KeypadAdd, Key_Keypad1,
Key_Keypad2, Key_Keypad3, Key_Keypad0, Key_KeypadDecimal, 0, 0, 0, Key_F11, Key_F12, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, Key_F13, Key_F14, Key_F15, Key_F16, Key_F17, Key_F18, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Key_KeypadAdd, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Key_KeypadEnter, Key_ControlRight, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, Key_KeypadDivide, 0, 0, Key_AltRight, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, Key_Pause, 0, Key_Home, Key_Up, Key_PageUp, 0, Key_Left, 0, Key_Right, 0, Key_End,
Key_Down, Key_PageDown, Key_Insert, Key_Delete, 0, 0, 0, 0, 0, 0, 0, Key_WinLeft, Key_WinRight, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
void Hotkeys_Add(Key baseKey, UInt8 flags, STRING_PURE String* text, bool more) {
UInt32 i;
for (i = 0; i < HotkeysText.Count; i++) {
HotkeyData hKey = HotkeysList[i];
if (hKey.BaseKey == baseKey && hKey.Flags == flags) {
StringsBuffer_Remove(&HotkeysText, hKey.TextIndex);
HotkeysList[i].StaysOpen = more;
HotkeysList[i].TextIndex = HotkeysText.Count;
StringsBuffer_Add(&HotkeysText, text);
return;
}
}
Hotkeys_AddNewHotkey(baseKey, flags, text, more);
}
bool Hotkeys_Remove(Key baseKey, UInt8 flags) {
UInt32 i, j;
for (i = 0; i < HotkeysText.Count; i++) {
HotkeyData hKey = HotkeysList[i];
if (hKey.BaseKey == baseKey && hKey.Flags == flags) {
for (j = i + 1; j < HotkeysText.Count; j++) { HotkeysList[j - 1] = HotkeysList[j]; }
StringsBuffer_Remove(&HotkeysText, hKey.TextIndex);
HotkeysList[i].TextIndex = UInt32_MaxValue;
return true;
}
}
return false;
}
void Hotkeys_AddNewHotkey(Key baseKey, UInt8 flags, STRING_PURE String* text, bool more) {
HotkeyData hKey;
hKey.BaseKey = baseKey;
hKey.Flags = flags;
hKey.TextIndex = HotkeysText.Count;
hKey.StaysOpen = more;
if (HotkeysText.Count == HOTKEYS_MAX_COUNT) {
ErrorHandler_Fail("Cannot define more than 256 hotkeys");
}
HotkeysList[HotkeysText.Count] = hKey;
StringsBuffer_Add(&HotkeysText, text);
/* sort so that hotkeys with largest modifiers are first */
Hotkeys_QuickSort(0, HotkeysText.Count - 1);
}
void Hotkeys_QuickSort(Int32 left, Int32 right) {
HotkeyData* keys = HotkeysList; HotkeyData key;
while (left < right) {
Int32 i = left, j = right;
UInt8 pivot = keys[(i + j) / 2].Flags;
/* partition the list */
while (i <= j) {
while (pivot > keys[i].Flags) i++;
while (pivot < keys[j].Flags) j--;
QuickSort_Swap_Maybe();
}
/* recurse into the smaller subset */
QuickSort_Recurse(Hotkeys_QuickSort)
}
}
bool Hotkeys_IsHotkey(Key key, STRING_TRANSIENT String* text, bool* moreInput) {
UInt8 flags = 0;
if (Key_IsControlPressed()) flags |= 1;
if (Key_IsShiftPressed()) flags |= 2;
if (Key_IsAltPressed()) flags |= 4;
String_Clear(text);
*moreInput = false;
UInt32 i;
for (i = 0; i < HotkeysText.Count; i++) {
HotkeyData hKey = HotkeysList[i];
if ((hKey.Flags & flags) == hKey.Flags && hKey.BaseKey == key) {
String hkeyText = StringsBuffer_UNSAFE_Get(&HotkeysText, hKey.TextIndex);
String_AppendString(text, &hkeyText);
*moreInput = hKey.StaysOpen;
return true;
}
}
return false;
}
void Hotkeys_Init(void) {
String prefix = String_FromConst("hotkey-");
UInt32 i;
for (i = 0; i < Options_Keys.Count; i++) {
String key = StringsBuffer_UNSAFE_Get(&Options_Keys, i);
if (!String_CaselessStarts(&key, &prefix)) continue;
Int32 keySplit = String_IndexOf(&key, '&', prefix.length);
if (keySplit < 0) continue; /* invalid key */
String strKey = String_UNSAFE_Substring(&key, prefix.length, keySplit - prefix.length);
String strFlags = String_UNSAFE_SubstringAt(&key, keySplit + 1);
String value = StringsBuffer_UNSAFE_Get(&Options_Values, i);
Int32 valueSplit = String_IndexOf(&value, '&', 0);
if (valueSplit < 0) continue; /* invalid value */
String strMoreInput = String_UNSAFE_Substring(&value, 0, valueSplit - 0);
String strText = String_UNSAFE_SubstringAt(&value, valueSplit + 1);
/* Then try to parse the key and value */
Key hotkey = Utils_ParseEnum(&strKey, Key_Unknown, Key_Names, Array_NumElements(Key_Names));
UInt8 flags; bool moreInput;
if (hotkey == Key_Unknown || strText.length == 0 || !Convert_TryParseUInt8(&strFlags, &flags)
|| !Convert_TryParseBool(&strMoreInput, &moreInput)) { continue; }
Hotkeys_AddHotkey(hotkey, flags, &strText, moreInput);
}
}
void Hotkeys_UserRemovedHotkey(Key baseKey, UInt8 flags) {
UInt8 keyBuffer[String_BufferSize(STRING_SIZE)];
String key = String_InitAndClear(keyBuffer, STRING_SIZE);
String_AppendConst(&key, "hotkey-"); String_AppendConst(&key, Key_Names[baseKey]);
String_Append(&key, '&'); String_AppendInt32(&key, flags);
Options_Set(key.buffer, NULL);
}
void Hotkeys_UserAddedHotkey(Key baseKey, UInt8 flags, bool moreInput, STRING_PURE String* text) {
UInt8 keyBuffer[String_BufferSize(STRING_SIZE)];
String key = String_InitAndClear(keyBuffer, STRING_SIZE);
UInt8 valueBuffer[String_BufferSize(STRING_SIZE * 2)];
String value = String_InitAndClear(valueBuffer, STRING_SIZE * 2);
String_AppendConst(&key, "hotkey-"); String_AppendConst(&key, Key_Names[baseKey]);
String_Append(&key, '&'); String_AppendInt32(&key, flags);
String_AppendBool(&value, moreInput); String_Append(&value, '&');
String_AppendString(&value, text);
Options_Set(key.buffer, &value);
}

25
src/Client/Hotkeys.h Normal file
View File

@ -0,0 +1,25 @@
#ifndef CC_HOTKEYS_H
#define CC_HOTKEYS_H
#include "Typedefs.h"
#include "Input.h"
#include "String.h"
extern UInt8 Hotkeys_LWJGL[256];
typedef struct HotkeyData_ {
UInt32 TextIndex; /* contents to copy directly into the input bar */
UInt8 BaseKey; /* Member of Key enumeration */
UInt8 Flags; /* ctrl 1, shift 2, alt 4 */
bool StaysOpen; /* whether the user is able to enter further input */
} HotkeyData;
#define HOTKEYS_MAX_COUNT 256
HotkeyData HotkeysList[HOTKEYS_MAX_COUNT];
StringsBuffer HotkeysText;
void Hotkeys_Add(Key baseKey, UInt8 flags, STRING_PURE String* text, bool more);
bool Hotkeys_Remove(Key baseKey, UInt8 flags);
bool Hotkeys_IsHotkey(Key key, STRING_TRANSIENT String* text, bool* moreInput);
void Hotkeys_Init(void);
void Hotkeys_UserRemovedHotkey(Key baseKey, UInt8 flags);
void Hotkeys_UserAddedHotkey(Key baseKey, UInt8 flags, bool moreInput, STRING_PURE String* text);
#endif

View File

@ -45,9 +45,9 @@ bool Inventory_IsHackBlock(BlockID b) {
BlockID Inventory_DefaultMapping(Int32 i) {
#if USE16_BIT
if ((i >= Block_CpeCount && i < 256) || i == BLOCK_AIR) return BLOCK_Invalid;
if ((i >= Block_CpeCount && i < 256) || i == BLOCK_AIR) return BLOCK_INVALID;
#else
if (i >= BLOCK_CPE_COUNT || i == BLOCK_AIR) return BLOCK_Invalid;
if (i >= BLOCK_CPE_COUNT || i == BLOCK_AIR) return BLOCK_INVALID;
#endif
if (!Game_ClassicMode) return (BlockID)i;
@ -99,7 +99,7 @@ void Inventory_SetDefaultMapping(void) {
for (i = 0; i < Array_NumElements(Inventory_Map); i++) {
BlockID mapping = Inventory_DefaultMapping(i);
if (Game_PureClassic && Inventory_IsHackBlock(mapping)) {
mapping = BLOCK_Invalid;
mapping = BLOCK_INVALID;
}
if (mapping != i) Inventory_Map[i] = mapping;
}
@ -131,7 +131,7 @@ void Inventory_Remove(BlockID block) {
Int32 i;
for (i = 0; i < Array_NumElements(Inventory_Map); i++) {
if (Inventory_Map[i] != block) continue;
Inventory_Map[i] = BLOCK_Invalid;
Inventory_Map[i] = BLOCK_INVALID;
}
}
@ -145,12 +145,12 @@ void Inventory_PushToFreeSlots(Int32 i) {
}
for (j = block; j < Array_NumElements(Inventory_Map); j++) {
if (Inventory_Map[j] == BLOCK_Invalid) {
if (Inventory_Map[j] == BLOCK_INVALID) {
Inventory_Map[j] = block; return;
}
}
for (j = 1; j < block; j++) {
if (Inventory_Map[j] == BLOCK_Invalid) {
if (Inventory_Map[j] == BLOCK_INVALID) {
Inventory_Map[j] = block; return;
}
}
@ -159,7 +159,7 @@ void Inventory_PushToFreeSlots(Int32 i) {
void Inventory_Insert(Int32 i, BlockID block) {
if (Inventory_Map[i] == block) return;
/* Need to push the old block to a different slot if different block. */
if (Inventory_Map[i] != BLOCK_Invalid) Inventory_PushToFreeSlots(i);
if (Inventory_Map[i] != BLOCK_INVALID) Inventory_PushToFreeSlots(i);
Inventory_Map[i] = block;
}

View File

@ -7,13 +7,9 @@
Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
*/
/* Width of the world, in terms of number of chunks. */
Int32 MapRenderer_ChunksX;
/* Height of the world, in terms of number of chunks. */
Int32 MapRenderer_ChunksY;
/* Length of the world, in terms of number of chunks. */
Int32 MapRenderer_ChunksZ;
/* Packs a coordinate into a single integer index. */
#define MapRenderer_Pack(cx, cy, cz) (((cz) * MapRenderer_ChunksY + (cy)) * MapRenderer_ChunksX + (cx))
/* TODO: Swap Y and Z? Make sure to update ChunkUpdater's ResetChunkCache and ClearChunkCache methods! */
@ -54,16 +50,9 @@ ChunkPartInfo* MapRenderer_PartsBuffer;
/* Offset of translucent chunk parts in MapRenderer_PartsBuffer. */
Int32 MapRenderer_TranslucentBufferOffset;
/* Retrieves the render info for the given chunk. */
ChunkInfo* MapRenderer_GetChunk(Int32 cx, Int32 cy, Int32 cz);
/* Marks the given chunk as needing to be deleted. */
void MapRenderer_RefreshChunk(Int32 cx, Int32 cy, Int32 cz);
/* Potentially generates meshes for several pending chunks. */
void MapRenderer_Update(Real64 deltaTime);
/* Renders all opaque and transparent blocks.
Pixels are either treated as fully replacing existing pixel, or skipped. */
void MapRenderer_RenderNormal(Real64 deltaTime);
/*Renders all translucent (e.g. water) blocks.
Pixels drawn blend into existing geometry.*/
void MapRenderer_RenderTranslucent(Real64 deltaTime);
#endif

View File

@ -15,11 +15,11 @@ void Options_Free(void) {
StringsBuffer_Free(&Options_Values);
}
UInt32 Options_Find(String key) {
UInt32 Options_Find(STRING_PURE String* key) {
UInt32 i;
for (i = 0; i < Options_Keys.Count; i++) {
String curKey = StringsBuffer_UNSAFE_Get(&Options_Keys, i);
if (String_CaselessEquals(&curKey, &key)) return i;
if (String_CaselessEquals(&curKey, key)) return i;
}
return OPT_NOT_FOUND;
}
@ -28,7 +28,7 @@ bool Options_TryGetValue(const UInt8* keyRaw, STRING_TRANSIENT String* value) {
String key = String_FromReadonly(keyRaw);
*value = String_MakeNull();
UInt32 i = Options_Find(key);
UInt32 i = Options_Find(&key);
if (i != OPT_NOT_FOUND) {
*value = StringsBuffer_UNSAFE_Get(&Options_Values, i);
return true;
@ -38,7 +38,7 @@ bool Options_TryGetValue(const UInt8* keyRaw, STRING_TRANSIENT String* value) {
if (sepIndex == -1) return false;
key = String_UNSAFE_SubstringAt(&key, sepIndex + 1);
i = Options_Find(key);
i = Options_Find(&key);
if (i != OPT_NOT_FOUND) {
*value = StringsBuffer_UNSAFE_Get(&Options_Values, i);
return true;
@ -92,7 +92,7 @@ void Options_Remove(UInt32 i) {
StringsBuffer_Remove(&Options_Values, i);
}
Int32 Options_Insert(String key, String value) {
Int32 Options_Insert(STRING_PURE String* key, STRING_PURE String* value) {
UInt32 i = Options_Find(key);
if (i != OPT_NOT_FOUND) {
Options_Remove(i);
@ -111,17 +111,17 @@ void Options_SetInt32(const UInt8* keyRaw, Int32 value) {
UInt8 numBuffer[String_BufferSize(STRING_INT32CHARS)];
String numStr = String_InitAndClear(numBuffer, STRING_INT32CHARS);
String_AppendInt32(&numStr, value);
Options_Set(keyRaw, numStr);
Options_Set(keyRaw, &numStr);
}
void Options_Set(const UInt8* keyRaw, STRING_PURE String value) {
void Options_Set(const UInt8* keyRaw, STRING_PURE String* value) {
String key = String_FromReadonly(keyRaw);
UInt32 i;
if (value.buffer == NULL) {
i = Options_Find(key);
if (value == NULL || value->buffer == NULL) {
i = Options_Find(&key);
if (i != OPT_NOT_FOUND) Options_Remove(i);
} else {
i = Options_Insert(key, value);
i = Options_Insert(&key, value);
}
if (i != OPT_NOT_FOUND) Options_Changed[i] = true;
}

View File

@ -86,5 +86,5 @@ Real32 Options_GetFloat(const UInt8* key, Real32 min, Real32 max, Real32 defValu
UInt32 Options_GetEnum(const UInt8* key, UInt32 defValue, const UInt8** names, UInt32 namesCount);
void Options_SetInt32(const UInt8* keyRaw, Int32 value);
void Options_Set(const UInt8* keyRaw, STRING_PURE String value);
void Options_Set(const UInt8* keyRaw, STRING_PURE String* value);
#endif

View File

@ -43,7 +43,7 @@ void Particle_Reset(Particle* p, Vector3 pos, Vector3 velocity, Real32 lifetime)
}
bool Particle_CanPass(BlockID block, bool throughLiquids) {
DrawType draw = Block_Draw[block];
UInt8 draw = Block_Draw[block];
return draw == DRAW_GAS || draw == DRAW_SPRITE || (throughLiquids && Block_IsLiquid(block));
}

View File

@ -97,6 +97,11 @@ bool String_Append(STRING_TRANSIENT String* str, UInt8 c) {
return true;
}
bool String_AppendBool(STRING_TRANSIENT String* str, bool value) {
UInt8* text = value ? "True" : "False";
return String_AppendConst(str, text);
}
Int32 String_MakeInt32(Int32 num, UInt8* numBuffer) {
Int32 len = 0;
@ -370,12 +375,12 @@ bool Convert_TryParseReal32(STRING_PURE String* str, Real32* value) {
}
bool Convert_TryParseBool(STRING_PURE String* str, bool* value) {
String trueStr = String_FromConst("true");
String trueStr = String_FromConst("True");
if (String_CaselessEquals(str, &trueStr)) {
*value = true; return true;
}
String falseStr = String_FromConst("false");
String falseStr = String_FromConst("False");
if (String_CaselessEquals(str, &falseStr)) {
*value = false; return true;
}

View File

@ -48,6 +48,7 @@ bool String_Equals(STRING_PURE String* a, STRING_PURE String* b);
bool String_CaselessEquals(STRING_PURE String* a, STRING_PURE String* b);
bool String_Append(STRING_TRANSIENT String* str, UInt8 c);
bool String_AppendBool(STRING_TRANSIENT String* str, bool value);
bool String_AppendInt32(STRING_TRANSIENT String* str, Int32 num);
/* Attempts to append an integer value to the end of a string, padding left with 0. */
bool String_AppendPaddedInt32(STRING_TRANSIENT String* str, Int32 num, Int32 minDigits);

View File

@ -587,7 +587,7 @@ void TableWidget_RecreateDescTex(TableWidget* widget) {
}
bool TableWidget_Show(BlockID block) {
if (block == BLOCK_Invalid) return false;
if (block == BLOCK_INVALID) return false;
if (block < BLOCK_CPE_COUNT) {
Int32 count = Game_UseCPEBlocks ? BLOCK_CPE_COUNT : BLOCK_ORIGINAL_COUNT;

View File

@ -142,12 +142,12 @@ void WorldEnv_ResetLight(void) {
void WorldEnv_SetEdgeBlock(BlockID block) {
if (block == BLOCK_Invalid) return;
if (block == BLOCK_INVALID) return;
WorldEnv_Set(block, WorldEnv_EdgeBlock, EnvVar_EdgeBlock);
}
void WorldEnv_SetSidesBlock(BlockID block) {
if (block == BLOCK_Invalid) return;
if (block == BLOCK_INVALID) return;
WorldEnv_Set(block, WorldEnv_SidesBlock, EnvVar_SidesBlock);
}