Skip to content

Commit

Permalink
introduce TR3 sidesteps
Browse files Browse the repository at this point in the history
  • Loading branch information
rr- committed Feb 27, 2021
1 parent 3b52a95 commit 669a398
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Tomb1Main.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
// - 9: use large medpack
"enable_numeric_keys": true,

// Enables TR3+ style sidesteps, e.g. shift+directional arrows (you still
// can use dedicated sidestep buttons).
"enable_tr3_sidesteps": true,

// Enables various cheats:
// - F10: immediately end the level.
// - F11: heal Lara. Hold WALK key to hurt instead.
Expand Down
1 change: 1 addition & 0 deletions src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ int T1MReadConfig()
READ_BOOL(enable_shotgun_flash);
READ_BOOL(enable_cheats);
READ_BOOL(enable_numeric_keys);
READ_BOOL(enable_tr3_sidesteps);
READ_BOOL(fix_key_triggers);
READ_BOOL(fix_end_of_level_freeze);
READ_BOOL(fix_tihocan_secret_sound);
Expand Down
1 change: 1 addition & 0 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ struct {
int8_t enable_numeric_keys;
int8_t enable_shotgun_flash;
int8_t enable_cheats;
int8_t enable_tr3_sidesteps;
int8_t healthbar_showing_mode;
int8_t healthbar_location;
int8_t healthbar_color;
Expand Down
53 changes: 51 additions & 2 deletions src/game/lara.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,25 @@ void LaraAsStop(ITEM_INFO* item, COLL_INFO* coll)
}

if (Input & IN_LEFT) {
#ifdef T1M_FEAT_INPUT
if (T1MConfig.enable_tr3_sidesteps && (Input & IN_SLOW)) {
item->goal_anim_state = AS_STEPLEFT;
} else {
item->goal_anim_state = AS_TURN_L;
}
#else
item->goal_anim_state = AS_TURN_L;
#endif
} else if (Input & IN_RIGHT) {
#ifdef T1M_FEAT_INPUT
if (T1MConfig.enable_tr3_sidesteps && (Input & IN_SLOW)) {
item->goal_anim_state = AS_STEPRIGHT;
} else {
item->goal_anim_state = AS_TURN_R;
}
#else
item->goal_anim_state = AS_TURN_R;
#endif
}

if (Input & IN_JUMP) {
Expand Down Expand Up @@ -351,6 +367,13 @@ void LaraAsTurnR(ITEM_INFO* item, COLL_INFO* coll)
}
#endif

#ifdef T1M_FEAT_INPUT
if (T1MConfig.enable_tr3_sidesteps && CHK_ANY(Input, IN_SLOW)) {
item->goal_anim_state = AS_STOP;
return;
}
#endif

Lara.turn_rate += LARA_TURN_RATE;
if (Lara.gun_status == LGS_READY) {
item->goal_anim_state = AS_FASTTURN;
Expand Down Expand Up @@ -387,6 +410,13 @@ void LaraAsTurnL(ITEM_INFO* item, COLL_INFO* coll)
}
#endif

#ifdef T1M_FEAT_INPUT
if (T1MConfig.enable_tr3_sidesteps && CHK_ANY(Input, IN_SLOW)) {
item->goal_anim_state = AS_STOP;
return;
}
#endif

Lara.turn_rate -= LARA_TURN_RATE;
if (Lara.gun_status == LGS_READY) {
item->goal_anim_state = AS_FASTTURN;
Expand Down Expand Up @@ -429,9 +459,9 @@ void LaraAsHang(ITEM_INFO* item, COLL_INFO* coll)
coll->enable_baddie_push = 0;
Camera.target_angle = CAM_A_HANG;
Camera.target_elevation = CAM_E_HANG;
if (Input & (IN_LEFT | IN_STEPL)) {
if (CHK_ANY(Input, IN_LEFT | IN_STEPL)) {
item->goal_anim_state = AS_HANGLEFT;
} else if (Input & (IN_RIGHT | IN_STEPR)) {
} else if (CHK_ANY(Input, IN_RIGHT | IN_STEPR)) {
item->goal_anim_state = AS_HANGRIGHT;
}
}
Expand Down Expand Up @@ -523,6 +553,13 @@ void LaraAsFastTurn(ITEM_INFO* item, COLL_INFO* coll)
}
#endif

#ifdef T1M_FEAT_INPUT
if (T1MConfig.enable_tr3_sidesteps && CHK_ANY(Input, IN_SLOW)) {
item->goal_anim_state = AS_STOP;
return;
}
#endif

if (Lara.turn_rate >= 0) {
Lara.turn_rate = LARA_FAST_TURN;
if (!(Input & IN_RIGHT)) {
Expand All @@ -543,6 +580,12 @@ void LaraAsStepRight(ITEM_INFO* item, COLL_INFO* coll)
return;
}

#ifdef T1M_FEAT_INPUT
if (T1MConfig.enable_tr3_sidesteps && CHK_ALL(Input, IN_RIGHT | IN_SLOW)) {
return;
}
#endif

if (!(Input & IN_STEPR)) {
item->goal_anim_state = AS_STOP;
}
Expand All @@ -567,6 +610,12 @@ void LaraAsStepLeft(ITEM_INFO* item, COLL_INFO* coll)
return;
}

#ifdef T1M_FEAT_INPUT
if (T1MConfig.enable_tr3_sidesteps && CHK_ALL(Input, IN_LEFT | IN_SLOW)) {
return;
}
#endif

if (!(Input & IN_STEPL)) {
item->goal_anim_state = AS_STOP;
}
Expand Down
2 changes: 2 additions & 0 deletions src/game/misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@
#define MIN(x, y) ((x) <= (y) ? (x) : (y))
#define MAX(x, y) ((x) >= (y) ? (x) : (y))
#endif
#define CHK_ALL(a, b) (((a) & (b)) == (b))
#define CHK_ANY(a, b) (((a) & (b)) != 0)

#endif

0 comments on commit 669a398

Please sign in to comment.