cmd: add new /gym command

This commit is contained in:
Marcin Kurczewski 2025-02-02 19:06:07 +01:00
parent ed18dcce71
commit a5f0f61251
9 changed files with 53 additions and 2 deletions

View file

@ -10,7 +10,8 @@
- added a fade-out effect when exiting the pause screen to the inventory
- added exit fade-out effects (#2348)
- added optional dynamic lighting for gun flashes and explosions, similar to TR2+ (#2357)
- added a `/cut` console command for playing cutscenes
- added a `/cut` (alias: `/cutscene`) console command for playing cutscenes
- added a `/gym` (alias: `/home`) console command for playing Lara's Home
- added a console log when using the `/demo` command
- ⚠️ changed the game data to use a separate strings file for text information, removing it from the game flow file
- changed the object texture limit from 2048 to unlimited (within game's overall memory cap)

View file

@ -63,6 +63,10 @@ Currently supported commands:
`/cutscene {num}`
Plays the specified cutscene.
- `/gym`
`/home`
Plays Lara's Home, if available. Alias of `/play 0`.
- `/load {slot_num}`
Loads the specified savegame slot.

View file

@ -8,7 +8,8 @@
- added the ability to disable exit fade effects alone (#2348)
- added a fade-out effect when completing Lara's Home
- added support for animated sprites (#2401)
- added a `/cut` console command for playing cutscenes
- added a `/cut` (alias: `/cutscene`) console command for playing cutscenes
- added a `/gym` (alias: `/home`) console command for playing Lara's Home
- added a console log when using the `/demo` command
- changed the object texture limit from 2048 to unlimited (within game's overall memory cap) (#1795)
- changed the sprite texture limit from 512 to unlimited (within game's overall memory cap) (#1795)

View file

@ -49,6 +49,10 @@ Currently supported commands:
`/cutscene {num}`
Plays the specified cutscene.
- `/gym`
`/home`
Plays Lara's Home, if available. Alias of `/play 0`.
- `/load {slot_num}`
Loads the specified savegame slot.

View file

@ -0,0 +1,31 @@
#include "game/console/cmd/play_gym.h"
#include "game/game_flow/common.h"
#include "game/game_string.h"
#include "strings.h"
static COMMAND_RESULT M_Entrypoint(const COMMAND_CONTEXT *ctx);
static COMMAND_RESULT M_Entrypoint(const COMMAND_CONTEXT *const ctx)
{
if (String_IsEmpty(ctx->args)) {
const GF_LEVEL *const level = GF_GetGymLevel();
if (level == nullptr) {
Console_Log(GS(OSD_INVALID_LEVEL));
return CR_FAILURE;
}
GF_OverrideCommand((GF_COMMAND) {
.action = GF_SELECT_GAME,
.param = level->num,
});
Console_Log(GS(OSD_PLAY_LEVEL), level->title);
return CR_SUCCESS;
} else {
return CR_BAD_INVOCATION;
}
}
CONSOLE_COMMAND g_Console_Cmd_PlayGym = {
.prefix = "gym|home",
.proc = M_Entrypoint,
};

View file

@ -0,0 +1,5 @@
#pragma once
#include "../common.h"
extern CONSOLE_COMMAND g_Console_Cmd_PlayGym;

View file

@ -102,6 +102,7 @@ sources = [
'game/console/cmd/load_game.c',
'game/console/cmd/play_cutscene.c',
'game/console/cmd/play_demo.c',
'game/console/cmd/play_gym.c',
'game/console/cmd/play_level.c',
'game/console/cmd/pos.c',
'game/console/cmd/save_game.c',

View file

@ -15,6 +15,7 @@
#include <libtrx/game/console/cmd/load_game.h>
#include <libtrx/game/console/cmd/play_cutscene.h>
#include <libtrx/game/console/cmd/play_demo.h>
#include <libtrx/game/console/cmd/play_gym.h>
#include <libtrx/game/console/cmd/play_level.h>
#include <libtrx/game/console/cmd/pos.h>
#include <libtrx/game/console/cmd/save_game.h>
@ -34,6 +35,7 @@ CONSOLE_COMMAND *g_ConsoleCommands[] = {
&g_Console_Cmd_EndLevel,
&g_Console_Cmd_PlayLevel,
&g_Console_Cmd_PlayCutscene,
&g_Console_Cmd_PlayGym,
&g_Console_Cmd_LoadGame,
&g_Console_Cmd_SaveGame,
&g_Console_Cmd_PlayDemo,

View file

@ -13,6 +13,7 @@
#include <libtrx/game/console/cmd/load_game.h>
#include <libtrx/game/console/cmd/play_cutscene.h>
#include <libtrx/game/console/cmd/play_demo.h>
#include <libtrx/game/console/cmd/play_gym.h>
#include <libtrx/game/console/cmd/play_level.h>
#include <libtrx/game/console/cmd/pos.h>
#include <libtrx/game/console/cmd/save_game.h>
@ -31,6 +32,7 @@ CONSOLE_COMMAND *g_ConsoleCommands[] = {
&g_Console_Cmd_EndLevel,
&g_Console_Cmd_PlayLevel,
&g_Console_Cmd_PlayCutscene,
&g_Console_Cmd_PlayGym,
&g_Console_Cmd_LoadGame,
&g_Console_Cmd_SaveGame,
&g_Console_Cmd_PlayDemo,