port ObjectCollision

This commit is contained in:
rr- 2021-02-24 20:42:10 +01:00
parent 0758e71b09
commit 1289598ab2
4 changed files with 25 additions and 9 deletions

View file

@ -142,7 +142,7 @@
<rect width="12.00" height="12.00" x="546.00" y="45.00" fill="forestgreen"/>
<rect width="12.00" height="12.00" x="560.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="lightpink"/>
<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="lightpink"/>
<rect width="12.00" height="12.00" x="616.00" y="45.00" fill="lightpink"/>
<rect width="12.00" height="12.00" x="630.00" y="45.00" fill="forestgreen"/>
@ -1212,7 +1212,7 @@
<rect width="6.12" height="6.48" x="642.83" y="441.77" fill="forestgreen"/>
<rect width="6.03" height="6.48" x="650.95" y="441.77" fill="lightpink"/>
<rect width="5.86" height="6.48" x="658.99" y="441.77" fill="mistyrose"/>
<rect width="5.86" height="6.48" x="666.84" y="441.77" fill="lightpink"/>
<rect width="5.86" height="6.48" x="666.84" y="441.77" fill="forestgreen"/>
<rect width="5.86" height="6.48" x="674.70" y="441.77" fill="lightpink"/>
<rect width="5.77" height="6.48" x="682.55" y="441.77" fill="lightpink"/>
<rect width="5.68" height="6.48" x="690.32" y="441.77" fill="mistyrose"/>
@ -1459,10 +1459,10 @@
<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="-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): 30.73%</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.57%</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.28%</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.45%</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): 30.86%</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.61%</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.14%</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.42%</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>
</svg>

Before

Width:  |  Height:  |  Size: 110 KiB

After

Width:  |  Height:  |  Size: 110 KiB

Before After
Before After

View file

@ -180,7 +180,7 @@ GetTiltType ---------- ---------- +
LaraBaddieCollision 0x00412700 0x00000209 +
EffectSpaz ---------- ---------- +
CreatureCollision 0x00412910 0x00000078 +
ObjectCollision 0x00412990 0x00000059 *
ObjectCollision 0x00412990 0x00000059 +
DoorCollision 0x004129F0 0x0000007B *
TrapCollision 0x00412A70 0x00000096 *
ItemPushLara 0x00412B10 0x00000335 +

View file

@ -614,7 +614,6 @@ void CreatureCollision(int16_t item_num, ITEM_INFO* lara_item, COLL_INFO* coll)
if (!TestBoundsCollide(item, lara_item, coll->radius)) {
return;
}
if (!TestCollision(item, lara_item)) {
return;
}
@ -628,6 +627,22 @@ 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)
{
ITEM_INFO* item = &Items[item_num];
if (!TestBoundsCollide(item, lara_item, coll->radius)) {
return;
}
if (!TestCollision(item, lara_item)) {
return;
}
if (coll->enable_baddie_push) {
ItemPushLara(item, lara_item, coll, 0, 1);
}
}
void ItemPushLara(
ITEM_INFO* item, ITEM_INFO* lara_item, COLL_INFO* coll, int32_t spazon,
int32_t bigpush)
@ -754,6 +769,7 @@ void T1MInjectGameCollide()
INJECT(0x004126A0, UpdateLaraRoom);
INJECT(0x00412700, LaraBaddieCollision);
INJECT(0x00412910, CreatureCollision);
INJECT(0x00412990, ObjectCollision);
INJECT(0x00412B10, ItemPushLara);
INJECT(0x00412E50, TestBoundsCollide);
}

View file

@ -5,7 +5,6 @@
#include <stdint.h>
// clang-format off
#define ObjectCollision ((void (*)(int16_t item_num, ITEM_INFO* lara_item, COLL_INFO* coll))0x00412990)
#define DoorCollision ((void (*)(int16_t item_num, ITEM_INFO* lara_item, COLL_INFO* coll))0x004129F0)
#define TrapCollision ((void (*)(int16_t item_num, ITEM_INFO* lara_item, COLL_INFO* coll))0x00412A70)
// clang-format on
@ -26,6 +25,7 @@ int16_t GetTiltType(FLOOR_INFO* floor, int32_t x, int32_t y, int32_t z);
void LaraBaddieCollision(ITEM_INFO* lara_item, COLL_INFO* coll);
void EffectSpaz(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 ItemPushLara(
ITEM_INFO* item, ITEM_INFO* lara_item, COLL_INFO* coll, int32_t spazon,
int32_t bigpush);