diff --git a/data/tr1/ship/cfg/TR1X_gameflow.json5 b/data/tr1/ship/cfg/TR1X_gameflow.json5 index 4a29bc779..0b03ff9a3 100644 --- a/data/tr1/ship/cfg/TR1X_gameflow.json5 +++ b/data/tr1/ship/cfg/TR1X_gameflow.json5 @@ -671,7 +671,7 @@ "KEYMAP_CAMERA_UP": "Camera Up", "KEYMAP_CHANGE_TARGET": "Change Target", "KEYMAP_DRAW_WEAPON": "Draw Weapon", - "KEYMAP_ENTER_CONSOLE": "Enter Console", + "KEYMAP_ENTER_CONSOLE": "Dev Console", "KEYMAP_EQUIP_MAGNUMS": "Equip Magnums", "KEYMAP_EQUIP_PISTOLS": "Equip Pistols", "KEYMAP_EQUIP_SHOTGUN": "Equip Shotgun", diff --git a/data/tr1/ship/cfg/TR1X_gameflow_demo_pc.json5 b/data/tr1/ship/cfg/TR1X_gameflow_demo_pc.json5 index 2e131435f..ee3ee2d3d 100644 --- a/data/tr1/ship/cfg/TR1X_gameflow_demo_pc.json5 +++ b/data/tr1/ship/cfg/TR1X_gameflow_demo_pc.json5 @@ -159,7 +159,7 @@ "KEYMAP_CAMERA_UP": "Camera Up", "KEYMAP_CHANGE_TARGET": "Change Target", "KEYMAP_DRAW_WEAPON": "Draw Weapon", - "KEYMAP_ENTER_CONSOLE": "Enter Console", + "KEYMAP_ENTER_CONSOLE": "Dev Console", "KEYMAP_EQUIP_MAGNUMS": "Equip Magnums", "KEYMAP_EQUIP_PISTOLS": "Equip Pistols", "KEYMAP_EQUIP_SHOTGUN": "Equip Shotgun", diff --git a/data/tr1/ship/cfg/TR1X_gameflow_ub.json5 b/data/tr1/ship/cfg/TR1X_gameflow_ub.json5 index ad33c6d77..a6bc0c16b 100644 --- a/data/tr1/ship/cfg/TR1X_gameflow_ub.json5 +++ b/data/tr1/ship/cfg/TR1X_gameflow_ub.json5 @@ -231,7 +231,7 @@ "KEYMAP_CAMERA_UP": "Camera Up", "KEYMAP_CHANGE_TARGET": "Change Target", "KEYMAP_DRAW_WEAPON": "Draw Weapon", - "KEYMAP_ENTER_CONSOLE": "Enter Console", + "KEYMAP_ENTER_CONSOLE": "Dev Console", "KEYMAP_EQUIP_MAGNUMS": "Equip Magnums", "KEYMAP_EQUIP_PISTOLS": "Equip Pistols", "KEYMAP_EQUIP_SHOTGUN": "Equip Shotgun", diff --git a/data/tr2/ship/cfg/TR2X_gameflow.json5 b/data/tr2/ship/cfg/TR2X_gameflow.json5 index d43385aa8..70b3b71ee 100644 --- a/data/tr2/ship/cfg/TR2X_gameflow.json5 +++ b/data/tr2/ship/cfg/TR2X_gameflow.json5 @@ -358,6 +358,24 @@ "CONTROL_CUSTOM_2": "User Keys 2", "CONTROL_CUSTOM_3": "User Keys 3", "CONTROL_DEFAULT_KEYS": "Default Keys", + "KEYMAP_ACTION": "Action", + "KEYMAP_BACK": "Back", + "KEYMAP_DRAW_WEAPON": "Draw Weapon", + "KEYMAP_ENTER_CONSOLE": "Dev Console", + "KEYMAP_FLY_CHEAT": "Fly Cheat", + "KEYMAP_INVENTORY": "Inventory", + "KEYMAP_ITEM_CHEAT": "Item Cheat", + "KEYMAP_JUMP": "Jump", + "KEYMAP_LEFT": "Left", + "KEYMAP_LEVEL_SKIP_CHEAT": "Level Skip", + "KEYMAP_LOOK": "Look", + "KEYMAP_RIGHT": "Right", + "KEYMAP_ROLL": "Roll", + "KEYMAP_RUN": "Run", + "KEYMAP_STEP_LEFT": "Step Left", + "KEYMAP_STEP_RIGHT": "Step Right", + "KEYMAP_USE_FLARE": "Flare", + "KEYMAP_WALK": "Walk", "MISC_OFF": "Off", "MISC_ON": "On", "OSD_AMBIGUOUS_INPUT_2": "Ambiguous input: %s and %s", diff --git a/docs/tr2/CHANGELOG.md b/docs/tr2/CHANGELOG.md index adc759244..8145ce7af 100644 --- a/docs/tr2/CHANGELOG.md +++ b/docs/tr2/CHANGELOG.md @@ -1,4 +1,7 @@ ## [Unreleased](https://github.com/LostArtefacts/TRX/compare/tr2-0.5...develop) - ××××-××-×× +- added a fly cheat key (#1642) +- added an items cheat key (#1641) +- added a level skip cheat key (#1640) - changed the inputs backend from DirectX to SDL (#1695) - improved controller support to match TR1X - changed the number of custom layouts to 3 diff --git a/src/libtrx/include/libtrx/game/game_string.def b/src/libtrx/include/libtrx/game/game_string.def index 9b10507bb..6ba37890e 100644 --- a/src/libtrx/include/libtrx/game/game_string.def +++ b/src/libtrx/include/libtrx/game/game_string.def @@ -52,3 +52,20 @@ GS_DEFINE(CONTROL_CUSTOM_3, "User Keys 3") GS_DEFINE(CONTROL_BACKEND_KEYBOARD, "Keyboard") GS_DEFINE(CONTROL_BACKEND_CONTROLLER, "Controller") GS_DEFINE(CONTROL_CUSTOMIZE, "Customize Controls") +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_FLY_CHEAT, "Fly Cheat") +GS_DEFINE(KEYMAP_ITEM_CHEAT, "Item Cheat") +GS_DEFINE(KEYMAP_LEVEL_SKIP_CHEAT, "Level Skip") +GS_DEFINE(KEYMAP_ENTER_CONSOLE, "Dev Console") diff --git a/src/libtrx/include/libtrx/game/input/backends/keyboard_tr2.def b/src/libtrx/include/libtrx/game/input/backends/keyboard_tr2.def index 070c361e9..ef92879bd 100644 --- a/src/libtrx/include/libtrx/game/input/backends/keyboard_tr2.def +++ b/src/libtrx/include/libtrx/game/input/backends/keyboard_tr2.def @@ -15,6 +15,10 @@ INPUT_KEYBOARD_ASSIGN(INPUT_ROLE_ENTER_CONSOLE, SDL_SCANCODE_SLASH INPUT_KEYBOARD_ASSIGN(INPUT_ROLE_SAVE, SDL_SCANCODE_F5) INPUT_KEYBOARD_ASSIGN(INPUT_ROLE_LOAD, SDL_SCANCODE_F6) +INPUT_KEYBOARD_ASSIGN(INPUT_ROLE_FLY_CHEAT, SDL_SCANCODE_O) +INPUT_KEYBOARD_ASSIGN(INPUT_ROLE_ITEM_CHEAT, SDL_SCANCODE_I) +INPUT_KEYBOARD_ASSIGN(INPUT_ROLE_LEVEL_SKIP_CHEAT, SDL_SCANCODE_L) + INPUT_KEYBOARD_ASSIGN(INPUT_ROLE_EQUIP_PISTOLS, SDL_SCANCODE_1) INPUT_KEYBOARD_ASSIGN(INPUT_ROLE_EQUIP_SHOTGUN, SDL_SCANCODE_2) INPUT_KEYBOARD_ASSIGN(INPUT_ROLE_EQUIP_MAGNUMS, SDL_SCANCODE_3) diff --git a/src/libtrx/include/libtrx/game/input/role.h b/src/libtrx/include/libtrx/game/input/role.h index bcbf94807..9371aebe5 100644 --- a/src/libtrx/include/libtrx/game/input/role.h +++ b/src/libtrx/include/libtrx/game/input/role.h @@ -93,6 +93,9 @@ typedef enum { INPUT_ROLE_TOGGLE_DITHER = 38, INPUT_ROLE_TOGGLE_FULLSCREEN = 39, INPUT_ROLE_TOGGLE_RENDERING_MODE = 40, + INPUT_ROLE_FLY_CHEAT = 41, + INPUT_ROLE_ITEM_CHEAT = 42, + INPUT_ROLE_LEVEL_SKIP_CHEAT = 43, #endif INPUT_ROLE_NUMBER_OF, // clang-format on diff --git a/src/libtrx/include/libtrx/game/input/state.h b/src/libtrx/include/libtrx/game/input/state.h index 2ecc70fde..baa811948 100644 --- a/src/libtrx/include/libtrx/game/input/state.h +++ b/src/libtrx/include/libtrx/game/input/state.h @@ -23,10 +23,11 @@ typedef union INPUT_STATE { uint64_t save : 1; uint64_t load : 1; -#if TR_VERSION == 1 uint64_t fly_cheat : 1; uint64_t item_cheat : 1; uint64_t level_skip_cheat : 1; + +#if TR_VERSION == 1 uint64_t turbo_cheat : 1; uint64_t camera_up : 1; uint64_t camera_down : 1; diff --git a/src/tr1/game/game_string.def b/src/tr1/game/game_string.def index 7e43c07fc..93e9c4741 100644 --- a/src/tr1/game/game_string.def +++ b/src/tr1/game/game_string.def @@ -43,25 +43,8 @@ GS_DEFINE(DETAIL_RESOLUTION_FMT, "%dx%d") GS_DEFINE(SOUND_SET_VOLUMES, "Set Volumes") GS_DEFINE(CONTROL_RESET_DEFAULTS, "Reset All: Hold %s") GS_DEFINE(CONTROL_UNBIND, "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_CHANGE_TARGET, "Change Target") GS_DEFINE(KEYMAP_TOGGLE_UI, "Toggle UI") GS_DEFINE(KEYMAP_TOGGLE_PHOTO_MODE, "Toggle Photo Mode") diff --git a/src/tr2/config.h b/src/tr2/config.h index c3302c164..b9ae39d80 100644 --- a/src/tr2/config.h +++ b/src/tr2/config.h @@ -15,6 +15,7 @@ typedef struct { struct { bool fix_m16_accuracy; + bool enable_cheats; } gameplay; struct { diff --git a/src/tr2/config_map.def b/src/tr2/config_map.def index 270ded597..eb6525b72 100644 --- a/src/tr2/config_map.def +++ b/src/tr2/config_map.def @@ -1,4 +1,5 @@ CFG_BOOL(g_Config, gameplay.fix_m16_accuracy, true) +CFG_BOOL(g_Config, gameplay.enable_cheats, false) CFG_ENUM(g_Config, rendering.screenshot_format, SCREENSHOT_FORMAT_JPEG, SCREENSHOT_FORMAT) CFG_INT32(g_Config, input.keyboard_layout, INPUT_LAYOUT_DEFAULT) CFG_INT32(g_Config, input.controller_layout, INPUT_LAYOUT_DEFAULT) diff --git a/src/tr2/game/game_string.def b/src/tr2/game/game_string.def index 95cd8f270..fdb36941c 100644 --- a/src/tr2/game/game_string.def +++ b/src/tr2/game/game_string.def @@ -18,3 +18,4 @@ GS_DEFINE(OSD_LOAD_GAME, "Loaded game from save slot %d") GS_DEFINE(OSD_LOAD_GAME_FAIL_UNAVAILABLE_SLOT, "Save slot %d is not available") GS_DEFINE(OSD_SAVE_GAME, "Saved game to save slot %d") GS_DEFINE(OSD_SAVE_GAME_FAIL, "Cannot save the game in the current state") +GS_DEFINE(KEYMAP_USE_FLARE, "Flare") diff --git a/src/tr2/game/input.c b/src/tr2/game/input.c index c3dae3490..667eb4796 100644 --- a/src/tr2/game/input.c +++ b/src/tr2/game/input.c @@ -2,6 +2,7 @@ #include "config.h" #include "game/console/common.h" +#include "game/game_string.h" #include "game/shell.h" #include "global/funcs.h" #include "global/vars.h" @@ -45,6 +46,10 @@ static void M_UpdateFromBackend( s->save |= backend->is_pressed(layout, INPUT_ROLE_SAVE); s->load |= backend->is_pressed(layout, INPUT_ROLE_LOAD); + s->item_cheat |= backend->is_pressed(layout, INPUT_ROLE_ITEM_CHEAT); + s->fly_cheat |= backend->is_pressed(layout, INPUT_ROLE_FLY_CHEAT); + s->level_skip_cheat |= backend->is_pressed(layout, INPUT_ROLE_LEVEL_SKIP_CHEAT); + s->equip_pistols |= backend->is_pressed(layout, INPUT_ROLE_EQUIP_PISTOLS); s->equip_shotgun |= backend->is_pressed(layout, INPUT_ROLE_EQUIP_SHOTGUN); s->equip_magnums |= backend->is_pressed(layout, INPUT_ROLE_EQUIP_MAGNUMS); @@ -95,6 +100,12 @@ void Input_Update(void) g_Input.right = 0; } + if (!g_Config.gameplay.enable_cheats) { + g_Input.item_cheat = 0; + g_Input.fly_cheat = 0; + g_Input.level_skip_cheat = 0; + } + g_InputDB = M_GetDebounced(g_Input); if (Input_IsInListenMode()) { @@ -107,22 +118,25 @@ const char *Input_GetRoleName(const INPUT_ROLE role) { // clang-format off switch (role) { - case INPUT_ROLE_UP: return g_GF_GameStrings[GF_S_GAME_KEYMAP_RUN]; - case INPUT_ROLE_DOWN: return g_GF_GameStrings[GF_S_GAME_KEYMAP_BACK]; - case INPUT_ROLE_LEFT: return g_GF_GameStrings[GF_S_GAME_KEYMAP_LEFT]; - case INPUT_ROLE_RIGHT: return g_GF_GameStrings[GF_S_GAME_KEYMAP_RIGHT]; - case INPUT_ROLE_STEP_L: return g_GF_GameStrings[GF_S_GAME_KEYMAP_STEP_LEFT]; - case INPUT_ROLE_STEP_R: return g_GF_GameStrings[GF_S_GAME_KEYMAP_STEP_RIGHT]; - case INPUT_ROLE_SLOW: return g_GF_GameStrings[GF_S_GAME_KEYMAP_WALK]; - case INPUT_ROLE_JUMP: return g_GF_GameStrings[GF_S_GAME_KEYMAP_JUMP]; - case INPUT_ROLE_ACTION: return g_GF_GameStrings[GF_S_GAME_KEYMAP_ACTION]; - case INPUT_ROLE_DRAW: return g_GF_GameStrings[GF_S_GAME_KEYMAP_DRAW_WEAPON]; - case INPUT_ROLE_USE_FLARE: return g_GF_GameStrings[GF_S_GAME_KEYMAP_FLARE]; - case INPUT_ROLE_LOOK: return g_GF_GameStrings[GF_S_GAME_KEYMAP_LOOK]; - case INPUT_ROLE_ROLL: return g_GF_GameStrings[GF_S_GAME_KEYMAP_ROLL]; - case INPUT_ROLE_OPTION: return g_GF_GameStrings[GF_S_GAME_KEYMAP_INVENTORY]; - case INPUT_ROLE_ENTER_CONSOLE: return "Console"; - default: return ""; + case INPUT_ROLE_UP: return GS(KEYMAP_RUN); + case INPUT_ROLE_DOWN: return GS(KEYMAP_BACK); + case INPUT_ROLE_LEFT: return GS(KEYMAP_LEFT); + case INPUT_ROLE_RIGHT: return GS(KEYMAP_RIGHT); + case INPUT_ROLE_STEP_L: return GS(KEYMAP_STEP_LEFT); + case INPUT_ROLE_STEP_R: return GS(KEYMAP_STEP_RIGHT); + case INPUT_ROLE_SLOW: return GS(KEYMAP_WALK); + case INPUT_ROLE_JUMP: return GS(KEYMAP_JUMP); + case INPUT_ROLE_ACTION: return GS(KEYMAP_ACTION); + case INPUT_ROLE_DRAW: return GS(KEYMAP_DRAW_WEAPON); + case INPUT_ROLE_USE_FLARE: return GS(KEYMAP_USE_FLARE); + case INPUT_ROLE_LOOK: return GS(KEYMAP_LOOK); + case INPUT_ROLE_ROLL: return GS(KEYMAP_ROLL); + case INPUT_ROLE_OPTION: return GS(KEYMAP_INVENTORY); + case INPUT_ROLE_FLY_CHEAT: return GS(KEYMAP_FLY_CHEAT); + case INPUT_ROLE_ITEM_CHEAT: return GS(KEYMAP_ITEM_CHEAT); + case INPUT_ROLE_LEVEL_SKIP_CHEAT: return GS(KEYMAP_LEVEL_SKIP_CHEAT); + case INPUT_ROLE_ENTER_CONSOLE: return GS(KEYMAP_ENTER_CONSOLE); + default: return ""; } // clang-format on } diff --git a/src/tr2/game/lara/control.c b/src/tr2/game/lara/control.c index a454fd599..5abcc18e1 100644 --- a/src/tr2/game/lara/control.c +++ b/src/tr2/game/lara/control.c @@ -245,6 +245,18 @@ void __cdecl Lara_Control(const int16_t item_num) { ITEM *const item = g_LaraItem; + if (g_InputDB.level_skip_cheat) { + Lara_Cheat_EndLevel(); + } + + if (g_InputDB.item_cheat) { + Lara_Cheat_GiveAllItems(); + } + + if (g_Lara.water_status != LWS_CHEAT && g_InputDB.fly_cheat) { + Lara_Cheat_EnterFlyMode(); + } + const bool room_submerged = g_Rooms[item->room_num].flags & RF_UNDERWATER; const int32_t water_depth = Lara_GetWaterDepth( item->pos.x, item->pos.y, item->pos.z, item->room_num); diff --git a/src/tr2/game/ui/controllers/controls.c b/src/tr2/game/ui/controllers/controls.c index c28b380c5..2c73d238b 100644 --- a/src/tr2/game/ui/controllers/controls.c +++ b/src/tr2/game/ui/controllers/controls.c @@ -1,5 +1,6 @@ #include "game/ui/controllers/controls.h" +#include "config.h" #include "game/input.h" #include "game/shell.h" #include "global/vars.h" @@ -10,17 +11,49 @@ #include static const INPUT_ROLE m_LeftRoles[] = { - INPUT_ROLE_UP, INPUT_ROLE_DOWN, INPUT_ROLE_LEFT, INPUT_ROLE_RIGHT, - INPUT_ROLE_STEP_L, INPUT_ROLE_STEP_R, INPUT_ROLE_SLOW, (INPUT_ROLE)-1, + // clang-format off + INPUT_ROLE_UP, + INPUT_ROLE_DOWN, + INPUT_ROLE_LEFT, + INPUT_ROLE_RIGHT, + INPUT_ROLE_STEP_L, + INPUT_ROLE_STEP_R, + INPUT_ROLE_SLOW, + INPUT_ROLE_ENTER_CONSOLE, + (INPUT_ROLE)-1, + // clang-format on }; -static const INPUT_ROLE m_RightRoles[] = { - INPUT_ROLE_JUMP, INPUT_ROLE_ACTION, INPUT_ROLE_DRAW, - INPUT_ROLE_USE_FLARE, INPUT_ROLE_LOOK, INPUT_ROLE_ROLL, - INPUT_ROLE_OPTION, INPUT_ROLE_ENTER_CONSOLE, (INPUT_ROLE)-1, +static const INPUT_ROLE m_RightRoles_CheatsOff[] = { + // clang-format off + INPUT_ROLE_JUMP, + INPUT_ROLE_ACTION, + INPUT_ROLE_DRAW, + INPUT_ROLE_USE_FLARE, + INPUT_ROLE_LOOK, + INPUT_ROLE_ROLL, + INPUT_ROLE_OPTION, + (INPUT_ROLE)-1, + // clang-format on }; -static const INPUT_ROLE *M_GetInputRoles(int32_t col); +static const INPUT_ROLE m_RightRoles_CheatsOn[] = { + // clang-format off + INPUT_ROLE_JUMP, + INPUT_ROLE_ACTION, + INPUT_ROLE_DRAW, + INPUT_ROLE_USE_FLARE, + INPUT_ROLE_LOOK, + INPUT_ROLE_ROLL, + INPUT_ROLE_OPTION, + INPUT_ROLE_FLY_CHEAT, + INPUT_ROLE_ITEM_CHEAT, + INPUT_ROLE_LEVEL_SKIP_CHEAT, + (INPUT_ROLE)-1, + // clang-format on +}; + +static INPUT_ROLE M_GetInputRole(int32_t col, int32_t row); static void M_CycleLayout(UI_CONTROLS_CONTROLLER *controller, int32_t dir); static bool M_NavigateLayout(UI_CONTROLS_CONTROLLER *controller); static bool M_NavigateInputs(UI_CONTROLS_CONTROLLER *controller); @@ -28,9 +61,15 @@ static bool M_NavigateInputsDebounce(UI_CONTROLS_CONTROLLER *controller); static bool M_Listen(UI_CONTROLS_CONTROLLER *controller); static bool M_ListenDebounce(UI_CONTROLS_CONTROLLER *controller); -static const INPUT_ROLE *M_GetInputRoles(const int32_t col) +static INPUT_ROLE M_GetInputRole(const int32_t col, const int32_t row) { - return col == 0 ? m_LeftRoles : m_RightRoles; + if (col == 0) { + return m_LeftRoles[row]; + } else if (g_Config.gameplay.enable_cheats) { + return m_RightRoles_CheatsOn[row]; + } else { + return m_RightRoles_CheatsOff[row]; + } } static void M_CycleLayout( @@ -95,7 +134,7 @@ static bool M_NavigateLayout(UI_CONTROLS_CONTROLLER *const controller) return false; } controller->active_role = - M_GetInputRoles(controller->active_col)[controller->active_row]; + M_GetInputRole(controller->active_col, controller->active_row); return true; } @@ -137,7 +176,7 @@ static bool M_NavigateInputs(UI_CONTROLS_CONTROLLER *const controller) return false; } controller->active_role = - M_GetInputRoles(controller->active_col)[controller->active_row]; + M_GetInputRole(controller->active_col, controller->active_row); return true; } @@ -223,15 +262,14 @@ bool UI_ControlsController_Control(UI_CONTROLS_CONTROLLER *const controller) INPUT_ROLE UI_ControlsController_GetInputRole( const int32_t col, const int32_t row) { - return M_GetInputRoles(col)[row]; + return M_GetInputRole(col, row); } int32_t UI_ControlsController_GetInputRoleCount(const int32_t col) { - int32_t result = 0; - const INPUT_ROLE *const roles = M_GetInputRoles(col); - while (roles[result] != (INPUT_ROLE)-1) { - result++; + int32_t row = 0; + while (M_GetInputRole(col, row) != (INPUT_ROLE)-1) { + row++; } - return result; + return row; } diff --git a/tools/tr2/config/TR2X_ConfigTool/Resources/Lang/en.json b/tools/tr2/config/TR2X_ConfigTool/Resources/Lang/en.json index d067a59d8..9708e9286 100644 --- a/tools/tr2/config/TR2X_ConfigTool/Resources/Lang/en.json +++ b/tools/tr2/config/TR2X_ConfigTool/Resources/Lang/en.json @@ -13,6 +13,10 @@ } }, "Properties": { + "enable_cheats": { + "Title": "Cheats", + "Description": "Enables various cheats:\n- L: immediately end the level.\n- I: give Lara all weapons; a boost of ammo and medipacks; and all plot items for the current level.\n- O: enable DOZY cheat (swimming midair).\n - WALK key: exit DOZY.\n - GUN key: open the closest door (doesn't work in certain places)." + }, "fix_m16_accuracy": { "Title": "Fix M16 accuracy", "Description": "Fixes the accuracy of the M16 while Lara is running." diff --git a/tools/tr2/config/TR2X_ConfigTool/Resources/specification.json b/tools/tr2/config/TR2X_ConfigTool/Resources/specification.json index b73dac68e..d5cf2c318 100644 --- a/tools/tr2/config/TR2X_ConfigTool/Resources/specification.json +++ b/tools/tr2/config/TR2X_ConfigTool/Resources/specification.json @@ -28,7 +28,11 @@ "ID": "gameplay_modifications", "Image": "Graphics/graphic3.jpg", "Properties": [ - + { + "Field": "enable_cheats", + "DataType": "Bool", + "DefaultValue": false + } ] }, {