diff --git a/docs/tr2/progress.svg b/docs/tr2/progress.svg index 64195a182..42f3b84c3 100644 --- a/docs/tr2/progress.svg +++ b/docs/tr2/progress.svg @@ -69,10 +69,10 @@ Tomb2.exe progress according to the physical function order: -69.86% (869) · 27.73% (345) · 0% (0) · 2.41% (30) +69.94% (870) · 27.65% (344) · 0% (0) · 2.41% (30) - - + + @@ -268,7 +268,7 @@ int32_t __cdecl Demo_Start(int32_t level_num); void __cdecl Demo_LoadLaraPos(void); void __cdecl Demo_GetInput(void); -int16_t __cdecl Diver_Harpoon(int32_t x, int32_t y, int32_t z, int16_t speed, PHD_ANGLE y_rot, int16_t room_num); +int16_t __cdecl Diver_Harpoon(int32_t x, int32_t y, int32_t z, int16_t speed, PHD_ANGLE y_rot, int16_t room_num); int32_t __cdecl Diver_GetWaterSurface(int32_t x, int32_t y, int32_t z, int16_t room_num); void __cdecl Diver_Control(int16_t item_num); void __cdecl Dog_Control(int16_t item_num); @@ -1324,10 +1324,10 @@ Tomb2.exe progress according to the function sizes: -74.22% · 25.45% · 0% · 0.33% +74.26% · 25.42% · 0% · 0.33% - - + + @@ -1978,7 +1978,7 @@ int32_t __cdecl WinGameStart(void); void __cdecl Gun_Rifle_FireM16(bool running); void __cdecl Matrix_TranslateAbs(int32_t x, int32_t y, int32_t z); -int16_t __cdecl Diver_Harpoon(int32_t x, int32_t y, int32_t z, int16_t speed, PHD_ANGLE y_rot, int16_t room_num); +int16_t __cdecl Diver_Harpoon(int32_t x, int32_t y, int32_t z, int16_t speed, PHD_ANGLE y_rot, int16_t room_num); void __cdecl Overlay_DisplayModeInfo(char* string); void __cdecl Lara_TakeHit(ITEM *lara_item, COLL_INFO *coll); void __cdecl Lara_Col_FastDive(ITEM *item, COLL_INFO *coll); diff --git a/docs/tr2/progress.txt b/docs/tr2/progress.txt index 1cdce0425..9d47bd796 100644 --- a/docs/tr2/progress.txt +++ b/docs/tr2/progress.txt @@ -3093,7 +3093,7 @@ typedef enum { 0x00416BF0 0x002D + void __cdecl Demo_GetInput(void); # game/diver.c -0x00416C20 0x007A - int16_t __cdecl Diver_Harpoon(int32_t x, int32_t y, int32_t z, int16_t speed, PHD_ANGLE y_rot, int16_t room_num); +0x00416C20 0x007A + int16_t __cdecl Diver_Harpoon(int32_t x, int32_t y, int32_t z, int16_t speed, PHD_ANGLE y_rot, int16_t room_num); 0x00416CA0 0x0106 - int32_t __cdecl Diver_GetWaterSurface(int32_t x, int32_t y, int32_t z, int16_t room_num); 0x00416DB0 0x0389 + void __cdecl Diver_Control(int16_t item_num); diff --git a/src/tr2/game/objects/creatures/diver.c b/src/tr2/game/objects/creatures/diver.c index 075960bf2..924b6d05f 100644 --- a/src/tr2/game/objects/creatures/diver.c +++ b/src/tr2/game/objects/creatures/diver.c @@ -1,6 +1,7 @@ #include "game/objects/creatures/diver.h" #include "game/creature.h" +#include "game/effects.h" #include "game/los.h" #include "global/const.h" #include "global/funcs.h" @@ -11,6 +12,7 @@ #define DIVER_DIE_ANIM 16 #define DIVER_HITPOINTS 20 #define DIVER_RADIUS (WALL_L / 3) // = 341 +#define DIVER_HARPOON_SPEED 150 static BITE m_DiverBite = { .pos = { .x = 17, .y = 164, .z = 44, }, .mesh_num = 18 }; @@ -220,3 +222,27 @@ void __cdecl Diver_Control(int16_t item_num) break; } } + +int16_t __cdecl Diver_Harpoon( + const int32_t x, const int32_t y, const int32_t z, const int16_t speed, + const int16_t y_rot, const int16_t room_num) +{ + const int16_t fx_num = Effect_Create(room_num); + if (fx_num != NO_ITEM) { + FX *const fx = &g_Effects[fx_num]; + fx->pos.x = x; + fx->pos.y = y; + fx->pos.z = z; + fx->room_num = room_num; + fx->rot.x = 0; + fx->rot.y = y_rot; + fx->rot.z = 0; + fx->speed = DIVER_HARPOON_SPEED; + fx->fall_speed = 0; + fx->frame_num = 0; + fx->object_id = O_MISSILE_HARPOON; + fx->shade = 3584; + ShootAtLara(fx); + } + return fx_num; +} diff --git a/src/tr2/game/objects/creatures/diver.h b/src/tr2/game/objects/creatures/diver.h index 7cb907c77..6a2e539f2 100644 --- a/src/tr2/game/objects/creatures/diver.h +++ b/src/tr2/game/objects/creatures/diver.h @@ -5,3 +5,7 @@ void Diver_Setup(void); void __cdecl Diver_Control(int16_t item_num); + +int16_t __cdecl Diver_Harpoon( + int32_t x, int32_t y, int32_t z, int16_t speed, int16_t y_rot, + int16_t room_num); diff --git a/src/tr2/global/funcs.h b/src/tr2/global/funcs.h index a663a9f2e..23d29ed8b 100644 --- a/src/tr2/global/funcs.h +++ b/src/tr2/global/funcs.h @@ -6,7 +6,6 @@ // clang-format off #define Output_InsertInventoryBackground ((void __cdecl (*)(const int16_t *obj_ptr))0x00401D50) -#define Diver_Harpoon ((int16_t __cdecl (*)(int32_t x, int32_t y, int32_t z, int16_t speed, PHD_ANGLE y_rot, int16_t room_num))0x00416C20) #define Diver_GetWaterSurface ((int32_t __cdecl (*)(int32_t x, int32_t y, int32_t z, int16_t room_num))0x00416CA0) #define Dog_Control ((void __cdecl (*)(int16_t item_num))0x00417160) #define Tiger_Control ((void __cdecl (*)(int16_t item_num))0x00417510) diff --git a/src/tr2/inject_exec.c b/src/tr2/inject_exec.c index 6e94b3b85..d84aba1bd 100644 --- a/src/tr2/inject_exec.c +++ b/src/tr2/inject_exec.c @@ -1017,6 +1017,7 @@ static void M_Objects(const bool enable) INJECT(enable, 0x004138E0, Object_Collision); INJECT(enable, 0x00413940, Door_Collision); INJECT(enable, 0x004139C0, Object_Collision_Trap); + INJECT(enable, 0x00416C20, Diver_Harpoon); INJECT(enable, 0x00416DB0, Diver_Control); INJECT(enable, 0x004177B0, Twinkle_Control); INJECT(enable, 0x00417AC0, Dragon_Collision);