mirror of
https://github.com/LostArtefacts/TR2X.git
synced 2024-12-02 19:06:47 +00:00
port Lara_WaterCurrent
This commit is contained in:
parent
306a99091e
commit
273939dbd2
@ -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">50.41% (614)</tspan> · <tspan class="known">47.13% (574)</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">50.49% (615)</tspan> · <tspan class="known">47.04% (573)</tspan> · <tspan class="todo">0% (0)</tspan> · <tspan class="unused">2.46% (30)</tspan></tspan></text>
|
||||
<g transform="translate(0 20)">
|
||||
<rect width="376.57" height="6" x="0" y="0" class="decompiled"/>
|
||||
<rect width="352.03" height="6" x="376.57" y="0" class="known"/>
|
||||
<rect width="377.18" height="6" x="0" y="0" class="decompiled"/>
|
||||
<rect width="351.42" height="6" x="377.18" y="0" class="known"/>
|
||||
<rect width="18.40" height="6" x="728.60" y="0" class="unused"/>
|
||||
</g>
|
||||
<g transform="translate(0 31)">
|
||||
@ -671,7 +671,7 @@
|
||||
<rect width="12" height="12" x="630" y="165" class="decompiled"><title>int32_t __cdecl Lara_GetWaterDepth(int32_t x, int32_t y, int32_t z, int16_t room_num);</title></rect>
|
||||
<rect width="12" height="12" x="645" y="165" class="decompiled"><title>void __cdecl Lara_TestWaterDepth(ITEM_INFO *item, COLL_INFO *coll);</title></rect>
|
||||
<rect width="12" height="12" x="660" y="165" class="decompiled"><title>void __cdecl Lara_SwimCollision(ITEM_INFO *item, COLL_INFO *coll);</title></rect>
|
||||
<rect width="12" height="12" x="675" y="165" class="known"><title>void __cdecl Lara_WaterCurrent(COLL_INFO *coll);</title></rect>
|
||||
<rect width="12" height="12" x="675" y="165" class="decompiled"><title>void __cdecl Lara_WaterCurrent(COLL_INFO *coll);</title></rect>
|
||||
<rect width="12" height="12" x="690" y="165" class="known"><title>void __cdecl InitialiseLOTarray(void);</title></rect>
|
||||
<rect width="12" height="12" x="705" y="165" class="known"><title>void __cdecl DisableBaddieAI(int16_t item_num);</title></rect>
|
||||
<rect width="12" height="12" x="720" y="165" class="known"><title>int32_t __cdecl LOT_EnableBaddieAI(int16_t item_num, int32_t always);</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">50.86%</tspan> · <tspan class="known">48.82%</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">51%</tspan> · <tspan class="known">48.67%</tspan> · <tspan class="todo">0%</tspan> · <tspan class="unused">0.33%</tspan></tspan></text>
|
||||
<g transform="translate(0 20)">
|
||||
<rect width="379.91" height="6" x="0" y="0" class="decompiled"/>
|
||||
<rect width="364.65" height="6" x="379.91" y="0" class="known"/>
|
||||
<rect width="380.98" height="6" x="0" y="0" class="decompiled"/>
|
||||
<rect width="363.58" height="6" x="380.98" y="0" class="known"/>
|
||||
<rect width="2.44" height="6" x="744.56" y="0" class="unused"/>
|
||||
</g>
|
||||
<g transform="translate(0 31)">
|
||||
@ -1489,7 +1489,7 @@
|
||||
<rect width="17.36" height="17.38" x="390.95" y="317.01" class="known"><title>void __cdecl MineControl(int16_t mine_num);</title></rect>
|
||||
<rect width="17.36" height="17.34" x="390.95" y="337.40" class="decompiled"><title>int32_t __cdecl Box_SearchLOT(LOT_INFO *lot, int32_t expansion);</title></rect>
|
||||
<rect width="17.36" height="17.26" x="390.95" y="357.74" class="known"><title>void __cdecl S_PrintShadow(int16_t radius, const BOUNDS_16 *bounds, const ITEM_INFO *item);</title></rect>
|
||||
<rect width="17.66" height="16.77" x="411.31" y="21.70" class="known"><title>void __cdecl Lara_WaterCurrent(COLL_INFO *coll);</title></rect>
|
||||
<rect width="17.66" height="16.77" x="411.31" y="21.70" class="decompiled"><title>void __cdecl Lara_WaterCurrent(COLL_INFO *coll);</title></rect>
|
||||
<rect width="17.54" height="16.77" x="431.97" y="21.70" class="known"><title>int32_t __cdecl GF_LoadScriptFile(char *fname);</title></rect>
|
||||
<rect width="17.45" height="16.77" x="452.50" y="21.70" class="decompiled"><title>void __cdecl Matrix_RotYXZpack(uint32_t rpack);</title></rect>
|
||||
<rect width="17.24" height="16.77" x="472.96" y="21.70" class="decompiled"><title>void __cdecl Camera_Look(const ITEM_INFO *item);</title></rect>
|
||||
|
Before Width: | Height: | Size: 362 KiB After Width: | Height: | Size: 362 KiB |
@ -3329,7 +3329,7 @@ typedef enum {
|
||||
0x004324A0 0x0192 + int32_t __cdecl Lara_GetWaterDepth(int32_t x, int32_t y, int32_t z, int16_t room_num);
|
||||
0x00432640 0x00CE + void __cdecl Lara_TestWaterDepth(ITEM_INFO *item, COLL_INFO *coll);
|
||||
0x00432710 0x015C + void __cdecl Lara_SwimCollision(ITEM_INFO *item, COLL_INFO *coll);
|
||||
0x00432870 0x01EC - void __cdecl Lara_WaterCurrent(COLL_INFO *coll);
|
||||
0x00432870 0x01EC + void __cdecl Lara_WaterCurrent(COLL_INFO *coll);
|
||||
|
||||
# game/lot.c
|
||||
0x00432A60 0x0053 -R void __cdecl InitialiseLOTarray(void);
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "game/lara/lara_misc.h"
|
||||
|
||||
#include "decomp/decomp.h"
|
||||
#include "game/box.h"
|
||||
#include "game/collide.h"
|
||||
#include "game/items.h"
|
||||
#include "game/lara/lara_control.h"
|
||||
@ -1692,3 +1693,98 @@ void __cdecl Lara_SwimCollision(ITEM_INFO *const item, COLL_INFO *const coll)
|
||||
Lara_TestWaterDepth(item, coll);
|
||||
}
|
||||
}
|
||||
|
||||
void __cdecl Lara_WaterCurrent(COLL_INFO *const coll)
|
||||
{
|
||||
ITEM_INFO *const item = g_LaraItem;
|
||||
|
||||
int16_t room_num = g_LaraItem->room_num;
|
||||
const ROOM_INFO *const r = &g_Rooms[g_LaraItem->room_num];
|
||||
const int32_t x_floor = (g_LaraItem->pos.z - r->pos.z) >> WALL_SHIFT;
|
||||
const int32_t y_floor = (g_LaraItem->pos.x - r->pos.x) >> WALL_SHIFT;
|
||||
g_LaraItem->box_num = r->floor[x_floor + y_floor * r->x_size].box;
|
||||
|
||||
if (g_Lara.creature == NULL) {
|
||||
g_Lara.current_active = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
XYZ_32 target;
|
||||
if (Box_CalculateTarget(&target, item, &g_Lara.creature->lot)
|
||||
== TARGET_NONE) {
|
||||
return;
|
||||
}
|
||||
|
||||
target.x -= item->pos.x;
|
||||
if (target.x > g_Lara.current_active) {
|
||||
item->pos.x += g_Lara.current_active;
|
||||
} else if (target.x < -g_Lara.current_active) {
|
||||
item->pos.x -= g_Lara.current_active;
|
||||
} else {
|
||||
item->pos.x += target.x;
|
||||
}
|
||||
|
||||
target.z -= item->pos.z;
|
||||
if (target.z > g_Lara.current_active) {
|
||||
item->pos.z += g_Lara.current_active;
|
||||
} else if (target.z < -g_Lara.current_active) {
|
||||
item->pos.z -= g_Lara.current_active;
|
||||
} else {
|
||||
item->pos.z += target.z;
|
||||
}
|
||||
|
||||
target.y = target.y - item->pos.y;
|
||||
if (target.y > g_Lara.current_active) {
|
||||
item->pos.y += g_Lara.current_active;
|
||||
} else if (target.y < -g_Lara.current_active) {
|
||||
item->pos.y -= g_Lara.current_active;
|
||||
} else {
|
||||
item->pos.y += target.y;
|
||||
}
|
||||
|
||||
g_Lara.current_active = 0;
|
||||
coll->facing =
|
||||
Math_Atan(item->pos.z - coll->old.z, item->pos.x - coll->old.x);
|
||||
Collide_GetCollisionInfo(
|
||||
coll, item->pos.x, item->pos.y + LARA_HEIGHT_UW / 2, item->pos.z,
|
||||
room_num, LARA_HEIGHT_UW);
|
||||
|
||||
switch (coll->coll_type) {
|
||||
case COLL_FRONT:
|
||||
if (item->rot.x > 35 * PHD_DEGREE) {
|
||||
item->rot.x = item->rot.x + LARA_UW_WALL_DEFLECT;
|
||||
} else if (item->rot.x < -35 * PHD_DEGREE) {
|
||||
item->rot.x = item->rot.x - LARA_UW_WALL_DEFLECT;
|
||||
} else {
|
||||
item->fall_speed = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case COLL_TOP:
|
||||
item->rot.x -= LARA_UW_WALL_DEFLECT;
|
||||
break;
|
||||
|
||||
case COLL_TOP_FRONT:
|
||||
item->fall_speed = 0;
|
||||
break;
|
||||
|
||||
case COLL_LEFT:
|
||||
item->rot.y += 910;
|
||||
break;
|
||||
|
||||
case COLL_RIGHT:
|
||||
item->rot.y -= 910;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (coll->side_mid.floor < 0) {
|
||||
item->pos.y += coll->side_mid.floor;
|
||||
item->rot.x += LARA_UW_WALL_DEFLECT;
|
||||
}
|
||||
Item_ShiftCol(item, coll);
|
||||
|
||||
coll->old = item->pos;
|
||||
}
|
||||
|
@ -78,3 +78,5 @@ int32_t __cdecl Lara_GetWaterDepth(
|
||||
void __cdecl Lara_TestWaterDepth(ITEM_INFO *item, const COLL_INFO *coll);
|
||||
|
||||
void __cdecl Lara_SwimCollision(ITEM_INFO *item, COLL_INFO *coll);
|
||||
|
||||
void __cdecl Lara_WaterCurrent(COLL_INFO *coll);
|
||||
|
@ -194,7 +194,6 @@
|
||||
#define undraw_flare_meshes ((void __cdecl (*)(void))0x00430010)
|
||||
#define ready_flare ((void __cdecl (*)(void))0x00430030)
|
||||
#define FlareControl ((void __cdecl (*)(int16_t item_num))0x00430070)
|
||||
#define Lara_WaterCurrent ((void __cdecl (*)(COLL_INFO *coll))0x00432870)
|
||||
#define InitialiseLOTarray ((void __cdecl (*)(void))0x00432A60)
|
||||
#define DisableBaddieAI ((void __cdecl (*)(int16_t item_num))0x00432AC0)
|
||||
#define LOT_EnableBaddieAI ((int32_t __cdecl (*)(int16_t item_num, int32_t always))0x00432B10)
|
||||
|
@ -583,6 +583,7 @@ static void Inject_Lara_Misc(const bool enable)
|
||||
INJECT(enable, 0x004324A0, Lara_GetWaterDepth);
|
||||
INJECT(enable, 0x00432640, Lara_TestWaterDepth);
|
||||
INJECT(enable, 0x00432710, Lara_SwimCollision);
|
||||
INJECT(enable, 0x00432870, Lara_WaterCurrent);
|
||||
}
|
||||
|
||||
static void Inject_Lara_State(const bool enable)
|
||||
|
Loading…
Reference in New Issue
Block a user