From 6cb449e02f776b3853fdbb1b0b41d703bd7f75aa Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Sat, 7 Oct 2023 08:41:04 +0200 Subject: [PATCH] port Lara_State_ClimbStance --- docs/progress.svg | 16 ++++++++-------- docs/progress.txt | 2 +- src/game/lara/lara_state.c | 22 ++++++++++++++++++++++ src/game/lara/lara_state.h | 2 ++ src/global/const.h | 1 + src/global/funcs.h | 1 - src/inject_exec.c | 1 + 7 files changed, 35 insertions(+), 10 deletions(-) diff --git a/docs/progress.svg b/docs/progress.svg index d0c037e..53a7023 100644 --- a/docs/progress.svg +++ b/docs/progress.svg @@ -69,10 +69,10 @@ Tomb2.exe progress according to the physical function order: -12.50% (150) · 85.08% (1021) · 0.67% (8) · 1.75% (21) +12.58% (151) · 85% (1020) · 0.67% (8) · 1.75% (21) - - + + @@ -596,7 +596,7 @@ void __cdecl AnimatePistols(int32_t weapon_type); void __cdecl Lara_State_ClimbLeft(struct ITEM_INFO *item, struct COLL_INFO *coll); void __cdecl Lara_State_ClimbRight(struct ITEM_INFO *item, struct COLL_INFO *coll); -void __cdecl Lara_State_ClimbStance(struct ITEM_INFO *item, struct COLL_INFO *coll); +void __cdecl Lara_State_ClimbStance(struct ITEM_INFO *item, struct COLL_INFO *coll); void __cdecl Lara_State_Climbing(struct ITEM_INFO *item, struct COLL_INFO *coll); void __cdecl Lara_State_ClimbEnd(struct ITEM_INFO *item, struct COLL_INFO *coll); void __cdecl Lara_State_ClimbDown(struct ITEM_INFO *item, struct COLL_INFO *coll); @@ -1281,10 +1281,10 @@ Tomb2.exe progress according to the function sizes: -6.62% · 93.05% · 0.02% · 0.31% +6.66% · 93.01% · 0.02% · 0.31% - - + + @@ -1942,7 +1942,7 @@ void __cdecl Lara_State_Glide(struct ITEM_INFO *item, struct COLL_INFO *coll); bool __cdecl GetRegistryBoolValue(LPCTSTR lpValueName, bool *pValue, bool defaultValue); int16_t __cdecl Lara_FloorFront(struct ITEM_INFO *item, PHD_ANGLE ang, int32_t dist); -void __cdecl Lara_State_ClimbStance(struct ITEM_INFO *item, struct COLL_INFO *coll); +void __cdecl Lara_State_ClimbStance(struct ITEM_INFO *item, struct COLL_INFO *coll); void __cdecl InitialiseHair(void); void __cdecl Lara_Col_Jumper(struct ITEM_INFO *item, struct COLL_INFO *coll); void __cdecl GameWindowCalculateSizeFromClient(int32_t *width, int32_t *height); diff --git a/docs/progress.txt b/docs/progress.txt index 1ed1df0..3eb163b 100644 --- a/docs/progress.txt +++ b/docs/progress.txt @@ -1654,7 +1654,7 @@ typedef enum LARA_GUN_STATE { # game/laraclimb.c 0042D850 00000035 + void __cdecl Lara_State_ClimbLeft(struct ITEM_INFO *item, struct COLL_INFO *coll); 0042D890 00000035 + void __cdecl Lara_State_ClimbRight(struct ITEM_INFO *item, struct COLL_INFO *coll); -0042D8D0 00000075 - void __cdecl Lara_State_ClimbStance(struct ITEM_INFO *item, struct COLL_INFO *coll); +0042D8D0 00000075 + void __cdecl Lara_State_ClimbStance(struct ITEM_INFO *item, struct COLL_INFO *coll); 0042D950 00000014 - void __cdecl Lara_State_Climbing(struct ITEM_INFO *item, struct COLL_INFO *coll); 0042D970 0000001E - void __cdecl Lara_State_ClimbEnd(struct ITEM_INFO *item, struct COLL_INFO *coll); 0042D990 00000014 - void __cdecl Lara_State_ClimbDown(struct ITEM_INFO *item, struct COLL_INFO *coll); diff --git a/src/game/lara/lara_state.c b/src/game/lara/lara_state.c index 289de64..6cc7136 100644 --- a/src/game/lara/lara_state.c +++ b/src/game/lara/lara_state.c @@ -846,3 +846,25 @@ void __cdecl Lara_State_ClimbRight( item->goal_anim_state = LS_CLIMB_STANCE; } } + +void __cdecl Lara_State_ClimbStance( + struct ITEM_INFO *item, struct COLL_INFO *coll) +{ + coll->enable_spaz = 0; + coll->enable_baddie_push = 0; + g_Camera.target_elevation = CAM_CLIMB_STANCE_ELEVATION; + + if (g_Input & IN_LOOK) { + Lara_LookUpDown(); + } + + if ((g_Input & IN_LEFT) || (g_Input & IN_STEP_LEFT)) { + item->goal_anim_state = LS_CLIMB_LEFT; + } else if ((g_Input & IN_RIGHT) || (g_Input & IN_STEP_RIGHT)) { + item->goal_anim_state = LS_CLIMB_RIGHT; + } else if ((g_Input & IN_JUMP)) { + item->goal_anim_state = LS_BACK_JUMP; + g_Lara.gun_status = LGS_ARMLESS; + g_Lara.move_angle = item->pos.y_rot + PHD_180; + } +} diff --git a/src/game/lara/lara_state.h b/src/game/lara/lara_state.h index 842c049..360d5dd 100644 --- a/src/game/lara/lara_state.h +++ b/src/game/lara/lara_state.h @@ -90,3 +90,5 @@ void __cdecl Lara_State_ClimbLeft( struct ITEM_INFO *item, struct COLL_INFO *coll); void __cdecl Lara_State_ClimbRight( struct ITEM_INFO *item, struct COLL_INFO *coll); +void __cdecl Lara_State_ClimbStance( + struct ITEM_INFO *item, struct COLL_INFO *coll); diff --git a/src/global/const.h b/src/global/const.h index fa13767..b0ce475 100644 --- a/src/global/const.h +++ b/src/global/const.h @@ -81,3 +81,4 @@ #define CAM_CLIMB_LEFT_ELEVATION (-15 * PHD_DEGREE) // = -2730 #define CAM_CLIMB_RIGHT_ANGLE (-CAM_CLIMB_LEFT_ANGLE) // = 5460 #define CAM_CLIMB_RIGHT_ELEVATION CAM_CLIMB_LEFT_ELEVATION // = -2730 +#define CAM_CLIMB_STANCE_ELEVATION (-20 * PHD_DEGREE) // = -3640 diff --git a/src/global/funcs.h b/src/global/funcs.h index 787f91b..a7373e1 100644 --- a/src/global/funcs.h +++ b/src/global/funcs.h @@ -417,7 +417,6 @@ #define undraw_pistol_mesh_right ((void __cdecl (*)(int32_t weapon_type))0x0042D350) #define PistolHandler ((void __cdecl (*)(int32_t weapon_type))0x0042D390) #define AnimatePistols ((void __cdecl (*)(int32_t weapon_type))0x0042D520) -#define Lara_State_ClimbStance ((void __cdecl (*)(struct ITEM_INFO *item, struct COLL_INFO *coll))0x0042D8D0) #define Lara_State_Climbing ((void __cdecl (*)(struct ITEM_INFO *item, struct COLL_INFO *coll))0x0042D950) #define Lara_State_ClimbEnd ((void __cdecl (*)(struct ITEM_INFO *item, struct COLL_INFO *coll))0x0042D970) #define Lara_State_ClimbDown ((void __cdecl (*)(struct ITEM_INFO *item, struct COLL_INFO *coll))0x0042D990) diff --git a/src/inject_exec.c b/src/inject_exec.c index 872cf5a..12c3b3f 100644 --- a/src/inject_exec.c +++ b/src/inject_exec.c @@ -135,6 +135,7 @@ static void Inject_Lara_State(void) INJECT(1, 0x00428B50, Lara_State_Extra_FinalAnim); INJECT(1, 0x0042D850, Lara_State_ClimbLeft); INJECT(1, 0x0042D890, Lara_State_ClimbRight); + INJECT(1, 0x0042D8D0, Lara_State_ClimbStance); } static void Inject_Lara_Col(void)