mirror of
https://github.com/LostArtefacts/TRX.git
synced 2025-04-28 12:47:58 +03:00
cmd: add new /music command
This commit is contained in:
parent
1d03d434bf
commit
0f2d3d71f0
9 changed files with 42 additions and 1 deletions
|
@ -452,6 +452,7 @@
|
|||
"OSD_INVALID_DEMO": "Invalid demo",
|
||||
"OSD_INVALID_ITEM": "Unknown item: %s",
|
||||
"OSD_INVALID_LEVEL": "Invalid level",
|
||||
"OSD_INVALID_MUSIC_TRACK": "Invalid music track",
|
||||
"OSD_INVALID_OBJECT": "Invalid object",
|
||||
"OSD_INVALID_ROOM": "Invalid room: %d. Valid rooms are 0-%d",
|
||||
"OSD_INVALID_SAMPLE": "Invalid sound: %d",
|
||||
|
@ -469,6 +470,7 @@
|
|||
"OSD_PLAY_CUTSCENE": "Loading cutscene %d",
|
||||
"OSD_PLAY_DEMO": "Loading demo %d",
|
||||
"OSD_PLAY_LEVEL": "Loading %s",
|
||||
"OSD_PLAY_MUSIC_TRACK": "Playing music track %d",
|
||||
"OSD_POS_GET": "Level: %d (%s) Room: %d\nPosition: %.3f, %.3f, %.3f\nRotation: %.3f,%.3f,%.3f",
|
||||
"OSD_POS_SET_ITEM": "Teleported to object: %s",
|
||||
"OSD_POS_SET_ITEM_FAIL": "Failed to teleport to object: %s",
|
||||
|
|
|
@ -545,6 +545,7 @@
|
|||
"OSD_INVALID_DEMO": "Invalid demo",
|
||||
"OSD_INVALID_ITEM": "Unknown item: %s",
|
||||
"OSD_INVALID_LEVEL": "Invalid level",
|
||||
"OSD_INVALID_MUSIC_TRACK": "Invalid music track",
|
||||
"OSD_INVALID_OBJECT": "Invalid object",
|
||||
"OSD_INVALID_ROOM": "Invalid room: %d. Valid rooms are 0-%d",
|
||||
"OSD_INVALID_SAMPLE": "Invalid sound: %d",
|
||||
|
@ -563,6 +564,7 @@
|
|||
"OSD_PLAY_CUTSCENE": "Loading cutscene %d",
|
||||
"OSD_PLAY_DEMO": "Loading demo %d",
|
||||
"OSD_PLAY_LEVEL": "Loading %s",
|
||||
"OSD_PLAY_MUSIC_TRACK": "Playing music track %d",
|
||||
"OSD_POS_GET": "Level: %d (%s) Room: %d\nPosition: %.3f, %.3f, %.3f\nRotation: %.3f,%.3f,%.3f",
|
||||
"OSD_POS_SET_ITEM": "Teleported to object: %s",
|
||||
"OSD_POS_SET_ITEM_FAIL": "Failed to teleport to object: %s",
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
- added optional dynamic lighting for gun flashes and explosions, similar to TR2+ (#2357)
|
||||
- added a `/cut` (alias: `/cutscene`) console command for playing cutscenes
|
||||
- added a `/gym` (alias: `/home`) console command for playing Lara's Home
|
||||
- added a `/music` console command that plays a specific music track
|
||||
- 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)
|
||||
|
|
|
@ -99,6 +99,9 @@ Currently supported commands:
|
|||
- `/set {option} {value}`
|
||||
Retrieves or assigns a new value to the given configuration option. Some options need a game re-launch to apply. The option names use `-` rather than `_`.
|
||||
|
||||
- `/music {track_id}`
|
||||
Plays a given music track. It uses internal game IDs that for historic reasons don't align with the music folder's file names.
|
||||
|
||||
- `/sfx`
|
||||
- `/sfx {sound}`
|
||||
Plays a given sound sample.
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
- added support for animated sprites (#2401)
|
||||
- added a `/cut` (alias: `/cutscene`) console command for playing cutscenes
|
||||
- added a `/gym` (alias: `/home`) console command for playing Lara's Home
|
||||
- added a `/music` console command that plays a specific music track
|
||||
- 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)
|
||||
|
|
|
@ -77,6 +77,9 @@ Currently supported commands:
|
|||
- `/set {option} {value}`
|
||||
Retrieves or assigns a new value to the given configuration option. Some options need a game re-launch to apply. The option names use `-` rather than `_`.
|
||||
|
||||
- `/music {track_id}`
|
||||
Plays a given music track. It uses internal game IDs that for historic reasons don't align with the music folder's file names.
|
||||
|
||||
- `/sfx`
|
||||
- `/sfx {sound}`
|
||||
Plays a given sound sample.
|
||||
|
|
26
src/libtrx/game/console/cmd/music.c
Normal file
26
src/libtrx/game/console/cmd/music.c
Normal file
|
@ -0,0 +1,26 @@
|
|||
#include "game/console/common.h"
|
||||
#include "game/console/registry.h"
|
||||
#include "game/game_string.h"
|
||||
#include "game/music.h"
|
||||
#include "strings.h"
|
||||
|
||||
static COMMAND_RESULT M_Entrypoint(const COMMAND_CONTEXT *ctx);
|
||||
|
||||
static COMMAND_RESULT M_Entrypoint(const COMMAND_CONTEXT *const ctx)
|
||||
{
|
||||
int32_t track_to_play = -1;
|
||||
if (String_IsEmpty(ctx->args)) {
|
||||
return CR_BAD_INVOCATION;
|
||||
} else if (String_ParseInteger(ctx->args, &track_to_play)) {
|
||||
if (Music_Play(track_to_play, MPM_ALWAYS)) {
|
||||
Console_Log(GS(OSD_PLAY_MUSIC_TRACK), track_to_play);
|
||||
} else {
|
||||
Console_Log(GS(OSD_INVALID_MUSIC_TRACK));
|
||||
}
|
||||
return CR_SUCCESS;
|
||||
} else {
|
||||
return CR_BAD_INVOCATION;
|
||||
}
|
||||
}
|
||||
|
||||
REGISTER_CONSOLE_COMMAND("music", M_Entrypoint)
|
|
@ -26,6 +26,8 @@ GS_DEFINE(OSD_INVALID_SAMPLE, "Invalid sound: %d")
|
|||
GS_DEFINE(OSD_OBJECT_NOT_FOUND, "Object not found")
|
||||
GS_DEFINE(OSD_SOUND_AVAILABLE_SAMPLES, "Available sounds: %s")
|
||||
GS_DEFINE(OSD_SOUND_PLAYING_SAMPLE, "Playing sound %d")
|
||||
GS_DEFINE(OSD_PLAY_MUSIC_TRACK, "Playing music track %d")
|
||||
GS_DEFINE(OSD_INVALID_MUSIC_TRACK, "Invalid music track")
|
||||
GS_DEFINE(OSD_UNKNOWN_COMMAND, "Unknown command: %s")
|
||||
GS_DEFINE(OSD_COMMAND_BAD_INVOCATION, "Invalid invocation: %s")
|
||||
GS_DEFINE(OSD_COMMAND_UNAVAILABLE, "This command is not currently available")
|
||||
|
|
|
@ -81,8 +81,8 @@ sources = [
|
|||
'game/anims/commands.c',
|
||||
'game/anims/common.c',
|
||||
'game/anims/frames.c',
|
||||
'game/camera/common.c',
|
||||
'game/camera/cinematic.c',
|
||||
'game/camera/common.c',
|
||||
'game/camera/fixed.c',
|
||||
'game/camera/photo_mode.c',
|
||||
'game/camera/vars.c',
|
||||
|
@ -100,6 +100,7 @@ sources = [
|
|||
'game/console/cmd/heal.c',
|
||||
'game/console/cmd/kill.c',
|
||||
'game/console/cmd/load_game.c',
|
||||
'game/console/cmd/music.c',
|
||||
'game/console/cmd/play_cutscene.c',
|
||||
'game/console/cmd/play_demo.c',
|
||||
'game/console/cmd/play_gym.c',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue