game-strings: extract from gameflow; dedupe code

This commit is contained in:
Marcin Kurczewski 2024-04-09 10:45:34 +02:00
parent 11dfeb9138
commit e77c49426e
36 changed files with 493 additions and 1069 deletions

1
.gitignore vendored
View file

@ -15,7 +15,6 @@ __pycache__/
# VS garbage
v15/
v16/
*.def
*.suo
*.o
*.obj

View file

@ -17,7 +17,7 @@ various pieces of global behaviour.
<details>
<summary>Show snippet</summary>
```json5
"main_menu_picture": "data/titleh.png",
"savegame_fmt_legacy": "saveati.%d",
@ -156,7 +156,7 @@ various pieces of global behaviour.
This is where the individual level details are defined - see
<a href="#level-properties">Level properties</a> for full details.
</td>
</tr>
</tr>
<tr valign="top">
<td>
<code>main_menu_picture</code>
@ -451,7 +451,7 @@ Following are each of the properties available within a level.
<td>String</td>
<td>Yes</td>
<td colspan="2">The title of the level.</td>
</tr>
</tr>
<tr valign="top">
<td rowspan="8">
<code>type</code>
@ -517,7 +517,7 @@ Following are each of the properties available within a level.
<code>title</code>
</td>
<td>The main menu level. One - and only one - of these must be defined.</td>
</tr>
</tr>
<tr valign="top">
<td>
<code>unobtainable_kills</code>
@ -915,7 +915,7 @@ game will exit to title.
{"type": "start_game"},
{"type": "loop_game"},
{"type": "stop_game"},
{"type": "level_stats", "level_id": 3},
{"type": "level_stats", "level_id": 3},
{"type": "play_synced_audio", "audio_id": 19},
{"type": "display_picture", "picture_path": "data/end.pcx", "display_time": 7.5},
{"type": "display_picture", "picture_path": "data/cred1.pcx", "display_time": 7.5},

View file

@ -580,182 +580,5 @@
],
"strings": {
"HEADING_INVENTORY": "INVENTORY",
"HEADING_GAME_OVER": "GAME OVER",
"HEADING_OPTION": "OPTION",
"HEADING_ITEMS": "ITEMS",
"PASSPORT_SELECT_LEVEL": "Select Level",
"PASSPORT_RESTART_LEVEL": "Restart Level",
"PASSPORT_STORY_SO_FAR": "Story so far...",
"PASSPORT_LEGACY_SELECT_LEVEL_1": "Legacy saves do not",
"PASSPORT_LEGACY_SELECT_LEVEL_2": "support this feature.",
"PASSPORT_SELECT_MODE": "Select Mode",
"PASSPORT_MODE_NEW_GAME": "New Game",
"PASSPORT_MODE_NEW_GAME_PLUS": "New Game+",
"PASSPORT_MODE_NEW_GAME_JP": "Japanese NG",
"PASSPORT_MODE_NEW_GAME_JP_PLUS": "Japanese NG+",
"PASSPORT_NEW_GAME": "New Game",
"PASSPORT_LOAD_GAME": "Load Game",
"PASSPORT_SAVE_GAME": "Save Game",
"PASSPORT_EXIT_GAME": "Exit Game",
"PASSPORT_EXIT_TO_TITLE": "Exit to Title",
"DETAIL_SELECT_DETAIL": "Select Detail",
"DETAIL_LEVEL_HIGH": "High",
"DETAIL_LEVEL_MEDIUM": "Medium",
"DETAIL_LEVEL_LOW": "Low",
"DETAIL_FPS": "FPS",
"DETAIL_PERSPECTIVE": "Perspective",
"DETAIL_BILINEAR": "Bilinear",
"DETAIL_TEXTURE_FILTER": "Texture filter",
"DETAIL_FBO_FILTER": "FBO filter",
"DETAIL_VSYNC": "VSync",
"DETAIL_BRIGHTNESS": "Brightness",
"DETAIL_UI_TEXT_SCALE": "UI text scale",
"DETAIL_UI_BAR_SCALE": "UI bar scale",
"DETAIL_RENDER_MODE": "Render mode",
"DETAIL_RENDER_MODE_LEGACY": "Window size",
"DETAIL_RENDER_MODE_FBO": "Framebuffer",
"DETAIL_RESOLUTION": "Resolution",
"DETAIL_DECIMAL_FMT": "%d",
"DETAIL_STRING_FMT": "%s",
"DETAIL_FLOAT_FMT": "%.1f",
"DETAIL_RESOLUTION_FMT": "%dx%d",
"SOUND_SET_VOLUMES": "Set Volumes",
"CONTROL_CUSTOMIZE": "Customize Controls",
"CONTROL_KEYBOARD": "Keyboard",
"CONTROL_CONTROLLER": "Controller",
"CONTROL_DEFAULT_KEYS": "Default Keys",
"CONTROL_CUSTOM_1": "Custom Scheme 1",
"CONTROL_CUSTOM_2": "Custom Scheme 2",
"CONTROL_CUSTOM_3": "Custom Scheme 3",
"CONTROL_RESET_DEFAULTS_KEY": "Reset All: Hold R",
"CONTROL_UNBIND_KEY": "Unbind: Hold Backspace",
"CONTROL_RESET_DEFAULTS_BTN": "Reset All: Hold %s",
"CONTROL_UNBIND_BTN": "Unbind: Hold %s",
"KEYMAP_RUN": "Run",
"KEYMAP_BACK": "Back",
"KEYMAP_LEFT": "Left",
"KEYMAP_RIGHT": "Right",
"KEYMAP_STEP_LEFT": "Step Left",
"KEYMAP_STEP_RIGHT": "Step Right",
"KEYMAP_WALK": "Walk",
"KEYMAP_JUMP": "Jump",
"KEYMAP_ACTION": "Action",
"KEYMAP_DRAW_WEAPON": "Draw Weapon",
"KEYMAP_LOOK": "Look",
"KEYMAP_ROLL": "Roll",
"KEYMAP_INVENTORY": "Inventory",
"KEYMAP_PAUSE": "Pause",
"KEYMAP_FLY_CHEAT": "Fly Cheat",
"KEYMAP_ITEM_CHEAT": "Item Cheat",
"KEYMAP_LEVEL_SKIP_CHEAT": "Level Skip",
"KEYMAP_TURBO_CHEAT": "Turbo Speed",
"KEYMAP_ENTER_CONSOLE": "Enter Console",
"KEYMAP_CAMERA_UP": "Camera Up",
"KEYMAP_CAMERA_DOWN": "Camera Down",
"KEYMAP_CAMERA_LEFT": "Camera Left",
"KEYMAP_CAMERA_RIGHT": "Camera Right",
"KEYMAP_CAMERA_RESET": "Reset Camera",
"KEYMAP_EQUIP_PISTOLS": "Equip Pistols",
"KEYMAP_EQUIP_SHOTGUN": "Equip Shotgun",
"KEYMAP_EQUIP_MAGNUMS": "Equip Magnums",
"KEYMAP_EQUIP_UZIS": "Equip Uzis",
"KEYMAP_USE_SMALL_MEDI": "Small Medi",
"KEYMAP_USE_BIG_MEDI": "Large Medi",
"KEYMAP_SAVE": "Quick Save",
"KEYMAP_LOAD": "Quick Load",
"KEYMAP_FPS": "Show FPS",
"KEYMAP_BILINEAR": "Toggle Texture Filter",
"STATS_KILLS_DETAIL_FMT": "KILLS %d of %d",
"STATS_KILLS_BASIC_FMT": "KILLS %d",
"STATS_PICKUPS_DETAIL_FMT": "PICKUPS %d of %d",
"STATS_PICKUPS_BASIC_FMT": "PICKUPS %d",
"STATS_SECRETS_FMT": "SECRETS %d of %d",
"STATS_DEATHS_FMT": "DEATHS %d",
"STATS_TIME_TAKEN_FMT": "TIME TAKEN %s",
"STATS_FINAL_STATISTICS": "Final Statistics",
"STATS_BONUS_STATISTICS": "Bonus Statistics",
"PAUSE_PAUSED": "Paused",
"PAUSE_EXIT_TO_TITLE": "Exit to title?",
"PAUSE_CONTINUE": "Continue",
"PAUSE_QUIT": "Quit",
"PAUSE_ARE_YOU_SURE": "Are you sure?",
"PAUSE_YES": "Yes",
"PAUSE_NO": "No",
"MISC_ON": "On",
"MISC_OFF": "Off",
"MISC_EMPTY_SLOT_FMT": "- EMPTY SLOT %d -",
"MISC_DEMO_MODE": "Demo Mode",
"INV_ITEM_MEDI": "Small Medi Pack",
"INV_ITEM_BIG_MEDI": "Large Medi Pack",
"INV_ITEM_PUZZLE1": "Puzzle",
"INV_ITEM_PUZZLE2": "Puzzle",
"INV_ITEM_PUZZLE3": "Puzzle",
"INV_ITEM_PUZZLE4": "Puzzle",
"INV_ITEM_KEY1": "Key",
"INV_ITEM_KEY2": "Key",
"INV_ITEM_KEY3": "Key",
"INV_ITEM_KEY4": "Key",
"INV_ITEM_PICKUP1": "Pickup",
"INV_ITEM_PICKUP2": "Pickup",
"INV_ITEM_LEADBAR": "Lead Bar",
"INV_ITEM_SCION": "Scion",
"INV_ITEM_PISTOLS": "Pistols",
"INV_ITEM_SHOTGUN": "Shotgun",
"INV_ITEM_MAGNUM": "Magnums",
"INV_ITEM_UZI": "Uzis",
"INV_ITEM_GRENADE": "Grenade",
"INV_ITEM_PISTOL_AMMO": "Pistol Clips",
"INV_ITEM_SHOTGUN_AMMO": "Shotgun Shells",
"INV_ITEM_MAGNUM_AMMO": "Magnum Clips",
"INV_ITEM_UZI_AMMO": "Uzi Clips",
"INV_ITEM_COMPASS": "Compass",
"INV_ITEM_GAME": "Game",
"INV_ITEM_DETAILS": "Detail Levels",
"INV_ITEM_SOUND": "Sound",
"INV_ITEM_CONTROLS": "Controls",
"INV_ITEM_LARAS_HOME": "Lara's Home",
"OSD_FLY_MODE_ON": "Fly mode enabled",
"OSD_FLY_MODE_OFF": "Fly mode disabled",
"OSD_FPS_GET": "FPS currently set to %d",
"OSD_FPS_SET": "FPS set to %d",
"OSD_POS_GET": "Room: %d\nPosition: %.3f, %.3f, %.3f\nRotation: %.3f,%.3f,%.3f",
"OSD_POS_SET_POS": "Teleported to position: %.3f %.3f %.3f",
"OSD_POS_SET_POS_FAIL": "Failed to teleport to position: %.3f %.3f %.3f",
"OSD_POS_SET_ROOM": "Teleported to room: %d",
"OSD_POS_SET_ROOM_FAIL": "Failed to teleport to room: %d",
"OSD_SPEED_GET": "Current speed: %d",
"OSD_SPEED_SET": "Speed set to %d",
"OSD_BRAID_ON": "Braid enabled",
"OSD_BRAID_OFF": "Braid disabled",
"OSD_CHEATS_ON": "Cheats enabled",
"OSD_CHEATS_OFF": "Cheats disabled",
"OSD_GIVE_ITEM": "Added %s to Lara's inventory",
"OSD_GIVE_ITEM_ALL_KEYS": "Surprise! Every key item Lara needs is now in her backpack.",
"OSD_GIVE_ITEM_ALL_GUNS": "Lock'n'load - Lara's armed to the teeth!",
"OSD_GIVE_ITEM_CHEAT": "Lara's backpack just got way heavier!",
"OSD_FLIPMAP_ON": "Flipmap set to ON",
"OSD_FLIPMAP_OFF": "Flipmap set to OFF",
"OSD_FLIPMAP_FAIL_ALREADY_ON": "Flipmap is already ON",
"OSD_FLIPMAP_FAIL_ALREADY_OFF": "Flipmap is already OFF",
"OSD_KILL_ALL": "Poof! %d enemies gone!",
"OSD_KILL_ALL_FAIL": "Uh-oh, there are no enemies left to kill...",
"OSD_KILL": "Bye-bye!",
"OSD_KILL_FAIL": "No enemy nearby...",
"OSD_COMPLETE_LEVEL": "Level complete!",
"OSD_PLAY_LEVEL": "Loading %s",
"OSD_TEXTURE_FILTER_SET": "Texture filter set to %s",
"OSD_TEXTURE_FILTER_NN": "nearest-neighbor",
"OSD_TEXTURE_FILTER_BILINEAR": "bilinear",
"OSD_PERSPECTIVE_FILTER_ON": "Perspective filter enabled",
"OSD_PERSPECTIVE_FILTER_OFF": "Perspective filter disabled",
"OSD_FPS_COUNTER_ON": "FPS counter enabled",
"OSD_FPS_COUNTER_OFF": "FPS counter disabled",
"OSD_UNAVAILABLE_ITEM": "This item is not currently available",
"OSD_INVALID_ITEM": "Unknown item: %s",
"OSD_INVALID_ROOM": "Invalid room: %d. Valid rooms are 0-%d",
"OSD_INVALID_LEVEL": "Invalid level",
"OSD_INVALID_COMMAND": "Unknown command: %s",
"OSD_COMMAND_FAIL": "Failed to run: %s",
},
}

View file

@ -153,182 +153,5 @@
],
"strings": {
"HEADING_INVENTORY": "INVENTORY",
"HEADING_GAME_OVER": "GAME OVER",
"HEADING_OPTION": "OPTION",
"HEADING_ITEMS": "ITEMS",
"PASSPORT_SELECT_LEVEL": "Select Level",
"PASSPORT_RESTART_LEVEL": "Restart Level",
"PASSPORT_STORY_SO_FAR": "Story so far...",
"PASSPORT_LEGACY_SELECT_LEVEL_1": "Legacy saves do not",
"PASSPORT_LEGACY_SELECT_LEVEL_2": "support this feature.",
"PASSPORT_SELECT_MODE": "Select Mode",
"PASSPORT_MODE_NEW_GAME": "New Game",
"PASSPORT_MODE_NEW_GAME_PLUS": "New Game+",
"PASSPORT_MODE_NEW_GAME_JP": "Japanese NG",
"PASSPORT_MODE_NEW_GAME_JP_PLUS": "Japanese NG+",
"PASSPORT_NEW_GAME": "New Game",
"PASSPORT_LOAD_GAME": "Load Game",
"PASSPORT_SAVE_GAME": "Save Game",
"PASSPORT_EXIT_GAME": "Exit Game",
"PASSPORT_EXIT_TO_TITLE": "Exit to Title",
"DETAIL_SELECT_DETAIL": "Select Detail",
"DETAIL_LEVEL_HIGH": "High",
"DETAIL_LEVEL_MEDIUM": "Medium",
"DETAIL_LEVEL_LOW": "Low",
"DETAIL_FPS": "FPS",
"DETAIL_PERSPECTIVE": "Perspective",
"DETAIL_BILINEAR": "Bilinear",
"DETAIL_TEXTURE_FILTER": "Texture filter",
"DETAIL_FBO_FILTER": "FBO filter",
"DETAIL_VSYNC": "VSync",
"DETAIL_BRIGHTNESS": "Brightness",
"DETAIL_UI_TEXT_SCALE": "UI text scale",
"DETAIL_UI_BAR_SCALE": "UI bar scale",
"DETAIL_RENDER_MODE": "Render mode",
"DETAIL_RENDER_MODE_LEGACY": "Window size",
"DETAIL_RENDER_MODE_FBO": "Framebuffer",
"DETAIL_RESOLUTION": "Resolution",
"DETAIL_DECIMAL_FMT": "%d",
"DETAIL_STRING_FMT": "%s",
"DETAIL_FLOAT_FMT": "%.1f",
"DETAIL_RESOLUTION_FMT": "%dx%d",
"SOUND_SET_VOLUMES": "Set Volumes",
"CONTROL_CUSTOMIZE": "Customize Controls",
"CONTROL_KEYBOARD": "Keyboard",
"CONTROL_CONTROLLER": "Controller",
"CONTROL_DEFAULT_KEYS": "Default Keys",
"CONTROL_CUSTOM_1": "Custom Scheme 1",
"CONTROL_CUSTOM_2": "Custom Scheme 2",
"CONTROL_CUSTOM_3": "Custom Scheme 3",
"CONTROL_RESET_DEFAULTS_KEY": "Reset All: Hold R",
"CONTROL_UNBIND_KEY": "Unbind: Hold Backspace",
"CONTROL_RESET_DEFAULTS_BTN": "Reset All: Hold %s",
"CONTROL_UNBIND_BTN": "Unbind: Hold %s",
"KEYMAP_RUN": "Run",
"KEYMAP_BACK": "Back",
"KEYMAP_LEFT": "Left",
"KEYMAP_RIGHT": "Right",
"KEYMAP_STEP_LEFT": "Step Left",
"KEYMAP_STEP_RIGHT": "Step Right",
"KEYMAP_WALK": "Walk",
"KEYMAP_JUMP": "Jump",
"KEYMAP_ACTION": "Action",
"KEYMAP_DRAW_WEAPON": "Draw Weapon",
"KEYMAP_LOOK": "Look",
"KEYMAP_ROLL": "Roll",
"KEYMAP_INVENTORY": "Inventory",
"KEYMAP_PAUSE": "Pause",
"KEYMAP_FLY_CHEAT": "Fly Cheat",
"KEYMAP_ITEM_CHEAT": "Item Cheat",
"KEYMAP_LEVEL_SKIP_CHEAT": "Level Skip",
"KEYMAP_TURBO_CHEAT": "Turbo Speed",
"KEYMAP_ENTER_CONSOLE": "Enter Console",
"KEYMAP_CAMERA_UP": "Camera Up",
"KEYMAP_CAMERA_DOWN": "Camera Down",
"KEYMAP_CAMERA_LEFT": "Camera Left",
"KEYMAP_CAMERA_RIGHT": "Camera Right",
"KEYMAP_CAMERA_RESET": "Reset Camera",
"KEYMAP_EQUIP_PISTOLS": "Equip Pistols",
"KEYMAP_EQUIP_SHOTGUN": "Equip Shotgun",
"KEYMAP_EQUIP_MAGNUMS": "Equip Magnums",
"KEYMAP_EQUIP_UZIS": "Equip Uzis",
"KEYMAP_USE_SMALL_MEDI": "Small Medi",
"KEYMAP_USE_BIG_MEDI": "Large Medi",
"KEYMAP_SAVE": "Quick Save",
"KEYMAP_LOAD": "Quick Load",
"KEYMAP_FPS": "Show FPS",
"KEYMAP_BILINEAR": "Toggle Texture Filter",
"STATS_KILLS_DETAIL_FMT": "KILLS %d of %d",
"STATS_KILLS_BASIC_FMT": "KILLS %d",
"STATS_PICKUPS_DETAIL_FMT": "PICKUPS %d of %d",
"STATS_PICKUPS_BASIC_FMT": "PICKUPS %d",
"STATS_SECRETS_FMT": "SECRETS %d of %d",
"STATS_DEATHS_FMT": "DEATHS %d",
"STATS_TIME_TAKEN_FMT": "TIME TAKEN %s",
"STATS_FINAL_STATISTICS": "Final Statistics",
"STATS_BONUS_STATISTICS": "Bonus Statistics",
"PAUSE_PAUSED": "Paused",
"PAUSE_EXIT_TO_TITLE": "Exit to title?",
"PAUSE_CONTINUE": "Continue",
"PAUSE_QUIT": "Quit",
"PAUSE_ARE_YOU_SURE": "Are you sure?",
"PAUSE_YES": "Yes",
"PAUSE_NO": "No",
"MISC_ON": "On",
"MISC_OFF": "Off",
"MISC_EMPTY_SLOT_FMT": "- EMPTY SLOT %d -",
"MISC_DEMO_MODE": "Demo Mode",
"INV_ITEM_MEDI": "Small Medi Pack",
"INV_ITEM_BIG_MEDI": "Large Medi Pack",
"INV_ITEM_PUZZLE1": "Puzzle",
"INV_ITEM_PUZZLE2": "Puzzle",
"INV_ITEM_PUZZLE3": "Puzzle",
"INV_ITEM_PUZZLE4": "Puzzle",
"INV_ITEM_KEY1": "Key",
"INV_ITEM_KEY2": "Key",
"INV_ITEM_KEY3": "Key",
"INV_ITEM_KEY4": "Key",
"INV_ITEM_PICKUP1": "Pickup",
"INV_ITEM_PICKUP2": "Pickup",
"INV_ITEM_LEADBAR": "Lead Bar",
"INV_ITEM_SCION": "Scion",
"INV_ITEM_PISTOLS": "Pistols",
"INV_ITEM_SHOTGUN": "Shotgun",
"INV_ITEM_MAGNUM": "Magnums",
"INV_ITEM_UZI": "Uzis",
"INV_ITEM_GRENADE": "Grenade",
"INV_ITEM_PISTOL_AMMO": "Pistol Clips",
"INV_ITEM_SHOTGUN_AMMO": "Shotgun Shells",
"INV_ITEM_MAGNUM_AMMO": "Magnum Clips",
"INV_ITEM_UZI_AMMO": "Uzi Clips",
"INV_ITEM_COMPASS": "Compass",
"INV_ITEM_GAME": "Game",
"INV_ITEM_DETAILS": "Detail Levels",
"INV_ITEM_SOUND": "Sound",
"INV_ITEM_CONTROLS": "Controls",
"INV_ITEM_LARAS_HOME": "Lara's Home",
"OSD_FLY_MODE_ON": "Fly mode enabled",
"OSD_FLY_MODE_OFF": "Fly mode disabled",
"OSD_FPS_GET": "FPS currently set to %d",
"OSD_FPS_SET": "FPS set to %d",
"OSD_POS_GET": "Room: %d\nPosition: %.3f, %.3f, %.3f\nRotation: %.3f,%.3f,%.3f",
"OSD_POS_SET_POS": "Teleported to position: %.3f %.3f %.3f",
"OSD_POS_SET_POS_FAIL": "Failed to teleport to position: %.3f %.3f %.3f",
"OSD_POS_SET_ROOM": "Teleported to room: %d",
"OSD_POS_SET_ROOM_FAIL": "Failed to teleport to room: %d",
"OSD_SPEED_GET": "Current speed: %d",
"OSD_SPEED_SET": "Speed set to %d",
"OSD_BRAID_ON": "Braid enabled",
"OSD_BRAID_OFF": "Braid disabled",
"OSD_CHEATS_ON": "Cheats enabled",
"OSD_CHEATS_OFF": "Cheats disabled",
"OSD_GIVE_ITEM": "Added %s to Lara's inventory",
"OSD_GIVE_ITEM_ALL_KEYS": "Surprise! Every key item Lara needs is now in her backpack.",
"OSD_GIVE_ITEM_ALL_GUNS": "Lock'n'load - Lara's armed to the teeth!",
"OSD_GIVE_ITEM_CHEAT": "Lara's backpack just got way heavier!",
"OSD_FLIPMAP_ON": "Flipmap set to ON",
"OSD_FLIPMAP_OFF": "Flipmap set to OFF",
"OSD_FLIPMAP_FAIL_ALREADY_ON": "Flipmap is already ON",
"OSD_FLIPMAP_FAIL_ALREADY_OFF": "Flipmap is already OFF",
"OSD_KILL_ALL": "Poof! %d enemies gone!",
"OSD_KILL_ALL_FAIL": "Uh-oh, there are no enemies left to kill...",
"OSD_KILL": "Bye-bye!",
"OSD_KILL_FAIL": "No enemy nearby...",
"OSD_COMPLETE_LEVEL": "Level complete!",
"OSD_PLAY_LEVEL": "Loading %s",
"OSD_TEXTURE_FILTER_SET": "Texture filter set to %s",
"OSD_TEXTURE_FILTER_NN": "nearest-neighbor",
"OSD_TEXTURE_FILTER_BILINEAR": "bilinear",
"OSD_PERSPECTIVE_FILTER_ON": "Perspective filter enabled",
"OSD_PERSPECTIVE_FILTER_OFF": "Perspective filter disabled",
"OSD_FPS_COUNTER_ON": "FPS counter enabled",
"OSD_FPS_COUNTER_OFF": "FPS counter disabled",
"OSD_UNAVAILABLE_ITEM": "This item is not currently available",
"OSD_INVALID_ITEM": "Unknown item: %s",
"OSD_INVALID_ROOM": "Invalid room: %d. Valid rooms are 0-%d",
"OSD_INVALID_LEVEL": "Invalid level",
"OSD_INVALID_COMMAND": "Unknown command: %s",
"OSD_COMMAND_FAIL": "Failed to run: %s",
},
}

View file

@ -60,7 +60,7 @@ package-win-all: (build-win "release") (build-win-config) (_docker
package-win-installer: (build-win "release") (build-win-config) (_docker_run "rrdash/tr1x" "package" "-o" "tools/installer/Installer/Resources/release.zip") (build-win-installer)
#!/bin/sh
git checkout "tools/installer/Installer/Resources/release.zip"
exe_name=$(tools/generate_version)-Installer.exe
exe_name=$(tools/get_version)-Installer.exe
cp tools/installer/out/TR1X_Installer.exe "${exe_name}"
echo "Created ${exe_name}"

View file

@ -119,6 +119,7 @@ sources = [
'src/game/game/game.c',
'src/game/game/game_draw.c',
'src/game/game/game_main_menu.c',
'src/game/game_string.c',
'src/game/gamebuf.c',
'src/game/gameflow.c',
'src/game/gun/gun.c',

View file

@ -18,9 +18,6 @@
#include <stdio.h>
#include <string.h>
#define Q(x) #x
#define QUOTE(x) Q(x)
CONFIG g_Config = { 0 };
static const char *m_TR1XGlobalSettingsPath = "cfg/TR1X.json5";

View file

@ -2,7 +2,7 @@
#include "game/clock.h"
#include "game/console.h"
#include "game/gameflow.h"
#include "game/game_string.h"
#include "game/interpolation.h"
#include "game/phase/phase.h"
#include "global/vars.h"
@ -33,7 +33,7 @@ void Clock_SetTurboSpeed(const int32_t idx)
m_TurboSpeedIdx = idx - TURBO_SPEED_OFFSET;
CLAMP(m_TurboSpeedIdx, 0, TURBO_SPEED_COUNT - 1);
LOG_INFO("Setting speed to %d (%.2f)", idx, Clock_GetSpeedMultiplier());
Console_Log(g_GameFlow.strings[GS_OSD_SPEED_SET], Clock_GetTurboSpeed());
Console_Log(GS(OSD_SPEED_SET), Clock_GetTurboSpeed());
}
int32_t Clock_GetTurboSpeed(void)

View file

@ -3,7 +3,7 @@
#include "config.h"
#include "game/clock.h"
#include "game/console_cmd.h"
#include "game/gameflow.h"
#include "game/game_string.h"
#include "game/input.h"
#include "game/output.h"
#include "game/screen.h"
@ -147,13 +147,11 @@ void Console_Confirm(void)
}
if (matching_cmd == NULL) {
Console_Log(
g_GameFlow.strings[GS_OSD_INVALID_COMMAND], m_Prompt.text);
Console_Log(GS(OSD_INVALID_COMMAND), m_Prompt.text);
} else {
bool success = matching_cmd->proc(args);
if (!success) {
Console_Log(
g_GameFlow.strings[GS_OSD_COMMAND_FAIL], m_Prompt.text);
Console_Log(GS(OSD_COMMAND_FAIL), m_Prompt.text);
}
}
}

View file

@ -5,6 +5,7 @@
#include "game/clock.h"
#include "game/console.h"
#include "game/effects/exploding_death.h"
#include "game/game_string.h"
#include "game/gameflow.h"
#include "game/inventory.h"
#include "game/inventory/inventory_vars.h"
@ -120,18 +121,18 @@ static bool Console_Cmd_Fps(const char *const args)
{
if (String_Equivalent(args, "60")) {
g_Config.rendering.fps = 60;
Console_Log(g_GameFlow.strings[GS_OSD_FPS_SET], g_Config.rendering.fps);
Console_Log(GS(OSD_FPS_SET), g_Config.rendering.fps);
return true;
}
if (String_Equivalent(args, "30")) {
g_Config.rendering.fps = 30;
Console_Log(g_GameFlow.strings[GS_OSD_FPS_SET], g_Config.rendering.fps);
Console_Log(GS(OSD_FPS_SET), g_Config.rendering.fps);
return true;
}
if (String_Equivalent(args, "")) {
Console_Log(g_GameFlow.strings[GS_OSD_FPS_GET], g_Config.rendering.fps);
Console_Log(GS(OSD_FPS_GET), g_Config.rendering.fps);
return true;
}
@ -145,7 +146,7 @@ static bool Console_Cmd_Pos(const char *const args)
}
Console_Log(
g_GameFlow.strings[GS_OSD_POS_GET], g_LaraItem->room_number,
GS(OSD_POS_GET), g_LaraItem->room_number,
g_LaraItem->pos.x / (float)WALL_L, g_LaraItem->pos.y / (float)WALL_L,
g_LaraItem->pos.z / (float)WALL_L,
g_LaraItem->rot.x * 360.0f / (float)PHD_ONE,
@ -171,11 +172,11 @@ static bool Console_Cmd_Teleport(const char *const args)
}
if (Item_Teleport(g_LaraItem, x * WALL_L, y * WALL_L, z * WALL_L)) {
Console_Log(g_GameFlow.strings[GS_OSD_POS_SET_POS], x, y, z);
Console_Log(GS(OSD_POS_SET_POS), x, y, z);
return true;
}
Console_Log(g_GameFlow.strings[GS_OSD_POS_SET_POS_FAIL], x, y, z);
Console_Log(GS(OSD_POS_SET_POS_FAIL), x, y, z);
return true;
}
}
@ -184,9 +185,7 @@ static bool Console_Cmd_Teleport(const char *const args)
int16_t room_num = -1;
if (sscanf(args, "%hd", &room_num) == 1) {
if (room_num < 0 || room_num >= g_RoomCount) {
Console_Log(
g_GameFlow.strings[GS_OSD_INVALID_ROOM], room_num,
g_RoomCount - 1);
Console_Log(GS(OSD_INVALID_ROOM), room_num, g_RoomCount - 1);
return true;
}
@ -204,13 +203,12 @@ static bool Console_Cmd_Teleport(const char *const args)
int32_t y = y1;
int32_t z = z1 + Random_GetControl() * (z2 - z1) / 0x7FFF;
if (Item_Teleport(g_LaraItem, x, y, z)) {
Console_Log(
g_GameFlow.strings[GS_OSD_POS_SET_ROOM], room_num);
Console_Log(GS(OSD_POS_SET_ROOM), room_num);
return true;
}
}
Console_Log(g_GameFlow.strings[GS_OSD_POS_SET_ROOM_FAIL], room_num);
Console_Log(GS(OSD_POS_SET_ROOM_FAIL), room_num);
return true;
}
}
@ -223,7 +221,7 @@ static bool Console_Cmd_Fly(const char *const args)
if (!g_Objects[O_LARA].loaded) {
return false;
}
Console_Log(g_GameFlow.strings[GS_OSD_FLY_MODE_ON]);
Console_Log(GS(OSD_FLY_MODE_ON));
Lara_Cheat_EnterFlyMode();
return true;
}
@ -231,8 +229,7 @@ static bool Console_Cmd_Fly(const char *const args)
static bool Console_Cmd_Speed(const char *const args)
{
if (strcmp(args, "") == 0) {
Console_Log(
g_GameFlow.strings[GS_OSD_SPEED_GET], Clock_GetTurboSpeed());
Console_Log(GS(OSD_SPEED_GET), Clock_GetTurboSpeed());
return true;
}
@ -249,13 +246,13 @@ static bool Console_Cmd_Braid(const char *const args)
{
if (String_Equivalent(args, "off")) {
g_Config.enable_braid = 0;
Console_Log(g_GameFlow.strings[GS_OSD_BRAID_OFF]);
Console_Log(GS(OSD_BRAID_OFF));
return true;
}
if (String_Equivalent(args, "on")) {
g_Config.enable_braid = 1;
Console_Log(g_GameFlow.strings[GS_OSD_BRAID_ON]);
Console_Log(GS(OSD_BRAID_ON));
return true;
}
@ -266,13 +263,13 @@ static bool Console_Cmd_Cheats(const char *const args)
{
if (String_Equivalent(args, "off")) {
g_Config.enable_cheats = false;
Console_Log(g_GameFlow.strings[GS_OSD_CHEATS_OFF]);
Console_Log(GS(OSD_CHEATS_OFF));
return true;
}
if (String_Equivalent(args, "on")) {
g_Config.enable_cheats = true;
Console_Log(g_GameFlow.strings[GS_OSD_CHEATS_ON]);
Console_Log(GS(OSD_CHEATS_ON));
return true;
}
@ -310,9 +307,9 @@ static bool Console_Cmd_GiveItem(const char *args)
if (g_Objects[desc->obj_id].loaded) {
Inv_AddItemNTimes(desc->obj_id, num);
Console_Log(g_GameFlow.strings[GS_OSD_GIVE_ITEM], desc_name);
Console_Log(GS(OSD_GIVE_ITEM), desc_name);
} else {
Console_Log(g_GameFlow.strings[GS_OSD_UNAVAILABLE_ITEM]);
Console_Log(GS(OSD_UNAVAILABLE_ITEM));
}
return true;
@ -329,7 +326,7 @@ static bool Console_Cmd_GiveItem(const char *args)
Inv_AddItem(O_KEY_ITEM4);
Inv_AddItem(O_PICKUP_ITEM1);
Inv_AddItem(O_PICKUP_ITEM2);
Console_Log(g_GameFlow.strings[GS_OSD_GIVE_ITEM_ALL_KEYS]);
Console_Log(GS(OSD_GIVE_ITEM_ALL_KEYS));
return true;
}
@ -341,11 +338,11 @@ static bool Console_Cmd_GiveItem(const char *args)
g_Lara.shotgun.ammo = g_GameInfo.bonus_flag & GBF_NGPLUS ? 10001 : 300;
g_Lara.magnums.ammo = g_GameInfo.bonus_flag & GBF_NGPLUS ? 10001 : 1000;
g_Lara.uzis.ammo = g_GameInfo.bonus_flag & GBF_NGPLUS ? 10001 : 2000;
Console_Log(g_GameFlow.strings[GS_OSD_GIVE_ITEM_ALL_GUNS]);
Console_Log(GS(OSD_GIVE_ITEM_ALL_GUNS));
return true;
}
Console_Log(g_GameFlow.strings[GS_OSD_INVALID_ITEM], args);
Console_Log(GS(OSD_INVALID_ITEM), args);
return true;
}
@ -354,7 +351,7 @@ static bool Console_Cmd_FlipMap(const char *args)
bool flip = false;
if (String_Equivalent(args, "on")) {
if (g_FlipStatus) {
Console_Log(g_GameFlow.strings[GS_OSD_FLIPMAP_FAIL_ALREADY_OFF]);
Console_Log(GS(OSD_FLIPMAP_FAIL_ALREADY_OFF));
return true;
} else {
flip = true;
@ -363,7 +360,7 @@ static bool Console_Cmd_FlipMap(const char *args)
if (String_Equivalent(args, "off")) {
if (!g_FlipStatus) {
Console_Log(g_GameFlow.strings[GS_OSD_FLIPMAP_FAIL_ALREADY_OFF]);
Console_Log(GS(OSD_FLIPMAP_FAIL_ALREADY_OFF));
return true;
} else {
flip = true;
@ -377,9 +374,9 @@ static bool Console_Cmd_FlipMap(const char *args)
if (flip) {
Room_FlipMap();
if (g_FlipStatus) {
Console_Log(g_GameFlow.strings[GS_OSD_FLIPMAP_ON]);
Console_Log(GS(OSD_FLIPMAP_ON));
} else {
Console_Log(g_GameFlow.strings[GS_OSD_FLIPMAP_OFF]);
Console_Log(GS(OSD_FLIPMAP_OFF));
}
return true;
}
@ -404,9 +401,9 @@ static bool Console_Cmd_Kill(const char *args)
}
if (num > 0) {
Sound_Effect(SFX_EXPLOSION_CHEAT, &g_LaraItem->pos, SPM_NORMAL);
Console_Log(g_GameFlow.strings[GS_OSD_KILL_ALL], num);
Console_Log(GS(OSD_KILL_ALL), num);
} else {
Console_Log(g_GameFlow.strings[GS_OSD_KILL_ALL_FAIL], num);
Console_Log(GS(OSD_KILL_ALL_FAIL), num);
}
return true;
}
@ -435,9 +432,9 @@ static bool Console_Cmd_Kill(const char *args)
}
if (found_anything) {
Console_Log(g_GameFlow.strings[GS_OSD_KILL]);
Console_Log(GS(OSD_KILL));
} else {
Console_Log(g_GameFlow.strings[GS_OSD_KILL_FAIL]);
Console_Log(GS(OSD_KILL_FAIL));
}
return true;
}
@ -480,7 +477,7 @@ static bool Console_Cmd_Level(const char *args)
}
if (level_to_load >= g_GameFlow.level_count) {
Console_Log(g_GameFlow.strings[GS_OSD_INVALID_LEVEL]);
Console_Log(GS(OSD_INVALID_LEVEL));
return true;
}
@ -488,8 +485,7 @@ static bool Console_Cmd_Level(const char *args)
g_GameInfo.select_level_num = level_to_load;
g_LevelComplete = true;
Console_Log(
g_GameFlow.strings[GS_OSD_PLAY_LEVEL],
g_GameFlow.levels[level_to_load].level_title);
GS(OSD_PLAY_LEVEL), g_GameFlow.levels[level_to_load].level_title);
return true;
}

57
src/game/game_string.c Normal file
View file

@ -0,0 +1,57 @@
#include "game_string.h"
#include "memory.h"
#include "util.h"
#include <assert.h>
#include <stddef.h>
#include <string.h>
typedef struct ENUM_NAME_MAP {
const char *str;
const GAME_STRING_ID val;
} ENUM_NAME_MAP;
static ENUM_NAME_MAP m_EnumNameMap[];
static char *m_StringMap[GS_NUMBER_OF] = { 0 };
#undef GS_DEFINE
#define GS_DEFINE(id, str) str,
static const char *m_DefaultStringMap[GS_NUMBER_OF] = {
#include "game/game_string.def"
};
#undef GS_DEFINE
#define GS_DEFINE(id, str) \
{ \
QUOTE(id), \
GS_##id, \
},
static ENUM_NAME_MAP m_EnumNameMap[] = {
#include "game/game_string.def"
{ NULL, 0 },
};
void GameString_Set(GAME_STRING_ID id, const char *value)
{
assert(id >= 0);
assert(id < GS_NUMBER_OF);
Memory_FreePointer(&m_StringMap[id]);
m_StringMap[id] = Memory_DupStr(value);
}
const char *GameString_Get(GAME_STRING_ID id)
{
return m_StringMap[id] != NULL ? (const char *)m_StringMap[id]
: m_DefaultStringMap[id];
}
GAME_STRING_ID GameString_IDFromEnum(const char *const str)
{
const ENUM_NAME_MAP *current = &m_EnumNameMap[0];
while (current->str) {
if (!strcmp(str, current->str)) {
return current->val;
}
current++;
}
return GS_INVALID;
}

177
src/game/game_string.def Normal file
View file

@ -0,0 +1,177 @@
GS_DEFINE(HEADING_INVENTORY, "INVENTORY")
GS_DEFINE(HEADING_GAME_OVER, "GAME OVER")
GS_DEFINE(HEADING_OPTION, "OPTION")
GS_DEFINE(HEADING_ITEMS, "ITEMS")
GS_DEFINE(PASSPORT_SELECT_LEVEL, "Select Level")
GS_DEFINE(PASSPORT_RESTART_LEVEL, "Restart Level")
GS_DEFINE(PASSPORT_STORY_SO_FAR, "Story so far...")
GS_DEFINE(PASSPORT_LEGACY_SELECT_LEVEL_1, "Legacy saves do not")
GS_DEFINE(PASSPORT_LEGACY_SELECT_LEVEL_2, "support this feature.")
GS_DEFINE(PASSPORT_SELECT_MODE, "Select Mode")
GS_DEFINE(PASSPORT_MODE_NEW_GAME, "New Game")
GS_DEFINE(PASSPORT_MODE_NEW_GAME_PLUS, "New Game+")
GS_DEFINE(PASSPORT_MODE_NEW_GAME_JP, "Japanese NG")
GS_DEFINE(PASSPORT_MODE_NEW_GAME_JP_PLUS, "Japanese NG+")
GS_DEFINE(PASSPORT_NEW_GAME, "New Game")
GS_DEFINE(PASSPORT_LOAD_GAME, "Load Game")
GS_DEFINE(PASSPORT_SAVE_GAME, "Save Game")
GS_DEFINE(PASSPORT_EXIT_GAME, "Exit Game")
GS_DEFINE(PASSPORT_EXIT_TO_TITLE, "Exit to Title")
GS_DEFINE(DETAIL_SELECT_DETAIL, "Select Detail")
GS_DEFINE(DETAIL_LEVEL_HIGH, "High")
GS_DEFINE(DETAIL_LEVEL_MEDIUM, "Medium")
GS_DEFINE(DETAIL_LEVEL_LOW, "Low")
GS_DEFINE(DETAIL_FPS, "FPS")
GS_DEFINE(DETAIL_PERSPECTIVE, "Perspective")
GS_DEFINE(DETAIL_BILINEAR, "Bilinear")
GS_DEFINE(DETAIL_TEXTURE_FILTER, "Texture filter")
GS_DEFINE(DETAIL_FBO_FILTER, "FBO filter")
GS_DEFINE(DETAIL_VSYNC, "VSync")
GS_DEFINE(DETAIL_BRIGHTNESS, "Brightness")
GS_DEFINE(DETAIL_UI_TEXT_SCALE, "UI text scale")
GS_DEFINE(DETAIL_UI_BAR_SCALE, "UI bar scale")
GS_DEFINE(DETAIL_RENDER_MODE, "Render mode")
GS_DEFINE(DETAIL_RENDER_MODE_LEGACY, "Window size")
GS_DEFINE(DETAIL_RENDER_MODE_FBO, "Framebuffer")
GS_DEFINE(DETAIL_RESOLUTION, "Resolution")
GS_DEFINE(DETAIL_DECIMAL_FMT, "%d")
GS_DEFINE(DETAIL_STRING_FMT, "%s")
GS_DEFINE(DETAIL_FLOAT_FMT, "%.1f")
GS_DEFINE(DETAIL_RESOLUTION_FMT, "%dx%d")
GS_DEFINE(SOUND_SET_VOLUMES, "Set Volumes")
GS_DEFINE(CONTROL_CUSTOMIZE, "Customize Controls")
GS_DEFINE(CONTROL_KEYBOARD, "Keyboard")
GS_DEFINE(CONTROL_CONTROLLER, "Controller")
GS_DEFINE(CONTROL_DEFAULT_KEYS, "Default Keys")
GS_DEFINE(CONTROL_CUSTOM_1, "Custom Scheme 1")
GS_DEFINE(CONTROL_CUSTOM_2, "Custom Scheme 2")
GS_DEFINE(CONTROL_CUSTOM_3, "Custom Scheme 3")
GS_DEFINE(CONTROL_RESET_DEFAULTS_KEY, "Reset All: Hold R")
GS_DEFINE(CONTROL_UNBIND_KEY, "Unbind: Hold Backspace")
GS_DEFINE(CONTROL_RESET_DEFAULTS_BTN, "Reset All: Hold %s")
GS_DEFINE(CONTROL_UNBIND_BTN, "Unbind: Hold %s")
GS_DEFINE(KEYMAP_RUN, "Run")
GS_DEFINE(KEYMAP_BACK, "Back")
GS_DEFINE(KEYMAP_LEFT, "Left")
GS_DEFINE(KEYMAP_RIGHT, "Right")
GS_DEFINE(KEYMAP_STEP_LEFT, "Step Left")
GS_DEFINE(KEYMAP_STEP_RIGHT, "Step Right")
GS_DEFINE(KEYMAP_WALK, "Walk")
GS_DEFINE(KEYMAP_JUMP, "Jump")
GS_DEFINE(KEYMAP_ACTION, "Action")
GS_DEFINE(KEYMAP_DRAW_WEAPON, "Draw Weapon")
GS_DEFINE(KEYMAP_LOOK, "Look")
GS_DEFINE(KEYMAP_ROLL, "Roll")
GS_DEFINE(KEYMAP_INVENTORY, "Inventory")
GS_DEFINE(KEYMAP_PAUSE, "Pause")
GS_DEFINE(KEYMAP_FLY_CHEAT, "Fly Cheat")
GS_DEFINE(KEYMAP_ITEM_CHEAT, "Item Cheat")
GS_DEFINE(KEYMAP_LEVEL_SKIP_CHEAT, "Level Skip")
GS_DEFINE(KEYMAP_TURBO_CHEAT, "Turbo Speed")
GS_DEFINE(KEYMAP_ENTER_CONSOLE, "Enter Console")
GS_DEFINE(KEYMAP_CAMERA_UP, "Camera Up")
GS_DEFINE(KEYMAP_CAMERA_DOWN, "Camera Down")
GS_DEFINE(KEYMAP_CAMERA_LEFT, "Camera Left")
GS_DEFINE(KEYMAP_CAMERA_RIGHT, "Camera Right")
GS_DEFINE(KEYMAP_CAMERA_RESET, "Reset Camera")
GS_DEFINE(KEYMAP_EQUIP_PISTOLS, "Equip Pistols")
GS_DEFINE(KEYMAP_EQUIP_SHOTGUN, "Equip Shotgun")
GS_DEFINE(KEYMAP_EQUIP_MAGNUMS, "Equip Magnums")
GS_DEFINE(KEYMAP_EQUIP_UZIS, "Equip Uzis")
GS_DEFINE(KEYMAP_USE_SMALL_MEDI, "Small Medi")
GS_DEFINE(KEYMAP_USE_BIG_MEDI, "Large Medi")
GS_DEFINE(KEYMAP_SAVE, "Quick Save")
GS_DEFINE(KEYMAP_LOAD, "Quick Load")
GS_DEFINE(KEYMAP_FPS, "Show FPS")
GS_DEFINE(KEYMAP_BILINEAR, "Toggle Texture Filter")
GS_DEFINE(STATS_KILLS_DETAIL_FMT, "KILLS %d of %d")
GS_DEFINE(STATS_KILLS_BASIC_FMT, "KILLS %d")
GS_DEFINE(STATS_PICKUPS_DETAIL_FMT, "PICKUPS %d of %d")
GS_DEFINE(STATS_PICKUPS_BASIC_FMT, "PICKUPS %d")
GS_DEFINE(STATS_SECRETS_FMT, "SECRETS %d of %d")
GS_DEFINE(STATS_DEATHS_FMT, "DEATHS %d")
GS_DEFINE(STATS_TIME_TAKEN_FMT, "TIME TAKEN %s")
GS_DEFINE(STATS_FINAL_STATISTICS, "Final Statistics")
GS_DEFINE(STATS_BONUS_STATISTICS, "Bonus Statistics")
GS_DEFINE(PAUSE_PAUSED, "Paused")
GS_DEFINE(PAUSE_EXIT_TO_TITLE, "Exit to title?")
GS_DEFINE(PAUSE_CONTINUE, "Continue")
GS_DEFINE(PAUSE_QUIT, "Quit")
GS_DEFINE(PAUSE_ARE_YOU_SURE, "Are you sure?")
GS_DEFINE(PAUSE_YES, "Yes")
GS_DEFINE(PAUSE_NO, "No")
GS_DEFINE(MISC_ON, "On")
GS_DEFINE(MISC_OFF, "Off")
GS_DEFINE(MISC_EMPTY_SLOT_FMT, "- EMPTY SLOT %d -")
GS_DEFINE(MISC_DEMO_MODE, "Demo Mode")
GS_DEFINE(INV_ITEM_MEDI, "Small Medi Pack")
GS_DEFINE(INV_ITEM_BIG_MEDI, "Large Medi Pack")
GS_DEFINE(INV_ITEM_PUZZLE1, "Puzzle")
GS_DEFINE(INV_ITEM_PUZZLE2, "Puzzle")
GS_DEFINE(INV_ITEM_PUZZLE3, "Puzzle")
GS_DEFINE(INV_ITEM_PUZZLE4, "Puzzle")
GS_DEFINE(INV_ITEM_KEY1, "Key")
GS_DEFINE(INV_ITEM_KEY2, "Key")
GS_DEFINE(INV_ITEM_KEY3, "Key")
GS_DEFINE(INV_ITEM_KEY4, "Key")
GS_DEFINE(INV_ITEM_PICKUP1, "Pickup")
GS_DEFINE(INV_ITEM_PICKUP2, "Pickup")
GS_DEFINE(INV_ITEM_LEADBAR, "Lead Bar")
GS_DEFINE(INV_ITEM_SCION, "Scion")
GS_DEFINE(INV_ITEM_PISTOLS, "Pistols")
GS_DEFINE(INV_ITEM_SHOTGUN, "Shotgun")
GS_DEFINE(INV_ITEM_MAGNUM, "Magnums")
GS_DEFINE(INV_ITEM_UZI, "Uzis")
GS_DEFINE(INV_ITEM_GRENADE, "Grenade")
GS_DEFINE(INV_ITEM_PISTOL_AMMO, "Pistol Clips")
GS_DEFINE(INV_ITEM_SHOTGUN_AMMO, "Shotgun Shells")
GS_DEFINE(INV_ITEM_MAGNUM_AMMO, "Magnum Clips")
GS_DEFINE(INV_ITEM_UZI_AMMO, "Uzi Clips")
GS_DEFINE(INV_ITEM_COMPASS, "Compass")
GS_DEFINE(INV_ITEM_GAME, "Game")
GS_DEFINE(INV_ITEM_DETAILS, "Detail Levels")
GS_DEFINE(INV_ITEM_SOUND, "Sound")
GS_DEFINE(INV_ITEM_CONTROLS, "Controls")
GS_DEFINE(INV_ITEM_LARAS_HOME, "Lara's Home")
GS_DEFINE(OSD_FLY_MODE_ON, "Fly mode enabled")
GS_DEFINE(OSD_FLY_MODE_OFF, "Fly mode disabled")
GS_DEFINE(OSD_FPS_GET, "FPS currently set to %d")
GS_DEFINE(OSD_FPS_SET, "FPS set to %d")
GS_DEFINE(OSD_POS_GET, "Room: %d\nPosition: %.3f, %.3f, %.3f\nRotation: %.3f,%.3f,%.3f")
GS_DEFINE(OSD_POS_SET_POS, "Teleported to position: %.3f %.3f %.3f")
GS_DEFINE(OSD_POS_SET_POS_FAIL, "Failed to teleport to position: %.3f %.3f %.3f")
GS_DEFINE(OSD_POS_SET_ROOM, "Teleported to room: %d")
GS_DEFINE(OSD_POS_SET_ROOM_FAIL, "Failed to teleport to room: %d")
GS_DEFINE(OSD_SPEED_GET, "Current speed: %d")
GS_DEFINE(OSD_SPEED_SET, "Speed set to %d")
GS_DEFINE(OSD_BRAID_ON, "Braid enabled")
GS_DEFINE(OSD_BRAID_OFF, "Braid disabled")
GS_DEFINE(OSD_CHEATS_ON, "Cheats enabled")
GS_DEFINE(OSD_CHEATS_OFF, "Cheats disabled")
GS_DEFINE(OSD_GIVE_ITEM, "Added %s to Lara's inventory")
GS_DEFINE(OSD_GIVE_ITEM_ALL_KEYS, "Surprise! Every key item Lara needs is now in her backpack.")
GS_DEFINE(OSD_GIVE_ITEM_ALL_GUNS, "Lock'n'load - Lara's armed to the teeth!")
GS_DEFINE(OSD_GIVE_ITEM_CHEAT, "Lara's backpack just got way heavier!")
GS_DEFINE(OSD_FLIPMAP_ON, "Flipmap set to ON")
GS_DEFINE(OSD_FLIPMAP_OFF, "Flipmap set to OFF")
GS_DEFINE(OSD_FLIPMAP_FAIL_ALREADY_ON, "Flipmap is already ON")
GS_DEFINE(OSD_FLIPMAP_FAIL_ALREADY_OFF, "Flipmap is already OFF")
GS_DEFINE(OSD_KILL_ALL, "Poof! %d enemies gone!")
GS_DEFINE(OSD_KILL_ALL_FAIL, "Uh-oh, there are no enemies left to kill...")
GS_DEFINE(OSD_KILL, "Bye-bye!")
GS_DEFINE(OSD_KILL_FAIL, "No enemy nearby...")
GS_DEFINE(OSD_COMPLETE_LEVEL, "Level complete!")
GS_DEFINE(OSD_PLAY_LEVEL, "Loading %s")
GS_DEFINE(OSD_TEXTURE_FILTER_SET, "Texture filter set to %s")
GS_DEFINE(OSD_TEXTURE_FILTER_NN, "nearest-neighbor")
GS_DEFINE(OSD_TEXTURE_FILTER_BILINEAR, "bilinear")
GS_DEFINE(OSD_PERSPECTIVE_FILTER_ON, "Perspective filter enabled")
GS_DEFINE(OSD_PERSPECTIVE_FILTER_OFF, "Perspective filter disabled")
GS_DEFINE(OSD_FPS_COUNTER_ON, "FPS counter enabled")
GS_DEFINE(OSD_FPS_COUNTER_OFF, "FPS counter disabled")
GS_DEFINE(OSD_UNAVAILABLE_ITEM, "This item is not currently available")
GS_DEFINE(OSD_INVALID_ITEM, "Unknown item: %s")
GS_DEFINE(OSD_INVALID_ROOM, "Invalid room: %d. Valid rooms are 0-%d")
GS_DEFINE(OSD_INVALID_LEVEL, "Invalid level")
GS_DEFINE(OSD_INVALID_COMMAND, "Unknown command: %s")
GS_DEFINE(OSD_COMMAND_FAIL, "Failed to run: %s")

15
src/game/game_string.h Normal file
View file

@ -0,0 +1,15 @@
#pragma once
#define GS(id) GameString_Get(GS_##id)
#undef GS_DEFINE
#define GS_DEFINE(id, str) GS_##id,
typedef enum GAME_STRING_ID {
GS_INVALID = -1,
#include "game/game_string.def"
GS_NUMBER_OF,
} GAME_STRING_ID;
void GameString_Set(GAME_STRING_ID id, const char *value);
const char *GameString_Get(GAME_STRING_ID id);
GAME_STRING_ID GameString_IDFromEnum(const char *str);

View file

@ -4,6 +4,7 @@
#include "filesystem.h"
#include "game/fmv.h"
#include "game/game.h"
#include "game/game_string.h"
#include "game/inventory.h"
#include "game/inventory/inventory_vars.h"
#include "game/lara.h"
@ -22,11 +23,6 @@
#include <string.h>
typedef struct ENUM_TO_STRING {
const char *str;
const int32_t val;
} ENUM_TO_STRING;
typedef struct GAMEFLOW_DISPLAY_PICTURE_DATA {
char *path;
double display_time;
@ -43,199 +39,6 @@ typedef struct GAMEFLOW_GIVE_ITEM_DATA {
int quantity;
} GAMEFLOW_GIVE_ITEM_DATA;
static GAME_STRING_ID GameFlow_StringToGameStringID(const char *str)
{
static const ENUM_TO_STRING map[] = {
{ "HEADING_INVENTORY", GS_HEADING_INVENTORY },
{ "HEADING_GAME_OVER", GS_HEADING_GAME_OVER },
{ "HEADING_OPTION", GS_HEADING_OPTION },
{ "HEADING_ITEMS", GS_HEADING_ITEMS },
{ "PASSPORT_SELECT_LEVEL", GS_PASSPORT_SELECT_LEVEL },
{ "PASSPORT_RESTART_LEVEL", GS_PASSPORT_RESTART_LEVEL },
{ "PASSPORT_STORY_SO_FAR", GS_PASSPORT_STORY_SO_FAR },
{ "PASSPORT_LEGACY_SELECT_LEVEL_1", GS_PASSPORT_LEGACY_SELECT_LEVEL_1 },
{ "PASSPORT_LEGACY_SELECT_LEVEL_2", GS_PASSPORT_LEGACY_SELECT_LEVEL_2 },
{ "PASSPORT_SELECT_MODE", GS_PASSPORT_SELECT_MODE },
{ "PASSPORT_MODE_NEW_GAME", GS_PASSPORT_MODE_NEW_GAME },
{ "PASSPORT_MODE_NEW_GAME_PLUS", GS_PASSPORT_MODE_NEW_GAME_PLUS },
{ "PASSPORT_MODE_NEW_GAME_JP", GS_PASSPORT_MODE_NEW_GAME_JP },
{ "PASSPORT_MODE_NEW_GAME_JP_PLUS", GS_PASSPORT_MODE_NEW_GAME_JP_PLUS },
{ "PASSPORT_NEW_GAME", GS_PASSPORT_NEW_GAME },
{ "PASSPORT_LOAD_GAME", GS_PASSPORT_LOAD_GAME },
{ "PASSPORT_SAVE_GAME", GS_PASSPORT_SAVE_GAME },
{ "PASSPORT_EXIT_GAME", GS_PASSPORT_EXIT_GAME },
{ "PASSPORT_EXIT_TO_TITLE", GS_PASSPORT_EXIT_TO_TITLE },
{ "DETAIL_SELECT_DETAIL", GS_DETAIL_SELECT_DETAIL },
{ "DETAIL_LEVEL_HIGH", GS_DETAIL_LEVEL_HIGH },
{ "DETAIL_LEVEL_MEDIUM", GS_DETAIL_LEVEL_MEDIUM },
{ "DETAIL_LEVEL_LOW", GS_DETAIL_LEVEL_LOW },
{ "DETAIL_PERSPECTIVE", GS_DETAIL_PERSPECTIVE },
{ "DETAIL_FPS", GS_DETAIL_FPS },
{ "DETAIL_DECIMAL_FMT", GS_DETAIL_DECIMAL_FMT },
{ "DETAIL_BILINEAR", GS_DETAIL_BILINEAR },
{ "DETAIL_TEXTURE_FILTER", GS_DETAIL_TEXTURE_FILTER },
{ "DETAIL_FBO_FILTER", GS_DETAIL_FBO_FILTER },
{ "DETAIL_VSYNC", GS_DETAIL_VSYNC },
{ "DETAIL_BRIGHTNESS", GS_DETAIL_BRIGHTNESS },
{ "DETAIL_UI_TEXT_SCALE", GS_DETAIL_UI_TEXT_SCALE },
{ "DETAIL_UI_BAR_SCALE", GS_DETAIL_UI_BAR_SCALE },
{ "DETAIL_RENDER_MODE", GS_DETAIL_RENDER_MODE },
{ "DETAIL_RENDER_MODE_LEGACY", GS_DETAIL_RENDER_MODE_LEGACY },
{ "DETAIL_RENDER_MODE_FBO", GS_DETAIL_RENDER_MODE_FBO },
{ "DETAIL_RESOLUTION", GS_DETAIL_RESOLUTION },
{ "DETAIL_STRING_FMT", GS_DETAIL_STRING_FMT },
{ "DETAIL_FLOAT_FMT", GS_DETAIL_FLOAT_FMT },
{ "DETAIL_RESOLUTION_FMT", GS_DETAIL_RESOLUTION_FMT },
{ "SOUND_SET_VOLUMES", GS_SOUND_SET_VOLUMES },
{ "CONTROL_CUSTOMIZE", GS_CONTROL_CUSTOMIZE },
{ "CONTROL_KEYBOARD", GS_CONTROL_KEYBOARD },
{ "CONTROL_CONTROLLER", GS_CONTROL_CONTROLLER },
{ "CONTROL_DEFAULT_KEYS", GS_CONTROL_DEFAULT_KEYS },
{ "CONTROL_CUSTOM_1", GS_CONTROL_CUSTOM_1 },
{ "CONTROL_CUSTOM_2", GS_CONTROL_CUSTOM_2 },
{ "CONTROL_CUSTOM_3", GS_CONTROL_CUSTOM_3 },
{ "CONTROL_RESET_DEFAULTS_KEY", GS_CONTROL_RESET_DEFAULTS_KEY },
{ "CONTROL_UNBIND_KEY", GS_CONTROL_UNBIND_KEY },
{ "CONTROL_RESET_DEFAULTS_BTN", GS_CONTROL_RESET_DEFAULTS_BTN },
{ "CONTROL_UNBIND_BTN", GS_CONTROL_UNBIND_BTN },
{ "KEYMAP_RUN", GS_KEYMAP_RUN },
{ "KEYMAP_BACK", GS_KEYMAP_BACK },
{ "KEYMAP_LEFT", GS_KEYMAP_LEFT },
{ "KEYMAP_RIGHT", GS_KEYMAP_RIGHT },
{ "KEYMAP_STEP_LEFT", GS_KEYMAP_STEP_LEFT },
{ "KEYMAP_STEP_RIGHT", GS_KEYMAP_STEP_RIGHT },
{ "KEYMAP_WALK", GS_KEYMAP_WALK },
{ "KEYMAP_JUMP", GS_KEYMAP_JUMP },
{ "KEYMAP_ACTION", GS_KEYMAP_ACTION },
{ "KEYMAP_DRAW_WEAPON", GS_KEYMAP_DRAW_WEAPON },
{ "KEYMAP_LOOK", GS_KEYMAP_LOOK },
{ "KEYMAP_ROLL", GS_KEYMAP_ROLL },
{ "KEYMAP_INVENTORY", GS_KEYMAP_INVENTORY },
{ "KEYMAP_FLY_CHEAT", GS_KEYMAP_FLY_CHEAT },
{ "KEYMAP_ITEM_CHEAT", GS_KEYMAP_ITEM_CHEAT },
{ "KEYMAP_LEVEL_SKIP_CHEAT", GS_KEYMAP_LEVEL_SKIP_CHEAT },
{ "KEYMAP_TURBO_CHEAT", GS_KEYMAP_TURBO_CHEAT },
{ "KEYMAP_ENTER_CONSOLE", GS_KEYMAP_ENTER_CONSOLE },
{ "KEYMAP_PAUSE", GS_KEYMAP_PAUSE },
{ "KEYMAP_CAMERA_UP", GS_KEYMAP_CAMERA_UP },
{ "KEYMAP_CAMERA_DOWN", GS_KEYMAP_CAMERA_DOWN },
{ "KEYMAP_CAMERA_LEFT", GS_KEYMAP_CAMERA_LEFT },
{ "KEYMAP_CAMERA_RIGHT", GS_KEYMAP_CAMERA_RIGHT },
{ "KEYMAP_CAMERA_RESET", GS_KEYMAP_CAMERA_RESET },
{ "KEYMAP_EQUIP_PISTOLS", GS_KEYMAP_EQUIP_PISTOLS },
{ "KEYMAP_EQUIP_SHOTGUN", GS_KEYMAP_EQUIP_SHOTGUN },
{ "KEYMAP_EQUIP_MAGNUMS", GS_KEYMAP_EQUIP_MAGNUMS },
{ "KEYMAP_EQUIP_UZIS", GS_KEYMAP_EQUIP_UZIS },
{ "KEYMAP_USE_SMALL_MEDI", GS_KEYMAP_USE_SMALL_MEDI },
{ "KEYMAP_USE_BIG_MEDI", GS_KEYMAP_USE_BIG_MEDI },
{ "KEYMAP_SAVE", GS_KEYMAP_SAVE },
{ "KEYMAP_LOAD", GS_KEYMAP_LOAD },
{ "KEYMAP_FPS", GS_KEYMAP_FPS },
{ "KEYMAP_BILINEAR", GS_KEYMAP_BILINEAR },
{ "STATS_TIME_TAKEN_FMT", GS_STATS_TIME_TAKEN_FMT },
{ "STATS_SECRETS_FMT", GS_STATS_SECRETS_FMT },
{ "STATS_DEATHS_FMT", GS_STATS_DEATHS_FMT },
{ "STATS_PICKUPS_DETAIL_FMT", GS_STATS_PICKUPS_DETAIL_FMT },
{ "STATS_PICKUPS_BASIC_FMT", GS_STATS_PICKUPS_BASIC_FMT },
{ "STATS_KILLS_DETAIL_FMT", GS_STATS_KILLS_DETAIL_FMT },
{ "STATS_KILLS_BASIC_FMT", GS_STATS_KILLS_BASIC_FMT },
{ "STATS_FINAL_STATISTICS", GS_STATS_FINAL_STATISTICS },
{ "STATS_BONUS_STATISTICS", GS_STATS_BONUS_STATISTICS },
{ "PAUSE_PAUSED", GS_PAUSE_PAUSED },
{ "PAUSE_EXIT_TO_TITLE", GS_PAUSE_EXIT_TO_TITLE },
{ "PAUSE_CONTINUE", GS_PAUSE_CONTINUE },
{ "PAUSE_QUIT", GS_PAUSE_QUIT },
{ "PAUSE_ARE_YOU_SURE", GS_PAUSE_ARE_YOU_SURE },
{ "PAUSE_YES", GS_PAUSE_YES },
{ "PAUSE_NO", GS_PAUSE_NO },
{ "MISC_ON", GS_MISC_ON },
{ "MISC_OFF", GS_MISC_OFF },
{ "MISC_EMPTY_SLOT_FMT", GS_MISC_EMPTY_SLOT_FMT },
{ "MISC_DEMO_MODE", GS_MISC_DEMO_MODE },
{ "INV_ITEM_MEDI", GS_INV_ITEM_MEDI },
{ "INV_ITEM_BIG_MEDI", GS_INV_ITEM_BIG_MEDI },
{ "INV_ITEM_PUZZLE1", GS_INV_ITEM_PUZZLE1 },
{ "INV_ITEM_PUZZLE2", GS_INV_ITEM_PUZZLE2 },
{ "INV_ITEM_PUZZLE3", GS_INV_ITEM_PUZZLE3 },
{ "INV_ITEM_PUZZLE4", GS_INV_ITEM_PUZZLE4 },
{ "INV_ITEM_KEY1", GS_INV_ITEM_KEY1 },
{ "INV_ITEM_KEY2", GS_INV_ITEM_KEY2 },
{ "INV_ITEM_KEY3", GS_INV_ITEM_KEY3 },
{ "INV_ITEM_KEY4", GS_INV_ITEM_KEY4 },
{ "INV_ITEM_PICKUP1", GS_INV_ITEM_PICKUP1 },
{ "INV_ITEM_PICKUP2", GS_INV_ITEM_PICKUP2 },
{ "INV_ITEM_LEADBAR", GS_INV_ITEM_LEADBAR },
{ "INV_ITEM_SCION", GS_INV_ITEM_SCION },
{ "INV_ITEM_PISTOLS", GS_INV_ITEM_PISTOLS },
{ "INV_ITEM_SHOTGUN", GS_INV_ITEM_SHOTGUN },
{ "INV_ITEM_MAGNUM", GS_INV_ITEM_MAGNUM },
{ "INV_ITEM_UZI", GS_INV_ITEM_UZI },
{ "INV_ITEM_GRENADE", GS_INV_ITEM_GRENADE },
{ "INV_ITEM_PISTOL_AMMO", GS_INV_ITEM_PISTOL_AMMO },
{ "INV_ITEM_SHOTGUN_AMMO", GS_INV_ITEM_SHOTGUN_AMMO },
{ "INV_ITEM_MAGNUM_AMMO", GS_INV_ITEM_MAGNUM_AMMO },
{ "INV_ITEM_UZI_AMMO", GS_INV_ITEM_UZI_AMMO },
{ "INV_ITEM_COMPASS", GS_INV_ITEM_COMPASS },
{ "INV_ITEM_GAME", GS_INV_ITEM_GAME },
{ "INV_ITEM_DETAILS", GS_INV_ITEM_DETAILS },
{ "INV_ITEM_SOUND", GS_INV_ITEM_SOUND },
{ "INV_ITEM_CONTROLS", GS_INV_ITEM_CONTROLS },
{ "INV_ITEM_GAMMA", GS_INV_ITEM_GAMMA },
{ "INV_ITEM_LARAS_HOME", GS_INV_ITEM_LARAS_HOME },
{ "OSD_FLY_MODE_ON", GS_OSD_FLY_MODE_ON },
{ "OSD_FLY_MODE_OFF", GS_OSD_FLY_MODE_OFF },
{ "OSD_FPS_GET", GS_OSD_FPS_GET },
{ "OSD_FPS_SET", GS_OSD_FPS_SET },
{ "OSD_POS_GET", GS_OSD_POS_GET },
{ "OSD_POS_SET_POS", GS_OSD_POS_SET_POS },
{ "OSD_POS_SET_POS_FAIL", GS_OSD_POS_SET_POS_FAIL },
{ "OSD_POS_SET_ROOM", GS_OSD_POS_SET_ROOM },
{ "OSD_POS_SET_ROOM_FAIL", GS_OSD_POS_SET_ROOM_FAIL },
{ "OSD_SPEED_GET", GS_OSD_SPEED_GET },
{ "OSD_SPEED_SET", GS_OSD_SPEED_SET },
{ "OSD_BRAID_ON", GS_OSD_BRAID_ON },
{ "OSD_BRAID_OFF", GS_OSD_BRAID_OFF },
{ "OSD_CHEATS_ON", GS_OSD_CHEATS_ON },
{ "OSD_CHEATS_OFF", GS_OSD_CHEATS_OFF },
{ "OSD_GIVE_ITEM", GS_OSD_GIVE_ITEM },
{ "OSD_GIVE_ITEM_ALL_KEYS", GS_OSD_GIVE_ITEM_ALL_KEYS },
{ "OSD_GIVE_ITEM_ALL_GUNS", GS_OSD_GIVE_ITEM_ALL_GUNS },
{ "OSD_FLIPMAP_ON", GS_OSD_FLIPMAP_ON },
{ "OSD_FLIPMAP_OFF", GS_OSD_FLIPMAP_OFF },
{ "OSD_FLIPMAP_FAIL_ALREADY_ON", GS_OSD_FLIPMAP_FAIL_ALREADY_ON },
{ "OSD_FLIPMAP_FAIL_ALREADY_OFF", GS_OSD_FLIPMAP_FAIL_ALREADY_OFF },
{ "OSD_KILL_ALL", GS_OSD_KILL_ALL },
{ "OSD_KILL_ALL_FAIL", GS_OSD_KILL_ALL_FAIL },
{ "OSD_KILL", GS_OSD_KILL },
{ "OSD_KILL_FAIL", GS_OSD_KILL_FAIL },
{ "OSD_COMPLETE_LEVEL", GS_OSD_COMPLETE_LEVEL },
{ "OSD_PLAY_LEVEL", GS_OSD_PLAY_LEVEL },
{ "OSD_TEXTURE_FILTER_SET", GS_OSD_TEXTURE_FILTER_SET },
{ "OSD_TEXTURE_FILTER_NN", GS_OSD_TEXTURE_FILTER_NN },
{ "OSD_TEXTURE_FILTER_BILINEAR", GS_OSD_TEXTURE_FILTER_BILINEAR },
{ "OSD_PERSPECTIVE_FILTER_ON", GS_OSD_PERSPECTIVE_FILTER_ON },
{ "OSD_PERSPECTIVE_FILTER_OFF", GS_OSD_PERSPECTIVE_FILTER_OFF },
{ "OSD_FPS_COUNTER_ON", GS_OSD_FPS_COUNTER_ON },
{ "OSD_FPS_COUNTER_OFF", GS_OSD_FPS_COUNTER_OFF },
{ "OSD_UNAVAILABLE_ITEM", GS_OSD_UNAVAILABLE_ITEM },
{ "OSD_INVALID_ITEM", GS_OSD_INVALID_ITEM },
{ "OSD_INVALID_ROOM", GS_OSD_INVALID_ROOM },
{ "OSD_INVALID_LEVEL", GS_OSD_INVALID_LEVEL },
{ "OSD_INVALID_COMMAND", GS_OSD_INVALID_COMMAND },
{ "OSD_COMMAND_FAIL", GS_OSD_COMMAND_FAIL },
{ NULL, 0 },
};
const ENUM_TO_STRING *current = &map[0];
while (current->str) {
if (!strcmp(str, current->str)) {
return current->val;
}
current++;
}
return -1;
}
GAMEFLOW g_GameFlow = { 0 };
static TRISTATE_BOOL GameFlow_ReadTristateBool(
@ -379,24 +182,17 @@ static bool GameFlow_LoadScriptGameStrings(struct json_object_s *obj)
struct json_object_element_s *strings_elem = strings_obj->start;
while (strings_elem) {
GAME_STRING_ID key =
GameFlow_StringToGameStringID(strings_elem->name->string);
const GAME_STRING_ID key =
GameString_IDFromEnum(strings_elem->name->string);
struct json_string_s *value = json_value_as_string(strings_elem->value);
if (!value || !value->string || key < 0 || key >= GS_NUMBER_OF) {
LOG_ERROR("invalid string key %s", strings_elem->name->string);
} else {
g_GameFlow.strings[key] = Memory_DupStr(value->string);
GameString_Set(key, value->string);
}
strings_elem = strings_elem->next;
}
for (const GAMEFLOW_DEFAULT_STRING *def = g_GameFlowDefaultStrings;
def->string; def++) {
if (!g_GameFlow.strings[def->key]) {
g_GameFlow.strings[def->key] = Memory_DupStr(def->string);
}
}
return true;
}
@ -1120,10 +916,6 @@ void GameFlow_Shutdown(void)
Memory_FreePointer(&g_GameFlow.savegame_fmt_bson);
Memory_FreePointer(&g_GameInfo.current);
for (int i = 0; i < GS_NUMBER_OF; i++) {
Memory_FreePointer(&g_GameFlow.strings[i]);
}
for (int i = 0; i < g_GameFlow.injections.length; i++) {
Memory_FreePointer(&g_GameFlow.injections.data_paths[i]);
}
@ -1211,41 +1003,41 @@ bool GameFlow_LoadFromFile(const char *file_name)
{
bool result = GameFlow_LoadFromFileImpl(file_name);
g_InvItemMedi.string = g_GameFlow.strings[GS_INV_ITEM_MEDI],
g_InvItemBigMedi.string = g_GameFlow.strings[GS_INV_ITEM_BIG_MEDI],
g_InvItemMedi.string = GS(INV_ITEM_MEDI),
g_InvItemBigMedi.string = GS(INV_ITEM_BIG_MEDI),
g_InvItemPuzzle1.string = g_GameFlow.strings[GS_INV_ITEM_PUZZLE1],
g_InvItemPuzzle2.string = g_GameFlow.strings[GS_INV_ITEM_PUZZLE2],
g_InvItemPuzzle3.string = g_GameFlow.strings[GS_INV_ITEM_PUZZLE3],
g_InvItemPuzzle4.string = g_GameFlow.strings[GS_INV_ITEM_PUZZLE4],
g_InvItemPuzzle1.string = GS(INV_ITEM_PUZZLE1),
g_InvItemPuzzle2.string = GS(INV_ITEM_PUZZLE2),
g_InvItemPuzzle3.string = GS(INV_ITEM_PUZZLE3),
g_InvItemPuzzle4.string = GS(INV_ITEM_PUZZLE4),
g_InvItemKey1.string = g_GameFlow.strings[GS_INV_ITEM_KEY1],
g_InvItemKey2.string = g_GameFlow.strings[GS_INV_ITEM_KEY2],
g_InvItemKey3.string = g_GameFlow.strings[GS_INV_ITEM_KEY3],
g_InvItemKey4.string = g_GameFlow.strings[GS_INV_ITEM_KEY4],
g_InvItemKey1.string = GS(INV_ITEM_KEY1),
g_InvItemKey2.string = GS(INV_ITEM_KEY2),
g_InvItemKey3.string = GS(INV_ITEM_KEY3),
g_InvItemKey4.string = GS(INV_ITEM_KEY4),
g_InvItemPickup1.string = g_GameFlow.strings[GS_INV_ITEM_PICKUP1],
g_InvItemPickup2.string = g_GameFlow.strings[GS_INV_ITEM_PICKUP2],
g_InvItemLeadBar.string = g_GameFlow.strings[GS_INV_ITEM_LEADBAR],
g_InvItemScion.string = g_GameFlow.strings[GS_INV_ITEM_SCION],
g_InvItemPickup1.string = GS(INV_ITEM_PICKUP1),
g_InvItemPickup2.string = GS(INV_ITEM_PICKUP2),
g_InvItemLeadBar.string = GS(INV_ITEM_LEADBAR),
g_InvItemScion.string = GS(INV_ITEM_SCION),
g_InvItemPistols.string = g_GameFlow.strings[GS_INV_ITEM_PISTOLS],
g_InvItemShotgun.string = g_GameFlow.strings[GS_INV_ITEM_SHOTGUN],
g_InvItemMagnum.string = g_GameFlow.strings[GS_INV_ITEM_MAGNUM],
g_InvItemUzi.string = g_GameFlow.strings[GS_INV_ITEM_UZI],
g_InvItemGrenade.string = g_GameFlow.strings[GS_INV_ITEM_GRENADE],
g_InvItemPistols.string = GS(INV_ITEM_PISTOLS),
g_InvItemShotgun.string = GS(INV_ITEM_SHOTGUN),
g_InvItemMagnum.string = GS(INV_ITEM_MAGNUM),
g_InvItemUzi.string = GS(INV_ITEM_UZI),
g_InvItemGrenade.string = GS(INV_ITEM_GRENADE),
g_InvItemPistolAmmo.string = g_GameFlow.strings[GS_INV_ITEM_PISTOL_AMMO],
g_InvItemShotgunAmmo.string = g_GameFlow.strings[GS_INV_ITEM_SHOTGUN_AMMO],
g_InvItemMagnumAmmo.string = g_GameFlow.strings[GS_INV_ITEM_MAGNUM_AMMO],
g_InvItemUziAmmo.string = g_GameFlow.strings[GS_INV_ITEM_UZI_AMMO],
g_InvItemPistolAmmo.string = GS(INV_ITEM_PISTOL_AMMO),
g_InvItemShotgunAmmo.string = GS(INV_ITEM_SHOTGUN_AMMO),
g_InvItemMagnumAmmo.string = GS(INV_ITEM_MAGNUM_AMMO),
g_InvItemUziAmmo.string = GS(INV_ITEM_UZI_AMMO),
g_InvItemCompass.string = g_GameFlow.strings[GS_INV_ITEM_COMPASS],
g_InvItemGame.string = g_GameFlow.strings[GS_INV_ITEM_GAME];
g_InvItemDetails.string = g_GameFlow.strings[GS_INV_ITEM_DETAILS];
g_InvItemSound.string = g_GameFlow.strings[GS_INV_ITEM_SOUND];
g_InvItemControls.string = g_GameFlow.strings[GS_INV_ITEM_CONTROLS];
g_InvItemLarasHome.string = g_GameFlow.strings[GS_INV_ITEM_LARAS_HOME];
g_InvItemCompass.string = GS(INV_ITEM_COMPASS),
g_InvItemGame.string = GS(INV_ITEM_GAME);
g_InvItemDetails.string = GS(INV_ITEM_DETAILS);
g_InvItemSound.string = GS(INV_ITEM_SOUND);
g_InvItemControls.string = GS(INV_ITEM_CONTROLS);
g_InvItemLarasHome.string = GS(INV_ITEM_LARAS_HOME);
if (g_GameFlow.force_save_crystals == TB_ON) {
g_Config.enable_save_crystals = true;

View file

@ -5,11 +5,6 @@
#include <stdbool.h>
#include <stdint.h>
typedef struct GAMEFLOW_DEFUALT_STRING {
GAME_STRING_ID key;
char *string;
} GAMEFLOW_DEFAULT_STRING;
typedef struct GAMEFLOW_SEQUENCE {
GAMEFLOW_SEQUENCE_TYPE type;
void *data;
@ -79,7 +74,6 @@ typedef struct GAMEFLOW {
TRISTATE_BOOL force_game_modes;
TRISTATE_BOOL force_save_crystals;
GAMEFLOW_LEVEL *levels;
char *strings[GS_NUMBER_OF];
RGB_F water_color;
float draw_distance_fade;
float draw_distance_max;
@ -91,7 +85,6 @@ typedef struct GAMEFLOW {
} GAMEFLOW;
extern GAMEFLOW g_GameFlow;
extern GAMEFLOW_DEFAULT_STRING g_GameFlowDefaultStrings[];
GAMEFLOW_OPTION
GameFlow_InterpretSequence(int32_t level_num, GAMEFLOW_LEVEL_TYPE level_type);

View file

@ -1,7 +1,7 @@
#include "game/inventory/inventory_ring.h"
#include "config.h"
#include "game/gameflow.h"
#include "game/game_string.h"
#include "game/inventory.h"
#include "game/inventory/inventory_vars.h"
#include "game/output.h"
@ -84,23 +84,19 @@ void Inv_Ring_InitHeader(RING_INFO *ring)
if (!g_InvRingText) {
switch (ring->type) {
case RT_MAIN:
g_InvRingText =
Text_Create(0, 26, g_GameFlow.strings[GS_HEADING_INVENTORY]);
g_InvRingText = Text_Create(0, 26, GS(HEADING_INVENTORY));
break;
case RT_OPTION:
if (g_InvMode == INV_DEATH_MODE) {
g_InvRingText = Text_Create(
0, 26, g_GameFlow.strings[GS_HEADING_GAME_OVER]);
g_InvRingText = Text_Create(0, 26, GS(HEADING_GAME_OVER));
} else {
g_InvRingText =
Text_Create(0, 26, g_GameFlow.strings[GS_HEADING_OPTION]);
g_InvRingText = Text_Create(0, 26, GS(HEADING_OPTION));
}
break;
case RT_KEYS:
g_InvRingText =
Text_Create(0, 26, g_GameFlow.strings[GS_HEADING_ITEMS]);
g_InvRingText = Text_Create(0, 26, GS(HEADING_ITEMS));
break;
}

View file

@ -4,7 +4,6 @@
#include "game/camera.h"
#include "game/collide.h"
#include "game/console.h"
#include "game/gameflow.h"
#include "game/gun.h"
#include "game/input.h"
#include "game/inventory.h"

View file

@ -2,6 +2,7 @@
#include "game/console.h"
#include "game/effects/exploding_death.h"
#include "game/game_string.h"
#include "game/gameflow.h"
#include "game/inventory.h"
#include "game/items.h"
@ -122,7 +123,7 @@ void Lara_Cheat_Control(void)
void Lara_Cheat_EndLevel(void)
{
g_LevelComplete = true;
Console_Log(g_GameFlow.strings[GS_OSD_COMPLETE_LEVEL]);
Console_Log(GS(OSD_COMPLETE_LEVEL));
}
void Lara_Cheat_EnterFlyMode(void)
@ -152,7 +153,7 @@ void Lara_Cheat_EnterFlyMode(void)
Lara_InitialiseMeshes(g_CurrentLevel);
g_Camera.type = CAM_CHASE;
Viewport_SetFOV(Viewport_GetUserFOV());
Console_Log(g_GameFlow.strings[GS_OSD_FLY_MODE_ON]);
Console_Log(GS(OSD_FLY_MODE_ON));
}
void Lara_Cheat_ExitFlyMode(void)
@ -176,7 +177,7 @@ void Lara_Cheat_ExitFlyMode(void)
g_Lara.torso_rot.y = 0;
}
g_Lara.gun_status = LGS_ARMLESS;
Console_Log(g_GameFlow.strings[GS_OSD_FLY_MODE_OFF]);
Console_Log(GS(OSD_FLY_MODE_OFF));
}
void Lara_Cheat_GetStuff(void)
@ -185,7 +186,7 @@ void Lara_Cheat_GetStuff(void)
return;
}
Console_Log(g_GameFlow.strings[GS_OSD_GIVE_ITEM_CHEAT]);
Console_Log(GS(OSD_GIVE_ITEM_CHEAT));
// play pistols drawing sound
Sound_Effect(SFX_LARA_DRAW, &g_LaraItem->pos, SPM_NORMAL);

View file

@ -1,6 +1,7 @@
#include "game/option/option_compass.h"
#include "config.h"
#include "game/game_string.h"
#include "game/gameflow.h"
#include "game/input.h"
#include "game/text.h"
@ -50,9 +51,8 @@ static void Option_CompassInitText(void)
// kills
sprintf(
buf,
g_GameFlow.strings
[g_Config.enable_detailed_stats ? GS_STATS_KILLS_DETAIL_FMT
: GS_STATS_KILLS_BASIC_FMT],
g_Config.enable_detailed_stats ? GS(STATS_KILLS_DETAIL_FMT)
: GS(STATS_KILLS_BASIC_FMT),
stats->kill_count, stats->max_kill_count);
m_Text[TEXT_KILLS] = Text_Create(0, y, buf);
y += row_height;
@ -60,9 +60,8 @@ static void Option_CompassInitText(void)
// pickups
sprintf(
buf,
g_GameFlow.strings
[g_Config.enable_detailed_stats ? GS_STATS_PICKUPS_DETAIL_FMT
: GS_STATS_PICKUPS_BASIC_FMT],
g_Config.enable_detailed_stats ? GS(STATS_PICKUPS_DETAIL_FMT)
: GS(STATS_PICKUPS_BASIC_FMT),
stats->pickup_count, stats->max_pickup_count);
m_Text[TEXT_PICKUPS] = Text_Create(0, y, buf);
y += row_height;
@ -77,15 +76,14 @@ static void Option_CompassInitText(void)
secret_flags >>= 1;
}
sprintf(
buf, g_GameFlow.strings[GS_STATS_SECRETS_FMT], secret_count,
buf, GS(STATS_SECRETS_FMT), secret_count,
g_GameInfo.current[g_CurrentLevel].stats.max_secret_count);
m_Text[TEXT_SECRETS] = Text_Create(0, y, buf);
y += row_height;
// deaths
if (g_Config.enable_deaths_counter && g_GameInfo.death_counter_supported) {
sprintf(
buf, g_GameFlow.strings[GS_STATS_DEATHS_FMT], stats->death_count);
sprintf(buf, GS(STATS_DEATHS_FMT), stats->death_count);
m_Text[TEXT_DEATHS] = Text_Create(0, y, buf);
y += row_height;
}
@ -128,7 +126,7 @@ void Option_Compass(INVENTORY_ITEM *inv_item)
} else {
sprintf(time_buf, "%d:%d%d", minutes, seconds / 10, seconds % 10);
}
sprintf(buf, g_GameFlow.strings[GS_STATS_TIME_TAKEN_FMT], time_buf);
sprintf(buf, GS(STATS_TIME_TAKEN_FMT), time_buf);
Text_ChangeText(m_Text[TEXT_TIME], buf);
}

View file

@ -2,7 +2,7 @@
#include "config.h"
#include "game/clock.h"
#include "game/gameflow.h"
#include "game/game_string.h"
#include "game/input.h"
#include "game/screen.h"
#include "game/sound.h"
@ -250,7 +250,7 @@ static void Option_ControlInitText(CONTROL_MODE mode, INPUT_LAYOUT layout_num)
int16_t y = TOP_Y + ROW_HEIGHT + BORDER * 2;
for (int i = 0; i < m_ControlMenu.vis_options; i++) {
m_ControlMenu.role_texts[i] =
Text_Create(x_roles, y, g_GameFlow.strings[col->game_string]);
Text_Create(x_roles, y, GameString_Get(col->game_string));
Text_CentreV(m_ControlMenu.role_texts[i], true);
m_ControlMenu.key_texts[i] = Text_Create(
@ -264,7 +264,7 @@ static void Option_ControlInitText(CONTROL_MODE mode, INPUT_LAYOUT layout_num)
m_Text[TEXT_TITLE] = Text_Create(
0, TOP_Y - BORDER / 2,
g_GameFlow.strings[m_LayoutMap[layout_num].layout_string]);
GameString_Get(m_LayoutMap[layout_num].layout_string));
Text_CentreH(m_Text[TEXT_TITLE], true);
Text_CentreV(m_Text[TEXT_TITLE], true);
Text_AddBackground(m_Text[TEXT_TITLE], 0, 0, 0, 0, TS_REQUESTED);
@ -311,17 +311,14 @@ static void Option_ControlInitText(CONTROL_MODE mode, INPUT_LAYOUT layout_num)
m_Text[TEXT_RESET_BORDER], box_width, ROW_HEIGHT, 0, 0, TS_BACKGROUND);
if (mode == CM_KEYBOARD) {
sprintf(
m_ResetGS, g_GameFlow.strings[GS_CONTROL_RESET_DEFAULTS_KEY],
RESET_ALL_KEY);
sprintf(
m_UnbindGS, g_GameFlow.strings[GS_CONTROL_UNBIND_KEY], UNBIND_KEY);
sprintf(m_ResetGS, GS(CONTROL_RESET_DEFAULTS_KEY), RESET_ALL_KEY);
sprintf(m_UnbindGS, GS(CONTROL_UNBIND_KEY), UNBIND_KEY);
} else {
sprintf(
m_ResetGS, g_GameFlow.strings[GS_CONTROL_RESET_DEFAULTS_BTN],
m_ResetGS, GS(CONTROL_RESET_DEFAULTS_BTN),
Input_GetButtonName(g_Config.input.cntlr_layout, RESET_ALL_BUTTON));
sprintf(
m_UnbindGS, g_GameFlow.strings[GS_CONTROL_UNBIND_BTN],
m_UnbindGS, GS(CONTROL_UNBIND_BTN),
Input_GetButtonName(g_Config.input.cntlr_layout, UNBIND_BUTTON));
}
@ -364,20 +361,17 @@ static void Option_ControlUpdateText(CONTROL_MODE mode, INPUT_LAYOUT layout_num)
}
if (mode == CM_KEYBOARD) {
sprintf(
m_ResetGS, g_GameFlow.strings[GS_CONTROL_RESET_DEFAULTS_KEY],
RESET_ALL_KEY);
sprintf(m_ResetGS, GS(CONTROL_RESET_DEFAULTS_KEY), RESET_ALL_KEY);
Text_ChangeText(m_Text[TEXT_RESET], m_ResetGS);
sprintf(
m_UnbindGS, g_GameFlow.strings[GS_CONTROL_UNBIND_KEY], UNBIND_KEY);
sprintf(m_UnbindGS, GS(CONTROL_UNBIND_KEY), UNBIND_KEY);
Text_ChangeText(m_Text[TEXT_UNBIND], m_UnbindGS);
} else {
sprintf(
m_ResetGS, g_GameFlow.strings[GS_CONTROL_RESET_DEFAULTS_BTN],
m_ResetGS, GS(CONTROL_RESET_DEFAULTS_BTN),
Input_GetButtonName(layout_num, RESET_ALL_BUTTON));
Text_ChangeText(m_Text[TEXT_RESET], m_ResetGS);
sprintf(
m_UnbindGS, g_GameFlow.strings[GS_CONTROL_UNBIND_BTN],
m_UnbindGS, GS(CONTROL_UNBIND_BTN),
Input_GetButtonName(layout_num, UNBIND_BUTTON));
Text_ChangeText(m_Text[TEXT_UNBIND], m_UnbindGS);
}
@ -385,7 +379,7 @@ static void Option_ControlUpdateText(CONTROL_MODE mode, INPUT_LAYOUT layout_num)
if (m_ControlMenu.cur_role == KC_TITLE) {
Text_ChangeText(
m_Text[TEXT_TITLE],
g_GameFlow.strings[m_LayoutMap[layout_num].layout_string]);
GameString_Get(m_LayoutMap[layout_num].layout_string));
int32_t title_w = Text_GetWidth(m_Text[TEXT_TITLE]);
Text_SetPos(
@ -407,7 +401,7 @@ static void Option_ControlUpdateText(CONTROL_MODE mode, INPUT_LAYOUT layout_num)
const TEXT_COLUMN_PLACEMENT *col = m_ControlMenu.top_row;
for (int i = 0; i < m_ControlMenu.vis_options; i++) {
Text_ChangeText(
m_ControlMenu.role_texts[i], g_GameFlow.strings[col->game_string]);
m_ControlMenu.role_texts[i], GameString_Get(col->game_string));
Text_ChangeText(
m_ControlMenu.key_texts[i],
Input_GetKeyName(mode, layout_num, col->role));

View file

@ -1,4 +1,4 @@
#include "game/gameflow.h"
#include "game/game_string.h"
#include "game/input.h"
#include "game/text.h"
#include "global/types.h"
@ -28,15 +28,12 @@ static void Option_ControlPickInitText(void)
Text_AddBackground(m_Text[TEXT_TITLE_BORDER], 180, 85, 0, 0, TS_BACKGROUND);
Text_AddOutline(m_Text[TEXT_TITLE_BORDER], true, TS_BACKGROUND);
m_Text[TEXT_TITLE] =
Text_Create(0, -30, g_GameFlow.strings[GS_CONTROL_CUSTOMIZE]);
m_Text[TEXT_TITLE] = Text_Create(0, -30, GS(CONTROL_CUSTOMIZE));
Text_AddBackground(m_Text[TEXT_TITLE], 176, 0, 0, 0, TS_HEADING);
Text_AddOutline(m_Text[TEXT_TITLE], true, TS_HEADING);
m_Text[TEXT_KEYBOARD] =
Text_Create(0, 0, g_GameFlow.strings[GS_CONTROL_KEYBOARD]);
m_Text[TEXT_CONTROLLER] =
Text_Create(0, 25, g_GameFlow.strings[GS_CONTROL_CONTROLLER]);
m_Text[TEXT_KEYBOARD] = Text_Create(0, 0, GS(CONTROL_KEYBOARD));
m_Text[TEXT_CONTROLLER] = Text_Create(0, 25, GS(CONTROL_CONTROLLER));
Text_AddBackground(m_Text[g_OptionSelected], 128, 0, 0, 0, TS_REQUESTED);
Text_AddOutline(m_Text[g_OptionSelected], true, TS_REQUESTED);

View file

@ -1,7 +1,7 @@
#include "game/option/option_graphics.h"
#include "config.h"
#include "game/gameflow.h"
#include "game/game_string.h"
#include "game/input.h"
#include "game/output.h"
#include "game/screen.h"
@ -185,8 +185,7 @@ static void Option_GraphicsInitText(void)
Text_CentreH(m_Text[TEXT_TITLE_BORDER], 1);
Text_CentreV(m_Text[TEXT_TITLE_BORDER], 1);
m_Text[TEXT_TITLE] =
Text_Create(0, TOP_Y, g_GameFlow.strings[GS_DETAIL_SELECT_DETAIL]);
m_Text[TEXT_TITLE] = Text_Create(0, TOP_Y, GS(DETAIL_SELECT_DETAIL));
Text_CentreH(m_Text[TEXT_TITLE], 1);
Text_CentreV(m_Text[TEXT_TITLE], 1);
Text_AddBackground(m_Text[TEXT_TITLE], ROW_WIDTH - 4, 0, 0, 0, TS_HEADING);
@ -359,11 +358,11 @@ static int16_t Option_GraphicsPlaceColumns(bool create)
&& row->option_name != OPTION_NUMBER_OF;
i++, row++) {
if (create) {
m_GraphicsMenu.option_texts[i] = Text_Create(
name_x, name_y, g_GameFlow.strings[row->option_string]);
m_GraphicsMenu.option_texts[i] =
Text_Create(name_x, name_y, GameString_Get(row->option_string));
m_GraphicsMenu.value_texts[i] = Text_Create(
value_x, value_y, g_GameFlow.strings[row->value_string]);
value_x, value_y, GameString_Get(row->value_string));
} else {
Text_SetPos(m_GraphicsMenu.option_texts[i], name_x, name_y);
Text_SetPos(m_GraphicsMenu.value_texts[i], value_x, value_y);
@ -385,50 +384,41 @@ static void Option_GraphicsChangeTextOption(
{
char buf[OPTION_LENGTH];
Text_ChangeText(option_text, g_GameFlow.strings[row->option_string]);
Text_ChangeText(option_text, GameString_Get(row->option_string));
switch (row->option_name) {
case OPTION_FPS:
sprintf(
buf, g_GameFlow.strings[GS_DETAIL_DECIMAL_FMT],
g_Config.rendering.fps);
sprintf(buf, GS(DETAIL_DECIMAL_FMT), g_Config.rendering.fps);
Text_ChangeText(value_text, buf);
break;
case OPTION_TEXTURE_FILTER: {
bool is_enabled = g_Config.rendering.texture_filter == GFX_TF_BILINEAR;
Text_ChangeText(
value_text,
g_GameFlow.strings[is_enabled ? GS_DETAIL_BILINEAR : GS_MISC_OFF]);
value_text, is_enabled ? GS(DETAIL_BILINEAR) : GS(MISC_OFF));
break;
}
case OPTION_FBO_FILTER: {
bool is_enabled = g_Config.rendering.fbo_filter == GFX_TF_BILINEAR;
Text_ChangeText(
value_text,
g_GameFlow.strings[is_enabled ? GS_DETAIL_BILINEAR : GS_MISC_OFF]);
value_text, is_enabled ? GS(DETAIL_BILINEAR) : GS(MISC_OFF));
break;
}
case OPTION_VSYNC: {
bool is_enabled = g_Config.rendering.enable_vsync;
Text_ChangeText(
value_text,
g_GameFlow.strings[is_enabled ? GS_MISC_ON : GS_MISC_OFF]);
Text_ChangeText(value_text, is_enabled ? GS(MISC_ON) : GS(MISC_OFF));
break;
}
case OPTION_BRIGHTNESS:
sprintf(
buf, g_GameFlow.strings[GS_DETAIL_FLOAT_FMT], g_Config.brightness);
sprintf(buf, GS(DETAIL_FLOAT_FMT), g_Config.brightness);
Text_ChangeText(value_text, buf);
break;
case OPTION_UI_TEXT_SCALE:
sprintf(
buf, g_GameFlow.strings[GS_DETAIL_FLOAT_FMT],
g_Config.ui.text_scale);
sprintf(buf, GS(DETAIL_FLOAT_FMT), g_Config.ui.text_scale);
Text_ChangeText(value_text, buf);
// Text_SetPos(
// m_Text[TEXT_ROW_SELECT],
@ -437,33 +427,29 @@ static void Option_GraphicsChangeTextOption(
break;
case OPTION_UI_BAR_SCALE:
sprintf(
buf, g_GameFlow.strings[GS_DETAIL_FLOAT_FMT],
g_Config.ui.bar_scale);
sprintf(buf, GS(DETAIL_FLOAT_FMT), g_Config.ui.bar_scale);
Text_ChangeText(value_text, buf);
break;
case OPTION_RENDER_MODE:
sprintf(
buf, g_GameFlow.strings[GS_DETAIL_STRING_FMT],
buf, GS(DETAIL_STRING_FMT),
(g_Config.rendering.render_mode == GFX_RM_FRAMEBUFFER
? g_GameFlow.strings[GS_DETAIL_RENDER_MODE_FBO]
: g_GameFlow.strings[GS_DETAIL_RENDER_MODE_LEGACY]));
? GS(DETAIL_RENDER_MODE_FBO)
: GS(DETAIL_RENDER_MODE_LEGACY)));
Text_ChangeText(value_text, buf);
break;
case OPTION_RESOLUTION:
sprintf(
buf, g_GameFlow.strings[GS_DETAIL_RESOLUTION_FMT],
Screen_GetResWidth(), Screen_GetResHeight());
buf, GS(DETAIL_RESOLUTION_FMT), Screen_GetResWidth(),
Screen_GetResHeight());
Text_ChangeText(value_text, buf);
break;
case OPTION_PERSPECTIVE: {
bool is_enabled = g_Config.rendering.enable_perspective_filter;
Text_ChangeText(
value_text,
g_GameFlow.strings[is_enabled ? GS_MISC_ON : GS_MISC_OFF]);
Text_ChangeText(value_text, is_enabled ? GS(MISC_ON) : GS(MISC_OFF));
break;
}

View file

@ -1,6 +1,7 @@
#include "game/option/option_passport.h"
#include "config.h"
#include "game/game_string.h"
#include "game/gameflow.h"
#include "game/input.h"
#include "game/inventory/inventory_vars.h"
@ -273,9 +274,7 @@ static void Option_PassportInitSaveRequester(int16_t page_num)
Requester_Init(req);
Requester_SetHeading(
req,
g_GameFlow.strings
[page_num == PAGE_1 ? GS_PASSPORT_LOAD_GAME
: GS_PASSPORT_SAVE_GAME]);
page_num == PAGE_1 ? GS(PASSPORT_LOAD_GAME) : GS(PASSPORT_SAVE_GAME));
if (Screen_GetResHeightDownscaled(RSR_TEXT) <= 240) {
req->vis_lines = 5;
@ -304,7 +303,7 @@ static void Option_PassportInitSelectLevelRequester(void)
REQUEST_INFO *req = &m_SelectLevelRequester;
req->flags |= RIF_BLOCKABLE;
Requester_Init(req);
Requester_SetHeading(req, g_GameFlow.strings[GS_PASSPORT_SELECT_LEVEL]);
Requester_SetHeading(req, GS(PASSPORT_SELECT_LEVEL));
if (Screen_GetResHeightDownscaled(RSR_TEXT) <= 240) {
req->vis_lines = 5;
@ -332,13 +331,11 @@ static void Option_PassportInitNewGameRequester(void)
{
REQUEST_INFO *req = &m_NewGameRequester;
Requester_Init(req);
Requester_SetHeading(req, g_GameFlow.strings[GS_PASSPORT_SELECT_MODE]);
Requester_AddItem(req, g_GameFlow.strings[GS_PASSPORT_MODE_NEW_GAME], 0);
Requester_AddItem(
req, g_GameFlow.strings[GS_PASSPORT_MODE_NEW_GAME_PLUS], 0);
Requester_AddItem(req, g_GameFlow.strings[GS_PASSPORT_MODE_NEW_GAME_JP], 0);
Requester_AddItem(
req, g_GameFlow.strings[GS_PASSPORT_MODE_NEW_GAME_JP_PLUS], 0);
Requester_SetHeading(req, GS(PASSPORT_SELECT_MODE));
Requester_AddItem(req, GS(PASSPORT_MODE_NEW_GAME), 0);
Requester_AddItem(req, GS(PASSPORT_MODE_NEW_GAME_PLUS), 0);
Requester_AddItem(req, GS(PASSPORT_MODE_NEW_GAME_JP), 0);
Requester_AddItem(req, GS(PASSPORT_MODE_NEW_GAME_JP_PLUS), 0);
req->vis_lines = MAX_GAME_MODES;
req->line_offset = 0;
@ -401,8 +398,7 @@ static void Option_PassportShowSelectLevel(void)
static void Option_PassportLoadGame(void)
{
Text_ChangeText(
m_Text[TEXT_PAGE_NAME], g_GameFlow.strings[GS_PASSPORT_LOAD_GAME]);
Text_ChangeText(m_Text[TEXT_PAGE_NAME], GS(PASSPORT_LOAD_GAME));
g_SavegameRequester.flags |= RIF_BLOCKABLE;
if (m_PassportStatus.mode == PASSPORT_MODE_BROWSE) {
@ -484,8 +480,7 @@ static void Option_PassportSelectLevel(void)
static void Option_PassportSaveGame(void)
{
Text_ChangeText(
m_Text[TEXT_PAGE_NAME], g_GameFlow.strings[GS_PASSPORT_SAVE_GAME]);
Text_ChangeText(m_Text[TEXT_PAGE_NAME], GS(PASSPORT_SAVE_GAME));
g_SavegameRequester.flags &= ~RIF_BLOCKABLE;
if (m_PassportStatus.mode == PASSPORT_MODE_BROWSE) {
@ -502,8 +497,7 @@ static void Option_PassportSaveGame(void)
static void Option_PassportNewGame(void)
{
Text_ChangeText(
m_Text[TEXT_PAGE_NAME], g_GameFlow.strings[GS_PASSPORT_NEW_GAME]);
Text_ChangeText(m_Text[TEXT_PAGE_NAME], GS(PASSPORT_NEW_GAME));
if (m_PassportStatus.mode == PASSPORT_MODE_BROWSE) {
if (g_InputDB.menu_confirm
@ -560,8 +554,7 @@ static void Option_PassportNewGame(void)
static void Option_PassportRestart(INVENTORY_ITEM *inv_item)
{
Text_ChangeText(
m_Text[TEXT_PAGE_NAME], g_GameFlow.strings[GS_PASSPORT_RESTART_LEVEL]);
Text_ChangeText(m_Text[TEXT_PAGE_NAME], GS(PASSPORT_RESTART_LEVEL));
if (Savegame_RestartAvailable(g_GameInfo.current_save_slot)) {
if (g_InputDB.menu_confirm) {
@ -662,17 +655,14 @@ void Option_Passport(INVENTORY_ITEM *inv_item)
break;
case PASSPORT_MODE_EXIT_TITLE:
Text_ChangeText(
m_Text[TEXT_PAGE_NAME],
g_GameFlow.strings[GS_PASSPORT_EXIT_TO_TITLE]);
Text_ChangeText(m_Text[TEXT_PAGE_NAME], GS(PASSPORT_EXIT_TO_TITLE));
if (g_InputDB.menu_confirm) {
g_GameInfo.passport_selection = PASSPORT_MODE_EXIT_TITLE;
}
break;
case PASSPORT_MODE_EXIT_GAME:
Text_ChangeText(
m_Text[TEXT_PAGE_NAME], g_GameFlow.strings[GS_PASSPORT_EXIT_GAME]);
Text_ChangeText(m_Text[TEXT_PAGE_NAME], GS(PASSPORT_EXIT_GAME));
if (g_InputDB.menu_confirm) {
g_GameInfo.passport_selection = PASSPORT_MODE_EXIT_GAME;
}

View file

@ -1,7 +1,7 @@
#include "game/option/option_sound.h"
#include "config.h"
#include "game/gameflow.h"
#include "game/game_string.h"
#include "game/input.h"
#include "game/music.h"
#include "game/sound.h"
@ -35,8 +35,7 @@ static void Option_SoundInitText(void)
m_Text[TEXT_RIGHT_ARROW] = Text_Create(40, 0, "\201");
m_Text[TEXT_TITLE_BORDER] = Text_Create(0, -32, " ");
m_Text[TEXT_TITLE] =
Text_Create(0, -30, g_GameFlow.strings[GS_SOUND_SET_VOLUMES]);
m_Text[TEXT_TITLE] = Text_Create(0, -30, GS(SOUND_SET_VOLUMES));
if (g_Config.music_volume > 10) {
g_Config.music_volume = 10;

View file

@ -4,6 +4,7 @@
#include "game/camera.h"
#include "game/effects.h"
#include "game/game.h"
#include "game/game_string.h"
#include "game/gameflow.h"
#include "game/input.h"
#include "game/interpolation.h"
@ -148,7 +149,7 @@ static void Phase_Demo_Start(void *arg)
g_Config.enable_tr2_jumping = false;
g_Config.target_mode = TLM_FULL;
m_DemoModeText = Text_Create(0, -16, g_GameFlow.strings[GS_MISC_DEMO_MODE]);
m_DemoModeText = Text_Create(0, -16, GS(MISC_DEMO_MODE));
Text_Flash(m_DemoModeText, 1, 20);
Text_AlignBottom(m_DemoModeText, 1);
Text_CentreH(m_DemoModeText, 1);

View file

@ -1,6 +1,7 @@
#include "game/phase/phase_pause.h"
#include "game/game.h"
#include "game/game_string.h"
#include "game/gameflow.h"
#include "game/input.h"
#include "game/music.h"
@ -67,7 +68,7 @@ static void Phase_Pause_RemoveText(void)
static void Phase_Pause_UpdateText(void)
{
if (m_PausedText == NULL) {
m_PausedText = Text_Create(0, -24, g_GameFlow.strings[GS_PAUSE_PAUSED]);
m_PausedText = Text_Create(0, -24, GS(PAUSE_PAUSED));
Text_CentreH(m_PausedText, 1);
Text_AlignBottom(m_PausedText, 1);
}
@ -145,9 +146,7 @@ static GAMEFLOW_OPTION Phase_Pause_Control(int32_t nframes)
case STATE_ASK: {
int32_t choice = Phase_Pause_DisplayRequester(
g_GameFlow.strings[GS_PAUSE_EXIT_TO_TITLE],
g_GameFlow.strings[GS_PAUSE_CONTINUE],
g_GameFlow.strings[GS_PAUSE_QUIT], 1);
GS(PAUSE_EXIT_TO_TITLE), GS(PAUSE_CONTINUE), GS(PAUSE_QUIT), 1);
if (choice == 1) {
Music_Unpause();
Sound_UnpauseAll();
@ -160,9 +159,7 @@ static GAMEFLOW_OPTION Phase_Pause_Control(int32_t nframes)
case STATE_CONFIRM: {
int32_t choice = Phase_Pause_DisplayRequester(
g_GameFlow.strings[GS_PAUSE_ARE_YOU_SURE],
g_GameFlow.strings[GS_PAUSE_YES], g_GameFlow.strings[GS_PAUSE_NO],
1);
GS(PAUSE_ARE_YOU_SURE), GS(PAUSE_YES), GS(PAUSE_NO), 1);
if (choice == 1) {
return GF_EXIT_TO_TITLE;
} else if (choice == 2) {

View file

@ -2,6 +2,7 @@
#include "config.h"
#include "game/game.h"
#include "game/game_string.h"
#include "game/gameflow.h"
#include "game/input.h"
#include "game/music.h"
@ -63,9 +64,8 @@ static void Phase_Stats_CreateTexts(int32_t level_num)
// kills
sprintf(
buf,
g_GameFlow.strings
[g_Config.enable_detailed_stats ? GS_STATS_KILLS_DETAIL_FMT
: GS_STATS_KILLS_BASIC_FMT],
g_Config.enable_detailed_stats ? GS(STATS_KILLS_DETAIL_FMT)
: GS(STATS_KILLS_BASIC_FMT),
stats->kill_count, stats->max_kill_count);
*cur_txt = Text_Create(0, y, buf);
Text_CentreH(*cur_txt, 1);
@ -76,9 +76,8 @@ static void Phase_Stats_CreateTexts(int32_t level_num)
// pickups
sprintf(
buf,
g_GameFlow.strings
[g_Config.enable_detailed_stats ? GS_STATS_PICKUPS_DETAIL_FMT
: GS_STATS_PICKUPS_BASIC_FMT],
g_Config.enable_detailed_stats ? GS(STATS_PICKUPS_DETAIL_FMT)
: GS(STATS_PICKUPS_BASIC_FMT),
stats->pickup_count, stats->max_pickup_count);
*cur_txt = Text_Create(0, y, buf);
Text_CentreH(*cur_txt, 1);
@ -95,9 +94,7 @@ static void Phase_Stats_CreateTexts(int32_t level_num)
}
secret_flags >>= 1;
}
sprintf(
buf, g_GameFlow.strings[GS_STATS_SECRETS_FMT], secret_count,
stats->max_secret_count);
sprintf(buf, GS(STATS_SECRETS_FMT), secret_count, stats->max_secret_count);
*cur_txt = Text_Create(0, y, buf);
Text_CentreH(*cur_txt, 1);
Text_CentreV(*cur_txt, 1);
@ -106,8 +103,7 @@ static void Phase_Stats_CreateTexts(int32_t level_num)
// deaths
if (g_Config.enable_deaths_counter && g_GameInfo.death_counter_supported) {
sprintf(
buf, g_GameFlow.strings[GS_STATS_DEATHS_FMT], stats->death_count);
sprintf(buf, GS(STATS_DEATHS_FMT), stats->death_count);
*cur_txt = Text_Create(0, y, buf);
Text_CentreH(*cur_txt, 1);
Text_CentreV(*cur_txt, 1);
@ -127,7 +123,7 @@ static void Phase_Stats_CreateTexts(int32_t level_num)
} else {
sprintf(time_str, "%d:%d%d", minutes, seconds / 10, seconds % 10);
}
sprintf(buf, g_GameFlow.strings[GS_STATS_TIME_TAKEN_FMT], time_str);
sprintf(buf, GS(STATS_TIME_TAKEN_FMT), time_str);
*cur_txt = Text_Create(0, y, buf);
Text_CentreH(*cur_txt, 1);
Text_CentreV(*cur_txt, 1);
@ -156,9 +152,8 @@ static void Phase_Stats_CreateTextsTotal(GAMEFLOW_LEVEL_TYPE level_type)
// kills
sprintf(
buf,
g_GameFlow.strings
[g_Config.enable_detailed_stats ? GS_STATS_KILLS_DETAIL_FMT
: GS_STATS_KILLS_BASIC_FMT],
g_Config.enable_detailed_stats ? GS(STATS_KILLS_DETAIL_FMT)
: GS(STATS_KILLS_BASIC_FMT),
stats.player_kill_count, stats.total_kill_count);
*cur_txt = Text_Create(0, y, buf);
Text_CentreH(*cur_txt, 1);
@ -169,9 +164,8 @@ static void Phase_Stats_CreateTextsTotal(GAMEFLOW_LEVEL_TYPE level_type)
// pickups
sprintf(
buf,
g_GameFlow.strings
[g_Config.enable_detailed_stats ? GS_STATS_PICKUPS_DETAIL_FMT
: GS_STATS_PICKUPS_BASIC_FMT],
g_Config.enable_detailed_stats ? GS(STATS_PICKUPS_DETAIL_FMT)
: GS(STATS_PICKUPS_BASIC_FMT),
stats.player_pickup_count, stats.total_pickup_count);
*cur_txt = Text_Create(0, y, buf);
Text_CentreH(*cur_txt, 1);
@ -181,8 +175,8 @@ static void Phase_Stats_CreateTextsTotal(GAMEFLOW_LEVEL_TYPE level_type)
// secrets
sprintf(
buf, g_GameFlow.strings[GS_STATS_SECRETS_FMT],
stats.player_secret_count, stats.total_secret_count);
buf, GS(STATS_SECRETS_FMT), stats.player_secret_count,
stats.total_secret_count);
*cur_txt = Text_Create(0, y, buf);
Text_CentreH(*cur_txt, 1);
Text_CentreV(*cur_txt, 1);
@ -191,8 +185,7 @@ static void Phase_Stats_CreateTextsTotal(GAMEFLOW_LEVEL_TYPE level_type)
// deaths
if (g_Config.enable_deaths_counter && g_GameInfo.death_counter_supported) {
sprintf(
buf, g_GameFlow.strings[GS_STATS_DEATHS_FMT], stats.death_count);
sprintf(buf, GS(STATS_DEATHS_FMT), stats.death_count);
*cur_txt = Text_Create(0, y, buf);
Text_CentreH(*cur_txt, 1);
Text_CentreV(*cur_txt, 1);
@ -212,7 +205,7 @@ static void Phase_Stats_CreateTextsTotal(GAMEFLOW_LEVEL_TYPE level_type)
} else {
sprintf(time_str, "%d:%d%d", minutes, seconds / 10, seconds % 10);
}
sprintf(buf, g_GameFlow.strings[GS_STATS_TIME_TAKEN_FMT], time_str);
sprintf(buf, GS(STATS_TIME_TAKEN_FMT), time_str);
*cur_txt = Text_Create(0, y, buf);
Text_CentreH(*cur_txt, 1);
Text_CentreV(*cur_txt, 1);
@ -231,9 +224,8 @@ static void Phase_Stats_CreateTextsTotal(GAMEFLOW_LEVEL_TYPE level_type)
// heading
sprintf(
buf, "%s",
g_GameFlow.strings
[level_type == GFL_BONUS ? GS_STATS_BONUS_STATISTICS
: GS_STATS_FINAL_STATISTICS]);
level_type == GFL_BONUS ? GS(STATS_BONUS_STATISTICS)
: GS(STATS_FINAL_STATISTICS));
*cur_txt = Text_Create(0, top_y + 2, buf);
Text_CentreH(*cur_txt, 1);
Text_CentreV(*cur_txt, 1);

View file

@ -2,6 +2,7 @@
#include "config.h"
#include "filesystem.h"
#include "game/game_string.h"
#include "game/gameflow.h"
#include "game/inventory.h"
#include "game/items.h"
@ -561,7 +562,7 @@ void Savegame_ScanSavedGames(void)
req->item_flags[req->items] |= RIF_BLOCKED;
sprintf(
&req->item_texts[req->items * req->item_text_len],
g_GameFlow.strings[GS_MISC_EMPTY_SLOT_FMT], i + 1);
GS(MISC_EMPTY_SLOT_FMT), i + 1);
}
req->items++;
@ -586,12 +587,12 @@ void Savegame_ScanAvailableLevels(REQUEST_INFO *req)
req->item_flags[req->items] |= RIF_BLOCKED;
sprintf(
&req->item_texts[req->items * req->item_text_len], "%s",
g_GameFlow.strings[GS_PASSPORT_LEGACY_SELECT_LEVEL_1]);
GS(PASSPORT_LEGACY_SELECT_LEVEL_1));
req->items++;
req->item_flags[req->items] |= RIF_BLOCKED;
sprintf(
&req->item_texts[req->items * req->item_text_len], "%s",
g_GameFlow.strings[GS_PASSPORT_LEGACY_SELECT_LEVEL_2]);
GS(PASSPORT_LEGACY_SELECT_LEVEL_2));
req->items++;
req->requested = 0;
req->line_offset = 0;
@ -611,7 +612,7 @@ void Savegame_ScanAvailableLevels(REQUEST_INFO *req)
req->item_flags[req->items] &= ~RIF_BLOCKED;
sprintf(
&req->item_texts[req->items * req->item_text_len], "%s",
g_GameFlow.strings[GS_PASSPORT_STORY_SO_FAR]);
GS(PASSPORT_STORY_SO_FAR));
req->items++;
}

View file

@ -6,6 +6,7 @@
#include "game/console.h"
#include "game/fmv.h"
#include "game/game.h"
#include "game/game_string.h"
#include "game/gamebuf.h"
#include "game/gameflow.h"
#include "game/input.h"
@ -303,14 +304,11 @@ void Shell_ProcessInput(void)
switch (g_Config.rendering.texture_filter) {
case GFX_TF_NN:
Console_Log(
g_GameFlow.strings[GS_OSD_TEXTURE_FILTER_SET],
g_GameFlow.strings[GS_OSD_TEXTURE_FILTER_NN]);
Console_Log(GS(OSD_TEXTURE_FILTER_SET), GS(OSD_TEXTURE_FILTER_NN));
break;
case GFX_TF_BILINEAR:
Console_Log(
g_GameFlow.strings[GS_OSD_TEXTURE_FILTER_SET],
g_GameFlow.strings[GS_OSD_TEXTURE_FILTER_BILINEAR]);
GS(OSD_TEXTURE_FILTER_SET), GS(OSD_TEXTURE_FILTER_BILINEAR));
break;
case GFX_TF_NUMBER_OF:
break;
@ -321,19 +319,18 @@ void Shell_ProcessInput(void)
if (g_InputDB.toggle_perspective_filter) {
g_Config.rendering.enable_perspective_filter ^= true;
Console_Log(g_GameFlow.strings
[g_Config.rendering.enable_perspective_filter
? GS_OSD_PERSPECTIVE_FILTER_ON
: GS_OSD_PERSPECTIVE_FILTER_OFF]);
Console_Log(
g_Config.rendering.enable_perspective_filter
? GS(OSD_PERSPECTIVE_FILTER_ON)
: GS(OSD_PERSPECTIVE_FILTER_OFF));
Config_Write();
}
if (g_InputDB.toggle_fps_counter) {
g_Config.rendering.enable_fps_counter ^= true;
Console_Log(g_GameFlow.strings
[g_Config.rendering.enable_fps_counter
? GS_OSD_FPS_COUNTER_ON
: GS_OSD_FPS_COUNTER_OFF]);
Console_Log(
g_Config.rendering.enable_fps_counter ? GS(OSD_FPS_COUNTER_ON)
: GS(OSD_FPS_COUNTER_OFF));
Config_Write();
}

View file

@ -1008,205 +1008,6 @@ typedef enum GAMEFLOW_SEQUENCE_TYPE {
GFS_LEGACY,
} GAMEFLOW_SEQUENCE_TYPE;
typedef enum GAME_STRING_ID {
GS_HEADING_INVENTORY,
GS_HEADING_GAME_OVER,
GS_HEADING_OPTION,
GS_HEADING_ITEMS,
GS_PASSPORT_SELECT_LEVEL,
GS_PASSPORT_STORY_SO_FAR,
GS_PASSPORT_LEGACY_SELECT_LEVEL_1,
GS_PASSPORT_LEGACY_SELECT_LEVEL_2,
GS_PASSPORT_RESTART_LEVEL,
GS_PASSPORT_SELECT_MODE,
GS_PASSPORT_MODE_NEW_GAME,
GS_PASSPORT_MODE_NEW_GAME_PLUS,
GS_PASSPORT_MODE_NEW_GAME_JP,
GS_PASSPORT_MODE_NEW_GAME_JP_PLUS,
GS_PASSPORT_NEW_GAME,
GS_PASSPORT_LOAD_GAME,
GS_PASSPORT_SAVE_GAME,
GS_PASSPORT_EXIT_GAME,
GS_PASSPORT_EXIT_TO_TITLE,
GS_DETAIL_SELECT_DETAIL,
GS_DETAIL_LEVEL_HIGH,
GS_DETAIL_LEVEL_MEDIUM,
GS_DETAIL_LEVEL_LOW,
GS_DETAIL_FPS,
GS_DETAIL_PERSPECTIVE,
GS_DETAIL_BILINEAR,
GS_DETAIL_TEXTURE_FILTER,
GS_DETAIL_FBO_FILTER,
GS_DETAIL_VSYNC,
GS_DETAIL_BRIGHTNESS,
GS_DETAIL_UI_TEXT_SCALE,
GS_DETAIL_UI_BAR_SCALE,
GS_DETAIL_RENDER_MODE,
GS_DETAIL_RENDER_MODE_LEGACY,
GS_DETAIL_RENDER_MODE_FBO,
GS_DETAIL_RESOLUTION,
GS_DETAIL_STRING_FMT,
GS_DETAIL_DECIMAL_FMT,
GS_DETAIL_FLOAT_FMT,
GS_DETAIL_RESOLUTION_FMT,
GS_SOUND_SET_VOLUMES,
GS_CONTROL_CUSTOMIZE,
GS_CONTROL_KEYBOARD,
GS_CONTROL_CONTROLLER,
GS_CONTROL_DEFAULT_KEYS,
GS_CONTROL_CUSTOM_1,
GS_CONTROL_CUSTOM_2,
GS_CONTROL_CUSTOM_3,
GS_CONTROL_RESET_DEFAULTS_KEY,
GS_CONTROL_RESET_DEFAULTS_BTN,
GS_CONTROL_UNBIND_KEY,
GS_CONTROL_UNBIND_BTN,
GS_KEYMAP_RUN,
GS_KEYMAP_BACK,
GS_KEYMAP_LEFT,
GS_KEYMAP_RIGHT,
GS_KEYMAP_STEP_LEFT,
GS_KEYMAP_STEP_RIGHT,
GS_KEYMAP_WALK,
GS_KEYMAP_JUMP,
GS_KEYMAP_ACTION,
GS_KEYMAP_DRAW_WEAPON,
GS_KEYMAP_LOOK,
GS_KEYMAP_ROLL,
GS_KEYMAP_INVENTORY,
GS_KEYMAP_FLY_CHEAT,
GS_KEYMAP_ITEM_CHEAT,
GS_KEYMAP_LEVEL_SKIP_CHEAT,
GS_KEYMAP_TURBO_CHEAT,
GS_KEYMAP_ENTER_CONSOLE,
GS_KEYMAP_PAUSE,
GS_KEYMAP_CAMERA_UP,
GS_KEYMAP_CAMERA_DOWN,
GS_KEYMAP_CAMERA_LEFT,
GS_KEYMAP_CAMERA_RIGHT,
GS_KEYMAP_CAMERA_RESET,
GS_KEYMAP_EQUIP_PISTOLS,
GS_KEYMAP_EQUIP_SHOTGUN,
GS_KEYMAP_EQUIP_MAGNUMS,
GS_KEYMAP_EQUIP_UZIS,
GS_KEYMAP_USE_SMALL_MEDI,
GS_KEYMAP_USE_BIG_MEDI,
GS_KEYMAP_SAVE,
GS_KEYMAP_LOAD,
GS_KEYMAP_FPS,
GS_KEYMAP_BILINEAR,
GS_STATS_KILLS_DETAIL_FMT,
GS_STATS_KILLS_BASIC_FMT,
GS_STATS_PICKUPS_DETAIL_FMT,
GS_STATS_PICKUPS_BASIC_FMT,
GS_STATS_SECRETS_FMT,
GS_STATS_DEATHS_FMT,
GS_STATS_TIME_TAKEN_FMT,
GS_STATS_FINAL_STATISTICS,
GS_STATS_BONUS_STATISTICS,
GS_PAUSE_PAUSED,
GS_PAUSE_EXIT_TO_TITLE,
GS_PAUSE_CONTINUE,
GS_PAUSE_QUIT,
GS_PAUSE_ARE_YOU_SURE,
GS_PAUSE_YES,
GS_PAUSE_NO,
GS_MISC_ON,
GS_MISC_OFF,
GS_MISC_EMPTY_SLOT_FMT,
GS_MISC_DEMO_MODE,
GS_INV_ITEM_MEDI,
GS_INV_ITEM_BIG_MEDI,
GS_INV_ITEM_PUZZLE1,
GS_INV_ITEM_PUZZLE2,
GS_INV_ITEM_PUZZLE3,
GS_INV_ITEM_PUZZLE4,
GS_INV_ITEM_KEY1,
GS_INV_ITEM_KEY2,
GS_INV_ITEM_KEY3,
GS_INV_ITEM_KEY4,
GS_INV_ITEM_PICKUP1,
GS_INV_ITEM_PICKUP2,
GS_INV_ITEM_LEADBAR,
GS_INV_ITEM_SCION,
GS_INV_ITEM_PISTOLS,
GS_INV_ITEM_SHOTGUN,
GS_INV_ITEM_MAGNUM,
GS_INV_ITEM_UZI,
GS_INV_ITEM_GRENADE,
GS_INV_ITEM_PISTOL_AMMO,
GS_INV_ITEM_SHOTGUN_AMMO,
GS_INV_ITEM_MAGNUM_AMMO,
GS_INV_ITEM_UZI_AMMO,
GS_INV_ITEM_COMPASS,
GS_INV_ITEM_GAME,
GS_INV_ITEM_DETAILS,
GS_INV_ITEM_SOUND,
GS_INV_ITEM_CONTROLS,
GS_INV_ITEM_GAMMA,
GS_INV_ITEM_LARAS_HOME,
GS_OSD_FLY_MODE_ON,
GS_OSD_FLY_MODE_OFF,
GS_OSD_FPS_GET,
GS_OSD_FPS_SET,
GS_OSD_POS_GET,
GS_OSD_POS_SET_POS,
GS_OSD_POS_SET_POS_FAIL,
GS_OSD_POS_SET_ROOM,
GS_OSD_POS_SET_ROOM_FAIL,
GS_OSD_SPEED_GET,
GS_OSD_SPEED_SET,
GS_OSD_BRAID_ON,
GS_OSD_BRAID_OFF,
GS_OSD_CHEATS_ON,
GS_OSD_CHEATS_OFF,
GS_OSD_GIVE_ITEM,
GS_OSD_GIVE_ITEM_ALL_KEYS,
GS_OSD_GIVE_ITEM_ALL_GUNS,
GS_OSD_FLIPMAP_ON,
GS_OSD_FLIPMAP_OFF,
GS_OSD_FLIPMAP_FAIL_ALREADY_ON,
GS_OSD_FLIPMAP_FAIL_ALREADY_OFF,
GS_OSD_KILL_ALL,
GS_OSD_KILL_ALL_FAIL,
GS_OSD_KILL,
GS_OSD_KILL_FAIL,
GS_OSD_COMPLETE_LEVEL,
GS_OSD_PLAY_LEVEL,
GS_OSD_TEXTURE_FILTER_SET,
GS_OSD_TEXTURE_FILTER_NN,
GS_OSD_TEXTURE_FILTER_BILINEAR,
GS_OSD_PERSPECTIVE_FILTER_ON,
GS_OSD_PERSPECTIVE_FILTER_OFF,
GS_OSD_FPS_COUNTER_ON,
GS_OSD_FPS_COUNTER_OFF,
GS_OSD_UNAVAILABLE_ITEM,
GS_OSD_INVALID_ITEM,
GS_OSD_INVALID_ROOM,
GS_OSD_INVALID_LEVEL,
GS_OSD_INVALID_COMMAND,
GS_OSD_COMMAND_FAIL,
GS_OSD_GIVE_ITEM_CHEAT,
GS_NUMBER_OF,
} GAME_STRING_ID;
typedef enum BAR_TYPE {
BT_LARA_HEALTH = 0,
BT_LARA_AIR = 1,
@ -2055,7 +1856,7 @@ typedef struct INVENTORY_SPRITE {
} INVENTORY_SPRITE;
typedef struct INVENTORY_ITEM {
char *string;
const char *string;
GAME_OBJECT_ID object_number;
int16_t frames_total;
int16_t current_frame;

View file

@ -103,7 +103,4 @@ SHADOW_INFO g_ShadowInfo = { 0 };
#ifndef MESON_BUILD
const char *g_TR1XVersion = "TR1X (non-Docker build)";
GAMEFLOW_DEFAULT_STRING g_GameFlowDefaultStrings[] = {
{ 0, NULL },
};
#endif

View file

@ -1,5 +1,8 @@
#pragma once
#define Q(x) #x
#define QUOTE(x) Q(x)
#define SQUARE(A) ((A) * (A))
#ifndef ABS
#define ABS(x) (((x) < 0) ? (-(x)) : (x))

View file

@ -1,35 +1,12 @@
#!/usr/bin/env python3
import argparse
import json
from pathlib import Path
from shared.versioning import generate_version
try:
import pyjson5
except ImportError:
import json5 as pyjson5
REPO_DIR = Path(__file__).parent.parent
SHIP_DIR = REPO_DIR / "data/ship"
SRC_DIR = REPO_DIR / "src"
CONFIG_DIR = SHIP_DIR / "cfg"
GAMEFLOW_PATH = CONFIG_DIR / "TR1X_gameflow.json5"
TEMPLATE = """
#include "game/gameflow.h"
#include "global/types.h"
#include <stddef.h>
const char *g_TR1XVersion = "{version}";
GAMEFLOW_DEFAULT_STRING g_GameFlowDefaultStrings[] = {{
{strings}
{{ 0, NULL }},
}};
"""
""".lstrip()
def parse_args() -> argparse.Namespace:
@ -39,14 +16,7 @@ def parse_args() -> argparse.Namespace:
def get_init_c() -> str:
gameflow = pyjson5.loads(GAMEFLOW_PATH.read_text(encoding="utf-8"))
return TEMPLATE.format(
version=generate_version(),
strings="\n".join(
f" {{ GS_{key}, {json.dumps(value)} }},"
for key, value in gameflow["strings"].items()
),
)
return TEMPLATE.format(version=generate_version())
def update_init_c(output_path: Path) -> None:

View file

@ -2,6 +2,8 @@
import argparse
from pathlib import Path
from shared.versioning import generate_version
REPO_DIR = Path(__file__).parent.parent
DATA_DIR = REPO_DIR / "data"
SRC_DIR = REPO_DIR / "src"
@ -9,12 +11,13 @@ SRC_DIR = REPO_DIR / "src"
def parse_args() -> argparse.Namespace:
parser = argparse.ArgumentParser()
parser.add_argument("--version-file", type=Path)
parser.add_argument('-o', "--output", type=Path, nargs="+")
parser.add_argument("-o", "--output", type=Path, nargs="+")
return parser.parse_args()
def write_rc_template(input_path: Path, output_path: Path, version: str) -> None:
def write_rc_template(
input_path: Path, output_path: Path, version: str
) -> None:
template = input_path.read_text()
template = template.replace("{version}", version)
template = template.replace("{icon_path}", str(DATA_DIR / "icon.ico"))
@ -23,10 +26,7 @@ def write_rc_template(input_path: Path, output_path: Path, version: str) -> None
def main() -> None:
args = parse_args()
if args.version_file and args.version_file.exists():
version = args.version_file.read_text().strip()
else:
version = ""
version = generate_version()
for output_path in args.output:
write_rc_template(

View file

@ -1,12 +1,40 @@
import argparse
import json
import os
import re
import sys
import zipfile
from collections.abc import Iterable
from pathlib import Path
from subprocess import check_call, check_output, run
from shared.common import DATA_DIR, SRC_DIR
from shared.versioning import generate_version
from shared.packaging import create_zip
SHIP_DIR = Path("/app/data/ship")
SHIP_DIR = DATA_DIR / "ship"
GAME_STRING_DEF_PATH = SRC_DIR / "game/game_string.def"
def get_default_string_map() -> dict[str, str]:
result: dict[str, str] = {}
for line in GAME_STRING_DEF_PATH.read_text().splitlines():
if match := re.match(r'^GS_DEFINE\((\w+), "([^"]+)"\)$', line.strip()):
result[match.group(1)] = match.group(2)
return result
def postprocess_gameflow(gameflow: str, string_map: dict[str, str]) -> str:
gameflow = re.sub(
r'^( "strings": {$)',
r"\1\n"
+ "\n".join(
f" {json.dumps(key)}: {json.dumps(value)},"
for key, value in string_map.items()
),
gameflow,
flags=re.M,
)
return gameflow
class BaseGameEntrypoint:
@ -74,18 +102,24 @@ class BaseGameEntrypoint:
check_call([self.UPX_TOOL, str(path)])
def package(self, args: argparse.Namespace) -> None:
string_map = get_default_string_map()
assert string_map
if args.output:
zip_path = args.output
else:
version = generate_version()
zip_path = Path(f"{version}-{self.RELEASE_ZIP_SUFFIX}.zip")
source_files = [
*[
(path, path.relative_to(SHIP_DIR))
for path in SHIP_DIR.rglob("*")
if path.is_file()
],
*self.RELEASE_ZIP_FILES,
]
create_zip(zip_path, source_files)
print(f"Created {zip_path}")
with zipfile.ZipFile(zip_path, "w") as handle:
for path in SHIP_DIR.rglob("*"):
arcname = path.relative_to(SHIP_DIR)
if "gameflow" in path.name:
handle.writestr(
str(arcname),
data=postprocess_gameflow(
path.read_text(), string_map
),
)
elif path.is_file():
handle.write(path, arcname=arcname)