diff --git a/docs/progress.svg b/docs/progress.svg index c92840131..42115524f 100644 --- a/docs/progress.svg +++ b/docs/progress.svg @@ -404,7 +404,7 @@ - + @@ -1045,7 +1045,7 @@ - + @@ -1403,10 +1403,10 @@ -Functions decompiled (count): 24.68% -Functions decompiled (bytesize): 18.10% -Functions not decompiled, but with known names (count): 59.91% -Functions not decompiled, but with known names (bytesize): 64.77% +Functions decompiled (count): 24.82% +Functions decompiled (bytesize): 18.18% +Functions not decompiled, but with known names (count): 59.77% +Functions not decompiled, but with known names (bytesize): 64.70% Functions not decompiled, with unknown names (count): 15.41% Functions not decompiled, with unknown names (bytesize): 17.12% diff --git a/docs/progress.txt b/docs/progress.txt index e3a6f22a4..0e5b276b4 100644 --- a/docs/progress.txt +++ b/docs/progress.txt @@ -408,7 +408,7 @@ draw_pistol_meshes 0x00426830 0x00000061 + PistolHandler 0x004268A0 0x0000012E + AnimatePistols 0x004269D0 0x000001F5 + LaraGun 0x00426BD0 0x00000271 + -InitialiseNewWeapon 0x00426E60 0x000000B9 * +InitialiseNewWeapon 0x00426E60 0x000000B9 + LaraTargetInfo 0x00426F20 0x00000194 * LaraGetNewTarget 0x004270C0 0x000001D9 * find_target_point 0x004272A0 0x000000B2 - diff --git a/src/game/lara.h b/src/game/lara.h index 731fb23dc..5782ef124 100644 --- a/src/game/lara.h +++ b/src/game/lara.h @@ -13,7 +13,6 @@ #define LaraGetNewTarget ((void __cdecl(*)(WEAPON_INFO* winfo))0x004270C0) #define AimWeapon ((void __cdecl(*)(WEAPON_INFO* winfo, LARA_ARM* arm))0x00427360) #define FireWeapon ((int32_t __cdecl(*)(int32_t weapon_type, ITEM_INFO *target, ITEM_INFO *src, PHD_ANGLE *angles))0x00427430) -#define InitialiseNewWeapon ((int32_t __cdecl(*)())0x00426E60) // clang-format on void __cdecl LaraSwapMeshExtra(); @@ -167,6 +166,7 @@ extern void (*LaraControlRoutines[])(ITEM_INFO* item, COLL_INFO* coll); extern void (*LaraCollisionRoutines[])(ITEM_INFO* item, COLL_INFO* coll); void __cdecl LaraGun(); +void __cdecl InitialiseNewWeapon(); void __cdecl draw_shotgun(); void __cdecl undraw_shotgun(); diff --git a/src/game/larafire.c b/src/game/larafire.c index 9fbf48555..ad7cd6c3c 100644 --- a/src/game/larafire.c +++ b/src/game/larafire.c @@ -143,7 +143,50 @@ void __cdecl LaraGun() } } +void __cdecl InitialiseNewWeapon() +{ + Lara.left_arm.x_rot = 0; + Lara.left_arm.y_rot = 0; + Lara.left_arm.z_rot = 0; + Lara.left_arm.lock = 0; + Lara.left_arm.flash_gun = 0; + Lara.left_arm.frame_number = AF_G_AIM; + Lara.right_arm.x_rot = 0; + Lara.right_arm.y_rot = 0; + Lara.right_arm.z_rot = 0; + Lara.right_arm.lock = 0; + Lara.right_arm.flash_gun = 0; + Lara.right_arm.frame_number = AF_G_AIM; + Lara.target = NULL; + + switch (Lara.gun_type) { + case LGT_PISTOLS: + case LGT_MAGNUMS: + case LGT_UZIS: + Lara.right_arm.frame_base = Objects[O_PISTOLS].frame_base; + Lara.left_arm.frame_base = Objects[O_PISTOLS].frame_base; + if (Lara.gun_status != LGS_ARMLESS) { + draw_pistol_meshes(Lara.gun_type); + } + break; + + case LGT_SHOTGUN: + Lara.right_arm.frame_base = Objects[O_SHOTGUN].frame_base; + Lara.left_arm.frame_base = Objects[O_SHOTGUN].frame_base; + if (Lara.gun_status != LGS_ARMLESS) { + draw_shotgun_meshes(); + } + break; + + default: + Lara.right_arm.frame_base = Objects[O_LARA].frame_base; + Lara.left_arm.frame_base = Objects[O_LARA].frame_base; + break; + } +} + void Tomb1MInjectGameLaraFire() { INJECT(0x00426BD0, LaraGun); + INJECT(0x00426E60, InitialiseNewWeapon); }