port InitialiseNewWeapon

This commit is contained in:
rr- 2021-02-20 13:52:45 +01:00
parent 1fd6c8874c
commit 83a5017ec8
4 changed files with 51 additions and 8 deletions

View file

@ -404,7 +404,7 @@
<rect width="12.00" height="12.00" x="14.00" y="129.00" fill="forestgreen"/> <rect width="12.00" height="12.00" x="14.00" y="129.00" fill="forestgreen"/>
<rect width="12.00" height="12.00" x="28.00" y="129.00" fill="forestgreen"/> <rect width="12.00" height="12.00" x="28.00" y="129.00" fill="forestgreen"/>
<rect width="12.00" height="12.00" x="42.00" y="129.00" fill="forestgreen"/> <rect width="12.00" height="12.00" x="42.00" y="129.00" fill="forestgreen"/>
<rect width="12.00" height="12.00" x="56.00" y="129.00" fill="lightpink"/> <rect width="12.00" height="12.00" x="56.00" y="129.00" fill="forestgreen"/>
<rect width="12.00" height="12.00" x="70.00" y="129.00" fill="lightpink"/> <rect width="12.00" height="12.00" x="70.00" y="129.00" fill="lightpink"/>
<rect width="12.00" height="12.00" x="84.00" y="129.00" fill="lightpink"/> <rect width="12.00" height="12.00" x="84.00" y="129.00" fill="lightpink"/>
<rect width="12.00" height="12.00" x="98.00" y="129.00" fill="lightpink"/> <rect width="12.00" height="12.00" x="98.00" y="129.00" fill="lightpink"/>
@ -1045,7 +1045,7 @@
<rect width="9.69" height="10.46" x="552.80" y="418.35" fill="lightpink"/> <rect width="9.69" height="10.46" x="552.80" y="418.35" fill="lightpink"/>
<rect width="9.69" height="10.40" x="552.80" y="430.81" fill="forestgreen"/> <rect width="9.69" height="10.40" x="552.80" y="430.81" fill="forestgreen"/>
<rect width="9.69" height="10.40" x="552.80" y="443.20" fill="lightpink"/> <rect width="9.69" height="10.40" x="552.80" y="443.20" fill="lightpink"/>
<rect width="9.69" height="10.07" x="552.80" y="455.60" fill="lightpink"/> <rect width="9.69" height="10.07" x="552.80" y="455.60" fill="forestgreen"/>
<rect width="9.69" height="9.94" x="552.80" y="467.67" fill="forestgreen"/> <rect width="9.69" height="9.94" x="552.80" y="467.67" fill="forestgreen"/>
<rect width="9.69" height="9.87" x="552.80" y="479.61" fill="lightpink"/> <rect width="9.69" height="9.87" x="552.80" y="479.61" fill="lightpink"/>
<rect width="9.69" height="9.81" x="552.80" y="491.48" fill="mistyrose"/> <rect width="9.69" height="9.81" x="552.80" y="491.48" fill="mistyrose"/>
@ -1403,10 +1403,10 @@
<rect width="-0.56" height="0.65" x="696.56" y="534.29" fill="mistyrose"/> <rect width="-0.56" height="0.65" x="696.56" y="534.29" fill="mistyrose"/>
<rect width="0.16" height="-0.94" x="695.12" y="536.94" fill="mistyrose"/> <rect width="0.16" height="-0.94" x="695.12" y="536.94" fill="mistyrose"/>
<rect width="-1.28" height="-0.94" x="697.28" y="536.94" fill="lightpink"/> <rect width="-1.28" height="-0.94" x="697.28" y="536.94" fill="lightpink"/>
<rect width="12.00" height="12.00" x="0.00" y="564.50" fill="forestgreen"/><text alignment-baseline="central" x="17.00" y="570.50" style="font-family: sans-serif; font-size: 15px">Functions decompiled (count): 24.68%</text> <rect width="12.00" height="12.00" x="0.00" y="564.50" fill="forestgreen"/><text alignment-baseline="central" x="17.00" y="570.50" style="font-family: sans-serif; font-size: 15px">Functions decompiled (count): 24.82%</text>
<rect width="12.00" height="12.00" x="0.00" y="582.50" fill="forestgreen"/><text alignment-baseline="central" x="17.00" y="588.50" style="font-family: sans-serif; font-size: 15px">Functions decompiled (bytesize): 18.10%</text> <rect width="12.00" height="12.00" x="0.00" y="582.50" fill="forestgreen"/><text alignment-baseline="central" x="17.00" y="588.50" style="font-family: sans-serif; font-size: 15px">Functions decompiled (bytesize): 18.18%</text>
<rect width="12.00" height="12.00" x="0.00" y="600.50" fill="lightpink"/><text alignment-baseline="central" x="17.00" y="606.50" style="font-family: sans-serif; font-size: 15px">Functions not decompiled, but with known names (count): 59.91%</text> <rect width="12.00" height="12.00" x="0.00" y="600.50" fill="lightpink"/><text alignment-baseline="central" x="17.00" y="606.50" style="font-family: sans-serif; font-size: 15px">Functions not decompiled, but with known names (count): 59.77%</text>
<rect width="12.00" height="12.00" x="0.00" y="618.50" fill="lightpink"/><text alignment-baseline="central" x="17.00" y="624.50" style="font-family: sans-serif; font-size: 15px">Functions not decompiled, but with known names (bytesize): 64.77%</text> <rect width="12.00" height="12.00" x="0.00" y="618.50" fill="lightpink"/><text alignment-baseline="central" x="17.00" y="624.50" style="font-family: sans-serif; font-size: 15px">Functions not decompiled, but with known names (bytesize): 64.70%</text>
<rect width="12.00" height="12.00" x="0.00" y="636.50" fill="mistyrose"/><text alignment-baseline="central" x="17.00" y="642.50" style="font-family: sans-serif; font-size: 15px">Functions not decompiled, with unknown names (count): 15.41%</text> <rect width="12.00" height="12.00" x="0.00" y="636.50" fill="mistyrose"/><text alignment-baseline="central" x="17.00" y="642.50" style="font-family: sans-serif; font-size: 15px">Functions not decompiled, with unknown names (count): 15.41%</text>
<rect width="12.00" height="12.00" x="0.00" y="654.50" fill="mistyrose"/><text alignment-baseline="central" x="17.00" y="660.50" style="font-family: sans-serif; font-size: 15px">Functions not decompiled, with unknown names (bytesize): 17.12%</text> <rect width="12.00" height="12.00" x="0.00" y="654.50" fill="mistyrose"/><text alignment-baseline="central" x="17.00" y="660.50" style="font-family: sans-serif; font-size: 15px">Functions not decompiled, with unknown names (bytesize): 17.12%</text>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 105 KiB

