From 18ecb01d2d9f51477cf709327686ce1bc1708b7e Mon Sep 17 00:00:00 2001 From: rr- Date: Sun, 7 Mar 2021 20:41:14 +0100 Subject: [PATCH] port BaddieBiteEffect --- docs/progress.svg | 12 ++++++------ docs/progress.txt | 2 +- src/game/sphere.c | 13 +++++++++++++ src/game/sphere.h | 5 +---- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/docs/progress.svg b/docs/progress.svg index ee0173ff2..88aa3f7f6 100644 --- a/docs/progress.svg +++ b/docs/progress.svg @@ -622,7 +622,7 @@ TestCollision GetSpheres GetJointAbsPosition -BaddieBiteEffect +BaddieBiteEffect T_InitPrint T_Print T_ChangeText @@ -1209,7 +1209,7 @@ LaraAsSurfBack LaraColUWDeath sub_408FF0 -BaddieBiteEffect +BaddieBiteEffect CreatureEffect LevelIsValid BoatControl @@ -1463,10 +1463,10 @@ sub_440EF0 sub_437BC0 S_CDVolume -Functions decompiled (count): 66.89% -Functions decompiled (bytesize): 63.05% -Functions not decompiled, but with known names (count): 19.15% -Functions not decompiled, but with known names (bytesize): 21.22% +Functions decompiled (count): 67.03% +Functions decompiled (bytesize): 63.09% +Functions not decompiled, but with known names (count): 19.02% +Functions not decompiled, but with known names (bytesize): 21.18% Functions not decompiled, with unknown names (count): 13.95% Functions not decompiled, with unknown names (bytesize): 15.73% diff --git a/docs/progress.txt b/docs/progress.txt index ef06757c7..1dd8e62d8 100644 --- a/docs/progress.txt +++ b/docs/progress.txt @@ -882,7 +882,7 @@ S_StartSyncedAudio 0x00439030 0x000000FC - TestCollision 0x00439130 0x00000128 + GetSpheres 0x00439260 0x000002EF + GetJointAbsPosition 0x00439550 0x0000019C + -BaddieBiteEffect 0x004396F0 0x0000005D * +BaddieBiteEffect 0x004396F0 0x0000005D + # text.cpp T_InitPrint 0x00439750 0x00000022 + diff --git a/src/game/sphere.c b/src/game/sphere.c index 0a77635e3..c4f339a73 100644 --- a/src/game/sphere.c +++ b/src/game/sphere.c @@ -1,5 +1,6 @@ #include "3dsystem/3d_gen.h" #include "game/draw.h" +#include "game/effects.h" #include "game/sphere.h" #include "game/vars.h" #include "util.h" @@ -183,9 +184,21 @@ void GetJointAbsPosition(ITEM_INFO* item, PHD_VECTOR* vec, int32_t joint) phd_PopMatrix(); } +void BaddieBiteEffect(ITEM_INFO* item, BITE_INFO* bite) +{ + PHD_VECTOR pos; + pos.x = bite->x; + pos.y = bite->y; + pos.z = bite->z; + GetJointAbsPosition(item, &pos, bite->mesh_num); + DoBloodSplat( + pos.x, pos.y, pos.z, item->speed, item->pos.y_rot, item->room_number); +} + void T1MInjectGameSphere() { INJECT(0x00439130, TestCollision); INJECT(0x00439260, GetSpheres); INJECT(0x00439550, GetJointAbsPosition); + INJECT(0x004396F0, BaddieBiteEffect); } diff --git a/src/game/sphere.h b/src/game/sphere.h index e26de66a1..64bbb27d4 100644 --- a/src/game/sphere.h +++ b/src/game/sphere.h @@ -4,13 +4,10 @@ #include "game/types.h" #include -// clang-format off -#define BaddieBiteEffect ((void (*)(ITEM_INFO *item, BITE_INFO *bite))0x004396F0) -// clang-format on - int32_t TestCollision(ITEM_INFO* item, ITEM_INFO* lara_item); int32_t GetSpheres(ITEM_INFO* item, SPHERE* slist, int32_t world_space); void GetJointAbsPosition(ITEM_INFO* item, PHD_VECTOR* vec, int32_t joint); +void BaddieBiteEffect(ITEM_INFO* item, BITE_INFO* bite); void T1MInjectGameSphere();