diff --git a/docs/progress.svg b/docs/progress.svg index d8165e25a..854605468 100644 --- a/docs/progress.svg +++ b/docs/progress.svg @@ -410,7 +410,7 @@ - + @@ -1001,7 +1001,7 @@ - + @@ -1403,10 +1403,10 @@ -Functions decompiled (count): 25.53% -Functions decompiled (bytesize): 18.99% -Functions not decompiled, but with known names (count): 59.06% -Functions not decompiled, but with known names (bytesize): 63.89% +Functions decompiled (count): 25.68% +Functions decompiled (bytesize): 19.09% +Functions not decompiled, but with known names (count): 58.92% +Functions not decompiled, but with known names (bytesize): 63.79% 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 4558c7427..bc558ddc4 100644 --- a/docs/progress.txt +++ b/docs/progress.txt @@ -210,7 +210,7 @@ sub_41A1D0 0x0041A1D0 0x00000027 - sub_41A200 0x0041A200 0x0000000F - ItemNearLara 0x0041A210 0x0000008C - SoundEffects 0x0041A2A0 0x0000006D * -DoBloodSplat 0x0041A310 0x00000059 - +DoBloodSplat 0x0041A310 0x00000059 * ControlBlood1 0x0041A370 0x0000008B - ControlExplosion1 0x0041A400 0x0000004C - Richochet 0x0041A450 0x00000072 * @@ -414,7 +414,7 @@ LaraGetNewTarget 0x004270C0 0x000001D9 + find_target_point 0x004272A0 0x000000B2 + AimWeapon 0x00427360 0x000000C1 + FireWeapon 0x00427430 0x000002F2 + -HitTarget 0x00427730 0x000000E5 * +HitTarget 0x00427730 0x000000E5 + LaraControl 0x00427850 0x00000372 * LaraSwapMeshExtra 0x00427BD0 0x00000030 + AnimateLara 0x00427C00 0x00000244 + diff --git a/src/game/effects.h b/src/game/effects.h index a19ca4132..c2456469f 100644 --- a/src/game/effects.h +++ b/src/game/effects.h @@ -10,6 +10,7 @@ #define StopSoundEffect ((void __cdecl(*)(int32_t sfx_num, PHD_3DPOS *pos))0x0042B300) #define ItemSparkle ((void __cdecl(*)(ITEM_INFO* item, int meshmask))0x0041A550) #define Richochet ((void __cdecl(*)(GAME_VECTOR* pos))0x0041A450) +#define DoBloodSplat ((int16_t __cdecl(*)(int32_t x, int32_t y, int32_t z, int16_t speed, PHD_ANGLE direction, int16_t room_num))0x0041A310) // clang-format on void __cdecl FxChainBlock(ITEM_INFO* item); diff --git a/src/game/lara.h b/src/game/lara.h index 581b8e036..bd9ea8b79 100644 --- a/src/game/lara.h +++ b/src/game/lara.h @@ -9,7 +9,6 @@ #define LaraControl ((void __cdecl(*)(int16_t item_num))0x00427850) #define UpdateLaraRoom ((void __cdecl(*)(ITEM_INFO* item, int height))0x004126A0) #define ShiftItem ((void __cdecl(*)(ITEM_INFO* item, COLL_INFO *coll))0x00412660) -#define HitTarget ((void __cdecl(*)(ITEM_INFO* item, GAME_VECTOR* hitpos, int damage))0x00427730) // clang-format on void __cdecl LaraSwapMeshExtra(); @@ -170,6 +169,7 @@ void __cdecl find_target_point(ITEM_INFO* item, GAME_VECTOR* target); void __cdecl AimWeapon(WEAPON_INFO* winfo, LARA_ARM* arm); int32_t __cdecl FireWeapon( int32_t weapon_type, ITEM_INFO* target, ITEM_INFO* src, PHD_ANGLE* angles); +void __cdecl HitTarget(ITEM_INFO* item, GAME_VECTOR* hitpos, int32_t damage); void __cdecl draw_shotgun(); void __cdecl undraw_shotgun(); diff --git a/src/game/larafire.c b/src/game/larafire.c index 5b1e58634..9d10087ce 100644 --- a/src/game/larafire.c +++ b/src/game/larafire.c @@ -456,6 +456,48 @@ int32_t __cdecl FireWeapon( return -1; } +void __cdecl HitTarget(ITEM_INFO* item, GAME_VECTOR* hitpos, int32_t damage) +{ + if (item->hit_points > 0 && item->hit_points <= damage) { + SaveGame[0].kills++; + } + item->hit_points -= damage; + item->hit_status = 1; + + DoBloodSplat( + hitpos->x, hitpos->y, hitpos->z, item->speed, item->pos.y_rot, + item->room_number); + + if (item->hit_points > 0) { + switch (item->object_number) { + case O_WOLF: + SoundEffect(20, &item->pos, 0); + break; + + case O_BEAR: + SoundEffect(16, &item->pos, 0); + break; + + case O_LION: + case O_LIONESS: + SoundEffect(85, &item->pos, 0); + break; + + case O_RAT: + SoundEffect(95, &item->pos, 0); + break; + + case O_MERCENARY1: + SoundEffect(132, &item->pos, 0); + break; + + case O_EVIL_NATLA: + SoundEffect(142, &item->pos, 0); + break; + } + } +} + void Tomb1MInjectGameLaraFire() { INJECT(0x00426BD0, LaraGun); @@ -465,4 +507,5 @@ void Tomb1MInjectGameLaraFire() INJECT(0x004272A0, find_target_point); INJECT(0x00427360, AimWeapon); INJECT(0x00427430, FireWeapon); + INJECT(0x00427730, HitTarget); }