Skip to content

Commit

Permalink
tr1/lara: merge animation injections
Browse files Browse the repository at this point in the history
This merges responsive jumping with Lara's main enhances animations
injection. The state changes that were part of the jumping injection
are now present as well as the original state changes, so allowing the
engine to pick the correct ones based on the player's setting.

Resolves LostArtefacts#1823.
  • Loading branch information
lahm86 committed Nov 4, 2024
1 parent 9f00581 commit 0953a0b
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 16 deletions.
2 changes: 0 additions & 2 deletions data/tr1/ship/cfg/TR1X_gameflow.json5
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"data/injections/backpack.bin",
"data/injections/braid.bin",
"data/injections/lara_animations.bin",
"data/injections/lara_jumping.bin",
"data/injections/purple_crystal.bin",
"data/injections/uzi_sfx.bin",
"data/injections/explosion.bin",
Expand All @@ -38,7 +37,6 @@
"data/injections/braid.bin",
"data/injections/gym_textures.bin",
"data/injections/lara_animations.bin",
"data/injections/lara_jumping.bin",
"data/injections/uzi_sfx.bin",
"data/injections/explosion.bin",
],
Expand Down
1 change: 0 additions & 1 deletion data/tr1/ship/cfg/TR1X_gameflow_ub.json5
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"data/injections/backpack.bin",
"data/injections/braid.bin",
"data/injections/lara_animations.bin",
"data/injections/lara_jumping.bin",
"data/injections/uzi_sfx.bin",
"data/injections/explosion.bin",
],
Expand Down
Binary file modified data/tr1/ship/data/injections/lara_animations.bin
Binary file not shown.
Binary file removed data/tr1/ship/data/injections/lara_jumping.bin
Binary file not shown.
1 change: 1 addition & 0 deletions docs/tr1/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
- fixed being able to shoot the scion multiple times if save/load is used while it blows up (#1819)
- improved enemy item drops by supporting the TR2+ approach of having drops defined in level data (#1713)
- improved Italian localization for the Config Tool
- improved the injection approach for Lara's responsive jumping (#1823)
- removed health cheat (we now have the `/hp` command)
- removed background for the "Reset" and "Unbind" labels in the controls dialog

Expand Down
13 changes: 2 additions & 11 deletions docs/tr1/GAMEFLOW.md
Original file line number Diff line number Diff line change
Expand Up @@ -1435,17 +1435,8 @@ provided with the game achieves.
<code>lara_animations.bin</code>
</td>
<td>
Injects several animations for Lara, such as the jump-twist, somersault,
and underwater roll.
</td>
</tr>
<tr valign="top">
<td>
<code>lara_jumping.bin</code>
</td>
<td>
Injects animation change/dispatch edits for Lara to cater for responsive
jumping, if that option is enabled.
Injects several animations, state changes and commands for Lara, such as
responsive jumping, jump-twist, somersault, underwater roll, and wading.
</td>
</tr>
<tr valign="top">
Expand Down
1 change: 1 addition & 0 deletions src/libtrx/include/libtrx/game/lara/enum_tr1.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ typedef enum {
LS_TWIST = 57,
LS_UW_ROLL = 58,
LS_WADE = 59,
LS_RESPONSIVE = 60,
} LARA_STATE;
// clang-format on

Expand Down
2 changes: 1 addition & 1 deletion src/tr1/game/inject.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ static void M_LoadFromFile(INJECTION *injection, const char *filename)
injection->relevant = g_Config.fix_texture_issues;
break;
case INJ_LARA_JUMPS:
injection->relevant = g_Config.enable_tr2_jumping;
injection->relevant = false; // Merged with INJ_LARA_ANIMS in 4.6
break;
case INJ_ITEM_POSITION:
injection->relevant = g_Config.fix_item_rots;
Expand Down
5 changes: 5 additions & 0 deletions src/tr1/game/lara/col.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ void (*g_LaraCollisionRoutines[])(ITEM *item, COLL_INFO *coll) = {
Lara_Col_DieMidas, Lara_Col_SwanDive, Lara_Col_FastDive,
Lara_Col_Gymnast, Lara_Col_WaterOut, Lara_Col_Controlled,
Lara_Col_Twist, Lara_Col_UWRoll, Lara_Col_Wade,
Lara_Col_Responsive,
};

static void M_Default(ITEM *item, COLL_INFO *coll);
Expand Down Expand Up @@ -1053,3 +1054,7 @@ void Lara_Col_Wade(ITEM *item, COLL_INFO *coll)

item->pos.y += MIN(coll->mid_floor, 50);
}

void Lara_Col_Responsive(ITEM *item, COLL_INFO *coll)
{
}
1 change: 1 addition & 0 deletions src/tr1/game/lara/col.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,4 @@ void Lara_Col_WaterOut(ITEM *item, COLL_INFO *coll);
void Lara_Col_Twist(ITEM *item, COLL_INFO *coll);
void Lara_Col_UWRoll(ITEM *item, COLL_INFO *coll);
void Lara_Col_Wade(ITEM *item, COLL_INFO *coll);
void Lara_Col_Responsive(ITEM *item, COLL_INFO *coll);
8 changes: 7 additions & 1 deletion src/tr1/game/lara/state.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ void (*g_LaraStateRoutines[])(ITEM *item, COLL_INFO *coll) = {
Lara_State_DieMidas, Lara_State_SwanDive, Lara_State_FastDive,
Lara_State_Gymnast, Lara_State_WaterOut, Lara_State_Controlled,
Lara_State_Twist, Lara_State_UWRoll, Lara_State_Wade,
Lara_State_Responsive,
};

static bool m_JumpPermitted = true;
Expand Down Expand Up @@ -138,7 +139,8 @@ void Lara_State_Run(ITEM *item, COLL_INFO *coll)
}

if (g_Input.jump && m_JumpPermitted && !item->gravity) {
item->goal_anim_state = LS_JUMP_FORWARD;
item->goal_anim_state =
g_Config.enable_tr2_jumping ? LS_RESPONSIVE : LS_JUMP_FORWARD;
} else if (g_Input.forward) {
if (g_Lara.water_status == LWS_WADE) {
item->goal_anim_state = LS_WADE;
Expand Down Expand Up @@ -1247,3 +1249,7 @@ void Lara_State_Wade(ITEM *item, COLL_INFO *coll)
item->goal_anim_state = LS_STOP;
}
}

void Lara_State_Responsive(ITEM *item, COLL_INFO *coll)
{
}
1 change: 1 addition & 0 deletions src/tr1/game/lara/state.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,4 @@ void Lara_State_WaterOut(ITEM *item, COLL_INFO *coll);
void Lara_State_Twist(ITEM *item, COLL_INFO *coll);
void Lara_State_UWRoll(ITEM *item, COLL_INFO *coll);
void Lara_State_Wade(ITEM *item, COLL_INFO *coll);
void Lara_State_Responsive(ITEM *item, COLL_INFO *coll);

0 comments on commit 0953a0b

Please sign in to comment.