port TrapCollision

This commit is contained in:
rr- 2021-02-24 20:48:14 +01:00
parent 23d72c6098
commit 12e1492346
4 changed files with 22 additions and 11 deletions

View file

@ -144,7 +144,7 @@
<rect width="12.00" height="12.00" x="574.00" y="45.00" fill="forestgreen"/> <rect width="12.00" height="12.00" x="574.00" y="45.00" fill="forestgreen"/>
<rect width="12.00" height="12.00" x="588.00" y="45.00" fill="forestgreen"/> <rect width="12.00" height="12.00" x="588.00" y="45.00" fill="forestgreen"/>
<rect width="12.00" height="12.00" x="602.00" y="45.00" fill="forestgreen"/> <rect width="12.00" height="12.00" x="602.00" y="45.00" fill="forestgreen"/>
<rect width="12.00" height="12.00" x="616.00" y="45.00" fill="lightpink"/> <rect width="12.00" height="12.00" x="616.00" y="45.00" fill="forestgreen"/>
<rect width="12.00" height="12.00" x="630.00" y="45.00" fill="forestgreen"/> <rect width="12.00" height="12.00" x="630.00" y="45.00" fill="forestgreen"/>
<rect width="12.00" height="12.00" x="644.00" y="45.00" fill="forestgreen"/> <rect width="12.00" height="12.00" x="644.00" y="45.00" fill="forestgreen"/>
<rect width="12.00" height="12.00" x="658.00" y="45.00" fill="lightpink"/> <rect width="12.00" height="12.00" x="658.00" y="45.00" fill="lightpink"/>
@ -1118,7 +1118,7 @@
<rect width="8.58" height="8.82" x="594.46" y="402.58" fill="forestgreen"/> <rect width="8.58" height="8.82" x="594.46" y="402.58" fill="forestgreen"/>
<rect width="8.44" height="8.82" x="605.04" y="402.58" fill="forestgreen"/> <rect width="8.44" height="8.82" x="605.04" y="402.58" fill="forestgreen"/>
<rect width="8.37" height="8.82" x="615.49" y="402.58" fill="forestgreen"/> <rect width="8.37" height="8.82" x="615.49" y="402.58" fill="forestgreen"/>
<rect width="8.37" height="8.82" x="625.86" y="402.58" fill="lightpink"/> <rect width="8.37" height="8.82" x="625.86" y="402.58" fill="forestgreen"/>
<rect width="8.37" height="8.82" x="636.23" y="402.58" fill="lightpink"/> <rect width="8.37" height="8.82" x="636.23" y="402.58" fill="lightpink"/>
<rect width="8.37" height="8.82" x="646.61" y="402.58" fill="lightpink"/> <rect width="8.37" height="8.82" x="646.61" y="402.58" fill="lightpink"/>
<rect width="8.37" height="8.82" x="656.98" y="402.58" fill="forestgreen"/> <rect width="8.37" height="8.82" x="656.98" y="402.58" fill="forestgreen"/>
@ -1459,10 +1459,10 @@
<rect width="-0.46" height="0.42" x="695.22" y="535.58" fill="mistyrose"/> <rect width="-0.46" height="0.42" x="695.22" y="535.58" fill="mistyrose"/>
<rect width="-0.76" height="-0.18" x="696.76" y="535.58" fill="mistyrose"/> <rect width="-0.76" height="-0.18" x="696.76" y="535.58" fill="mistyrose"/>
<rect width="-0.76" height="-1.39" x="696.76" y="537.39" fill="lightpink"/> <rect width="-0.76" height="-1.39" x="696.76" y="537.39" 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): 31.00%</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): 31.14%</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): 30.66%</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): 30.72%</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): 55.01%</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): 54.87%</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): 53.37%</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): 53.31%</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): 13.99%</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): 13.99%</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): 15.97%</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): 15.97%</text>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 110 KiB

After

Width:  |  Height:  |  Size: 110 KiB

Before After
Before After

View file

