diff --git a/src/config.c b/src/config.c index 945cfbf0..1f04f57a 100644 --- a/src/config.c +++ b/src/config.c @@ -13,28 +13,28 @@ CONFIG g_Config = { 0 }; static const char *m_ConfigPath = DIR_CONFIG "/TR2X.json5"; -static void Config_Load(struct json_object_s *root_obj); -static void Config_Dump(struct json_object_s *root_obj); +static void M_Load(struct json_object_s *root_obj); +static void M_Dump(struct json_object_s *root_obj); -static void Config_Load(struct json_object_s *root_obj) +static void M_Load(struct json_object_s *root_obj) { ConfigFile_LoadOptions(root_obj, g_ConfigOptionMap); } -static void Config_Dump(struct json_object_s *root_obj) +static void M_Dump(struct json_object_s *root_obj) { ConfigFile_DumpOptions(root_obj, g_ConfigOptionMap); } bool Config_Read(void) { - return ConfigFile_Read(m_ConfigPath, &Config_Load); + return ConfigFile_Read(m_ConfigPath, &M_Load); } bool Config_Write(void) { File_CreateDirectory(DIR_CONFIG); - return ConfigFile_Write(m_ConfigPath, &Config_Dump); + return ConfigFile_Write(m_ConfigPath, &M_Dump); } void Config_Sanitize(void) diff --git a/src/decomp/decomp.c b/src/decomp/decomp.c index 961b665f..e1467b89 100644 --- a/src/decomp/decomp.c +++ b/src/decomp/decomp.c @@ -37,25 +37,28 @@ #define IDI_MAINICON 100 -static bool InsertDisplayModeInListSorted( +static bool M_InsertDisplayModeInListSorted( DISPLAY_MODE_LIST *mode_list, DISPLAY_MODE *src_mode); -static void DisplayModeListInit(DISPLAY_MODE_LIST *mode_list); -static void DisplayModeListDelete(DISPLAY_MODE_LIST *mode_list); -static bool DisplayModeListCopy(DISPLAY_MODE_LIST *dst, DISPLAY_MODE_LIST *src); -static DISPLAY_MODE *InsertDisplayMode( +static void M_DisplayModeListInit(DISPLAY_MODE_LIST *mode_list); +static void M_DisplayModeListDelete(DISPLAY_MODE_LIST *mode_list); +static bool M_DisplayModeListCopy( + DISPLAY_MODE_LIST *dst, DISPLAY_MODE_LIST *src); +static DISPLAY_MODE *M_InsertDisplayMode( DISPLAY_MODE_LIST *mode_list, DISPLAY_MODE_NODE *before); -static DISPLAY_MODE *InsertDisplayModeInListHead(DISPLAY_MODE_LIST *mode_list); -static DISPLAY_MODE *InsertDisplayModeInListTail(DISPLAY_MODE_LIST *mode_list); +static DISPLAY_MODE *M_InsertDisplayModeInListHead( + DISPLAY_MODE_LIST *mode_list); +static DISPLAY_MODE *M_InsertDisplayModeInListTail( + DISPLAY_MODE_LIST *mode_list); -static void DisplayModeListInit(DISPLAY_MODE_LIST *mode_list) +static void M_DisplayModeListInit(DISPLAY_MODE_LIST *mode_list) { mode_list->head = NULL; mode_list->tail = NULL; mode_list->count = 0; } -static void DisplayModeListDelete(DISPLAY_MODE_LIST *mode_list) +static void M_DisplayModeListDelete(DISPLAY_MODE_LIST *mode_list) { DISPLAY_MODE_NODE *node; DISPLAY_MODE_NODE *nextNode; @@ -64,28 +67,29 @@ static void DisplayModeListDelete(DISPLAY_MODE_LIST *mode_list) nextNode = node->next; free(node); } - DisplayModeListInit(mode_list); + M_DisplayModeListInit(mode_list); } -static bool DisplayModeListCopy(DISPLAY_MODE_LIST *dst, DISPLAY_MODE_LIST *src) +static bool M_DisplayModeListCopy( + DISPLAY_MODE_LIST *dst, DISPLAY_MODE_LIST *src) { if (dst == NULL || src == NULL || dst == src) { return false; } - DisplayModeListDelete(dst); + M_DisplayModeListDelete(dst); for (DISPLAY_MODE_NODE *node = src->head; node != NULL; node = node->next) { - DISPLAY_MODE *dst_mode = InsertDisplayModeInListTail(dst); + DISPLAY_MODE *dst_mode = M_InsertDisplayModeInListTail(dst); *dst_mode = node->body; } return true; } -static DISPLAY_MODE *InsertDisplayMode( +static DISPLAY_MODE *M_InsertDisplayMode( DISPLAY_MODE_LIST *mode_list, DISPLAY_MODE_NODE *before) { if (!before || !before->previous) { - return InsertDisplayModeInListHead(mode_list); + return M_InsertDisplayModeInListHead(mode_list); } DISPLAY_MODE_NODE *node = malloc(sizeof(DISPLAY_MODE_NODE)); @@ -103,7 +107,7 @@ static DISPLAY_MODE *InsertDisplayMode( return &node->body; } -static DISPLAY_MODE *InsertDisplayModeInListHead(DISPLAY_MODE_LIST *mode_list) +static DISPLAY_MODE *M_InsertDisplayModeInListHead(DISPLAY_MODE_LIST *mode_list) { DISPLAY_MODE_NODE *node = malloc(sizeof(DISPLAY_MODE_NODE)); if (!node) { @@ -126,7 +130,7 @@ static DISPLAY_MODE *InsertDisplayModeInListHead(DISPLAY_MODE_LIST *mode_list) return &node->body; } -static DISPLAY_MODE *InsertDisplayModeInListTail(DISPLAY_MODE_LIST *mode_list) +static DISPLAY_MODE *M_InsertDisplayModeInListTail(DISPLAY_MODE_LIST *mode_list) { DISPLAY_MODE_NODE *node = malloc(sizeof(DISPLAY_MODE_NODE)); if (!node) { @@ -149,24 +153,24 @@ static DISPLAY_MODE *InsertDisplayModeInListTail(DISPLAY_MODE_LIST *mode_list) return &node->body; } -static bool InsertDisplayModeInListSorted( +static bool M_InsertDisplayModeInListSorted( DISPLAY_MODE_LIST *mode_list, DISPLAY_MODE *src_mode) { DISPLAY_MODE *dst_mode = NULL; if (mode_list->head == NULL || CompareVideoModes(src_mode, &mode_list->head->body)) { - dst_mode = InsertDisplayModeInListHead(mode_list); + dst_mode = M_InsertDisplayModeInListHead(mode_list); goto finish; } for (DISPLAY_MODE_NODE *node = mode_list->head; node != NULL; node = node->next) { if (CompareVideoModes(src_mode, &node->body)) { - dst_mode = InsertDisplayMode(mode_list, node); + dst_mode = M_InsertDisplayMode(mode_list, node); goto finish; } } - dst_mode = InsertDisplayModeInListTail(mode_list); + dst_mode = M_InsertDisplayModeInListTail(mode_list); finish: if (dst_mode == NULL) { @@ -2424,11 +2428,13 @@ HRESULT __stdcall EnumDisplayModesCallback( if (adapter->hw_render_supported && (render_bit_depth & adapter->hw_device_desc.dwDeviceRenderBitDepth) != 0) { - InsertDisplayModeInListSorted(&adapter->hw_disp_mode_list, &video_mode); + M_InsertDisplayModeInListSorted( + &adapter->hw_disp_mode_list, &video_mode); } if (sw_renderer_supported) { - InsertDisplayModeInListSorted(&adapter->sw_disp_mode_list, &video_mode); + M_InsertDisplayModeInListSorted( + &adapter->sw_disp_mode_list, &video_mode); } return DDENUMRET_OK; @@ -2452,8 +2458,8 @@ bool __cdecl WinVidGetDisplayAdapters(void) *next_node = NULL; node != NULL; node = next_node) { next_node = node->next; - DisplayModeListDelete(&node->body.sw_disp_mode_list); - DisplayModeListDelete(&node->body.hw_disp_mode_list); + M_DisplayModeListDelete(&node->body.sw_disp_mode_list); + M_DisplayModeListDelete(&node->body.hw_disp_mode_list); S_FlaggedString_Delete(&node->body.driver_name); S_FlaggedString_Delete(&node->body.driver_desc); free(node); @@ -2508,8 +2514,8 @@ BOOL WINAPI EnumDisplayAdaptersCallback( list_node->previous = adapter_list->tail; S_FlaggedString_InitAdapter(&list_node->body); - DisplayModeListInit(&list_node->body.hw_disp_mode_list); - DisplayModeListInit(&list_node->body.sw_disp_mode_list); + M_DisplayModeListInit(&list_node->body.hw_disp_mode_list); + M_DisplayModeListInit(&list_node->body.sw_disp_mode_list); if (!adapter_list->head) { adapter_list->head = list_node; @@ -2913,13 +2919,13 @@ void __cdecl WinVidStart(void) S_FlaggedString_Copy( &g_CurrentDisplayAdapter.driver_name, &preferred->driver_name); - DisplayModeListInit(&g_CurrentDisplayAdapter.hw_disp_mode_list); - DisplayModeListCopy( + M_DisplayModeListInit(&g_CurrentDisplayAdapter.hw_disp_mode_list); + M_DisplayModeListCopy( &g_CurrentDisplayAdapter.hw_disp_mode_list, &preferred->hw_disp_mode_list); - DisplayModeListInit(&g_CurrentDisplayAdapter.sw_disp_mode_list); - DisplayModeListCopy( + M_DisplayModeListInit(&g_CurrentDisplayAdapter.sw_disp_mode_list); + M_DisplayModeListCopy( &g_CurrentDisplayAdapter.sw_disp_mode_list, &preferred->sw_disp_mode_list); diff --git a/src/decomp/stats.c b/src/decomp/stats.c index 2ce353e5..2e3c7342 100644 --- a/src/decomp/stats.c +++ b/src/decomp/stats.c @@ -25,7 +25,7 @@ typedef struct { uint8_t medipacks; } STATS; -static STATS Stats_GetEndGameStats(void) +static STATS M_GetEndGameStats(void) { STATS result = { 0 }; @@ -238,7 +238,7 @@ void __cdecl ShowEndStatsText(void) &g_StatsRequester, g_GF_GameStrings[GF_S_GAME_MISC_FINAL_STATISTICS], 0, 0, 0); - const STATS stats = Stats_GetEndGameStats(); + const STATS stats = M_GetEndGameStats(); const int32_t sec = stats.timer / FRAMES_PER_SECOND; sprintf( diff --git a/src/game/console.c b/src/game/console.c index e4d91726..e9e79211 100644 --- a/src/game/console.c +++ b/src/game/console.c @@ -45,14 +45,14 @@ static const double m_LogScale = 0.8; static const char m_ValidPromptChars[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.- "; -static void Console_ShutdownPrompt(void); -static void Console_ShutdownLogs(void); -static void Console_UpdatePromptTextstring(void); -static void Console_UpdateCaretTextstring(void); -static COMMAND_RESULT Console_Eval(const char *cmdline); +static void M_ShutdownPrompt(void); +static void M_ShutdownLogs(void); +static void M_UpdatePromptTextstring(void); +static void M_UpdateCaretTextstring(void); +static COMMAND_RESULT M_Eval(const char *cmdline); extern CONSOLE_COMMAND *g_ConsoleCommands[]; -static void Console_ShutdownPrompt(void) +static void M_ShutdownPrompt(void) { if (m_Prompt.prompt_ts != NULL) { Text_Remove(m_Prompt.prompt_ts); @@ -64,7 +64,7 @@ static void Console_ShutdownPrompt(void) } } -static void Console_ShutdownLogs(void) +static void M_ShutdownLogs(void) { for (int32_t i = 0; i < MAX_LOG_LINES; i++) { Text_Remove(m_Logs[i].ts); @@ -72,12 +72,12 @@ static void Console_ShutdownLogs(void) } } -static void Console_UpdatePromptTextstring(void) +static void M_UpdatePromptTextstring(void) { Text_ChangeText(m_Prompt.prompt_ts, m_Prompt.text); } -static void Console_UpdateCaretTextstring(void) +static void M_UpdateCaretTextstring(void) { const char old = m_Prompt.prompt_ts->text[m_Prompt.caret]; m_Prompt.prompt_ts->text[m_Prompt.caret] = '\0'; @@ -87,7 +87,7 @@ static void Console_UpdateCaretTextstring(void) Text_SetPos(m_Prompt.caret_ts, MARGIN + width, -MARGIN); } -static COMMAND_RESULT Console_Eval(const char *const cmdline) +static COMMAND_RESULT M_Eval(const char *const cmdline) { const char *args = NULL; const CONSOLE_COMMAND *matching_cmd = NULL; @@ -155,14 +155,14 @@ void Console_Init(void) void Console_Shutdown(void) { m_IsOpened = false; - Console_ShutdownPrompt(); - Console_ShutdownLogs(); + M_ShutdownPrompt(); + M_ShutdownLogs(); } void Console_Open(void) { if (m_IsOpened) { - Console_ShutdownPrompt(); + M_ShutdownPrompt(); } else { LOG_DEBUG("opening console!"); } @@ -181,7 +181,7 @@ void Console_Open(void) m_Prompt.prompt_ts, PHD_ONE * m_PromptScale, PHD_ONE * m_PromptScale); Text_AlignBottom(m_Prompt.prompt_ts, true); - Console_UpdateCaretTextstring(); + M_UpdateCaretTextstring(); } void Console_Close(void) @@ -189,7 +189,7 @@ void Console_Close(void) LOG_DEBUG("closing console!"); m_IsOpened = false; strcpy(m_Prompt.text, ""); - Console_ShutdownPrompt(); + M_ShutdownPrompt(); } bool Console_IsOpened(void) @@ -205,7 +205,7 @@ void Console_Confirm(void) } LOG_INFO("executing command: %s", m_Prompt.text); - Console_Eval(m_Prompt.text); + M_Eval(m_Prompt.text); Console_Close(); } @@ -225,7 +225,7 @@ bool Console_HandleKeyDown(const uint32_t key) } if (m_Prompt.caret > 0) { m_Prompt.caret--; - Console_UpdateCaretTextstring(); + M_UpdateCaretTextstring(); } return true; @@ -235,7 +235,7 @@ bool Console_HandleKeyDown(const uint32_t key) } if (m_Prompt.caret < (int32_t)strlen(m_Prompt.text)) { m_Prompt.caret++; - Console_UpdateCaretTextstring(); + M_UpdateCaretTextstring(); } return true; @@ -244,7 +244,7 @@ bool Console_HandleKeyDown(const uint32_t key) return false; } m_Prompt.caret = 0; - Console_UpdateCaretTextstring(); + M_UpdateCaretTextstring(); return true; case VK_END: @@ -252,7 +252,7 @@ bool Console_HandleKeyDown(const uint32_t key) return false; } m_Prompt.caret = strlen(m_Prompt.text); - Console_UpdateCaretTextstring(); + M_UpdateCaretTextstring(); return true; case VK_BACK: @@ -264,8 +264,8 @@ bool Console_HandleKeyDown(const uint32_t key) m_Prompt.text[i - 1] = m_Prompt.text[i]; } m_Prompt.caret--; - Console_UpdatePromptTextstring(); - Console_UpdateCaretTextstring(); + M_UpdatePromptTextstring(); + M_UpdateCaretTextstring(); } return true; } @@ -304,8 +304,8 @@ void Console_HandleChar(const uint32_t char_) m_Prompt.caret += insert_length; m_Prompt.text[MAX_PROMPT_LENGTH - 1] = '\0'; - Console_UpdatePromptTextstring(); - Console_UpdateCaretTextstring(); + M_UpdatePromptTextstring(); + M_UpdateCaretTextstring(); } void Console_Log(const char *fmt, ...) diff --git a/src/game/console_cmd.c b/src/game/console_cmd.c index e054d2df..76610f84 100644 --- a/src/game/console_cmd.c +++ b/src/game/console_cmd.c @@ -29,10 +29,10 @@ #include #include -static bool Console_Cmd_CanTargetObject(GAME_OBJECT_ID object_id); -static bool Console_Cmd_CanTargetObjectCreature(GAME_OBJECT_ID object_id); -static bool Console_Cmd_CanTargetObjectPickup(GAME_OBJECT_ID object_id); -static bool Console_Cmd_IsFloatRound(float num); +static bool M_CanTargetObject(GAME_OBJECT_ID object_id); +static bool M_CanTargetObjectCreature(GAME_OBJECT_ID object_id); +static bool M_CanTargetObjectPickup(GAME_OBJECT_ID object_id); +static bool M_IsFloatRound(float num); static COMMAND_RESULT Console_Cmd_Teleport(const char *args); static COMMAND_RESULT Console_Cmd_Fly(const char *const args); static COMMAND_RESULT Console_Cmd_FlipMap(const char *args); @@ -47,25 +47,25 @@ static COMMAND_RESULT Console_Cmd_ExitToTitle(const char *args); static COMMAND_RESULT Console_Cmd_ExitGame(const char *args); static COMMAND_RESULT Console_Cmd_Abortion(const char *args); -static bool Console_Cmd_CanTargetObject(const GAME_OBJECT_ID object_id) +static bool M_CanTargetObject(const GAME_OBJECT_ID object_id) { return !Object_IsObjectType(object_id, g_NullObjects) && !Object_IsObjectType(object_id, g_AnimObjects) && !Object_IsObjectType(object_id, g_InvObjects); } -static bool Console_Cmd_CanTargetObjectCreature(const GAME_OBJECT_ID object_id) +static bool M_CanTargetObjectCreature(const GAME_OBJECT_ID object_id) { return Object_IsObjectType(object_id, g_EnemyObjects) || Object_IsObjectType(object_id, g_FriendObjects); } -static bool Console_Cmd_CanTargetObjectPickup(const GAME_OBJECT_ID object_id) +static bool M_CanTargetObjectPickup(const GAME_OBJECT_ID object_id) { return Object_IsObjectType(object_id, g_PickupObjects); } -static inline bool Console_Cmd_IsFloatRound(const float num) +static inline bool M_IsFloatRound(const float num) { return (fabsf(num) - roundf(num)) < 0.0001f; } @@ -86,10 +86,10 @@ static COMMAND_RESULT Console_Cmd_Teleport(const char *const args) { float x, y, z; if (sscanf(args, "%f %f %f", &x, &y, &z) == 3) { - if (Console_Cmd_IsFloatRound(x)) { + if (M_IsFloatRound(x)) { x += 0.5f; } - if (Console_Cmd_IsFloatRound(z)) { + if (M_IsFloatRound(z)) { z += 0.5f; } @@ -142,7 +142,7 @@ static COMMAND_RESULT Console_Cmd_Teleport(const char *const args) if (!String_Equivalent(args, "")) { int32_t match_count = 0; GAME_OBJECT_ID *matching_objs = - Object_IdsFromName(args, &match_count, Console_Cmd_CanTargetObject); + Object_IdsFromName(args, &match_count, M_CanTargetObject); const ITEM_INFO *best_item = NULL; int32_t best_distance = INT32_MAX; @@ -299,8 +299,8 @@ static COMMAND_RESULT Console_Cmd_Kill(const char *args) bool matches_found = false; int32_t num_killed = 0; int32_t match_count = 0; - GAME_OBJECT_ID *matching_objs = Object_IdsFromName( - args, &match_count, Console_Cmd_CanTargetObjectCreature); + GAME_OBJECT_ID *matching_objs = + Object_IdsFromName(args, &match_count, M_CanTargetObjectCreature); for (int16_t item_num = 0; item_num < Item_GetTotalCount(); item_num++) { @@ -376,8 +376,8 @@ static COMMAND_RESULT Console_Cmd_GiveItem(const char *args) bool found = false; int32_t match_count = 0; - GAME_OBJECT_ID *matching_objs = Object_IdsFromName( - args, &match_count, Console_Cmd_CanTargetObjectPickup); + GAME_OBJECT_ID *matching_objs = + Object_IdsFromName(args, &match_count, M_CanTargetObjectPickup); for (int32_t i = 0; i < match_count; i++) { const GAME_OBJECT_ID object_id = matching_objs[i]; if (g_Objects[object_id].loaded) { diff --git a/src/game/effects.c b/src/game/effects.c index 1616d352..e6fad7fc 100644 --- a/src/game/effects.c +++ b/src/game/effects.c @@ -6,10 +6,10 @@ #include "global/funcs.h" #include "global/vars.h" -static void Effect_RemoveActive(const int16_t fx_num); -static void Effect_RemoveDrawn(const int16_t fx_num); +static void M_RemoveActive(const int16_t fx_num); +static void M_RemoveDrawn(const int16_t fx_num); -static void Effect_RemoveActive(const int16_t fx_num) +static void M_RemoveActive(const int16_t fx_num) { FX_INFO *const fx = &g_Effects[fx_num]; int16_t link_num = g_NextEffectActive; @@ -27,7 +27,7 @@ static void Effect_RemoveActive(const int16_t fx_num) } } -static void Effect_RemoveDrawn(const int16_t fx_num) +static void M_RemoveDrawn(const int16_t fx_num) { FX_INFO *const fx = &g_Effects[fx_num]; int16_t link_num = g_Rooms[fx->room_num].fx_num; @@ -83,8 +83,8 @@ int16_t __cdecl Effect_Create(const int16_t room_num) void __cdecl Effect_Kill(const int16_t fx_num) { FX_INFO *const fx = &g_Effects[fx_num]; - Effect_RemoveActive(fx_num); - Effect_RemoveDrawn(fx_num); + M_RemoveActive(fx_num); + M_RemoveDrawn(fx_num); fx->next_fx = g_NextEffectFree; g_NextEffectFree = fx_num; diff --git a/src/game/gameflow.c b/src/game/gameflow.c index 1779f8c1..23ba06b6 100644 --- a/src/game/gameflow.c +++ b/src/game/gameflow.c @@ -21,17 +21,17 @@ #define GF_CURRENT_VERSION 3 -static void GF_ReadStringTable( +static void M_ReadStringTable( VFILE *file, int32_t count, char ***table, char **buffer); -static GF_ADD_INV GF_ModifyInventory_GetGunAdder(LARA_GUN_TYPE gun_type); -static GF_ADD_INV GF_ModifyInventory_GetAmmoAdder(LARA_GUN_TYPE gun_type); -static GF_ADD_INV GF_ModifyInventory_GetItemAdder(GAME_OBJECT_ID object_id); -static void GF_ModifyInventory_GunOrAmmo( +static GF_ADD_INV M_ModifyInventory_GetGunAdder(LARA_GUN_TYPE gun_type); +static GF_ADD_INV M_ModifyInventory_GetAmmoAdder(LARA_GUN_TYPE gun_type); +static GF_ADD_INV M_ModifyInventory_GetItemAdder(GAME_OBJECT_ID object_id); +static void M_ModifyInventory_GunOrAmmo( START_INFO *start, int32_t type, LARA_GUN_TYPE gun_type); -static void GF_ModifyInventory_Item(int32_t type, GAME_OBJECT_ID object_id); +static void M_ModifyInventory_Item(int32_t type, GAME_OBJECT_ID object_id); -static void GF_ReadStringTable( +static void M_ReadStringTable( VFILE *const file, const int32_t count, char ***const table, char **const buffer) { @@ -54,7 +54,7 @@ static void GF_ReadStringTable( } } -static GF_ADD_INV GF_ModifyInventory_GetGunAdder(const LARA_GUN_TYPE gun_type) +static GF_ADD_INV M_ModifyInventory_GetGunAdder(const LARA_GUN_TYPE gun_type) { // clang-format off switch (gun_type) { @@ -70,7 +70,7 @@ static GF_ADD_INV GF_ModifyInventory_GetGunAdder(const LARA_GUN_TYPE gun_type) // clang-format on } -static GF_ADD_INV GF_ModifyInventory_GetAmmoAdder(const LARA_GUN_TYPE gun_type) +static GF_ADD_INV M_ModifyInventory_GetAmmoAdder(const LARA_GUN_TYPE gun_type) { // clang-format off switch (gun_type) { @@ -86,8 +86,7 @@ static GF_ADD_INV GF_ModifyInventory_GetAmmoAdder(const LARA_GUN_TYPE gun_type) // clang-format on } -static GF_ADD_INV GF_ModifyInventory_GetItemAdder( - const GAME_OBJECT_ID object_id) +static GF_ADD_INV M_ModifyInventory_GetItemAdder(const GAME_OBJECT_ID object_id) { // clang-format off switch (object_id) { @@ -109,7 +108,7 @@ static GF_ADD_INV GF_ModifyInventory_GetItemAdder( // clang-format on } -static void GF_ModifyInventory_GunOrAmmo( +static void M_ModifyInventory_GunOrAmmo( START_INFO *const start, const int32_t type, const LARA_GUN_TYPE gun_type) { const GAME_OBJECT_ID gun_item = Gun_GetGunObject(gun_type); @@ -117,8 +116,8 @@ static void GF_ModifyInventory_GunOrAmmo( const int32_t ammo_qty = Gun_GetAmmoQuantity(gun_type); AMMO_INFO *const ammo_info = Gun_GetAmmoInfo(gun_type); - const GF_ADD_INV gun_adder = GF_ModifyInventory_GetGunAdder(gun_type); - const GF_ADD_INV ammo_adder = GF_ModifyInventory_GetAmmoAdder(gun_type); + const GF_ADD_INV gun_adder = M_ModifyInventory_GetGunAdder(gun_type); + const GF_ADD_INV ammo_adder = M_ModifyInventory_GetAmmoAdder(gun_type); if (Inv_RequestItem(gun_item)) { if (type == 1) { @@ -170,10 +169,10 @@ static void GF_ModifyInventory_GunOrAmmo( } } -static void GF_ModifyInventory_Item( +static void M_ModifyInventory_Item( const int32_t type, const GAME_OBJECT_ID object_id) { - const GF_ADD_INV item_adder = GF_ModifyInventory_GetItemAdder(object_id); + const GF_ADD_INV item_adder = M_ModifyInventory_GetItemAdder(object_id); int32_t qty = 0; if (type == 1) { qty = g_GF_SecretInvItems[item_adder]; @@ -252,20 +251,20 @@ BOOL __cdecl GF_LoadFromFile(const char *const file_name) g_GameFlow.level_complete_track = VFile_ReadU8(file); VFile_Skip(file, 4); - GF_ReadStringTable( + M_ReadStringTable( file, g_GameFlow.num_levels, &g_GF_LevelNames, &g_GF_LevelNamesBuf); - GF_ReadStringTable( + M_ReadStringTable( file, g_GameFlow.num_pictures, &g_GF_PicFilenames, &g_GF_PicFilenamesBuf); - GF_ReadStringTable( + M_ReadStringTable( file, g_GameFlow.num_titles, &g_GF_TitleFileNames, &g_GF_TitleFileNamesBuf); - GF_ReadStringTable( + M_ReadStringTable( file, g_GameFlow.num_fmvs, &g_GF_FMVFilenames, &g_GF_FMVFilenamesBuf); - GF_ReadStringTable( + M_ReadStringTable( file, g_GameFlow.num_levels, &g_GF_LevelFileNames, &g_GF_LevelFileNamesBuf); - GF_ReadStringTable( + M_ReadStringTable( file, g_GameFlow.num_cutscenes, &g_GF_CutsceneFileNames, &g_GF_CutsceneFileNamesBuf); @@ -289,35 +288,35 @@ BOOL __cdecl GF_LoadFromFile(const char *const file_name) return false; } - GF_ReadStringTable( + M_ReadStringTable( file, GF_S_GAME_NUMBER_OF, &g_GF_GameStrings, &g_GF_GameStringsBuf); - GF_ReadStringTable( + M_ReadStringTable( file, GF_S_PC_NUMBER_OF, &g_GF_PCStrings, &g_GF_PCStringsBuf); - GF_ReadStringTable( + M_ReadStringTable( file, g_GameFlow.num_levels, &g_GF_Puzzle1Strings, &g_GF_Puzzle1StringsBuf); - GF_ReadStringTable( + M_ReadStringTable( file, g_GameFlow.num_levels, &g_GF_Puzzle2Strings, &g_GF_Puzzle2StringsBuf); - GF_ReadStringTable( + M_ReadStringTable( file, g_GameFlow.num_levels, &g_GF_Puzzle3Strings, &g_GF_Puzzle3StringsBuf); - GF_ReadStringTable( + M_ReadStringTable( file, g_GameFlow.num_levels, &g_GF_Puzzle4Strings, &g_GF_Puzzle4StringsBuf); - GF_ReadStringTable( + M_ReadStringTable( file, g_GameFlow.num_levels, &g_GF_Pickup1Strings, &g_GF_Pickup1StringsBuf); - GF_ReadStringTable( + M_ReadStringTable( file, g_GameFlow.num_levels, &g_GF_Pickup2Strings, &g_GF_Pickup2StringsBuf); - GF_ReadStringTable( + M_ReadStringTable( file, g_GameFlow.num_levels, &g_GF_Key1Strings, &g_GF_Key1StringsBuf); - GF_ReadStringTable( + M_ReadStringTable( file, g_GameFlow.num_levels, &g_GF_Key2Strings, &g_GF_Key2StringsBuf); - GF_ReadStringTable( + M_ReadStringTable( file, g_GameFlow.num_levels, &g_GF_Key3Strings, &g_GF_Key3StringsBuf); - GF_ReadStringTable( + M_ReadStringTable( file, g_GameFlow.num_levels, &g_GF_Key4Strings, &g_GF_Key4StringsBuf); VFile_Close(file); @@ -651,26 +650,26 @@ void __cdecl GF_ModifyInventory(const int32_t level, const int32_t type) Inv_AddItem(O_PISTOL_ITEM); } - GF_ModifyInventory_GunOrAmmo(start, type, LGT_MAGNUMS); - GF_ModifyInventory_GunOrAmmo(start, type, LGT_UZIS); - GF_ModifyInventory_GunOrAmmo(start, type, LGT_SHOTGUN); - GF_ModifyInventory_GunOrAmmo(start, type, LGT_HARPOON); - GF_ModifyInventory_GunOrAmmo(start, type, LGT_M16); - GF_ModifyInventory_GunOrAmmo(start, type, LGT_GRENADE); - - GF_ModifyInventory_Item(type, O_FLARE_ITEM); - GF_ModifyInventory_Item(type, O_SMALL_MEDIPACK_ITEM); - GF_ModifyInventory_Item(type, O_LARGE_MEDIPACK_ITEM); - GF_ModifyInventory_Item(type, O_PICKUP_ITEM_1); - GF_ModifyInventory_Item(type, O_PICKUP_ITEM_2); - GF_ModifyInventory_Item(type, O_PUZZLE_ITEM_1); - GF_ModifyInventory_Item(type, O_PUZZLE_ITEM_2); - GF_ModifyInventory_Item(type, O_PUZZLE_ITEM_3); - GF_ModifyInventory_Item(type, O_PUZZLE_ITEM_4); - GF_ModifyInventory_Item(type, O_KEY_ITEM_1); - GF_ModifyInventory_Item(type, O_KEY_ITEM_2); - GF_ModifyInventory_Item(type, O_KEY_ITEM_3); - GF_ModifyInventory_Item(type, O_KEY_ITEM_4); + M_ModifyInventory_GunOrAmmo(start, type, LGT_MAGNUMS); + M_ModifyInventory_GunOrAmmo(start, type, LGT_UZIS); + M_ModifyInventory_GunOrAmmo(start, type, LGT_SHOTGUN); + M_ModifyInventory_GunOrAmmo(start, type, LGT_HARPOON); + M_ModifyInventory_GunOrAmmo(start, type, LGT_M16); + M_ModifyInventory_GunOrAmmo(start, type, LGT_GRENADE); + + M_ModifyInventory_Item(type, O_FLARE_ITEM); + M_ModifyInventory_Item(type, O_SMALL_MEDIPACK_ITEM); + M_ModifyInventory_Item(type, O_LARGE_MEDIPACK_ITEM); + M_ModifyInventory_Item(type, O_PICKUP_ITEM_1); + M_ModifyInventory_Item(type, O_PICKUP_ITEM_2); + M_ModifyInventory_Item(type, O_PUZZLE_ITEM_1); + M_ModifyInventory_Item(type, O_PUZZLE_ITEM_2); + M_ModifyInventory_Item(type, O_PUZZLE_ITEM_3); + M_ModifyInventory_Item(type, O_PUZZLE_ITEM_4); + M_ModifyInventory_Item(type, O_KEY_ITEM_1); + M_ModifyInventory_Item(type, O_KEY_ITEM_2); + M_ModifyInventory_Item(type, O_KEY_ITEM_3); + M_ModifyInventory_Item(type, O_KEY_ITEM_4); for (int32_t i = 0; i < GF_ADD_INV_NUMBER_OF; i++) { if (type == 1) { diff --git a/src/game/gameflow/gameflow_new.c b/src/game/gameflow/gameflow_new.c index 2d2eb708..31ab1deb 100644 --- a/src/game/gameflow/gameflow_new.c +++ b/src/game/gameflow/gameflow_new.c @@ -12,13 +12,12 @@ GAMEFLOW_NEW g_GameflowNew; GAME_INFO g_GameInfo; -static void GF_N_LoadObjectString(const char *key, const char *value); -static void GF_N_LoadGameString(const char *key, const char *value); -static void GF_N_LoadObjectStrings(const int32_t level_num); -static void GF_N_LoadGameStrings(const int32_t level_num); +static void M_LoadObjectString(const char *key, const char *value); +static void M_LoadGameString(const char *key, const char *value); +static void M_LoadObjectStrings(const int32_t level_num); +static void M_LoadGameStrings(const int32_t level_num); -static void GF_N_LoadObjectString( - const char *const key, const char *const value) +static void M_LoadObjectString(const char *const key, const char *const value) { const GAME_OBJECT_ID object = ENUM_STRING_GET(GAME_OBJECT_ID, key, NO_OBJECT); @@ -27,7 +26,7 @@ static void GF_N_LoadObjectString( } } -static void GF_N_LoadGameString(const char *const key, const char *const value) +static void M_LoadGameString(const char *const key, const char *const value) { if (!GameString_IsKnown(key)) { LOG_ERROR("Invalid game string key: %s", key); @@ -38,13 +37,13 @@ static void GF_N_LoadGameString(const char *const key, const char *const value) } } -static void GF_N_LoadObjectStrings(const int32_t level_num) +static void M_LoadObjectStrings(const int32_t level_num) { const GAMEFLOW_NEW *const gf = &g_GameflowNew; const GAMEFLOW_NEW_STRING_ENTRY *entry = gf->object_strings; while (entry != NULL && entry->key != NULL) { - GF_N_LoadObjectString(entry->key, entry->value); + M_LoadObjectString(entry->key, entry->value); entry++; } @@ -53,19 +52,19 @@ static void GF_N_LoadObjectStrings(const int32_t level_num) const GAMEFLOW_NEW_LEVEL *const level = &gf->levels[level_num]; entry = level->object_strings; while (entry != NULL && entry->key != NULL) { - GF_N_LoadObjectString(entry->key, entry->value); + M_LoadObjectString(entry->key, entry->value); entry++; } } } -static void GF_N_LoadGameStrings(const int32_t level_num) +static void M_LoadGameStrings(const int32_t level_num) { const GAMEFLOW_NEW *const gf = &g_GameflowNew; const GAMEFLOW_NEW_STRING_ENTRY *entry = gf->game_strings; while (entry != NULL && entry->key != NULL) { - GF_N_LoadGameString(entry->key, entry->value); + M_LoadGameString(entry->key, entry->value); entry++; } @@ -74,7 +73,7 @@ static void GF_N_LoadGameStrings(const int32_t level_num) const GAMEFLOW_NEW_LEVEL *const level = &gf->levels[level_num]; entry = level->game_strings; while (entry != NULL && entry->key != NULL) { - GF_N_LoadGameString(entry->key, entry->value); + M_LoadGameString(entry->key, entry->value); entry++; } } @@ -82,6 +81,6 @@ static void GF_N_LoadGameStrings(const int32_t level_num) void GF_N_LoadStrings(const int32_t level_num) { - GF_N_LoadObjectStrings(level_num); - GF_N_LoadGameStrings(level_num); + M_LoadObjectStrings(level_num); + M_LoadGameStrings(level_num); } diff --git a/src/game/gameflow/reader.c b/src/game/gameflow/reader.c index ebc89bdc..c48c2237 100644 --- a/src/game/gameflow/reader.c +++ b/src/game/gameflow/reader.c @@ -8,12 +8,13 @@ #include #include -static void GF_N_StringTableShutdown(GAMEFLOW_NEW_STRING_ENTRY *dest); -static bool GF_N_LoadStringTable( +static void M_StringTableShutdown(GAMEFLOW_NEW_STRING_ENTRY *dest); +static bool M_LoadStringTable( struct json_object_s *root_obj, const char *key, GAMEFLOW_NEW_STRING_ENTRY **dest); +static bool M_LoadScriptLevels(struct json_object_s *obj, GAMEFLOW_NEW *gf); -static void GF_N_StringTableShutdown(GAMEFLOW_NEW_STRING_ENTRY *const dest) +static void M_StringTableShutdown(GAMEFLOW_NEW_STRING_ENTRY *const dest) { if (dest == NULL) { return; @@ -27,7 +28,7 @@ static void GF_N_StringTableShutdown(GAMEFLOW_NEW_STRING_ENTRY *const dest) Memory_Free(dest); } -static bool GF_N_LoadStringTable( +static bool M_LoadStringTable( struct json_object_s *const root_obj, const char *const key, GAMEFLOW_NEW_STRING_ENTRY **dest) { @@ -68,7 +69,7 @@ static bool GF_N_LoadStringTable( return true; } -static bool GF_N_LoadScriptLevels( +static bool M_LoadScriptLevels( struct json_object_s *obj, GAMEFLOW_NEW *const gf) { bool result = true; @@ -105,10 +106,10 @@ static bool GF_N_LoadScriptLevels( goto end; } - result &= GF_N_LoadStringTable( + result &= M_LoadStringTable( jlvl_obj, "object_strings", &level->object_strings); - result &= GF_N_LoadStringTable( - jlvl_obj, "game_strings", &level->game_strings); + result &= + M_LoadStringTable(jlvl_obj, "game_strings", &level->game_strings); } end: @@ -144,9 +145,9 @@ bool GF_N_Load(const char *const path) GAMEFLOW_NEW *const gf = &g_GameflowNew; struct json_object_s *root_obj = json_value_as_object(root); result &= - GF_N_LoadStringTable(root_obj, "object_strings", &gf->object_strings); - result &= GF_N_LoadStringTable(root_obj, "game_strings", &gf->game_strings); - result &= GF_N_LoadScriptLevels(root_obj, gf); + M_LoadStringTable(root_obj, "object_strings", &gf->object_strings); + result &= M_LoadStringTable(root_obj, "game_strings", &gf->game_strings); + result &= M_LoadScriptLevels(root_obj, gf); end: if (root) { @@ -167,10 +168,10 @@ void GF_N_Shutdown(void) GAMEFLOW_NEW *const gf = &g_GameflowNew; for (int32_t i = 0; i < gf->level_count; i++) { - GF_N_StringTableShutdown(gf->levels[i].object_strings); - GF_N_StringTableShutdown(gf->levels[i].game_strings); + M_StringTableShutdown(gf->levels[i].object_strings); + M_StringTableShutdown(gf->levels[i].game_strings); } - GF_N_StringTableShutdown(gf->object_strings); - GF_N_StringTableShutdown(gf->game_strings); + M_StringTableShutdown(gf->object_strings); + M_StringTableShutdown(gf->game_strings); } diff --git a/src/game/inventory/common.c b/src/game/inventory/common.c index 00af3176..4c3caa5a 100644 --- a/src/game/inventory/common.c +++ b/src/game/inventory/common.c @@ -28,12 +28,12 @@ static TEXTSTRING *m_VersionText = NULL; -static void Inv_RemoveItemsText(void); -static void Inv_RemoveAllText(void); -static void Inv_ShowItemQuantity(const char *fmt, int32_t qty); -static void Inv_ShowAmmoQuantity(const char *fmt, int32_t qty); +static void M_RemoveItemsText(void); +static void M_RemoveAllText(void); +static void M_ShowItemQuantity(const char *fmt, int32_t qty); +static void M_ShowAmmoQuantity(const char *fmt, int32_t qty); -static void Inv_RemoveItemsText(void) +static void M_RemoveItemsText(void) { for (int32_t i = 0; i < 2; i++) { Text_Remove(g_Inv_ItemText[i]); @@ -41,9 +41,9 @@ static void Inv_RemoveItemsText(void) } } -static void Inv_RemoveAllText(void) +static void M_RemoveAllText(void) { - Inv_RemoveItemsText(); + M_RemoveItemsText(); Text_Remove(g_Inv_TagText); g_Inv_TagText = NULL; @@ -62,7 +62,7 @@ static void Inv_RemoveAllText(void) m_VersionText = NULL; } -static void Inv_ShowItemQuantity(const char *const fmt, const int32_t qty) +static void M_ShowItemQuantity(const char *const fmt, const int32_t qty) { if (g_Inv_ItemText[1] == NULL && !g_SaveGame.bonus_flag) { char string[64]; @@ -74,10 +74,10 @@ static void Inv_ShowItemQuantity(const char *const fmt, const int32_t qty) } } -static void Inv_ShowAmmoQuantity(const char *const fmt, const int32_t qty) +static void M_ShowAmmoQuantity(const char *const fmt, const int32_t qty) { if (!g_SaveGame.bonus_flag) { - Inv_ShowItemQuantity(fmt, qty); + M_ShowItemQuantity(fmt, qty); } } @@ -240,7 +240,7 @@ int32_t __cdecl Inv_Display(int32_t inventory_mode) do { if (g_GF_OverrideDir != (GAME_FLOW_DIR)-1) { INVENTORY_ITEM *inv_item = ring.list[ring.current_object]; - Inv_RemoveAllText(); + M_RemoveAllText(); Option_ShutdownInventory(inv_item); return GFD_OVERRIDE; } @@ -748,7 +748,7 @@ int32_t __cdecl Inv_Display(int32_t inventory_mode) } } while (imo.status != RNG_DONE); - Inv_RemoveAllText(); + M_RemoveAllText(); S_FinishInventory(); g_Inv_IsActive = 0; @@ -1184,45 +1184,44 @@ void __cdecl Inv_RingNotActive(const INVENTORY_ITEM *const inv_item) const int32_t qty = Inv_RequestItem(inv_item->object_id); switch (inv_item->object_id) { case O_SHOTGUN_OPTION: - Inv_ShowAmmoQuantity( - "%5d", g_Lara.shotgun_ammo.ammo / SHOTGUN_AMMO_CLIP); + M_ShowAmmoQuantity("%5d", g_Lara.shotgun_ammo.ammo / SHOTGUN_AMMO_CLIP); break; case O_MAGNUM_OPTION: - Inv_ShowAmmoQuantity("%5d", g_Lara.magnum_ammo.ammo); + M_ShowAmmoQuantity("%5d", g_Lara.magnum_ammo.ammo); break; case O_UZI_OPTION: - Inv_ShowAmmoQuantity("%5d", g_Lara.uzi_ammo.ammo); + M_ShowAmmoQuantity("%5d", g_Lara.uzi_ammo.ammo); break; case O_HARPOON_OPTION: - Inv_ShowAmmoQuantity("%5d", g_Lara.harpoon_ammo.ammo); + M_ShowAmmoQuantity("%5d", g_Lara.harpoon_ammo.ammo); break; case O_M16_OPTION: - Inv_ShowAmmoQuantity("%5d", g_Lara.m16_ammo.ammo); + M_ShowAmmoQuantity("%5d", g_Lara.m16_ammo.ammo); break; case O_GRENADE_OPTION: - Inv_ShowAmmoQuantity("%5d", g_Lara.grenade_ammo.ammo); + M_ShowAmmoQuantity("%5d", g_Lara.grenade_ammo.ammo); break; case O_SHOTGUN_AMMO_OPTION: - Inv_ShowAmmoQuantity("%d", SHOTGUN_SHELL_COUNT * qty); + M_ShowAmmoQuantity("%d", SHOTGUN_SHELL_COUNT * qty); break; case O_MAGNUM_AMMO_OPTION: case O_UZI_AMMO_OPTION: case O_HARPOON_AMMO_OPTION: case O_M16_AMMO_OPTION: - Inv_ShowAmmoQuantity("%d", 2 * qty); + M_ShowAmmoQuantity("%d", 2 * qty); break; case O_GRENADE_AMMO_OPTION: case O_FLARES_OPTION: - Inv_ShowAmmoQuantity("%d", qty); + M_ShowAmmoQuantity("%d", qty); break; case O_SMALL_MEDIPACK_OPTION: case O_LARGE_MEDIPACK_OPTION: g_HealthBarTimer = 40; Overlay_DrawHealthBar(Overlay_FlashCounter()); - Inv_ShowItemQuantity("%d", qty); + M_ShowItemQuantity("%d", qty); break; case O_PUZZLE_OPTION_1: @@ -1236,7 +1235,7 @@ void __cdecl Inv_RingNotActive(const INVENTORY_ITEM *const inv_item) case O_PICKUP_OPTION_1: case O_PICKUP_OPTION_2: if (qty > 1) { - Inv_ShowItemQuantity("%d", qty); + M_ShowItemQuantity("%d", qty); } break; @@ -1247,5 +1246,5 @@ void __cdecl Inv_RingNotActive(const INVENTORY_ITEM *const inv_item) void __cdecl Inv_RingActive(void) { - Inv_RemoveItemsText(); + M_RemoveItemsText(); } diff --git a/src/game/items.c b/src/game/items.c index 58a8822d..a3653b81 100644 --- a/src/game/items.c +++ b/src/game/items.c @@ -15,9 +15,9 @@ static int16_t m_MaxUsedItemCount = 0; static BOUNDS_16 m_InterpolatedBounds = { 0 }; -static OBJECT_BOUNDS Item_ConvertBounds(const int16_t *bounds_in); +static OBJECT_BOUNDS M_ConvertBounds(const int16_t *bounds_in); -static OBJECT_BOUNDS Item_ConvertBounds(const int16_t *const bounds_in) +static OBJECT_BOUNDS M_ConvertBounds(const int16_t *const bounds_in) { // TODO: remove this conversion utility once we gain control over its // incoming arguments @@ -354,7 +354,7 @@ int32_t __cdecl Item_TestPosition( const int16_t *const bounds_in, const ITEM_INFO *const src_item, const ITEM_INFO *const dst_item) { - const OBJECT_BOUNDS bounds = Item_ConvertBounds(bounds_in); + const OBJECT_BOUNDS bounds = M_ConvertBounds(bounds_in); const XYZ_16 rot = { .x = dst_item->rot.x - src_item->rot.x, diff --git a/src/game/lara/lara_cheat.c b/src/game/lara/lara_cheat.c index c91c6336..d3620312 100644 --- a/src/game/lara/lara_cheat.c +++ b/src/game/lara/lara_cheat.c @@ -22,13 +22,13 @@ #include #include -static void Lara_Cheat_GiveAllGunsImpl(void); -static void Lara_Cheat_GiveAllMedpacksImpl(void); -static void Lara_Cheat_GiveAllKeysImpl(void); -static void Lara_Cheat_ReinitialiseGunMeshes(void); -static void Lara_Cheat_ResetGunStatus(void); +static void M_GiveAllGunsImpl(void); +static void M_GiveAllMedpacksImpl(void); +static void M_GiveAllKeysImpl(void); +static void M_ReinitialiseGunMeshes(void); +static void M_ResetGunStatus(void); -static void Lara_Cheat_ReinitialiseGunMeshes(void) +static void M_ReinitialiseGunMeshes(void) { // TODO: consider refactoring flare check once more is known about overall // flare control. @@ -42,7 +42,7 @@ static void Lara_Cheat_ReinitialiseGunMeshes(void) } } -static void Lara_Cheat_GiveAllGunsImpl(void) +static void M_GiveAllGunsImpl(void) { Inv_AddItem(O_PISTOL_ITEM); Inv_AddItem(O_MAGNUM_ITEM); @@ -59,14 +59,14 @@ static void Lara_Cheat_GiveAllGunsImpl(void) g_Lara.grenade_ammo.ammo = 300; } -static void Lara_Cheat_GiveAllMedpacksImpl(void) +static void M_GiveAllMedpacksImpl(void) { Inv_AddItemNTimes(O_FLARES_ITEM, 10); Inv_AddItemNTimes(O_SMALL_MEDIPACK_ITEM, 10); Inv_AddItemNTimes(O_LARGE_MEDIPACK_ITEM, 10); } -static void Lara_Cheat_GiveAllKeysImpl(void) +static void M_GiveAllKeysImpl(void) { Inv_AddItem(O_PUZZLE_ITEM_1); Inv_AddItem(O_PUZZLE_ITEM_2); @@ -80,7 +80,7 @@ static void Lara_Cheat_GiveAllKeysImpl(void) Inv_AddItem(O_PICKUP_ITEM_2); } -static void Lara_Cheat_ResetGunStatus(void) +static void M_ResetGunStatus(void) { const bool has_flare = g_Lara.mesh_ptrs[LM_HAND_L] == g_Meshes[g_Objects[O_LARA_FLARE].mesh_idx + LM_HAND_L]; @@ -117,7 +117,7 @@ bool __cdecl Lara_Cheat_EnterFlyMode(void) } if (g_Lara.extra_anim) { - Lara_Cheat_ResetGunStatus(); + M_ResetGunStatus(); } Lara_GetOffVehicle(); @@ -149,7 +149,7 @@ bool __cdecl Lara_Cheat_EnterFlyMode(void) g_Lara.burn = 0; g_Lara.extra_anim = 0; - Lara_Cheat_ReinitialiseGunMeshes(); + M_ReinitialiseGunMeshes(); g_Camera.type = CAM_CHASE; Output_AlterFOV(GAME_FOV * PHD_DEGREE); @@ -187,7 +187,7 @@ bool __cdecl Lara_Cheat_ExitFlyMode(void) g_Lara.gun_status = LGS_UNDRAW; } else { g_Lara.gun_status = LGS_ARMLESS; - Lara_Cheat_ReinitialiseGunMeshes(); + M_ReinitialiseGunMeshes(); } Console_Log(GS(OSD_FLY_MODE_OFF)); @@ -245,8 +245,8 @@ bool Lara_Cheat_OpenNearestDoor(void) void __cdecl Lara_Cheat_GetStuff(void) { - Lara_Cheat_GiveAllGunsImpl(); - Lara_Cheat_GiveAllMedpacksImpl(); + M_GiveAllGunsImpl(); + M_GiveAllMedpacksImpl(); } bool Lara_Cheat_GiveAllKeys(void) @@ -255,7 +255,7 @@ bool Lara_Cheat_GiveAllKeys(void) return false; } - Lara_Cheat_GiveAllKeysImpl(); + M_GiveAllKeysImpl(); Sound_Effect(SFX_LARA_KEY, NULL, SPM_ALWAYS); Console_Log(GS(OSD_GIVE_ITEM_ALL_KEYS)); @@ -268,7 +268,7 @@ bool Lara_Cheat_GiveAllGuns(void) return false; } - Lara_Cheat_GiveAllGunsImpl(); + M_GiveAllGunsImpl(); Sound_Effect(SFX_LARA_RELOAD, NULL, SPM_ALWAYS); Console_Log(GS(OSD_GIVE_ITEM_ALL_GUNS)); @@ -281,9 +281,9 @@ bool Lara_Cheat_GiveAllItems(void) return false; } - Lara_Cheat_GiveAllGunsImpl(); - Lara_Cheat_GiveAllKeysImpl(); - Lara_Cheat_GiveAllMedpacksImpl(); + M_GiveAllGunsImpl(); + M_GiveAllKeysImpl(); + M_GiveAllMedpacksImpl(); Sound_Effect(SFX_LARA_HOLSTER, &g_LaraItem->pos, SPM_NORMAL); Console_Log(GS(OSD_GIVE_ITEM_CHEAT)); @@ -405,8 +405,8 @@ bool Lara_Cheat_Teleport(int32_t x, int32_t y, int32_t z) } g_Lara.extra_anim = 0; - Lara_Cheat_ResetGunStatus(); - Lara_Cheat_ReinitialiseGunMeshes(); + M_ResetGunStatus(); + M_ReinitialiseGunMeshes(); } g_Lara.spaz_effect_count = 0; diff --git a/src/game/lara/lara_misc.c b/src/game/lara/lara_misc.c index 597246e3..fc258044 100644 --- a/src/game/lara/lara_misc.c +++ b/src/game/lara/lara_misc.c @@ -24,10 +24,10 @@ #define CLIMB_HANG 900 #define CLIMB_SHIFT 70 -static void __cdecl Lara_TakeHit_Impl( +static void __cdecl M_TakeHit( ITEM_INFO *const lara_item, const int32_t dx, const int32_t dz); -static void __cdecl Lara_TakeHit_Impl( +static void __cdecl M_TakeHit( ITEM_INFO *const lara_item, const int32_t dx, const int32_t dz) { const PHD_ANGLE hit_angle = lara_item->rot.y + PHD_180 - Math_Atan(dz, dx); @@ -1032,7 +1032,7 @@ void __cdecl Lara_TakeHit( { const int32_t dx = g_Lara.spaz_effect->pos.x - lara_item->pos.x; const int32_t dz = g_Lara.spaz_effect->pos.z - lara_item->pos.z; - Lara_TakeHit_Impl(lara_item, dx, dz); + M_TakeHit(lara_item, dx, dz); g_Lara.spaz_effect_count--; } @@ -1153,7 +1153,7 @@ void __cdecl Lara_Push( dz -= (c * rz - s * rx) >> W2V_SHIFT; if (spaz_on && bounds->max_y - bounds->min_y > STEP_L) { - Lara_TakeHit_Impl(lara_item, dx, dz); + M_TakeHit(lara_item, dx, dz); } int16_t old_facing = coll->facing; diff --git a/src/game/level.c b/src/game/level.c index d6f6b2db..4fd4b037 100644 --- a/src/game/level.c +++ b/src/game/level.c @@ -15,32 +15,32 @@ #include -static void __cdecl Level_LoadTexturePages(VFILE *file); -static void __cdecl Level_LoadRooms(VFILE *file); -static void __cdecl Level_LoadMeshBase(VFILE *file); -static void __cdecl Level_LoadMeshes(VFILE *file); -static int32_t __cdecl Level_LoadAnims(VFILE *file, int32_t **frame_pointers); -static void __cdecl Level_LoadAnimChanges(VFILE *file); -static void __cdecl Level_LoadAnimCommands(VFILE *file); -static void __cdecl Level_LoadAnimBones(VFILE *file); -static void __cdecl Level_LoadAnimFrames(VFILE *file); -static void __cdecl Level_LoadObjects(VFILE *file); -static void __cdecl Level_LoadStaticObjects(VFILE *file); -static void __cdecl Level_LoadTextures(VFILE *file); -static void __cdecl Level_LoadSprites(VFILE *file); -static void __cdecl Level_LoadItems(VFILE *file); -static void __cdecl Level_LoadDepthQ(VFILE *file); -static void __cdecl Level_LoadPalettes(VFILE *file); -static void __cdecl Level_LoadCameras(VFILE *file); -static void __cdecl Level_LoadSoundEffects(VFILE *file); -static void __cdecl Level_LoadBoxes(VFILE *file); -static void __cdecl Level_LoadAnimatedTextures(VFILE *file); -static void __cdecl Level_LoadCinematic(VFILE *file); -static void __cdecl Level_LoadDemo(VFILE *file); -static void __cdecl Level_LoadDemoExternal(const char *level_name); -static void __cdecl Level_LoadSamples(VFILE *file); - -static void __cdecl Level_LoadTexturePages(VFILE *const file) +static void __cdecl M_LoadTexturePages(VFILE *file); +static void __cdecl M_LoadRooms(VFILE *file); +static void __cdecl M_LoadMeshBase(VFILE *file); +static void __cdecl M_LoadMeshes(VFILE *file); +static int32_t __cdecl M_LoadAnims(VFILE *file, int32_t **frame_pointers); +static void __cdecl M_LoadAnimChanges(VFILE *file); +static void __cdecl M_LoadAnimCommands(VFILE *file); +static void __cdecl M_LoadAnimBones(VFILE *file); +static void __cdecl M_LoadAnimFrames(VFILE *file); +static void __cdecl M_LoadObjects(VFILE *file); +static void __cdecl M_LoadStaticObjects(VFILE *file); +static void __cdecl M_LoadTextures(VFILE *file); +static void __cdecl M_LoadSprites(VFILE *file); +static void __cdecl M_LoadItems(VFILE *file); +static void __cdecl M_LoadDepthQ(VFILE *file); +static void __cdecl M_LoadPalettes(VFILE *file); +static void __cdecl M_LoadCameras(VFILE *file); +static void __cdecl M_LoadSoundEffects(VFILE *file); +static void __cdecl M_LoadBoxes(VFILE *file); +static void __cdecl M_LoadAnimatedTextures(VFILE *file); +static void __cdecl M_LoadCinematic(VFILE *file); +static void __cdecl M_LoadDemo(VFILE *file); +static void __cdecl M_LoadDemoExternal(const char *level_name); +static void __cdecl M_LoadSamples(VFILE *file); + +static void __cdecl M_LoadTexturePages(VFILE *const file) { BENCHMARK *const benchmark = Benchmark_Start(); char *base = NULL; @@ -94,7 +94,7 @@ static void __cdecl Level_LoadTexturePages(VFILE *const file) Benchmark_End(benchmark, NULL); } -static void __cdecl Level_LoadRooms(VFILE *const file) +static void __cdecl M_LoadRooms(VFILE *const file) { BENCHMARK *const benchmark = Benchmark_Start(); @@ -209,7 +209,7 @@ static void __cdecl Level_LoadRooms(VFILE *const file) Benchmark_End(benchmark, NULL); } -static void __cdecl Level_LoadMeshBase(VFILE *const file) +static void __cdecl M_LoadMeshBase(VFILE *const file) { BENCHMARK *const benchmark = Benchmark_Start(); const int32_t num_meshes = VFile_ReadS32(file); @@ -219,7 +219,7 @@ static void __cdecl Level_LoadMeshBase(VFILE *const file) Benchmark_End(benchmark, NULL); } -static void __cdecl Level_LoadMeshes(VFILE *const file) +static void __cdecl M_LoadMeshes(VFILE *const file) { BENCHMARK *const benchmark = Benchmark_Start(); const int32_t num_mesh_ptrs = VFile_ReadS32(file); @@ -238,8 +238,7 @@ static void __cdecl Level_LoadMeshes(VFILE *const file) Benchmark_End(benchmark, NULL); } -static int32_t __cdecl Level_LoadAnims( - VFILE *const file, int32_t **frame_pointers) +static int32_t __cdecl M_LoadAnims(VFILE *const file, int32_t **frame_pointers) { BENCHMARK *const benchmark = Benchmark_Start(); const int32_t num_anims = VFile_ReadS32(file); @@ -273,7 +272,7 @@ static int32_t __cdecl Level_LoadAnims( return num_anims; } -static void __cdecl Level_LoadAnimChanges(VFILE *const file) +static void __cdecl M_LoadAnimChanges(VFILE *const file) { BENCHMARK *const benchmark = Benchmark_Start(); const int32_t num_anim_changes = VFile_ReadS32(file); @@ -306,7 +305,7 @@ static void __cdecl Level_LoadAnimRanges(VFILE *const file) Benchmark_End(benchmark, NULL); } -static void __cdecl Level_LoadAnimCommands(VFILE *const file) +static void __cdecl M_LoadAnimCommands(VFILE *const file) { BENCHMARK *const benchmark = Benchmark_Start(); const int32_t num_anim_commands = VFile_ReadS32(file); @@ -317,7 +316,7 @@ static void __cdecl Level_LoadAnimCommands(VFILE *const file) Benchmark_End(benchmark, NULL); } -static void __cdecl Level_LoadAnimBones(VFILE *const file) +static void __cdecl M_LoadAnimBones(VFILE *const file) { BENCHMARK *const benchmark = Benchmark_Start(); const int32_t num_anim_bones = VFile_ReadS32(file); @@ -328,7 +327,7 @@ static void __cdecl Level_LoadAnimBones(VFILE *const file) Benchmark_End(benchmark, NULL); } -static void __cdecl Level_LoadAnimFrames(VFILE *const file) +static void __cdecl M_LoadAnimFrames(VFILE *const file) { BENCHMARK *const benchmark = Benchmark_Start(); const int32_t anim_frame_data_size = VFile_ReadS32(file); @@ -341,7 +340,7 @@ static void __cdecl Level_LoadAnimFrames(VFILE *const file) Benchmark_End(benchmark, NULL); } -static void __cdecl Level_LoadObjects(VFILE *const file) +static void __cdecl M_LoadObjects(VFILE *const file) { BENCHMARK *const benchmark = Benchmark_Start(); const int32_t num_objects = VFile_ReadS32(file); @@ -360,7 +359,7 @@ static void __cdecl Level_LoadObjects(VFILE *const file) Benchmark_End(benchmark, NULL); } -static void __cdecl Level_LoadStaticObjects(VFILE *const file) +static void __cdecl M_LoadStaticObjects(VFILE *const file) { BENCHMARK *const benchmark = Benchmark_Start(); const int32_t num_static_objects = VFile_ReadS32(file); @@ -386,7 +385,7 @@ static void __cdecl Level_LoadStaticObjects(VFILE *const file) Benchmark_End(benchmark, NULL); } -static void __cdecl Level_LoadTextures(VFILE *const file) +static void __cdecl M_LoadTextures(VFILE *const file) { BENCHMARK *const benchmark = Benchmark_Start(); const int32_t num_textures = VFile_ReadS32(file); @@ -425,7 +424,7 @@ static void __cdecl Level_LoadTextures(VFILE *const file) Benchmark_End(benchmark, NULL); } -static void __cdecl Level_LoadSprites(VFILE *const file) +static void __cdecl M_LoadSprites(VFILE *const file) { BENCHMARK *const benchmark = Benchmark_Start(); const int32_t num_sprites = VFile_ReadS32(file); @@ -462,7 +461,7 @@ static void __cdecl Level_LoadSprites(VFILE *const file) Benchmark_End(benchmark, NULL); } -static void __cdecl Level_LoadItems(VFILE *const file) +static void __cdecl M_LoadItems(VFILE *const file) { BENCHMARK *const benchmark = Benchmark_Start(); @@ -505,7 +504,7 @@ static void __cdecl Level_LoadItems(VFILE *const file) Benchmark_End(benchmark, NULL); } -static void __cdecl Level_LoadDepthQ(VFILE *const file) +static void __cdecl M_LoadDepthQ(VFILE *const file) { BENCHMARK *const benchmark = Benchmark_Start(); for (int32_t i = 0; i < 32; i++) { @@ -550,7 +549,7 @@ static void __cdecl Level_LoadDepthQ(VFILE *const file) Benchmark_End(benchmark, NULL); } -static void __cdecl Level_LoadPalettes(VFILE *const file) +static void __cdecl M_LoadPalettes(VFILE *const file) { BENCHMARK *const benchmark = Benchmark_Start(); VFile_Read(file, g_GamePalette8, sizeof(RGB_888) * 256); @@ -570,7 +569,7 @@ static void __cdecl Level_LoadPalettes(VFILE *const file) Benchmark_End(benchmark, NULL); } -static void __cdecl Level_LoadCameras(VFILE *const file) +static void __cdecl M_LoadCameras(VFILE *const file) { BENCHMARK *const benchmark = Benchmark_Start(); g_NumCameras = VFile_ReadS32(file); @@ -594,7 +593,7 @@ static void __cdecl Level_LoadCameras(VFILE *const file) Benchmark_End(benchmark, NULL); } -static void __cdecl Level_LoadSoundEffects(VFILE *const file) +static void __cdecl M_LoadSoundEffects(VFILE *const file) { BENCHMARK *const benchmark = Benchmark_Start(); @@ -619,7 +618,7 @@ static void __cdecl Level_LoadSoundEffects(VFILE *const file) Benchmark_End(benchmark, NULL); } -static void __cdecl Level_LoadBoxes(VFILE *const file) +static void __cdecl M_LoadBoxes(VFILE *const file) { BENCHMARK *const benchmark = Benchmark_Start(); g_BoxCount = VFile_ReadS32(file); @@ -663,7 +662,7 @@ static void __cdecl Level_LoadBoxes(VFILE *const file) Benchmark_End(benchmark, NULL); } -static void __cdecl Level_LoadAnimatedTextures(VFILE *const file) +static void __cdecl M_LoadAnimatedTextures(VFILE *const file) { BENCHMARK *const benchmark = Benchmark_Start(); const int32_t num_ranges = VFile_ReadS32(file); @@ -673,7 +672,7 @@ static void __cdecl Level_LoadAnimatedTextures(VFILE *const file) Benchmark_End(benchmark, NULL); } -static void __cdecl Level_LoadCinematic(VFILE *const file) +static void __cdecl M_LoadCinematic(VFILE *const file) { BENCHMARK *const benchmark = Benchmark_Start(); g_NumCineFrames = VFile_ReadS16(file); @@ -701,7 +700,7 @@ static void __cdecl Level_LoadCinematic(VFILE *const file) Benchmark_End(benchmark, NULL); } -static void __cdecl Level_LoadDemo(VFILE *const file) +static void __cdecl M_LoadDemo(VFILE *const file) { BENCHMARK *const benchmark = Benchmark_Start(); g_DemoCount = 0; @@ -722,7 +721,7 @@ static void __cdecl Level_LoadDemo(VFILE *const file) Benchmark_End(benchmark, NULL); } -static void __cdecl Level_LoadDemoExternal(const char *const level_name) +static void __cdecl M_LoadDemoExternal(const char *const level_name) { BENCHMARK *const benchmark = Benchmark_Start(); char file_name[MAX_PATH]; @@ -744,7 +743,7 @@ static void __cdecl Level_LoadDemoExternal(const char *const level_name) Benchmark_End(benchmark, NULL); } -static void __cdecl Level_LoadSamples(VFILE *const file) +static void __cdecl M_LoadSamples(VFILE *const file) { BENCHMARK *const benchmark = Benchmark_Start(); int32_t *sample_offsets = NULL; @@ -867,24 +866,24 @@ bool __cdecl Level_Load(const char *const file_name, const int32_t level_num) } g_LevelFilePalettesOffset = VFile_GetPos(file); - Level_LoadPalettes(file); + M_LoadPalettes(file); g_LevelFileTexPagesOffset = VFile_GetPos(file); - Level_LoadTexturePages(file); + M_LoadTexturePages(file); VFile_Skip(file, 4); - Level_LoadRooms(file); + M_LoadRooms(file); - Level_LoadMeshBase(file); - Level_LoadMeshes(file); + M_LoadMeshBase(file); + M_LoadMeshes(file); int32_t *frame_pointers = NULL; - const int32_t num_anims = Level_LoadAnims(file, &frame_pointers); - Level_LoadAnimChanges(file); + const int32_t num_anims = M_LoadAnims(file, &frame_pointers); + M_LoadAnimChanges(file); Level_LoadAnimRanges(file); - Level_LoadAnimCommands(file); - Level_LoadAnimBones(file); - Level_LoadAnimFrames(file); + M_LoadAnimCommands(file); + M_LoadAnimBones(file); + M_LoadAnimFrames(file); for (int32_t i = 0; i < num_anims; i++) { ANIM_STRUCT *const anim = &g_Anims[i]; @@ -893,25 +892,25 @@ bool __cdecl Level_Load(const char *const file_name, const int32_t level_num) } Memory_FreePointer(&frame_pointers); - Level_LoadObjects(file); + M_LoadObjects(file); InitialiseObjects(); - Level_LoadStaticObjects(file); - Level_LoadTextures(file); + M_LoadStaticObjects(file); + M_LoadTextures(file); - Level_LoadSprites(file); - Level_LoadCameras(file); - Level_LoadSoundEffects(file); - Level_LoadBoxes(file); - Level_LoadAnimatedTextures(file); - Level_LoadItems(file); + M_LoadSprites(file); + M_LoadCameras(file); + M_LoadSoundEffects(file); + M_LoadBoxes(file); + M_LoadAnimatedTextures(file); + M_LoadItems(file); g_LevelFileDepthQOffset = VFile_GetPos(file); - Level_LoadDepthQ(file); - Level_LoadCinematic(file); - Level_LoadDemo(file); - Level_LoadSamples(file); + M_LoadDepthQ(file); + M_LoadCinematic(file); + M_LoadDemo(file); + M_LoadSamples(file); - Level_LoadDemoExternal(full_path); + M_LoadDemoExternal(full_path); VFile_Close(file); file = NULL; diff --git a/src/game/music/music_backend_cdaudio.c b/src/game/music/music_backend_cdaudio.c index 91d5b9c7..038f5458 100644 --- a/src/game/music/music_backend_cdaudio.c +++ b/src/game/music/music_backend_cdaudio.c @@ -24,14 +24,12 @@ typedef struct { CDAUDIO_TRACK *tracks; } BACKEND_DATA; -static bool Music_Backend_CDAudio_Parse(BACKEND_DATA *const data); -static bool Music_Backend_CDAudio_Init(MUSIC_BACKEND *const backend); -static const char *Music_Backend_CDAudio_Describe( - const MUSIC_BACKEND *const backend); -static int32_t Music_Backend_CDAudio_Play( - const MUSIC_BACKEND *const backend, int32_t track_id); - -static bool Music_Backend_CDAudio_Parse(BACKEND_DATA *const data) +static bool M_Parse(BACKEND_DATA *data); +static bool M_Init(MUSIC_BACKEND *backend); +static const char *M_Describe(const MUSIC_BACKEND *backend); +static int32_t M_Play(const MUSIC_BACKEND *backend, int32_t track_id); + +static bool M_Parse(BACKEND_DATA *const data) { assert(data != NULL); @@ -105,7 +103,7 @@ static bool Music_Backend_CDAudio_Parse(BACKEND_DATA *const data) return true; } -static bool Music_Backend_CDAudio_Init(MUSIC_BACKEND *const backend) +static bool M_Init(MUSIC_BACKEND *const backend) { assert(backend != NULL); BACKEND_DATA *data = backend->data; @@ -116,7 +114,7 @@ static bool Music_Backend_CDAudio_Init(MUSIC_BACKEND *const backend) return false; } - if (!Music_Backend_CDAudio_Parse(data)) { + if (!M_Parse(data)) { LOG_ERROR("Failed to parse CDAudio data"); return false; } @@ -124,8 +122,7 @@ static bool Music_Backend_CDAudio_Init(MUSIC_BACKEND *const backend) return true; } -static const char *Music_Backend_CDAudio_Describe( - const MUSIC_BACKEND *const backend) +static const char *M_Describe(const MUSIC_BACKEND *const backend) { assert(backend != NULL); const BACKEND_DATA *const data = backend->data; @@ -133,8 +130,8 @@ static const char *Music_Backend_CDAudio_Describe( return data->description; } -static int32_t Music_Backend_CDAudio_Play( - const MUSIC_BACKEND *const backend, int32_t track_id) +static int32_t M_Play( + const MUSIC_BACKEND *const backend, const int32_t track_id) { assert(backend != NULL); const BACKEND_DATA *const data = backend->data; @@ -174,9 +171,9 @@ MUSIC_BACKEND *Music_Backend_CDAudio_Factory(const char *path) MUSIC_BACKEND *backend = Memory_Alloc(sizeof(MUSIC_BACKEND)); backend->data = data; - backend->init = Music_Backend_CDAudio_Init; - backend->describe = Music_Backend_CDAudio_Describe; - backend->play = Music_Backend_CDAudio_Play; + backend->init = M_Init; + backend->describe = M_Describe; + backend->play = M_Play; return backend; } diff --git a/src/game/music/music_backend_files.c b/src/game/music/music_backend_files.c index 07d2ede2..636b7687 100644 --- a/src/game/music/music_backend_files.c +++ b/src/game/music/music_backend_files.c @@ -16,15 +16,12 @@ typedef struct { static const char *m_ExtensionsToTry[] = { ".flac", ".ogg", ".mp3", ".wav", NULL }; -static char *Music_Backend_Files_GetTrackFileName( - const char *base_dir, int32_t track); +static char *M_GetTrackFileName(const char *base_dir, int32_t track); +static const char *M_Describe(const MUSIC_BACKEND *backend); +static bool M_Init(MUSIC_BACKEND *backend); +static int32_t M_Play(const MUSIC_BACKEND *backend, int32_t track_id); -static bool Music_Backend_Files_Init(MUSIC_BACKEND *const backend); -static int32_t Music_Backend_Files_Play( - const MUSIC_BACKEND *const backend, int32_t track_id); - -static char *Music_Backend_Files_GetTrackFileName( - const char *base_dir, int32_t track) +static char *M_GetTrackFileName(const char *base_dir, int32_t track) { char file_path[64]; sprintf(file_path, "%s/track%02d.flac", base_dir, track); @@ -37,7 +34,7 @@ static char *Music_Backend_Files_GetTrackFileName( return result; } -static bool Music_Backend_Files_Init(MUSIC_BACKEND *const backend) +static bool M_Init(MUSIC_BACKEND *const backend) { assert(backend != NULL); const BACKEND_DATA *data = backend->data; @@ -45,8 +42,7 @@ static bool Music_Backend_Files_Init(MUSIC_BACKEND *const backend) return File_DirExists(data->dir); } -static const char *Music_Backend_Files_Describe( - const MUSIC_BACKEND *const backend) +static const char *M_Describe(const MUSIC_BACKEND *const backend) { assert(backend != NULL); const BACKEND_DATA *const data = backend->data; @@ -54,14 +50,14 @@ static const char *Music_Backend_Files_Describe( return data->description; } -static int32_t Music_Backend_Files_Play( - const MUSIC_BACKEND *const backend, int32_t track_id) +static int32_t M_Play( + const MUSIC_BACKEND *const backend, const int32_t track_id) { assert(backend != NULL); const BACKEND_DATA *const data = backend->data; assert(data != NULL); - char *file_path = Music_Backend_Files_GetTrackFileName(data->dir, track_id); + char *file_path = M_GetTrackFileName(data->dir, track_id); if (file_path == NULL) { LOG_ERROR("Invalid track: %d", track_id); return -1; @@ -85,9 +81,9 @@ MUSIC_BACKEND *Music_Backend_Files_Factory(const char *path) MUSIC_BACKEND *backend = Memory_Alloc(sizeof(MUSIC_BACKEND)); backend->data = data; - backend->init = Music_Backend_Files_Init; - backend->describe = Music_Backend_Files_Describe; - backend->play = Music_Backend_Files_Play; + backend->init = M_Init; + backend->describe = M_Describe; + backend->play = M_Play; return backend; } diff --git a/src/game/music/music_main.c b/src/game/music/music_main.c index b806a1d1..405fb110 100644 --- a/src/game/music/music_main.c +++ b/src/game/music/music_main.c @@ -21,10 +21,10 @@ static float m_MusicVolume = 0.0f; static int32_t m_AudioStreamID = -1; static const MUSIC_BACKEND *m_Backend = NULL; -static const MUSIC_BACKEND *Music_FindBackend(void); -static void Music_StreamFinished(int32_t stream_id, void *user_data); +static const MUSIC_BACKEND *M_FindBackend(void); +static void M_StreamFinished(int32_t stream_id, void *user_data); -static const MUSIC_BACKEND *Music_FindBackend(void) +static const MUSIC_BACKEND *M_FindBackend(void) { MUSIC_BACKEND *all_backends[] = { Music_Backend_Files_Factory("music"), @@ -47,7 +47,7 @@ static const MUSIC_BACKEND *Music_FindBackend(void) return NULL; } -static void Music_StreamFinished(const int32_t stream_id, void *const user_data) +static void M_StreamFinished(const int32_t stream_id, void *const user_data) { // When a stream finishes, play the remembered background BGM. if (stream_id == m_AudioStreamID) { @@ -67,7 +67,7 @@ bool __cdecl Music_Init(void) return true; } - m_Backend = Music_FindBackend(); + m_Backend = M_FindBackend(); if (m_Backend == NULL) { LOG_ERROR("No music backend is available"); goto finish; @@ -90,7 +90,7 @@ void __cdecl Music_Shutdown(void) return; } - // We are only interested in calling Music_StreamFinished if a stream + // We are only interested in calling M_StreamFinished if a stream // finished by itself. In cases where we end the streams early by hand, // we clear the finish callback in order to avoid resuming the BGM playback // just after we stop it. @@ -132,7 +132,7 @@ void __cdecl Music_Play(int16_t track_id, bool is_looped) Audio_Stream_SetIsLooped(m_AudioStreamID, is_looped); Audio_Stream_SetVolume(m_AudioStreamID, m_MusicVolume); - Audio_Stream_SetFinishCallback(m_AudioStreamID, Music_StreamFinished, NULL); + Audio_Stream_SetFinishCallback(m_AudioStreamID, M_StreamFinished, NULL); finish: g_CD_TrackID = track_id; diff --git a/src/game/objects/general/final_level_counter.c b/src/game/objects/general/final_level_counter.c index 428824dd..ef977ab0 100644 --- a/src/game/objects/general/final_level_counter.c +++ b/src/game/objects/general/final_level_counter.c @@ -10,11 +10,11 @@ #define CUTSCENE_DELAY (5 * FRAMES_PER_SECOND) // = 150 -static int16_t __cdecl FinalLevelCounter_FindBestBoss(void); -static void __cdecl FinalLevelCounter_ActivateLastBoss(void); -static void __cdecl FinalLevelCounter_PrepareCutscene(int16_t item_num); +static int16_t __cdecl M_FindBestBoss(void); +static void __cdecl M_ActivateLastBoss(void); +static void __cdecl M_PrepareCutscene(int16_t item_num); -static int16_t __cdecl FinalLevelCounter_FindBestBoss(void) +static int16_t __cdecl M_FindBestBoss(void) { int32_t best_dist = 0; int16_t best_item = g_FinalBossItem[0]; @@ -48,9 +48,9 @@ static int16_t __cdecl FinalLevelCounter_FindBestBoss(void) return best_item; } -static void __cdecl FinalLevelCounter_ActivateLastBoss(void) +static void __cdecl M_ActivateLastBoss(void) { - const int16_t item_num = FinalLevelCounter_FindBestBoss(); + const int16_t item_num = M_FindBestBoss(); ITEM_INFO *const item = &g_Items[item_num]; item->touch_bits = 0; item->status = IS_ACTIVE; @@ -60,7 +60,7 @@ static void __cdecl FinalLevelCounter_ActivateLastBoss(void) g_FinalBossActive = 1; } -static void __cdecl FinalLevelCounter_PrepareCutscene(const int16_t item_num) +static void __cdecl M_PrepareCutscene(const int16_t item_num) { ITEM_INFO *const item = &g_Items[item_num]; Creature_Kill(item, 0, 0, LA_EXTRA_FINAL_ANIM); @@ -77,14 +77,14 @@ void __cdecl FinalLevelCounter_Control(const int16_t item_num) { if (g_SaveGame.statistics.kills == g_FinalLevelCount && !g_FinalBossActive) { - FinalLevelCounter_ActivateLastBoss(); + M_ActivateLastBoss(); return; } if (g_SaveGame.statistics.kills > g_FinalLevelCount) { g_FinalBossActive++; if (g_FinalBossActive == CUTSCENE_DELAY) { - FinalLevelCounter_PrepareCutscene(item_num); + M_PrepareCutscene(item_num); } } } diff --git a/src/game/objects/names.c b/src/game/objects/names.c index 1d23c0c1..e2b54828 100644 --- a/src/game/objects/names.c +++ b/src/game/objects/names.c @@ -60,13 +60,12 @@ ENUM_STRING_MAP ENUM_STRING_MAP(GAME_OBJECT_ID)[] = { { NULL, -1 } }; -static int32_t Object_NameMatch(const char *user_input, const char *name); -static void Object_TryMatch( +static int32_t M_NameMatch(const char *user_input, const char *name); +static void M_TryMatch( VECTOR *matches, const char *user_input, const char *name, GAME_OBJECT_ID object_id); -static int32_t Object_NameMatch( - const char *const user_input, const char *const name) +static int32_t M_NameMatch(const char *const user_input, const char *const name) { int32_t score; @@ -88,11 +87,11 @@ static int32_t Object_NameMatch( return score; } -static void Object_TryMatch( +static void M_TryMatch( VECTOR *const matches, const char *const user_input, const char *const name, const GAME_OBJECT_ID object_id) { - int32_t score = Object_NameMatch(user_input, name); + int32_t score = M_NameMatch(user_input, name); if (!g_Objects[object_id].loaded) { score -= GOOD_MATCH_THRESHOLD; } @@ -153,7 +152,7 @@ GAME_OBJECT_ID *Object_IdsFromName( if (filter != NULL && !filter(object_id)) { continue; } - Object_TryMatch(matches, user_input, item->string, object_id); + M_TryMatch(matches, user_input, item->string, object_id); } // Store matches from hardcoded strings @@ -161,8 +160,7 @@ GAME_OBJECT_ID *Object_IdsFromName( if (filter != NULL && !filter(object_id)) { continue; } - Object_TryMatch( - matches, user_input, Object_GetName(object_id), object_id); + M_TryMatch(matches, user_input, Object_GetName(object_id), object_id); } // If we got a perfect match, discard poor matches diff --git a/src/game/option/option_detail.c b/src/game/option/option_detail.c index 9f5c3792..8803c87b 100644 --- a/src/game/option/option_detail.c +++ b/src/game/option/option_detail.c @@ -4,10 +4,10 @@ #include "global/funcs.h" #include "global/vars.h" -static void Option_Detail_InitText(void); -static void Option_Detail_ShutdownText(void); +static void M_InitText(void); +static void M_ShutdownText(void); -static void Option_Detail_InitText(void) +static void M_InitText(void) { g_DetailText[0] = Text_Create(0, 50, 0, g_GF_GameStrings[GF_S_GAME_DETAIL_LOW]); @@ -31,7 +31,7 @@ static void Option_Detail_InitText(void) } } -static void Option_Detail_ShutdownText(void) +static void M_ShutdownText(void) { for (int32_t i = 0; i < 5; i++) { Text_Remove(g_DetailText[i]); @@ -42,7 +42,7 @@ static void Option_Detail_ShutdownText(void) void __cdecl Option_Detail(INVENTORY_ITEM *const item) { if (g_DetailText[0] == NULL) { - Option_Detail_InitText(); + M_InitText(); } if ((g_InputDB & IN_BACK) && g_DetailLevel > 0) { @@ -75,11 +75,11 @@ void __cdecl Option_Detail(INVENTORY_ITEM *const item) } if (g_InputDB & (IN_SELECT | IN_DESELECT)) { - Option_Detail_ShutdownText(); + M_ShutdownText(); } } void Option_Detail_Shutdown(void) { - Option_Detail_ShutdownText(); + M_ShutdownText(); } diff --git a/src/game/option/option_sound.c b/src/game/option/option_sound.c index 1ca0e353..9b9a7af2 100644 --- a/src/game/option/option_sound.c +++ b/src/game/option/option_sound.c @@ -10,10 +10,10 @@ #include -static void Option_Sound_InitText(void); -static void Option_Sound_ShutdownText(void); +static void M_InitText(void); +static void M_ShutdownText(void); -static void Option_Sound_InitText(void) +static void M_InitText(void) { CLAMPG(g_OptionMusicVolume, 10); CLAMPG(g_OptionSoundVolume, 10); @@ -43,7 +43,7 @@ static void Option_Sound_InitText(void) } } -static void Option_Sound_ShutdownText(void) +static void M_ShutdownText(void) { for (int32_t i = 0; i < 4; i++) { Text_Remove(g_SoundText[i]); @@ -53,7 +53,7 @@ static void Option_Sound_ShutdownText(void) void Option_Sound_Shutdown(void) { - Option_Sound_ShutdownText(); + M_ShutdownText(); } void __cdecl Option_Sound(INVENTORY_ITEM *const item) @@ -61,7 +61,7 @@ void __cdecl Option_Sound(INVENTORY_ITEM *const item) char text[8]; if (g_SoundText[0] == NULL) { - Option_Sound_InitText(); + M_InitText(); } if ((g_InputDB & IN_FORWARD) && g_SoundOptionLine > 0) { diff --git a/src/game/sound.c b/src/game/sound.c index cf2185c6..55798231 100644 --- a/src/game/sound.c +++ b/src/game/sound.c @@ -53,28 +53,28 @@ typedef enum { #define DECIBEL_LUT_SIZE 512 -static int32_t Sound_ConvertVolumeToDecibel(int32_t volume); -static int32_t Sound_ConvertPanToDecibel(uint16_t pan); -static float Sound_ConvertPitch(float pitch); -static int32_t Sound_Play( - int32_t track_id, int32_t volume, float pitch, int32_t pan, bool is_looped); - -static void Sound_Slot_Clear(SOUND_SLOT *const slot); -static void Sound_Slot_ClearAll(void); -static void Sound_Slot_Close(SOUND_SLOT *const slot); -static void Sound_Slot_Update(SOUND_SLOT *const slot); - static int32_t m_DecibelLUT[DECIBEL_LUT_SIZE] = { 0 }; static SOUND_SLOT m_SoundSlots[SOUND_MAX_SLOTS] = { 0 }; -static int32_t Sound_ConvertVolumeToDecibel(const int32_t volume) +static int32_t M_ConvertVolumeToDecibel(int32_t volume); +static int32_t M_ConvertPanToDecibel(uint16_t pan); +static float M_ConvertPitch(float pitch); +static int32_t M_Play( + int32_t track_id, int32_t volume, float pitch, int32_t pan, bool is_looped); + +static void M_ClearSlot(SOUND_SLOT *const slot); +static void M_ClearAllSlots(void); +static void M_CloseSlot(SOUND_SLOT *const slot); +static void M_UpdateSlot(SOUND_SLOT *const slot); + +static int32_t M_ConvertVolumeToDecibel(const int32_t volume) { const double adjusted_volume = g_MasterVolume * volume; const double scaler = 0x1.p-21; // 2.0e-21 return (adjusted_volume * scaler - 1.0) * 5000.0; } -static int32_t Sound_ConvertPanToDecibel(const uint16_t pan) +static int32_t M_ConvertPanToDecibel(const uint16_t pan) { const int32_t result = sin((pan / 32767.0) * M_PI) * (DECIBEL_LUT_SIZE / 2); if (result > 0) { @@ -86,47 +86,47 @@ static int32_t Sound_ConvertPanToDecibel(const uint16_t pan) } } -static float Sound_ConvertPitch(const float pitch) +static float M_ConvertPitch(const float pitch) { return pitch / 0x10000.p0; } -static int32_t Sound_Play( +static int32_t M_Play( const int32_t sample_num, const int32_t volume, const float pitch, const int32_t pan, const bool is_looped) { const int32_t handle = Audio_Sample_Play( - sample_num, Sound_ConvertVolumeToDecibel(volume), - Sound_ConvertPitch(pitch), Sound_ConvertPanToDecibel(pan), is_looped); + sample_num, M_ConvertVolumeToDecibel(volume), M_ConvertPitch(pitch), + M_ConvertPanToDecibel(pan), is_looped); return handle; } -static void Sound_Slot_ClearAll(void) +static void M_ClearAllSlots(void) { for (int32_t i = 0; i < SOUND_MAX_SLOTS; i++) { SOUND_SLOT *const slot = &m_SoundSlots[i]; - Sound_Slot_Clear(slot); + M_ClearSlot(slot); } } -static void Sound_Slot_Clear(SOUND_SLOT *const slot) +static void M_ClearSlot(SOUND_SLOT *const slot) { slot->sample_num = -1; slot->handle = AUDIO_NO_SOUND; } -static void Sound_Slot_Close(SOUND_SLOT *const slot) +static void M_CloseSlot(SOUND_SLOT *const slot) { Audio_Sample_Close(slot->handle); - Sound_Slot_Clear(slot); + M_ClearSlot(slot); } -static void Sound_Slot_Update(SOUND_SLOT *const slot) +static void M_UpdateSlot(SOUND_SLOT *const slot) { - Audio_Sample_SetPan(slot->handle, Sound_ConvertPanToDecibel(slot->pan)); - Audio_Sample_SetPitch(slot->handle, Sound_ConvertPitch(slot->pitch)); + Audio_Sample_SetPan(slot->handle, M_ConvertPanToDecibel(slot->pan)); + Audio_Sample_SetPitch(slot->handle, M_ConvertPitch(slot->pitch)); Audio_Sample_SetVolume( - slot->handle, Sound_ConvertVolumeToDecibel(slot->volume)); + slot->handle, M_ConvertVolumeToDecibel(slot->volume)); } void __cdecl Sound_Init(void) @@ -142,7 +142,7 @@ void __cdecl Sound_Init(void) } Sound_SetMasterVolume(32); - Sound_Slot_ClearAll(); + M_ClearAllSlots(); g_SoundIsActive = true; } @@ -153,7 +153,7 @@ void __cdecl Sound_Shutdown(void) } Audio_Shutdown(); - Sound_Slot_ClearAll(); + M_ClearAllSlots(); } void __cdecl Sound_SetMasterVolume(int32_t volume) @@ -270,7 +270,7 @@ void __cdecl Sound_Effect( if (Audio_Sample_IsPlaying(i)) { return; } - Sound_Slot_Clear(slot); + M_ClearSlot(slot); } } break; @@ -279,7 +279,7 @@ void __cdecl Sound_Effect( for (int32_t i = 0; i < SOUND_MAX_SLOTS; i++) { SOUND_SLOT *const slot = &m_SoundSlots[i]; if (slot->sample_num == sample_num) { - Sound_Slot_Close(slot); + M_CloseSlot(slot); break; } } @@ -301,7 +301,7 @@ void __cdecl Sound_Effect( } const bool is_looped = mode == SOUND_MODE_LOOPED; - int32_t handle = Sound_Play(track_id, volume, pitch, pan, is_looped); + int32_t handle = M_Play(track_id, volume, pitch, pan, is_looped); if (handle == AUDIO_NO_SOUND) { int32_t min_volume = 0x8000; @@ -316,8 +316,8 @@ void __cdecl Sound_Effect( if (min_slot >= 0 && volume >= min_volume) { SOUND_SLOT *const slot = &m_SoundSlots[min_slot]; - Sound_Slot_Close(slot); - handle = Sound_Play(track_id, volume, pitch, pan, is_looped); + M_CloseSlot(slot); + handle = M_Play(track_id, volume, pitch, pan, is_looped); } } @@ -357,7 +357,7 @@ void __cdecl Sound_StopEffect(const int32_t sample_id) SOUND_SLOT *const slot = &m_SoundSlots[i]; if (slot->sample_num >= sample_num && slot->sample_num < sample_num + num_samples) { - Sound_Slot_Close(slot); + M_CloseSlot(slot); } } } @@ -365,7 +365,7 @@ void __cdecl Sound_StopEffect(const int32_t sample_id) void __cdecl Sound_StopAllSamples(void) { Audio_Sample_CloseAll(); - Sound_Slot_ClearAll(); + M_ClearAllSlots(); } void __cdecl Sound_EndScene(void) @@ -383,13 +383,13 @@ void __cdecl Sound_EndScene(void) if ((s->flags & SOUND_MODE_MASK) == SOUND_MODE_LOOPED) { if (slot->volume == 0) { - Sound_Slot_Close(slot); + M_CloseSlot(slot); } else { - Sound_Slot_Update(slot); + M_UpdateSlot(slot); slot->volume = 0; } } else if (!Audio_Sample_IsPlaying(slot->handle)) { - Sound_Slot_Clear(slot); + M_ClearSlot(slot); } } } diff --git a/src/game/ui/controls_dialog.c b/src/game/ui/controls_dialog.c index e31fd0da..0d78e4a5 100644 --- a/src/game/ui/controls_dialog.c +++ b/src/game/ui/controls_dialog.c @@ -18,30 +18,29 @@ typedef struct { UI_WIDGET *right_column; } UI_CONTROLS_DIALOG; -static int32_t UI_ControlsDialog_GetWidth(const UI_CONTROLS_DIALOG *self); -static int32_t UI_ControlsDialog_GetHeight(const UI_CONTROLS_DIALOG *self); -static void UI_ControlsDialog_SetPosition( - UI_CONTROLS_DIALOG *self, int32_t x, int32_t y); -static void UI_ControlsDialog_Control(UI_CONTROLS_DIALOG *self); -static void UI_ControlsDialog_Free(UI_CONTROLS_DIALOG *self); - -static int32_t UI_ControlsDialog_GetWidth(const UI_CONTROLS_DIALOG *const self) +static int32_t M_GetWidth(const UI_CONTROLS_DIALOG *self); +static int32_t M_GetHeight(const UI_CONTROLS_DIALOG *self); +static void M_SetPosition(UI_CONTROLS_DIALOG *self, int32_t x, int32_t y); +static void M_Control(UI_CONTROLS_DIALOG *self); +static void M_Free(UI_CONTROLS_DIALOG *self); + +static int32_t M_GetWidth(const UI_CONTROLS_DIALOG *const self) { return self->window->get_width(self->window); } -static int32_t UI_ControlsDialog_GetHeight(const UI_CONTROLS_DIALOG *const self) +static int32_t M_GetHeight(const UI_CONTROLS_DIALOG *const self) { return self->window->get_height(self->window); } -static void UI_ControlsDialog_SetPosition( +static void M_SetPosition( UI_CONTROLS_DIALOG *const self, const int32_t x, const int32_t y) { return self->window->set_position(self->window, x, y); } -static void UI_ControlsDialog_Control(UI_CONTROLS_DIALOG *const self) +static void M_Control(UI_CONTROLS_DIALOG *const self) { if (UI_ControlsController_Control(self->controller)) { // Trigger the UI updates only if anything has changed. @@ -51,7 +50,7 @@ static void UI_ControlsDialog_Control(UI_CONTROLS_DIALOG *const self) } } -static void UI_ControlsDialog_Free(UI_CONTROLS_DIALOG *const self) +static void M_Free(UI_CONTROLS_DIALOG *const self) { self->left_column->free(self->left_column); self->right_column->free(self->right_column); @@ -66,11 +65,11 @@ UI_WIDGET *UI_ControlsDialog_Create(UI_CONTROLS_CONTROLLER *const controller) { UI_CONTROLS_DIALOG *const self = Memory_Alloc(sizeof(UI_CONTROLS_DIALOG)); self->vtable = (UI_WIDGET_VTABLE) { - .control = (UI_WIDGET_CONTROL)UI_ControlsDialog_Control, - .get_width = (UI_WIDGET_GET_WIDTH)UI_ControlsDialog_GetWidth, - .get_height = (UI_WIDGET_GET_HEIGHT)UI_ControlsDialog_GetHeight, - .set_position = (UI_WIDGET_SET_POSITION)UI_ControlsDialog_SetPosition, - .free = (UI_WIDGET_FREE)UI_ControlsDialog_Free, + .control = (UI_WIDGET_CONTROL)M_Control, + .get_width = (UI_WIDGET_GET_WIDTH)M_GetWidth, + .get_height = (UI_WIDGET_GET_HEIGHT)M_GetHeight, + .set_position = (UI_WIDGET_SET_POSITION)M_SetPosition, + .free = (UI_WIDGET_FREE)M_Free, }; self->controller = controller; diff --git a/src/inject_exec.c b/src/inject_exec.c index aec519ee..3af86d2d 100644 --- a/src/inject_exec.c +++ b/src/inject_exec.c @@ -62,52 +62,52 @@ #include "specific/s_flagged_string.h" #include "specific/s_input.h" -static void Inject_Decomp_General(const bool enable); -static void Inject_Decomp_Stats(const bool enable); -static void Inject_Decomp_Effects(const bool enable); -static void Inject_HWR(bool enable); +static void M_DecompGeneral(const bool enable); +static void M_DecompStats(const bool enable); +static void M_DecompEffects(const bool enable); +static void M_HWR(bool enable); -static void Inject_Camera(bool enable); -static void Inject_Collide(bool enable); -static void Inject_Room(bool enable); -static void Inject_Math(bool enable); -static void Inject_Matrix(bool enable); -static void Inject_Shell(bool enable); -static void Inject_Requester(bool enable); -static void Inject_Option(bool enable); -static void Inject_Text(bool enable); -static void Inject_Input(bool enable); -static void Inject_Output(bool enable); -static void Inject_Music(bool enable); -static void Inject_Sound(bool enable); +static void M_Camera(bool enable); +static void M_Collide(bool enable); +static void M_Room(bool enable); +static void M_Math(bool enable); +static void M_Matrix(bool enable); +static void M_Shell(bool enable); +static void M_Requester(bool enable); +static void M_Option(bool enable); +static void M_Text(bool enable); +static void M_Input(bool enable); +static void M_Output(bool enable); +static void M_Music(bool enable); +static void M_Sound(bool enable); -static void Inject_Demo(bool enable); -static void Inject_Gameflow(bool enable); -static void Inject_Overlay(bool enable); -static void Inject_Random(bool enable); -static void Inject_Items(bool enable); -static void Inject_Effects(bool enable); -static void Inject_LOS(bool enable); -static void Inject_People(bool enable); -static void Inject_Level(bool enable); -static void Inject_Inventory(bool enable); -static void Inject_Lara_Look(bool enable); -static void Inject_Lara_Draw(bool enable); -static void Inject_Lara_Misc(bool enable); -static void Inject_Lara_State(bool enable); -static void Inject_Lara_Col(bool enable); -static void Inject_Gun(bool enable); +static void M_Demo(bool enable); +static void M_Gameflow(bool enable); +static void M_Overlay(bool enable); +static void M_Random(bool enable); +static void M_Items(bool enable); +static void M_Effects(bool enable); +static void M_LOS(bool enable); +static void M_People(bool enable); +static void M_Level(bool enable); +static void M_Inventory(bool enable); +static void M_Lara_Look(bool enable); +static void M_Lara_Draw(bool enable); +static void M_Lara_Misc(bool enable); +static void M_Lara_State(bool enable); +static void M_Lara_Col(bool enable); +static void M_Gun(bool enable); -static void Inject_Creature(bool enable); -static void Inject_Box(bool enable); -static void Inject_Lot(bool enable); -static void Inject_Objects(bool enable); +static void M_Creature(bool enable); +static void M_Box(bool enable); +static void M_Lot(bool enable); +static void M_Objects(bool enable); -static void Inject_S_Audio_Sample(bool enable); -static void Inject_S_Input(bool enable); -static void Inject_S_FlaggedString(bool enable); +static void M_S_Audio_Sample(bool enable); +static void M_S_Input(bool enable); +static void M_S_FlaggedString(bool enable); -static void Inject_Decomp_General(const bool enable) +static void M_DecompGeneral(const bool enable) { INJECT(enable, 0x00411F50, Game_SetCutsceneTrack); INJECT(enable, 0x00411F60, Game_Cutscene_Start); @@ -216,7 +216,7 @@ static void Inject_Decomp_General(const bool enable) INJECT(enable, 0x004550C0, S_SaveSettings); } -static void Inject_Decomp_Stats(const bool enable) +static void M_DecompStats(const bool enable) { INJECT(enable, 0x004262B0, AddAssaultTime); INJECT(enable, 0x00426340, ShowGymStatsText); @@ -226,12 +226,12 @@ static void Inject_Decomp_Stats(const bool enable) INJECT(enable, 0x0044C850, GameStats); } -static void Inject_Decomp_Effects(const bool enable) +static void M_DecompEffects(const bool enable) { INJECT(enable, 0x00433360, Effect_ExplodingDeath); } -static void Inject_HWR(bool enable) +static void M_HWR(bool enable) { INJECT(enable, 0x0044CFE0, HWR_InitState); INJECT(enable, 0x0044D110, HWR_ResetTexSource); @@ -249,7 +249,7 @@ static void Inject_HWR(bool enable) INJECT(enable, 0x0044D5E0, HWR_Init); } -static void Inject_Background(const bool enable) +static void M_Background(const bool enable) { INJECT(enable, 0x00443990, BGND_Make640x480); INJECT(enable, 0x00443B50, BGND_AddTexture); @@ -263,7 +263,7 @@ static void Inject_Background(const bool enable) INJECT(enable, 0x00444510, BGND_Init); } -static void Inject_Camera(const bool enable) +static void M_Camera(const bool enable) { INJECT(enable, 0x004105A0, Camera_Initialise); INJECT(enable, 0x00410650, Camera_Move); @@ -282,13 +282,13 @@ static void Inject_Camera(const bool enable) INJECT(enable, 0x00415100, Camera_RefreshFromTrigger); } -static void Inject_Collide(const bool enable) +static void M_Collide(const bool enable) { INJECT(enable, 0x004128F0, Collide_GetCollisionInfo); INJECT(enable, 0x00412FE0, Collide_CollideStaticObjects); } -static void Inject_Game(const bool enable) +static void M_Game(const bool enable) { INJECT(enable, 0x00414390, Game_Control); INJECT(enable, 0x00418990, Game_Draw); @@ -297,7 +297,7 @@ static void Inject_Game(const bool enable) INJECT(enable, 0x0044C5D0, Game_Loop); } -static void Inject_Room(const bool enable) +static void M_Room(const bool enable) { INJECT(enable, 0x00412FB0, Room_FindGridShift); INJECT(enable, 0x004133D0, Room_GetNearbyRooms); @@ -322,7 +322,7 @@ static void Inject_Room(const bool enable) INJECT(enable, 0x00416800, Room_TriggerMusicTrack); } -static void Inject_Matrix(const bool enable) +static void M_Matrix(const bool enable) { INJECT(enable, 0x00401000, Matrix_GenerateW2V); INJECT(enable, 0x004011D0, Matrix_LookAt); @@ -350,7 +350,7 @@ static void Inject_Matrix(const bool enable) INJECT(enable, 0x0045729E, Matrix_PushUnit); } -static void Inject_Math(const bool enable) +static void M_Math(const bool enable) { INJECT(enable, 0x00457C10, Math_Atan); INJECT(enable, 0x00457C58, Math_Cos); @@ -359,14 +359,14 @@ static void Inject_Math(const bool enable) INJECT(enable, 0x00401250, Math_GetVectorAngles); } -static void Inject_Shell(const bool enable) +static void M_Shell(const bool enable) { INJECT(enable, 0x0044E770, Shell_Cleanup); INJECT(enable, 0x0044E890, Shell_ExitSystem); INJECT(enable, 0x00454980, Shell_Main); } -static void Inject_Requester(const bool enable) +static void M_Requester(const bool enable) { INJECT(enable, 0x004255A0, Requester_Init); INJECT(enable, 0x00425630, Requester_Shutdown); @@ -381,7 +381,7 @@ static void Inject_Requester(const bool enable) INJECT(enable, 0x00426270, Requester_SetSize); } -static void Inject_Option(const bool enable) +static void M_Option(const bool enable) { INJECT(enable, 0x0044EDC0, Option_DoInventory); INJECT(enable, 0x0044EED0, Option_Passport); @@ -391,7 +391,7 @@ static void Inject_Option(const bool enable) INJECT(enable, 0x0044FE20, Option_Controls); } -static void Inject_Text(const bool enable) +static void M_Text(const bool enable) { INJECT(enable, 0x00440450, Text_Init); INJECT(enable, 0x00440480, Text_Create); @@ -415,13 +415,13 @@ static void Inject_Text(const bool enable) INJECT(enable, 0x00440ED0, Text_GetScaleV); } -static void Inject_Input(const bool enable) +static void M_Input(const bool enable) { INJECT(enable, 0x0044DA10, Input_Update); INJECT(enable, 0x004239C0, Input_GetDebounced); } -static void Inject_Output(const bool enable) +static void M_Output(const bool enable) { INJECT(enable, 0x004019E0, Output_InsertPolygons); INJECT(enable, 0x00401AE0, Output_InsertRoom); @@ -499,7 +499,7 @@ static void Inject_Output(const bool enable) INJECT(enable, 0x0041BA50, Output_InsertPolygons_I); } -static void Inject_Music(const bool enable) +static void M_Music(const bool enable) { INJECT(enable, 0x004553E0, Music_Init); INJECT(enable, 0x00455460, Music_Shutdown); @@ -509,7 +509,7 @@ static void Inject_Music(const bool enable) INJECT(enable, 0x004556B0, Music_SetVolume); } -static void Inject_Sound(const bool enable) +static void M_Sound(const bool enable) { INJECT(enable, 0x00455380, Sound_SetMasterVolume); INJECT(enable, 0x0041C560, Sound_UpdateEffects); @@ -520,7 +520,7 @@ static void Inject_Sound(const bool enable) INJECT(enable, 0x0043F980, Sound_Init); } -static void Inject_Demo(const bool enable) +static void M_Demo(const bool enable) { INJECT(enable, 0x00416910, Demo_Control); INJECT(enable, 0x00416970, Demo_Start); @@ -528,7 +528,7 @@ static void Inject_Demo(const bool enable) INJECT(enable, 0x00416BF0, Demo_GetInput); } -static void Inject_Gameflow(bool enable) +static void M_Gameflow(bool enable) { INJECT(enable, 0x0041FA60, GF_LoadScriptFile); INJECT(enable, 0x0041FC50, GF_DoFrontendSequence); @@ -538,7 +538,7 @@ static void Inject_Gameflow(bool enable) INJECT(enable, 0x0044B6C0, GF_LoadFromFile); } -static void Inject_Overlay(const bool enable) +static void M_Overlay(const bool enable) { INJECT(enable, 0x004219A0, Overlay_FlashCounter); INJECT(enable, 0x004219D0, Overlay_DrawAssaultTimer); @@ -554,7 +554,7 @@ static void Inject_Overlay(const bool enable) INJECT(enable, 0x00422050, Overlay_DrawModeInfo); } -static void Inject_Random(const bool enable) +static void M_Random(const bool enable) { INJECT(enable, 0x0044C970, Random_GetControl); INJECT(enable, 0x0044C990, Random_SeedControl); @@ -563,7 +563,7 @@ static void Inject_Random(const bool enable) INJECT(enable, 0x0044D870, Random_Seed); } -static void Inject_Items(const bool enable) +static void M_Items(const bool enable) { INJECT(enable, 0x00426CF0, Item_InitialiseArray); INJECT(enable, 0x00426D50, Item_Kill); @@ -589,7 +589,7 @@ static void Inject_Items(const bool enable) INJECT(enable, 0x0041C0B0, Item_GetBestFrame); } -static void Inject_Effects(const bool enable) +static void M_Effects(const bool enable) { INJECT(enable, 0x004272F0, Effect_InitialiseArray); INJECT(enable, 0x00427320, Effect_Create); @@ -598,7 +598,7 @@ static void Inject_Effects(const bool enable) INJECT(enable, 0x00419890, Effect_Draw); } -static void Inject_LOS(const bool enable) +static void M_LOS(const bool enable) { INJECT(enable, 0x00415BE0, LOS_Check); INJECT(enable, 0x00415C80, LOS_CheckZ); @@ -607,17 +607,17 @@ static void Inject_LOS(const bool enable) INJECT(enable, 0x00416340, LOS_CheckSmashable); } -static void Inject_People(const bool enable) +static void M_People(const bool enable) { INJECT(enable, 0x00435E00, Creature_CanTargetEnemy); } -static void Inject_Level(const bool enable) +static void M_Level(const bool enable) { INJECT(enable, 0x0044B260, Level_Load); } -static void Inject_Inventory(const bool enable) +static void M_Inventory(const bool enable) { INJECT(enable, 0x00422080, Inv_Display); INJECT(enable, 0x00423310, Inv_Construct); @@ -654,7 +654,7 @@ static void Inject_Inventory(const bool enable) INJECT(enable, 0x00425530, Inv_Ring_MotionItemDeselect); } -static void Inject_Lara_Control(const bool enable) +static void M_Lara_Control(const bool enable) { INJECT(enable, 0x00427580, Lara_HandleAboveWater); INJECT(enable, 0x00431670, Lara_HandleSurface); @@ -670,20 +670,20 @@ static void Inject_Lara_Control(const bool enable) INJECT(enable, 0x00431570, Lara_InitialiseMeshes); } -static void Inject_Lara_Draw(const bool enable) +static void M_Lara_Draw(const bool enable) { INJECT(enable, 0x00419DF0, Lara_Draw); INJECT(enable, 0x0041AB20, Lara_Draw_I); } -static void Inject_Lara_Look(const bool enable) +static void M_Lara_Look(const bool enable) { INJECT(enable, 0x00427720, Lara_LookUpDown); INJECT(enable, 0x00427790, Lara_LookLeftRight); INJECT(enable, 0x00427810, Lara_ResetLook); } -static void Inject_Lara_Misc(const bool enable) +static void M_Lara_Misc(const bool enable) { INJECT(enable, 0x0042A0A0, Lara_GetCollisionInfo); INJECT(enable, 0x0042A0E0, Lara_SlideSlope); @@ -723,7 +723,7 @@ static void Inject_Lara_Misc(const bool enable) INJECT(enable, 0x00442D80, Lara_TouchLava); } -static void Inject_Lara_State(const bool enable) +static void M_Lara_State(const bool enable) { INJECT(enable, 0x00432180, Lara_SwimTurn); INJECT(enable, 0x004278A0, Lara_State_Walk); @@ -794,7 +794,7 @@ static void Inject_Lara_State(const bool enable) INJECT(enable, 0x00432410, Lara_State_UWTwist); } -static void Inject_Lara_Col(const bool enable) +static void M_Lara_Col(const bool enable) { INJECT(enable, 0x00428C00, Lara_Fallen); INJECT(enable, 0x00428C60, Lara_CollideStop); @@ -850,7 +850,7 @@ static void Inject_Lara_Col(const bool enable) INJECT(enable, 0x00432440, Lara_Col_UWDeath); } -static void Inject_Gun(bool enable) +static void M_Gun(bool enable) { INJECT(enable, 0x0042BC00, Gun_Rifle_DrawMeshes); INJECT(enable, 0x0042BC40, Gun_Rifle_UndrawMeshes); @@ -885,7 +885,7 @@ static void Inject_Gun(bool enable) INJECT(enable, 0x0042F740, Gun_GetWeaponAnim); } -static void Inject_Creature(const bool enable) +static void M_Creature(const bool enable) { INJECT(enable, 0x0040E1B0, Creature_Initialise); INJECT(enable, 0x0040E1E0, Creature_Activate); @@ -907,7 +907,7 @@ static void Inject_Creature(const bool enable) INJECT(enable, 0x00413860, Creature_Collision); } -static void Inject_Box(const bool enable) +static void M_Box(const bool enable) { INJECT(enable, 0x0040E490, Box_SearchLOT); INJECT(enable, 0x0040E690, Box_UpdateLOT); @@ -919,7 +919,7 @@ static void Inject_Box(const bool enable) INJECT(enable, 0x0040F3D0, Box_BadFloor); } -static void Inject_Lot(const bool enable) +static void M_Lot(const bool enable) { INJECT(enable, 0x00432A60, LOT_InitialiseArray); INJECT(enable, 0x00432AC0, LOT_DisableBaddieAI); @@ -929,7 +929,7 @@ static void Inject_Lot(const bool enable) INJECT(enable, 0x00432F90, LOT_ClearLOT); } -static void Inject_Objects(const bool enable) +static void M_Objects(const bool enable) { INJECT(enable, 0x0040C880, Bird_Initialise); INJECT(enable, 0x0040C910, Bird_Control); @@ -957,7 +957,7 @@ static void Inject_Objects(const bool enable) INJECT(enable, 0x00442F40, Ember_Control); } -static void Inject_S_Audio_Sample(const bool enable) +static void M_S_Audio_Sample(const bool enable) { INJECT(enable, 0x00447BC0, S_Audio_Sample_GetAdapter); INJECT(enable, 0x00447C10, S_Audio_Sample_CloseAllTracks); @@ -987,12 +987,12 @@ static void Inject_S_Audio_Sample(const bool enable) INJECT(enable, 0x004553C0, S_Audio_Sample_OutIsTrackPlaying); } -static void Inject_S_Input(const bool enable) +static void M_S_Input(const bool enable) { INJECT(enable, 0x0044D8F0, S_Input_Key); } -static void Inject_S_FlaggedString(const bool enable) +static void M_S_FlaggedString(const bool enable) { INJECT(enable, 0x00445F00, S_FlaggedString_Delete); INJECT(enable, 0x00446100, S_FlaggedString_InitAdapter); @@ -1001,53 +1001,53 @@ static void Inject_S_FlaggedString(const bool enable) void Inject_Exec(void) { - Inject_Decomp_General(true); - Inject_Decomp_Stats(true); - Inject_Decomp_Effects(true); - Inject_HWR(true); - Inject_Background(true); + M_DecompGeneral(true); + M_DecompStats(true); + M_DecompEffects(true); + M_HWR(true); + M_Background(true); - Inject_Camera(true); - Inject_Collide(true); - Inject_Game(true); - Inject_Room(true); - Inject_Math(true); - Inject_Matrix(true); - Inject_Shell(true); - Inject_Requester(true); - Inject_Option(true); - Inject_Text(true); - Inject_Input(true); - Inject_Output(true); - Inject_Music(true); - Inject_Sound(true); + M_Camera(true); + M_Collide(true); + M_Game(true); + M_Room(true); + M_Math(true); + M_Matrix(true); + M_Shell(true); + M_Requester(true); + M_Option(true); + M_Text(true); + M_Input(true); + M_Output(true); + M_Music(true); + M_Sound(true); - Inject_Demo(true); - Inject_Gameflow(true); - Inject_Overlay(true); - Inject_Random(true); - Inject_Items(true); - Inject_Effects(true); - Inject_LOS(true); - Inject_People(true); - Inject_Level(true); + M_Demo(true); + M_Gameflow(true); + M_Overlay(true); + M_Random(true); + M_Items(true); + M_Effects(true); + M_LOS(true); + M_People(true); + M_Level(true); - Inject_Inventory(true); + M_Inventory(true); - Inject_Lara_Control(true); - Inject_Lara_Draw(true); - Inject_Lara_Look(true); - Inject_Lara_Misc(true); - Inject_Lara_State(true); - Inject_Lara_Col(true); - Inject_Gun(true); + M_Lara_Control(true); + M_Lara_Draw(true); + M_Lara_Look(true); + M_Lara_Misc(true); + M_Lara_State(true); + M_Lara_Col(true); + M_Gun(true); - Inject_Creature(true); - Inject_Box(true); - Inject_Lot(true); - Inject_Objects(true); + M_Creature(true); + M_Box(true); + M_Lot(true); + M_Objects(true); - Inject_S_Audio_Sample(true); - Inject_S_Input(true); - Inject_S_FlaggedString(true); + M_S_Audio_Sample(true); + M_S_Input(true); + M_S_FlaggedString(true); } diff --git a/src/main_exe.c b/src/main_exe.c index e0989c1f..0f6717b8 100644 --- a/src/main_exe.c +++ b/src/main_exe.c @@ -6,7 +6,7 @@ // The path to the legitimate host process const char *m_HostProcessPath = "Tomb2.exe"; -static bool FileExists(const char *path) +static bool M_FileExists(const char *path) { DWORD fileAttributes = GetFileAttributes(path); if (fileAttributes != INVALID_FILE_ATTRIBUTES @@ -16,7 +16,7 @@ static bool FileExists(const char *path) return false; } -static bool InjectDLL(HANDLE process_handle, const char *dll_path) +static bool M_InjectDLL(HANDLE process_handle, const char *dll_path) { bool success = false; LPVOID load_library_addr = @@ -24,7 +24,7 @@ static bool InjectDLL(HANDLE process_handle, const char *dll_path) fprintf(stderr, "Injecting %s\n", dll_path); - if (!FileExists(dll_path)) { + if (!M_FileExists(dll_path)) { fprintf(stderr, "DLL does not exist.\n"); goto finish; } @@ -133,7 +133,7 @@ int32_t main(const int32_t argc, const char *const argv[]) goto finish; } - if (!InjectDLL(pi.hProcess, dll_path)) { + if (!M_InjectDLL(pi.hProcess, dll_path)) { fprintf(stderr, "Failed to inject the DLL.\n"); goto finish; } diff --git a/src/specific/s_audio_sample.c b/src/specific/s_audio_sample.c index f52ec715..0adca3ec 100644 --- a/src/specific/s_audio_sample.c +++ b/src/specific/s_audio_sample.c @@ -52,11 +52,11 @@ typedef struct __unaligned } WAVE_FILE_HEADER; -static void S_Audio_Sample_CreateWAV( +static void M_CreateWAV( const LPWAVEFORMATEX format, const void *data, size_t data_size, char **buffer, size_t *buffer_size); -static void S_Audio_Sample_CreateWAV( +static void M_CreateWAV( const LPWAVEFORMATEX format, const void *const data, const size_t data_size, char **const buffer, size_t *const buffer_size) { @@ -109,7 +109,7 @@ bool __cdecl S_Audio_Sample_Load( { char *wave = NULL; size_t wave_size; - S_Audio_Sample_CreateWAV(format, data, data_size, &wave, &wave_size); + M_CreateWAV(format, data, data_size, &wave, &wave_size); const bool result = Audio_Sample_LoadSingle(sample_id, wave, wave_size); Memory_FreePointer(&wave); diff --git a/src/specific/s_input.c b/src/specific/s_input.c index 047be9ea..012fa155 100644 --- a/src/specific/s_input.c +++ b/src/specific/s_input.c @@ -60,10 +60,10 @@ static bool m_IsF8Pressed = false; static bool m_IsF11Pressed = false; static int32_t m_MediPackCooldown = 0; -static bool S_Input_KbdKey(int32_t layout_num, INPUT_ROLE role); -static bool S_Input_JoyKey(int32_t layout_num, INPUT_ROLE role); +static bool M_KbdKey(int32_t layout_num, INPUT_ROLE role); +static bool M_JoyKey(int32_t layout_num, INPUT_ROLE role); -static bool S_Input_KbdKey(const int32_t layout_num, const INPUT_ROLE role) +static bool M_KbdKey(const int32_t layout_num, const INPUT_ROLE role) { uint16_t key = Input_GetAssignedKey(layout_num, role); if (key >= 0x100) { @@ -90,7 +90,7 @@ static bool S_Input_KbdKey(const int32_t layout_num, const INPUT_ROLE role) return false; } -static bool S_Input_JoyKey(const int32_t layout_num, const INPUT_ROLE role) +static bool M_JoyKey(const int32_t layout_num, const INPUT_ROLE role) { uint16_t key = Input_GetAssignedKey(layout_num, role); if (key < 0x100) { @@ -101,8 +101,8 @@ static bool S_Input_JoyKey(const int32_t layout_num, const INPUT_ROLE role) bool __cdecl S_Input_Key(const INPUT_ROLE role) { - return S_Input_KbdKey(1, role) || S_Input_JoyKey(1, role) - || (!g_ConflictLayout[role] && S_Input_KbdKey(0, role)); + return M_KbdKey(1, role) || M_JoyKey(1, role) + || (!g_ConflictLayout[role] && M_KbdKey(0, role)); } // TODO: refactor me!!! diff --git a/subprojects/libtrx b/subprojects/libtrx index 39c2d551..cce71ee7 160000 --- a/subprojects/libtrx +++ b/subprojects/libtrx @@ -1 +1 @@ -Subproject commit 39c2d55127f456909c21934ba48f431a0040eac6 +Subproject commit cce71ee7d1568534293ff2fc377e404b6b0f5335