port KillEffect

This commit is contained in:
rr- 2021-03-02 11:48:22 +01:00
parent 1dd6a1b96d
commit 01bb9d2617
4 changed files with 42 additions and 8 deletions

View file

@ -327,7 +327,7 @@
<rect width="12.00" height="12.00" x="336.00" y="101.00" fill="forestgreen"><title>GlobalItemReplace</title></rect>
<rect width="12.00" height="12.00" x="350.00" y="101.00" fill="forestgreen"><title>InitialiseFXArray</title></rect>
<rect width="12.00" height="12.00" x="364.00" y="101.00" fill="forestgreen"><title>CreateEffect</title></rect>
<rect width="12.00" height="12.00" x="378.00" y="101.00" fill="lightpink"><title>KillEffect</title></rect>
<rect width="12.00" height="12.00" x="378.00" y="101.00" fill="forestgreen"><title>KillEffect</title></rect>
<rect width="12.00" height="12.00" x="392.00" y="101.00" fill="lightpink"><title>EffectNewRoom</title></rect>
<rect width="12.00" height="12.00" x="406.00" y="101.00" fill="forestgreen"><title>LaraAboveWater</title></rect>
<rect width="12.00" height="12.00" x="420.00" y="101.00" fill="forestgreen"><title>LaraAsWalk</title></rect>
@ -1041,7 +1041,7 @@
<rect width="11.14" height="11.03" x="525.45" y="485.99" fill="forestgreen"><title>HitTarget</title></rect>
<rect width="11.14" height="11.03" x="525.45" y="499.02" fill="lightpink"><title>InitialiseStatue</title></rect>
<rect width="11.14" height="10.98" x="525.45" y="512.05" fill="forestgreen"><title>MoveLaraPosition</title></rect>
<rect width="11.14" height="10.98" x="525.45" y="525.02" fill="lightpink"><title>KillEffect</title></rect>
<rect width="11.14" height="10.98" x="525.45" y="525.02" fill="forestgreen"><title>KillEffect</title></rect>
<rect width="11.81" height="10.35" x="538.59" y="366.13" fill="forestgreen"><title>LaraDeflectEdgeJump</title></rect>
<rect width="11.63" height="10.35" x="552.39" y="366.13" fill="lightpink"><title>StatueControl</title></rect>
<rect width="11.57" height="10.35" x="566.02" y="366.13" fill="forestgreen"><title>T_Print</title></rect>
@ -1463,10 +1463,10 @@
<rect width="-0.06" height="-0.07" x="694.51" y="536.07" fill="mistyrose"><title>sub_440EF0</title></rect>
<rect width="-0.45" height="-0.55" x="696.45" y="536.07" fill="mistyrose"><title>sub_437BC0</title></rect>
<rect width="-0.45" height="-1.52" x="696.45" y="537.52" fill="lightpink"><title>S_CDVolume</title></rect>
<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): 46.92%</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): 44.65%</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): 38.99%</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): 39.52%</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): 47.06%</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): 44.74%</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): 38.85%</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): 39.43%</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): 14.09%</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.83%</text>
</svg>

Before

Width:  |  Height:  |  Size: 160 KiB

After

Width:  |  Height:  |  Size: 160 KiB

Before After
Before After

View file

@ -444,7 +444,7 @@ SpawnItem 0x00422110 0x000000B6 +
GlobalItemReplace 0x004221D0 0x00000080 +
InitialiseFXArray 0x00422250 0x00000030 +
CreateEffect 0x00422280 0x00000069 +
KillEffect 0x004222F0 0x000000E4 *
KillEffect 0x004222F0 0x000000E4 +
EffectNewRoom 0x004223E0 0x00000096 *
# lara.cpp

View file

@ -265,6 +265,39 @@ int16_t CreateEffect(int16_t room_num)
return fx_num;
}
void KillEffect(int16_t fx_num)
{
FX_INFO* fx = &Effects[fx_num];
int16_t linknum = NextFxActive;
if (linknum == fx_num) {
NextFxActive = fx->next_active;
} else {
for (; linknum != NO_ITEM; linknum = Effects[linknum].next_active) {
if (Effects[linknum].next_active == fx_num) {
Effects[linknum].next_active = fx->next_active;
break;
}
}
}
ROOM_INFO* r = &RoomInfo[fx->room_number];
linknum = r->fx_number;
if (linknum == fx_num) {
r->fx_number = fx->next_fx;
} else {
for (; linknum != NO_ITEM; linknum = Effects[linknum].next_fx) {
if (Effects[linknum].next_fx == fx_num) {
Effects[linknum].next_fx = fx->next_fx;
break;
}
}
}
fx->next_fx = NextFxFree;
NextFxFree = fx_num;
}
void T1MInjectGameItems()
{
INJECT(0x00421B10, InitialiseItemArray);
@ -279,4 +312,5 @@ void T1MInjectGameItems()
INJECT(0x004221D0, GlobalItemReplace);
INJECT(0x00422250, InitialiseFXArray);
INJECT(0x00422280, CreateEffect);
INJECT(0x004222F0, KillEffect);
}

View file

@ -5,7 +5,6 @@
#include <stdint.h>
// clang-format off
#define KillEffect ((void (*)(int16_t fx_num))0x004222F0)
#define EffectNewRoom ((void (*)(int16_t fx_num, int16_t room_num))0x004223E0)
// clang-format on
@ -21,6 +20,7 @@ int16_t SpawnItem(ITEM_INFO* item, int16_t object_num);
int32_t GlobalItemReplace(int32_t src_object_num, int32_t dst_object_num);
void InitialiseFXArray();
int16_t CreateEffect(int16_t room_num);
void KillEffect(int16_t fx_num);
void T1MInjectGameItems();