mirror of
https://github.com/LostArtefacts/TR2X.git
synced 2024-12-03 11:30:56 +00:00
port Item_TestBoundsCollide
This commit is contained in:
parent
f1bfe52d3e
commit
ce0e3f6751
@ -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">46.22% (563)</tspan> · <tspan class="known">51.31% (625)</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">46.31% (564)</tspan> · <tspan class="known">51.23% (624)</tspan> · <tspan class="todo">0% (0)</tspan> · <tspan class="unused">2.46% (30)</tspan></tspan></text>
|
||||
<g transform="translate(0 20)">
|
||||
<rect width="345.29" height="6" x="0" y="0" class="decompiled"/>
|
||||
<rect width="383.31" height="6" x="345.29" y="0" class="known"/>
|
||||
<rect width="345.90" height="6" x="0" y="0" class="decompiled"/>
|
||||
<rect width="382.70" height="6" x="345.90" y="0" class="known"/>
|
||||
<rect width="18.40" height="6" x="728.60" y="0" class="unused"/>
|
||||
</g>
|
||||
<g transform="translate(0 31)">
|
||||
@ -237,7 +237,7 @@
|
||||
<rect width="12" height="12" x="120" y="45" class="decompiled"><title>void __cdecl Door_Collision(int16_t item_num, ITEM_INFO *lara_item, COLL_INFO *coll);</title></rect>
|
||||
<rect width="12" height="12" x="135" y="45" class="decompiled"><title>void __cdecl Object_Collision_Trap(int16_t item_num, ITEM_INFO *lara_item, COLL_INFO *coll);</title></rect>
|
||||
<rect width="12" height="12" x="150" y="45" class="decompiled"><title>void __cdecl Lara_Push(ITEM_INFO *item, ITEM_INFO *lara_item, COLL_INFO *coll, int32_t spaz_on, int32_t big_push);</title></rect>
|
||||
<rect width="12" height="12" x="165" y="45" class="known"><title>int32_t __cdecl Item_TestBoundsCollide(const ITEM_INFO *src_item, const ITEM_INFO *dst_item, int32_t radius);</title></rect>
|
||||
<rect width="12" height="12" x="165" y="45" class="decompiled"><title>int32_t __cdecl Item_TestBoundsCollide(const ITEM_INFO *src_item, const ITEM_INFO *dst_item, int32_t radius);</title></rect>
|
||||
<rect width="12" height="12" x="180" y="45" class="known"><title>int32_t __cdecl Item_TestPosition(int16_t *bounds, ITEM_INFO *src_item, ITEM_INFO *dst_item);</title></rect>
|
||||
<rect width="12" height="12" x="195" y="45" class="known"><title>void __cdecl Item_AlignPosition(XYZ_32 *vec, ITEM_INFO *src_item, ITEM_INFO *dst_item);</title></rect>
|
||||
<rect width="12" height="12" x="210" y="45" class="known"><title>int32_t __cdecl Lara_MovePosition(XYZ_32 *vec, ITEM_INFO *item, ITEM_INFO *lara_item);</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">43.13%</tspan> · <tspan class="known">56.54%</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">43.19%</tspan> · <tspan class="known">56.48%</tspan> · <tspan class="todo">0%</tspan> · <tspan class="unused">0.33%</tspan></tspan></text>
|
||||
<g transform="translate(0 20)">
|
||||
<rect width="322.18" height="6" x="0" y="0" class="decompiled"/>
|
||||
<rect width="422.38" height="6" x="322.18" y="0" class="known"/>
|
||||
<rect width="322.62" height="6" x="0" y="0" class="decompiled"/>
|
||||
<rect width="421.94" height="6" x="322.62" y="0" class="known"/>
|
||||
<rect width="2.44" height="6" x="744.56" y="0" class="unused"/>
|
||||
</g>
|
||||
<g transform="translate(0 31)">
|
||||
@ -1742,7 +1742,7 @@
|
||||
<rect width="10.04" height="10.11" x="534.67" y="136.56" class="known"><title>void __cdecl GetCarriedItems(void);</title></rect>
|
||||
<rect width="9.98" height="10.11" x="547.71" y="136.56" class="known"><title>void __cdecl Demo_LoadLaraPos(void);</title></rect>
|
||||
<rect width="9.85" height="10.11" x="560.69" y="136.56" class="decompiled"><title>void __cdecl Output_InsertFlatRect(int32_t x0, int32_t y0, int32_t x1, int32_t y1, int32_t z, uint8_t color_idx);</title></rect>
|
||||
<rect width="9.85" height="10.11" x="573.54" y="136.56" class="known"><title>int32_t __cdecl Item_TestBoundsCollide(const ITEM_INFO *src_item, const ITEM_INFO *dst_item, int32_t radius);</title></rect>
|
||||
<rect width="9.85" height="10.11" x="573.54" y="136.56" class="decompiled"><title>int32_t __cdecl Item_TestBoundsCollide(const ITEM_INFO *src_item, const ITEM_INFO *dst_item, int32_t radius);</title></rect>
|
||||
<rect width="9.79" height="10.11" x="586.38" y="136.56" class="decompiled"><title>void __cdecl Lara_State_Wade(ITEM_INFO *item, COLL_INFO *coll);</title></rect>
|
||||
<rect width="9.72" height="10.11" x="599.17" y="136.56" class="known"><title>void __cdecl DInputKeyboardCreate(void);</title></rect>
|
||||
<rect width="9.66" height="10.11" x="611.89" y="136.56" class="decompiled"><title>void __cdecl Room_GetNearbyRooms(int32_t x, int32_t y, int32_t z, int32_t r, int32_t h, int16_t room_num);</title></rect>
|
||||
|
Before Width: | Height: | Size: 361 KiB After Width: | Height: | Size: 361 KiB |
@ -2752,7 +2752,7 @@ typedef struct __unaligned {
|
||||
0x00413940 0x0077 + void __cdecl Door_Collision(int16_t item_num, ITEM_INFO *lara_item, COLL_INFO *coll);
|
||||
0x004139C0 0x0067 + void __cdecl Object_Collision_Trap(int16_t item_num, ITEM_INFO *lara_item, COLL_INFO *coll);
|
||||
0x00413A30 0x0306 + void __cdecl Lara_Push(ITEM_INFO *item, ITEM_INFO *lara_item, COLL_INFO *coll, int32_t spaz_on, int32_t big_push);
|
||||
0x00413D40 0x00CB - int32_t __cdecl Item_TestBoundsCollide(const ITEM_INFO *src_item, const ITEM_INFO *dst_item, int32_t radius);
|
||||
0x00413D40 0x00CB + int32_t __cdecl Item_TestBoundsCollide(const ITEM_INFO *src_item, const ITEM_INFO *dst_item, int32_t radius);
|
||||
0x00413E10 0x0137 - int32_t __cdecl Item_TestPosition(int16_t *bounds, ITEM_INFO *src_item, ITEM_INFO *dst_item);
|
||||
0x00413F50 0x013B - void __cdecl Item_AlignPosition(XYZ_32 *vec, ITEM_INFO *src_item, ITEM_INFO *dst_item);
|
||||
0x00414090 0x0187 - int32_t __cdecl Lara_MovePosition(XYZ_32 *vec, ITEM_INFO *item, ITEM_INFO *lara_item);
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "game/items.h"
|
||||
|
||||
#include "game/camera.h"
|
||||
#include "game/math.h"
|
||||
#include "game/room.h"
|
||||
#include "global/const.h"
|
||||
#include "global/funcs.h"
|
||||
@ -292,3 +293,33 @@ void __cdecl Item_UpdateRoom(ITEM_INFO *const item, const int32_t height)
|
||||
Item_NewRoom(g_Lara.item_num, room_num);
|
||||
}
|
||||
}
|
||||
|
||||
int32_t __cdecl Item_TestBoundsCollide(
|
||||
const ITEM_INFO *const src_item, const ITEM_INFO *const dst_item,
|
||||
const int32_t radius)
|
||||
{
|
||||
const int16_t *const src_bounds = Item_GetBestFrame(src_item);
|
||||
const int16_t *const dst_bounds = Item_GetBestFrame(dst_item);
|
||||
|
||||
if (src_item->pos.y + src_bounds[FBBOX_MAX_Y]
|
||||
<= dst_item->pos.y + dst_bounds[FBBOX_MIN_Y]
|
||||
|| src_item->pos.y + src_bounds[FBBOX_MIN_Y]
|
||||
>= dst_item->pos.y + dst_bounds[FBBOX_MAX_Y]) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const int32_t c = Math_Cos(src_item->rot.y);
|
||||
const int32_t s = Math_Sin(src_item->rot.y);
|
||||
const int32_t dx = dst_item->pos.x - src_item->pos.x;
|
||||
const int32_t dz = dst_item->pos.z - src_item->pos.z;
|
||||
const int32_t rx = (c * dx - s * dz) >> W2V_SHIFT;
|
||||
const int32_t rz = (c * dz + s * dx) >> W2V_SHIFT;
|
||||
|
||||
// clang-format off
|
||||
return (
|
||||
rx >= src_bounds[FBBOX_MIN_X] - radius &&
|
||||
rx <= src_bounds[FBBOX_MAX_X] + radius &&
|
||||
rz >= src_bounds[FBBOX_MIN_Z] - radius &&
|
||||
rz <= src_bounds[FBBOX_MAX_Z] + radius);
|
||||
// clang-format on
|
||||
}
|
||||
|
@ -16,5 +16,7 @@ void __cdecl Item_ClearKilled(void);
|
||||
bool Item_Teleport(ITEM_INFO *item, int32_t x, int32_t y, int32_t z);
|
||||
void __cdecl Item_ShiftCol(ITEM_INFO *item, COLL_INFO *coll);
|
||||
void __cdecl Item_UpdateRoom(ITEM_INFO *item, int32_t height);
|
||||
int32_t __cdecl Item_TestBoundsCollide(
|
||||
const ITEM_INFO *src_item, const ITEM_INFO *dst_item, int32_t radius);
|
||||
|
||||
bool Item_IsSmashable(const ITEM_INFO *item);
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "game/objects/common.h"
|
||||
|
||||
#include "game/items.h"
|
||||
#include "game/lara/lara_misc.h"
|
||||
#include "global/funcs.h"
|
||||
#include "global/vars.h"
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "game/objects/general/door.h"
|
||||
|
||||
#include "game/items.h"
|
||||
#include "game/lara/lara_misc.h"
|
||||
#include "global/funcs.h"
|
||||
#include "global/vars.h"
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
// clang-format off
|
||||
#define Output_InsertInventoryBackground ((void __cdecl (*)(const int16_t *obj_ptr))0x00401D50)
|
||||
#define Item_TestBoundsCollide ((int32_t __cdecl (*)(const ITEM_INFO *src_item, const ITEM_INFO *dst_item, int32_t radius))0x00413D40)
|
||||
#define Item_TestPosition ((int32_t __cdecl (*)(int16_t *bounds, ITEM_INFO *src_item, ITEM_INFO *dst_item))0x00413E10)
|
||||
#define Item_AlignPosition ((void __cdecl (*)(XYZ_32 *vec, ITEM_INFO *src_item, ITEM_INFO *dst_item))0x00413F50)
|
||||
#define Lara_MovePosition ((int32_t __cdecl (*)(XYZ_32 *vec, ITEM_INFO *item, ITEM_INFO *lara_item))0x00414090)
|
||||
|
@ -452,6 +452,7 @@ static void Inject_Items(const bool enable)
|
||||
INJECT(enable, 0x00427520, Item_ClearKilled);
|
||||
INJECT(enable, 0x00413500, Item_ShiftCol);
|
||||
INJECT(enable, 0x00413540, Item_UpdateRoom);
|
||||
INJECT(enable, 0x00413D40, Item_TestBoundsCollide);
|
||||
}
|
||||
|
||||
static void Inject_Effects(const bool enable)
|
||||
|
Loading…
Reference in New Issue
Block a user