Skip to content

Commit

Permalink
tr2/input: add TR3+ sidesteps option
Browse files Browse the repository at this point in the history
Resolves #2111.
  • Loading branch information
rr- committed Dec 30, 2024
1 parent bf63297 commit 38f44a6
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 23 deletions.
1 change: 1 addition & 0 deletions docs/tr2/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
- completed decompilation efforts – TR2X.dll is gone, Tomb2.exe no longer needed (#1694)
- added the ability to turn FMVs off (#2110)
- added an option to use PS1 contrast levels, available under F8 (#1646)
- added an option to use TR3+ side steps (#2111)
- added an option to allow disabling the developer console (#2063)
- added an optional fix for the QWOP glitch (#2122)
- added an optional fix for the step glitch, where Lara can be pushed into walls (#2124)
Expand Down
1 change: 1 addition & 0 deletions src/tr2/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ typedef struct {
bool enable_cheats;
bool enable_console;
bool enable_fmv;
bool enable_tr3_sidesteps;
bool enable_auto_item_selection;
int32_t turbo_speed;
} gameplay;
Expand Down
1 change: 1 addition & 0 deletions src/tr2/config_map.def
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ CFG_BOOL(g_Config, gameplay.fix_walk_run_jump, true)
CFG_BOOL(g_Config, gameplay.enable_cheats, false)
CFG_BOOL(g_Config, gameplay.enable_console, true)
CFG_BOOL(g_Config, gameplay.enable_fmv, true)
CFG_BOOL(g_Config, gameplay.enable_tr3_sidesteps, true)
CFG_BOOL(g_Config, gameplay.enable_auto_item_selection, true)
CFG_INT32(g_Config, gameplay.turbo_speed, 0)
CFG_BOOL(g_Config, visuals.enable_3d_pickups, true)
Expand Down
13 changes: 13 additions & 0 deletions src/tr2/game/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,19 @@ void Input_Update(void)
g_Input.turbo_cheat = 0;
}

if (g_Config.gameplay.enable_tr3_sidesteps) {
if (g_Input.slow && !g_Input.forward && !g_Input.back
&& !g_Input.step_left && !g_Input.step_right) {
if (g_Input.left) {
g_Input.left = 0;
g_Input.step_left = 1;
} else if (g_Input.right) {
g_Input.right = 0;
g_Input.step_right = 1;
}
}
}

g_InputDB = M_GetDebounced(g_Input);

if (Input_IsInListenMode()) {
Expand Down
52 changes: 30 additions & 22 deletions src/tr2/game/lara/state.c
Original file line number Diff line number Diff line change
Expand Up @@ -903,10 +903,12 @@ void Lara_State_SurfSwim(ITEM *item, COLL_INFO *coll)
}

g_Lara.dive_count = 0;
if (g_Input.left) {
item->rot.y -= LARA_SLOW_TURN;
} else if (g_Input.right) {
item->rot.y += LARA_SLOW_TURN;
if (!g_Config.gameplay.enable_tr3_sidesteps || !g_Input.slow) {
if (g_Input.left) {
item->rot.y -= LARA_SLOW_TURN;
} else if (g_Input.right) {
item->rot.y += LARA_SLOW_TURN;
}
}
if (!g_Input.forward || g_Input.jump) {
item->goal_anim_state = LS_SURF_TREAD;
Expand All @@ -923,10 +925,12 @@ void Lara_State_SurfBack(ITEM *item, COLL_INFO *coll)
}

g_Lara.dive_count = 0;
if (g_Input.left) {
item->rot.y -= LARA_SURF_TURN;
} else if (g_Input.right) {
item->rot.y += LARA_SURF_TURN;
if (!g_Config.gameplay.enable_tr3_sidesteps || !g_Input.slow) {
if (g_Input.left) {
item->rot.y -= LARA_SURF_TURN;
} else if (g_Input.right) {
item->rot.y += LARA_SURF_TURN;
}
}
if (!g_Input.back) {
item->goal_anim_state = LS_SURF_TREAD;
Expand All @@ -943,13 +947,15 @@ void Lara_State_SurfLeft(ITEM *item, COLL_INFO *coll)
}

g_Lara.dive_count = 0;
if (g_Input.left) {
item->rot.y -= LARA_SURF_TURN;
} else if (g_Input.right) {
item->rot.y += LARA_SURF_TURN;
}
if (!g_Input.step_left) {
item->goal_anim_state = LS_SURF_TREAD;
if (!g_Config.gameplay.enable_tr3_sidesteps || !g_Input.slow) {
if (g_Input.left) {
item->rot.y -= LARA_SURF_TURN;
} else if (g_Input.right) {
item->rot.y += LARA_SURF_TURN;
}
if (!g_Input.step_left) {
item->goal_anim_state = LS_SURF_TREAD;
}
}
item->fall_speed += 8;
CLAMPG(item->fall_speed, LARA_MAX_SURF_SPEED);
Expand All @@ -963,13 +969,15 @@ void Lara_State_SurfRight(ITEM *item, COLL_INFO *coll)
}

g_Lara.dive_count = 0;
if (g_Input.left) {
item->rot.y -= LARA_SURF_TURN;
} else if (g_Input.right) {
item->rot.y += LARA_SURF_TURN;
}
if (!g_Input.step_right) {
item->goal_anim_state = LS_SURF_TREAD;
if (!g_Config.gameplay.enable_tr3_sidesteps || !g_Input.slow) {
if (g_Input.left) {
item->rot.y -= LARA_SURF_TURN;
} else if (g_Input.right) {
item->rot.y += LARA_SURF_TURN;
}
if (!g_Input.step_right) {
item->goal_anim_state = LS_SURF_TREAD;
}
}
item->fall_speed += 8;
CLAMPG(item->fall_speed, LARA_MAX_SURF_SPEED);
Expand Down
4 changes: 4 additions & 0 deletions tools/tr2/config/TR2X_ConfigTool/Resources/Lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
}
},
"Properties": {
"enable_tr3_sidesteps": {
"Title": "Enhanced sidesteps",
"Description": "Enables TR3+ style sidesteps, e.g. shift+directional arrows. Dedicated sidestep buttons will still work."
},
"enable_3d_pickups": {
"Title": "3D pickups",
"Description": "Enables 3D models to be rendered in place of the sprites for pickup items."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@
"ID": "controls",
"Image": "Graphics/graphic1.jpg",
"Properties": [

{
"Field": "enable_tr3_sidesteps",
"DataType": "Bool",
"DefaultValue": true
}
]
},
{
Expand Down

0 comments on commit 38f44a6

Please sign in to comment.