After

Width:  |  Height:  |  Size: 105 KiB

Before After
Before After

View file

@ -408,7 +408,7 @@ draw_pistol_meshes 0x00426830 0x00000061 +
PistolHandler 0x004268A0 0x0000012E + PistolHandler 0x004268A0 0x0000012E +
AnimatePistols 0x004269D0 0x000001F5 + AnimatePistols 0x004269D0 0x000001F5 +
LaraGun 0x00426BD0 0x00000271 + LaraGun 0x00426BD0 0x00000271 +
InitialiseNewWeapon 0x00426E60 0x000000B9 * InitialiseNewWeapon 0x00426E60 0x000000B9 +
LaraTargetInfo 0x00426F20 0x00000194 * LaraTargetInfo 0x00426F20 0x00000194 *
LaraGetNewTarget 0x004270C0 0x000001D9 * LaraGetNewTarget 0x004270C0 0x000001D9 *
find_target_point 0x004272A0 0x000000B2 - find_target_point 0x004272A0 0x000000B2 -

View file

@ -13,7 +13,6 @@
#define LaraGetNewTarget ((void __cdecl(*)(WEAPON_INFO* winfo))0x004270C0) #define LaraGetNewTarget ((void __cdecl(*)(WEAPON_INFO* winfo))0x004270C0)
#define AimWeapon ((void __cdecl(*)(WEAPON_INFO* winfo, LARA_ARM* arm))0x00427360) #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 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 // clang-format on
void __cdecl LaraSwapMeshExtra(); 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); extern void (*LaraCollisionRoutines[])(ITEM_INFO* item, COLL_INFO* coll);
void __cdecl LaraGun(); void __cdecl LaraGun();
void __cdecl InitialiseNewWeapon();
void __cdecl draw_shotgun(); void __cdecl draw_shotgun();
void __cdecl undraw_shotgun(); void __cdecl undraw_shotgun();

View file

@ -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() void Tomb1MInjectGameLaraFire()
{ {
INJECT(0x00426BD0, LaraGun); INJECT(0x00426BD0, LaraGun);
INJECT(0x00426E60, InitialiseNewWeapon);
} }