mirror of
https://github.com/LostArtefacts/TRX.git
synced 2025-04-28 20:58:07 +03:00
add looking while running feature
This commit is contained in:
parent
20274c7864
commit
c94812f490
5 changed files with 68 additions and 3 deletions
|
@ -25,6 +25,8 @@ Currently the following configuration options are supported:
|
|||
(for No Heal challenge runs).
|
||||
- `enable_red_healthbar`: replaces the default golden healthbar with a red one.
|
||||
- `enable_enemy_healthbar`: enables showing healthbar for the active enemy.
|
||||
- `enable_look_while_running`: allows the player to look while running, jumping
|
||||
etc. (similar to TR2 style).
|
||||
- `fix_end_of_level_freeze`: fix game freeze when ending the level with the
|
||||
Action key held.
|
||||
|
||||
|
|
|
@ -3,5 +3,6 @@
|
|||
"disable_medpacks": false,
|
||||
"enable_red_healthbar": true,
|
||||
"enable_enemy_healthbar": true,
|
||||
"enable_look_while_running": true,
|
||||
"fix_end_of_level_freeze": true
|
||||
}
|
||||
|
|
|
@ -15,6 +15,23 @@ void __cdecl LaraAsWalk(ITEM_INFO* item, COLL_INFO* coll)
|
|||
return;
|
||||
}
|
||||
|
||||
if (TR1MConfig.enable_look_while_running) {
|
||||
if (Input & IN_LOOK) {
|
||||
Camera.type = LOOK_CAMERA;
|
||||
if ((Input & IN_LEFT) && Lara.head_y_rot > -MAX_HEAD_ROTATION) {
|
||||
Lara.head_y_rot -= HEAD_TURN / 2;
|
||||
} else if (
|
||||
(Input & IN_RIGHT) && Lara.head_y_rot < MAX_HEAD_ROTATION) {
|
||||
Lara.head_y_rot += HEAD_TURN / 2;
|
||||
}
|
||||
Lara.torso_y_rot = Lara.head_y_rot;
|
||||
return;
|
||||
}
|
||||
if (Camera.type == LOOK_CAMERA) {
|
||||
Camera.type = CHASE_CAMERA;
|
||||
}
|
||||
}
|
||||
|
||||
if (Input & IN_LEFT) {
|
||||
Lara.turn_rate -= LARA_TURN_RATE;
|
||||
if (Lara.turn_rate < -LARA_SLOW_TURN) {
|
||||
|
@ -53,6 +70,28 @@ void __cdecl LaraAsRun(ITEM_INFO* item, COLL_INFO* coll)
|
|||
return;
|
||||
}
|
||||
|
||||
if (TR1MConfig.enable_look_while_running) {
|
||||
if (Input & IN_LOOK) {
|
||||
Camera.type = LOOK_CAMERA;
|
||||
if ((Input & IN_LEFT) && Lara.head_y_rot > -MAX_HEAD_ROTATION) {
|
||||
Lara.head_y_rot -= HEAD_TURN / 2;
|
||||
} else if (
|
||||
(Input & IN_RIGHT) && Lara.head_y_rot < MAX_HEAD_ROTATION) {
|
||||
Lara.head_y_rot += HEAD_TURN / 2;
|
||||
}
|
||||
Lara.torso_y_rot = Lara.head_y_rot;
|
||||
|
||||
if ((Input & IN_JUMP) && !item->gravity_status) {
|
||||
item->goal_anim_state = AS_FORWARDJUMP;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
if (Camera.type == LOOK_CAMERA) {
|
||||
Camera.type = CHASE_CAMERA;
|
||||
}
|
||||
}
|
||||
|
||||
if (Input & IN_LEFT) {
|
||||
Lara.turn_rate -= LARA_TURN_RATE;
|
||||
if (Lara.turn_rate < -LARA_FAST_TURN) {
|
||||
|
@ -154,6 +193,23 @@ void __cdecl LaraAsStop(ITEM_INFO* item, COLL_INFO* coll)
|
|||
|
||||
void __cdecl LaraAsForwardJump(ITEM_INFO* item, COLL_INFO* coll)
|
||||
{
|
||||
if (TR1MConfig.enable_look_while_running) {
|
||||
if (Input & IN_LOOK) {
|
||||
Camera.type = LOOK_CAMERA;
|
||||
if ((Input & IN_LEFT) && Lara.head_y_rot > -MAX_HEAD_ROTATION) {
|
||||
Lara.head_y_rot -= HEAD_TURN / 2;
|
||||
} else if (
|
||||
(Input & IN_RIGHT) && Lara.head_y_rot < MAX_HEAD_ROTATION) {
|
||||
Lara.head_y_rot += HEAD_TURN / 2;
|
||||
}
|
||||
Lara.torso_y_rot = Lara.head_y_rot;
|
||||
return;
|
||||
}
|
||||
if (Camera.type == LOOK_CAMERA) {
|
||||
Camera.type = CHASE_CAMERA;
|
||||
}
|
||||
}
|
||||
|
||||
if (item->goal_anim_state == AS_SWANDIVE
|
||||
|| item->goal_anim_state == AS_REACH) {
|
||||
item->goal_anim_state = AS_FORWARDJUMP;
|
||||
|
@ -204,7 +260,8 @@ void __cdecl LaraAsFastBack(ITEM_INFO* item, COLL_INFO* coll)
|
|||
|
||||
void __cdecl LaraAsTurnR(ITEM_INFO* item, COLL_INFO* coll)
|
||||
{
|
||||
if (item->hit_points <= 0) {
|
||||
if (item->hit_points <= 0
|
||||
|| (TR1MConfig.enable_look_while_running && (Input & IN_LOOK))) {
|
||||
item->goal_anim_state = AS_STOP;
|
||||
return;
|
||||
}
|
||||
|
@ -233,7 +290,8 @@ void __cdecl LaraAsTurnR(ITEM_INFO* item, COLL_INFO* coll)
|
|||
|
||||
void __cdecl LaraAsTurnL(ITEM_INFO* item, COLL_INFO* coll)
|
||||
{
|
||||
if (item->hit_points <= 0) {
|
||||
if (item->hit_points <= 0
|
||||
|| (TR1MConfig.enable_look_while_running && (Input & IN_LOOK))) {
|
||||
item->goal_anim_state = AS_STOP;
|
||||
return;
|
||||
}
|
||||
|
@ -361,7 +419,8 @@ void __cdecl LaraAsBack(ITEM_INFO* item, COLL_INFO* coll)
|
|||
|
||||
void __cdecl LaraAsFastTurn(ITEM_INFO* item, COLL_INFO* coll)
|
||||
{
|
||||
if (item->hit_points <= 0) {
|
||||
if (item->hit_points <= 0
|
||||
|| (TR1MConfig.enable_look_while_running && (Input & IN_LOOK))) {
|
||||
item->goal_anim_state = AS_STOP;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -56,6 +56,8 @@ static int TR1MReadConfig()
|
|||
tr1m_json_get_boolean_value(json, "enable_red_healthbar");
|
||||
TR1MConfig.enable_enemy_healthbar =
|
||||
tr1m_json_get_boolean_value(json, "enable_enemy_healthbar");
|
||||
TR1MConfig.enable_look_while_running =
|
||||
tr1m_json_get_boolean_value(json, "enable_look_while_running");
|
||||
TR1MConfig.fix_end_of_level_freeze =
|
||||
tr1m_json_get_boolean_value(json, "fix_end_of_level_freeze");
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ struct {
|
|||
int disable_medpacks;
|
||||
int enable_red_healthbar;
|
||||
int enable_enemy_healthbar;
|
||||
int enable_look_while_running;
|
||||
int fix_end_of_level_freeze;
|
||||
} TR1MConfig;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue