console/cmd: make /heal extinguish Lara

This commit is contained in:
Marcin Kurczewski 2024-09-19 14:36:22 +02:00
parent 651ba884a3
commit 2425e46cfa
No known key found for this signature in database
GPG key ID: CC65E6FD28CAE42A
5 changed files with 23 additions and 25 deletions

View file

@ -26,6 +26,7 @@
- fixed Bacon Lara re-spawning after saving and loading (#1500, regression from 0.7)
- fixed config JSON not sanitizing some numeric values (#1515)
- fixed potential crashes in custom levels if hybrid creature objects are not present in the level (#1444)
- changed `/heal` console command to also extinguish Lara
- changed `/tp` console command to look for the closest place to teleport to when targeting items (#1484)
- changed `/set` console command output to always use fully-qualified option names
- changed `/fps`, `/vsync`, `/wireframe`, `/braid` and `/cheats` console commands output to be in line with `/set` console command output

View file

@ -151,6 +151,7 @@ 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',

View file

@ -22,6 +22,7 @@
#include "global/vars.h"
#include <libtrx/game/console/commands/config.h>
#include <libtrx/game/console/commands/heal.h>
#include <libtrx/game/console/commands/pos.h>
#include <libtrx/game/console/commands/set_health.h>
#include <libtrx/game/console/common.h>
@ -41,7 +42,6 @@ static COMMAND_RESULT Console_Cmd_Wireframe(const char *const args);
static COMMAND_RESULT Console_Cmd_Braid(const char *const args);
static COMMAND_RESULT Console_Cmd_Cheats(const char *const args);
static COMMAND_RESULT Console_Cmd_Teleport(const char *const args);
static COMMAND_RESULT Console_Cmd_Heal(const char *const args);
static COMMAND_RESULT Console_Cmd_Fly(const char *const args);
static COMMAND_RESULT Console_Cmd_Speed(const char *const args);
static COMMAND_RESULT Console_Cmd_GiveItem(const char *args);
@ -220,28 +220,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;
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
@ -604,7 +582,6 @@ CONSOLE_COMMAND *g_ConsoleCommands[] = {
&(CONSOLE_COMMAND) { .prefix = "braid", .proc = Console_Cmd_Braid },
&(CONSOLE_COMMAND) { .prefix = "cheats", .proc = Console_Cmd_Cheats },
&(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 = "speed", .proc = Console_Cmd_Speed },
&(CONSOLE_COMMAND) { .prefix = "give", .proc = Console_Cmd_GiveItem },
@ -624,6 +601,7 @@ CONSOLE_COMMAND *g_ConsoleCommands[] = {
&(CONSOLE_COMMAND) { .prefix = "natlastinks",
.proc = Console_Cmd_Abortion },
&g_Console_Cmd_Pos,
&g_Console_Cmd_Heal,
&g_Console_Cmd_SetHealth,
&g_Console_Cmd_Config,
NULL,

18
src/game/lara/misc.c Normal file
View file

@ -0,0 +1,18 @@
#include "game/effects.h"
#include <libtrx/game/lara/misc.h>
void Lara_Extinguish(void)
{
// put out flame objects
int16_t fx_num = g_NextFxActive;
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;
}
}

@ -1 +1 @@
Subproject commit a444a38cd1ea7e11c10ddd4b373f4fda926eebb9
Subproject commit 39c2d55127f456909c21934ba48f431a0040eac6