port Lara_TouchLava

This commit is contained in:
Marcin Kurczewski 2024-09-10 22:42:41 +02:00
parent a10d65aeff
commit e17a7cc4cc
No known key found for this signature in database
GPG Key ID: CC65E6FD28CAE42A
8 changed files with 46 additions and 11 deletions

View File

@ -69,10 +69,10 @@
</g>
<g transform="translate(0 116)">
<text x="0" y="7.50">Tomb2.exe progress according to the physical function order:</text>
<text class="todo" style="font-size: 12px; " x="747" y="9"><tspan text-anchor="end"><tspan class="decompiled">61.66% (751)</tspan> · <tspan class="known">35.88% (437)</tspan> · <tspan class="todo">0% (0)</tspan> · <tspan class="unused">2.46% (30)</tspan></tspan></text>
<text class="todo" style="font-size: 12px; " x="747" y="9"><tspan text-anchor="end"><tspan class="decompiled">61.74% (752)</tspan> · <tspan class="known">35.80% (436)</tspan> · <tspan class="todo">0% (0)</tspan> · <tspan class="unused">2.46% (30)</tspan></tspan></text>
<g transform="translate(0 20)">
<rect width="460.59" height="6" x="0" y="0" class="decompiled"/>
<rect width="268.01" height="6" x="460.59" y="0" class="known"/>
<rect width="461.20" height="6" x="0" y="0" class="decompiled"/>
<rect width="267.40" height="6" x="461.20" y="0" class="known"/>
<rect width="18.40" height="6" x="728.60" y="0" class="unused"/>
</g>
<g transform="translate(0 31)">
@ -865,7 +865,7 @@
<rect width="12" height="12" x="540" y="225" class="known"><title>void __cdecl FlameEmitterControl(int16_t item_num);</title></rect>
<rect width="12" height="12" x="555" y="225" class="decompiled"><title>void __cdecl Flame_Control(int16_t fx_num);</title></rect>
<rect width="12" height="12" x="570" y="225" class="decompiled"><title>void __cdecl Lara_CatchFire(void);</title></rect>
<rect width="12" height="12" x="585" y="225" class="known"><title>void __cdecl LavaBurn(ITEM_INFO *item);</title></rect>
<rect width="12" height="12" x="585" y="225" class="decompiled"><title>void __cdecl Lara_TouchLava(ITEM_INFO *item);</title></rect>
<rect width="12" height="12" x="600" y="225" class="known"><title>void __cdecl LavaSpray(int16_t item_num);</title></rect>
<rect width="12" height="12" x="615" y="225" class="known"><title>void __cdecl ControlLavaBlob(int16_t fx_num);</title></rect>
<rect width="12" height="12" x="630" y="225" class="known"><title>void __cdecl GiantYetiControl(int16_t item_num);</title></rect>
@ -1298,10 +1298,10 @@
</g>
<g transform="translate(0 546)">
<text x="0" y="7.50">Tomb2.exe progress according to the function sizes:</text>
<text class="todo" style="font-size: 12px; " x="747" y="9"><tspan text-anchor="end"><tspan class="decompiled">65.19%</tspan> · <tspan class="known">34.48%</tspan> · <tspan class="todo">0%</tspan> · <tspan class="unused">0.33%</tspan></tspan></text>
<text class="todo" style="font-size: 12px; " x="747" y="9"><tspan text-anchor="end"><tspan class="decompiled">65.26%</tspan> · <tspan class="known">34.41%</tspan> · <tspan class="todo">0%</tspan> · <tspan class="unused">0.33%</tspan></tspan></text>
<g transform="translate(0 20)">
<rect width="487" height="6" x="0" y="0" class="decompiled"/>
<rect width="257.56" height="6" x="487" y="0" class="known"/>
<rect width="487.51" height="6" x="0" y="0" class="decompiled"/>
<rect width="257.05" height="6" x="487.51" y="0" class="known"/>
<rect width="2.44" height="6" x="744.56" y="0" class="unused"/>
</g>
<g transform="translate(0 31)">
@ -1697,7 +1697,7 @@
<rect width="10.66" height="11.04" x="494.80" y="266.42" class="decompiled"><title>void __cdecl Camera_RefreshFromTrigger(int16_t type, const int16_t *data);</title></rect>
<rect width="10.66" height="11.04" x="494.80" y="280.46" class="decompiled"><title>int32_t __cdecl Lara_TestWaterStepOut(ITEM_INFO *item, COLL_INFO *coll);</title></rect>
<rect width="10.66" height="11.04" x="494.80" y="294.50" class="decompiled"><title>int32_t __cdecl S_Audio_Sample_Play(int32_t sample_id, int32_t volume, int32_t pitch, int32_t pan, int32_t flags);</title></rect>
<rect width="10.66" height="10.98" x="494.80" y="308.54" class="known"><title>void __cdecl LavaBurn(ITEM_INFO *item);</title></rect>
<rect width="10.66" height="10.98" x="494.80" y="308.54" class="decompiled"><title>void __cdecl Lara_TouchLava(ITEM_INFO *item);</title></rect>
<rect width="10.66" height="10.98" x="494.80" y="322.51" class="decompiled"><title>void __cdecl RenderFinish(bool need_to_clear_textures);</title></rect>
<rect width="10.66" height="10.86" x="494.80" y="336.49" class="known"><title>bool __cdecl DInputJoystickCreate(void);</title></rect>
<rect width="10.66" height="10.86" x="494.80" y="350.35" class="known"><title>void __cdecl S_InitialisePolyList(BOOL clear_back_buffer);</title></rect>

