diff --git a/docs/tr2/progress.svg b/docs/tr2/progress.svg index f05afafff..90aa91d38 100644 --- a/docs/tr2/progress.svg +++ b/docs/tr2/progress.svg @@ -69,10 +69,10 @@ Tomb2.exe progress according to the physical function order: -67.28% (837) · 30.31% (377) · 0% (0) · 2.41% (30) +67.36% (838) · 30.23% (376) · 0% (0) · 2.41% (30) - - + + @@ -798,7 +798,7 @@ void __cdecl SkidooDriver_Initialise(int16_t item_num); void __cdecl SkidooDriver_Control(int16_t rider_num); void __cdecl SkidooArmed_Push(const ITEM *item, ITEM *lara_item, int32_t radius); -void __cdecl SkidooArmed_Collision(int16_t item_num, ITEM *lara_item, COLL_INFO *coll); +void __cdecl SkidooArmed_Collision(int16_t item_num, ITEM *lara_item, COLL_INFO *coll); int32_t __cdecl Music_GetRealTrack(int32_t track); void __cdecl Sound_Effect(int32_t sample_id, const XYZ_32 *pos, uint32_t flags); void __cdecl Sound_StopEffect(int32_t sample_id); @@ -1324,10 +1324,10 @@ Tomb2.exe progress according to the function sizes: -72.66% · 27.02% · 0% · 0.33% +72.69% · 26.98% · 0% · 0.33% - - + + @@ -1956,7 +1956,7 @@ int32_t __cdecl AddAssaultTime(uint32_t time); void __cdecl Lara_Col_Stop(ITEM *item, COLL_INFO *coll); void __cdecl Lara_Col_Roll(ITEM *item, COLL_INFO *coll); -void __cdecl SkidooArmed_Collision(int16_t item_num, ITEM *lara_item, COLL_INFO *coll); +void __cdecl SkidooArmed_Collision(int16_t item_num, ITEM *lara_item, COLL_INFO *coll); int32_t __cdecl Room_FindByPos(int32_t x, int32_t y, int32_t z); void __cdecl ControlExplosion1(int16_t fx_num); int32_t __cdecl Lara_DeflectEdge(ITEM *item, COLL_INFO *coll); diff --git a/docs/tr2/progress.txt b/docs/tr2/progress.txt index c27b40588..40b263fe5 100644 --- a/docs/tr2/progress.txt +++ b/docs/tr2/progress.txt @@ -3677,7 +3677,7 @@ typedef enum { 0x0043ED40 0x007F + void __cdecl SkidooDriver_Initialise(int16_t item_num); 0x0043EDD0 0x03E2 + void __cdecl SkidooDriver_Control(int16_t rider_num); 0x0043F1D0 0x0119 + void __cdecl SkidooArmed_Push(const ITEM *item, ITEM *lara_item, int32_t radius); -0x0043F2F0 0x0081 - void __cdecl SkidooArmed_Collision(int16_t item_num, ITEM *lara_item, COLL_INFO *coll); +0x0043F2F0 0x0081 + void __cdecl SkidooArmed_Collision(int16_t item_num, ITEM *lara_item, COLL_INFO *coll); # game/sound.c 0x0043F380 0x0031 * int32_t __cdecl Music_GetRealTrack(int32_t track); diff --git a/src/tr2/game/objects/vehicles/skidoo_armed.c b/src/tr2/game/objects/vehicles/skidoo_armed.c index f1aab9aec..c0486ea04 100644 --- a/src/tr2/game/objects/vehicles/skidoo_armed.c +++ b/src/tr2/game/objects/vehicles/skidoo_armed.c @@ -1,6 +1,8 @@ #include "game/objects/vehicles/skidoo_armed.h" #include "game/items.h" +#include "game/lara/control.h" +#include "game/lara/misc.h" #include "game/math.h" #include "game/objects/creatures/skidoo_driver.h" #include "global/funcs.h" @@ -70,3 +72,26 @@ void __cdecl SkidooArmed_Push( lara_item->pos.x = item->pos.x + ((rz * sy + rx * cy) >> W2V_SHIFT); lara_item->pos.z = item->pos.z + ((rz * cy - rx * sy) >> W2V_SHIFT); } + +void __cdecl SkidooArmed_Collision( + const int16_t item_num, ITEM *const lara_item, COLL_INFO *const coll) +{ + ITEM *const item = Item_Get(item_num); + if (!Item_TestBoundsCollide(item, lara_item, coll->radius)) { + return; + } + + if (!Collide_TestCollision(item, lara_item)) { + return; + } + + if (coll->enable_baddie_push) { + Lara_Push( + item, lara_item, coll, item->speed > 0 ? coll->enable_spaz : false, + false); + } + + if (g_Lara.skidoo == NO_ITEM && item->speed > 0) { + Lara_TakeDamage(100, true); + } +} diff --git a/src/tr2/game/objects/vehicles/skidoo_armed.h b/src/tr2/game/objects/vehicles/skidoo_armed.h index 07e480276..5a55efcdb 100644 --- a/src/tr2/game/objects/vehicles/skidoo_armed.h +++ b/src/tr2/game/objects/vehicles/skidoo_armed.h @@ -6,3 +6,6 @@ void SkidooArmed_Setup(void); void __cdecl SkidooArmed_Push( const ITEM *item, ITEM *lara_item, int32_t radius); + +void __cdecl SkidooArmed_Collision( + int16_t item_num, ITEM *lara_item, COLL_INFO *coll); diff --git a/src/tr2/global/funcs.h b/src/tr2/global/funcs.h index 331e98bda..b199212d7 100644 --- a/src/tr2/global/funcs.h +++ b/src/tr2/global/funcs.h @@ -171,7 +171,6 @@ #define DoShift ((int32_t __cdecl (*)(ITEM *skidoo, XYZ_32 *pos, XYZ_32 *old))0x0043D320) #define DoDynamics ((int32_t __cdecl (*)(int32_t height, int32_t fall_speed, int32_t *y))0x0043D5A0) #define GetCollisionAnim ((int32_t __cdecl (*)(ITEM *skidoo, XYZ_32 *moved))0x0043D600) -#define SkidooArmed_Collision ((void __cdecl (*)(int16_t item_num, ITEM *lara_item, COLL_INFO *coll))0x0043F2F0) #define Music_GetRealTrack ((int32_t __cdecl (*)(int32_t track))0x0043F380) #define Collide_TestCollision ((int32_t __cdecl (*)(ITEM *item, const ITEM *lara_item))0x0043F9B0) #define Collide_GetSpheres ((int32_t __cdecl (*)(const ITEM *item, SPHERE *spheres, bool world_space))0x0043FAE0) diff --git a/src/tr2/inject_exec.c b/src/tr2/inject_exec.c index 128446e66..a56577060 100644 --- a/src/tr2/inject_exec.c +++ b/src/tr2/inject_exec.c @@ -1032,6 +1032,7 @@ static void M_Objects(const bool enable) INJECT(enable, 0x0043ED40, SkidooDriver_Initialise); INJECT(enable, 0x0043EDD0, SkidooDriver_Control); INJECT(enable, 0x0043F1D0, SkidooArmed_Push); + INJECT(enable, 0x0043F2F0, SkidooArmed_Collision); INJECT(enable, 0x00442B30, FlameEmitter_Control); INJECT(enable, 0x00442BC0, Flame_Control); INJECT(enable, 0x00442E70, EmberEmitter_Control);