@ -182,7 +182,7 @@ EffectSpaz ---------- ---------- +
CreatureCollision 0x00412910 0x00000078 + CreatureCollision 0x00412910 0x00000078 +
ObjectCollision 0x00412990 0x00000059 + ObjectCollision 0x00412990 0x00000059 +
DoorCollision 0x004129F0 0x0000007B + DoorCollision 0x004129F0 0x0000007B +
TrapCollision 0x00412A70 0x00000096 * TrapCollision 0x00412A70 0x00000096 +
ItemPushLara 0x00412B10 0x00000335 + ItemPushLara 0x00412B10 0x00000335 +
TestBoundsCollide 0x00412E50 0x000000D1 + TestBoundsCollide 0x00412E50 0x000000D1 +
TestLaraPosition 0x00412F30 0x00000137 - TestLaraPosition 0x00412F30 0x00000137 -

View file

@ -663,6 +663,19 @@ void DoorCollision(int16_t item_num, ITEM_INFO* lara_item, COLL_INFO* coll)
} }
} }
void TrapCollision(int16_t item_num, ITEM_INFO* lara_item, COLL_INFO* coll)
{
ITEM_INFO* item = &Items[item_num];
if (item->status == IS_ACTIVE) {
if (TestBoundsCollide(item, lara_item, coll->radius)) {
TestCollision(item, lara_item);
}
} else if (item->status != IS_INVISIBLE) {
ObjectCollision(item_num, lara_item, coll);
}
}
void ItemPushLara( void ItemPushLara(
ITEM_INFO* item, ITEM_INFO* lara_item, COLL_INFO* coll, int32_t spazon, ITEM_INFO* item, ITEM_INFO* lara_item, COLL_INFO* coll, int32_t spazon,
int32_t bigpush) int32_t bigpush)
@ -791,6 +804,7 @@ void T1MInjectGameCollide()
INJECT(0x00412910, CreatureCollision); INJECT(0x00412910, CreatureCollision);
INJECT(0x00412990, ObjectCollision); INJECT(0x00412990, ObjectCollision);
INJECT(0x004129F0, DoorCollision); INJECT(0x004129F0, DoorCollision);
INJECT(0x00412A70, TrapCollision);
INJECT(0x00412B10, ItemPushLara); INJECT(0x00412B10, ItemPushLara);
INJECT(0x00412E50, TestBoundsCollide); INJECT(0x00412E50, TestBoundsCollide);
} }

View file

@ -4,10 +4,6 @@
#include "types.h" #include "types.h"
#include <stdint.h> #include <stdint.h>
// clang-format off
#define TrapCollision ((void (*)(int16_t item_num, ITEM_INFO* lara_item, COLL_INFO* coll))0x00412A70)
// clang-format on
void GetCollisionInfo( void GetCollisionInfo(
COLL_INFO* coll, int32_t xpos, int32_t ypos, int32_t zpos, int16_t room_num, COLL_INFO* coll, int32_t xpos, int32_t ypos, int32_t zpos, int16_t room_num,
int32_t objheight); int32_t objheight);
@ -26,6 +22,7 @@ void EffectSpaz(ITEM_INFO* lara_item, COLL_INFO* coll);
void CreatureCollision(int16_t item_num, ITEM_INFO* lara_item, COLL_INFO* coll); void CreatureCollision(int16_t item_num, ITEM_INFO* lara_item, COLL_INFO* coll);
void ObjectCollision(int16_t item_num, ITEM_INFO* lara_item, COLL_INFO* coll); void ObjectCollision(int16_t item_num, ITEM_INFO* lara_item, COLL_INFO* coll);
void DoorCollision(int16_t item_num, ITEM_INFO* lara_item, COLL_INFO* coll); void DoorCollision(int16_t item_num, ITEM_INFO* lara_item, COLL_INFO* coll);
void TrapCollision(int16_t item_num, ITEM_INFO* lara_item, COLL_INFO* coll);
void ItemPushLara( void ItemPushLara(
ITEM_INFO* item, ITEM_INFO* lara_item, COLL_INFO* coll, int32_t spazon, ITEM_INFO* item, ITEM_INFO* lara_item, COLL_INFO* coll, int32_t spazon,
int32_t bigpush); int32_t bigpush);