Before

Width:  |  Height:  |  Size: 364 KiB

After

Width:  |  Height:  |  Size: 364 KiB

View File

@ -3732,7 +3732,7 @@ typedef enum {
0x00442B30 0x0090 -R void __cdecl FlameEmitterControl(int16_t item_num);
0x00442BC0 0x0164 + void __cdecl Flame_Control(int16_t fx_num);
0x00442D30 0x0049 + void __cdecl Lara_CatchFire(void);
0x00442D80 0x00E6 -R void __cdecl LavaBurn(ITEM_INFO *item);
0x00442D80 0x00E6 + void __cdecl Lara_TouchLava(ITEM_INFO *item);
0x00442E70 0x00C5 -R void __cdecl LavaSpray(int16_t item_num);
0x00442F40 0x010B -R void __cdecl ControlLavaBlob(int16_t fx_num);

View File

@ -9,6 +9,7 @@
#include "game/lara/lara_control.h"
#include "game/math.h"
#include "game/matrix.h"
#include "game/random.h"
#include "game/room.h"
#include "game/sound.h"
#include "global/const.h"
@ -1818,3 +1819,33 @@ void __cdecl Lara_CatchFire(void)
fx->counter = -1;
g_Lara.burn = 1;
}
void __cdecl Lara_TouchLava(ITEM_INFO *const item)
{
if (item->hit_points < 0) {
return;
}
int16_t room_num = item->room_num;
const SECTOR_INFO *const sector =
Room_GetSector(item->pos.x, MAX_HEIGHT, item->pos.z, &room_num);
const int32_t height =
Room_GetHeight(sector, item->pos.x, MAX_HEIGHT, item->pos.z);
if (item->floor != height) {
return;
}
item->hit_points = -1;
item->hit_status = 1;
for (int32_t i = 0; i < 10; i++) {
const int16_t fx_num = Effect_Create(item->room_num);
if (fx_num != NO_ITEM) {
FX_INFO *const fx = &g_Effects[fx_num];
fx->object_id = O_FLAME;
fx->frame_num =
g_Objects[O_FLAME].mesh_count * Random_GetControl() / 0x7FFF;
fx->counter = -1 - 24 * Random_GetControl() / 0x7FFF;
}
}
}

View File

@ -82,3 +82,5 @@ void __cdecl Lara_SwimCollision(ITEM_INFO *item, COLL_INFO *coll);
void __cdecl Lara_WaterCurrent(COLL_INFO *coll);
void __cdecl Lara_CatchFire(void);
void __cdecl Lara_TouchLava(ITEM_INFO *item);

View File

@ -3,6 +3,7 @@
#include "game/box.h"
#include "game/camera.h"
#include "game/items.h"
#include "game/lara/lara_misc.h"
#include "game/lot.h"
#include "game/math.h"
#include "game/music.h"
@ -369,7 +370,7 @@ void __cdecl Room_TestTriggers(const int16_t *fd, bool heavy)
if (!heavy
&& (g_LaraItem->pos.y == g_LaraItem->floor
|| g_Lara.water_status != LWS_ABOVE_WATER)) {
LavaBurn(g_LaraItem);
Lara_TouchLava(g_LaraItem);
}
if (FLOORDATA_IS_END(*fd)) {

View File

@ -18,6 +18,7 @@
#define WALL_SHIFT 10
#define STEP_L (WALL_L / 4) // = 256
#define NO_HEIGHT (-32512)
#define MAX_HEIGHT 32000
#define NO_BAD_POS (-NO_HEIGHT) // = 32512
#define NO_BAD_NEG (NO_HEIGHT) // = -32512
#define BAD_JUMP_CEILING ((STEP_L * 3) / 4) // = 192

View File

@ -259,7 +259,6 @@
#define DartsControl ((void __cdecl (*)(int16_t item_num))0x00442980)
#define DartEffectControl ((void __cdecl (*)(int16_t fx_num))0x00442AE0)
#define FlameEmitterControl ((void __cdecl (*)(int16_t item_num))0x00442B30)
#define LavaBurn ((void __cdecl (*)(ITEM_INFO *item))0x00442D80)
#define LavaSpray ((void __cdecl (*)(int16_t item_num))0x00442E70)
#define ControlLavaBlob ((void __cdecl (*)(int16_t fx_num))0x00442F40)
#define GiantYetiControl ((void __cdecl (*)(int16_t item_num))0x00443050)

View File

@ -717,6 +717,7 @@ static void Inject_Lara_Misc(const bool enable)
INJECT(enable, 0x00432710, Lara_SwimCollision);
INJECT(enable, 0x00432870, Lara_WaterCurrent);
INJECT(enable, 0x00442D30, Lara_CatchFire);
INJECT(enable, 0x00442D80, Lara_TouchLava);
}
static void Inject_Lara_State(const bool enable)