diff --git a/meson.build b/meson.build index 9e95cc4f..38fa8fa7 100644 --- a/meson.build +++ b/meson.build @@ -118,6 +118,7 @@ dll_sources = [ 'src/game/lara/lara_look.c', 'src/game/lara/lara_misc.c', 'src/game/lara/lara_state.c', + 'src/game/lara/misc.c', 'src/game/level.c', 'src/game/los.c', 'src/game/lot.c', diff --git a/src/game/console_cmd.c b/src/game/console_cmd.c index 4ae0e423..e054d2df 100644 --- a/src/game/console_cmd.c +++ b/src/game/console_cmd.c @@ -19,6 +19,7 @@ #include "lara/lara_misc.h" #include +#include #include #include #include @@ -33,7 +34,6 @@ 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 COMMAND_RESULT Console_Cmd_Teleport(const char *args); -static COMMAND_RESULT Console_Cmd_Heal(const char *args); static COMMAND_RESULT Console_Cmd_Fly(const char *const args); static COMMAND_RESULT Console_Cmd_FlipMap(const char *args); static COMMAND_RESULT Console_Cmd_GiveItem(const char *args); @@ -200,29 +200,6 @@ static COMMAND_RESULT Console_Cmd_Teleport(const char *const args) return CR_BAD_INVOCATION; } -static COMMAND_RESULT Console_Cmd_Heal(const char *const args) -{ - if (g_GameInfo.current_level.type == GFL_TITLE - || g_GameInfo.current_level.type == GFL_DEMO - || g_GameInfo.current_level.type == GFL_CUTSCENE) { - return CR_UNAVAILABLE; - } - - if (!g_Objects[O_LARA].loaded) { - return CR_UNAVAILABLE; - } - - if (g_LaraItem->hit_points == LARA_MAX_HITPOINTS) { - Console_Log(GS(OSD_HEAL_ALREADY_FULL_HP)); - return CR_SUCCESS; - } - - g_LaraItem->hit_points = LARA_MAX_HITPOINTS; - Lara_Extinguish(); - Console_Log(GS(OSD_HEAL_SUCCESS)); - return CR_SUCCESS; -} - static COMMAND_RESULT Console_Cmd_Fly(const char *const args) { if (g_GameInfo.current_level.type == GFL_TITLE @@ -562,7 +539,6 @@ static COMMAND_RESULT Console_Cmd_Abortion(const char *const args) CONSOLE_COMMAND *g_ConsoleCommands[] = { &(CONSOLE_COMMAND) { .prefix = "tp", .proc = Console_Cmd_Teleport }, - &(CONSOLE_COMMAND) { .prefix = "heal", .proc = Console_Cmd_Heal }, &(CONSOLE_COMMAND) { .prefix = "fly", .proc = Console_Cmd_Fly }, &(CONSOLE_COMMAND) { .prefix = "give", .proc = Console_Cmd_GiveItem }, &(CONSOLE_COMMAND) { .prefix = "gimme", .proc = Console_Cmd_GiveItem }, @@ -582,6 +558,7 @@ CONSOLE_COMMAND *g_ConsoleCommands[] = { .proc = Console_Cmd_Abortion }, &g_Console_Cmd_Config, &g_Console_Cmd_Pos, + &g_Console_Cmd_Heal, &g_Console_Cmd_SetHealth, NULL, }; diff --git a/src/game/game_string.def b/src/game/game_string.def index 49cc2d42..6200cebd 100644 --- a/src/game/game_string.def +++ b/src/game/game_string.def @@ -38,5 +38,3 @@ GS_DEFINE(OSD_SAVE_GAME, "Saved game to save slot %d") GS_DEFINE(OSD_SAVE_GAME_FAIL, "Cannot save the game in the current state") GS_DEFINE(OSD_CURRENT_HEALTH_GET, "Current Lara's health: %d") GS_DEFINE(OSD_CURRENT_HEALTH_SET, "Lara's health set to %d") -GS_DEFINE(OSD_HEAL_ALREADY_FULL_HP, "Lara's already at full health") -GS_DEFINE(OSD_HEAL_SUCCESS, "Healed Lara back to full health") diff --git a/src/game/lara/common.c b/src/game/lara/common.c index d0ec42c7..b28f4d6c 100644 --- a/src/game/lara/common.c +++ b/src/game/lara/common.c @@ -1,7 +1,7 @@ -#include "game/lara/common.h" - #include "global/vars.h" +#include + ITEM_INFO *Lara_GetItem(void) { return g_LaraItem; diff --git a/src/game/lara/common.h b/src/game/lara/common.h deleted file mode 100644 index ee4675e4..00000000 --- a/src/game/lara/common.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -#include "game/items.h" - -ITEM_INFO *Lara_GetItem(void); diff --git a/src/game/lara/lara_misc.c b/src/game/lara/lara_misc.c index 5d81dddc..597246e3 100644 --- a/src/game/lara/lara_misc.c +++ b/src/game/lara/lara_misc.c @@ -1802,27 +1802,6 @@ void __cdecl Lara_WaterCurrent(COLL_INFO *const coll) coll->old = item->pos; } -void __cdecl Lara_Extinguish(void) -{ - if (!g_Lara.burn) { - return; - } - - g_Lara.burn = 0; - - // put out flame objects - int16_t fx_num = g_NextEffectActive; - while (fx_num != NO_ITEM) { - FX_INFO *const fx = &g_Effects[fx_num]; - const int16_t next_fx_num = fx->next_active; - if (fx->object_id == O_FLAME && fx->counter < 0) { - fx->counter = 0; - Effect_Kill(fx_num); - } - fx_num = next_fx_num; - } -} - void __cdecl Lara_CatchFire(void) { if (g_Lara.burn || g_Lara.water_status == LWS_CHEAT) { diff --git a/src/game/lara/lara_misc.h b/src/game/lara/lara_misc.h index ead1689f..6475d284 100644 --- a/src/game/lara/lara_misc.h +++ b/src/game/lara/lara_misc.h @@ -81,7 +81,6 @@ void __cdecl Lara_SwimCollision(ITEM_INFO *item, COLL_INFO *coll); void __cdecl Lara_WaterCurrent(COLL_INFO *coll); -void __cdecl Lara_Extinguish(void); void __cdecl Lara_CatchFire(void); void __cdecl Lara_TouchLava(ITEM_INFO *item); diff --git a/src/game/lara/misc.c b/src/game/lara/misc.c new file mode 100644 index 00000000..4ff1e0c7 --- /dev/null +++ b/src/game/lara/misc.c @@ -0,0 +1,25 @@ +#include "game/effects.h" +#include "global/vars.h" + +#include + +void __cdecl Lara_Extinguish(void) +{ + if (!g_Lara.burn) { + return; + } + + g_Lara.burn = 0; + + // put out flame objects + int16_t fx_num = g_NextEffectActive; + while (fx_num != NO_ITEM) { + FX_INFO *const fx = &g_Effects[fx_num]; + const int16_t next_fx_num = fx->next_active; + if (fx->object_id == O_FLAME && fx->counter < 0) { + fx->counter = 0; + Effect_Kill(fx_num); + } + fx_num = next_fx_num; + } +} diff --git a/subprojects/libtrx b/subprojects/libtrx index a444a38c..39c2d551 160000 --- a/subprojects/libtrx +++ b/subprojects/libtrx @@ -1 +1 @@ -Subproject commit a444a38cd1ea7e11c10ddd4b373f4fda926eebb9 +Subproject commit 39c2d55127f456909c21934ba48f431a0040eac6