Skip to content

Commit

Permalink
tr2/vars: mark global trigger index for removal
Browse files Browse the repository at this point in the history
This marks g_TriggerIndex as legacy.
  • Loading branch information
lahm86 committed Nov 15, 2024
1 parent b40bb2a commit ba773b7
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 18 deletions.
2 changes: 1 addition & 1 deletion docs/tr2/progress.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4513,7 +4513,7 @@ typedef enum {
0x00526188 - MATRIX *g_IMMatrixPtr;
0x0052618C - ROOM *g_Rooms;
0x00526240 - int32_t g_FlipStatus;
0x00526288 - int16_t *g_TriggerIndex;
0x00526288 - int16_t *g_Legacy_TriggerIndex;
0x005262A0 - int32_t g_LOSRooms[20];
0x005262F0 - ITEM *g_Items;
0x005262F6 - int16_t g_NumCineFrames;
Expand Down
2 changes: 1 addition & 1 deletion src/libtrx/include/libtrx/game/collision.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ typedef struct __PACKING {
int16_t facing;
int16_t quadrant;
int16_t coll_type;
int16_t *trigger;
int16_t *trigger; // TODO: linked to g_TriggerIndex, so to be eliminated
int8_t x_tilt;
int8_t z_tilt;
int8_t hit_by_baddie;
Expand Down
1 change: 0 additions & 1 deletion src/tr2/game/collide.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ void __cdecl Collide_GetCollisionInfo(
coll->side_mid.floor = height;
coll->side_mid.ceiling = ceiling;
coll->side_mid.type = g_HeightType;
coll->trigger = g_TriggerIndex;

const int16_t tilt = Room_GetTiltType(sector, x, g_LaraItem->pos.y, z);
coll->z_tilt = tilt >> 8;
Expand Down
7 changes: 0 additions & 7 deletions src/tr2/game/lara/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -824,13 +824,6 @@ int32_t __cdecl Lara_CheckForLetGo(ITEM *item, COLL_INFO *coll)
item->gravity = 0;
item->fall_speed = 0;

int16_t room_num = item->room_num;
int32_t x = item->pos.x;
int32_t y = item->pos.y;
int32_t z = item->pos.z;
const SECTOR *const sector = Room_GetSector(x, y, z, &room_num);
Room_GetHeight(sector, x, y, z);
coll->trigger = g_TriggerIndex;
if (g_Input.action && item->hit_points > 0) {
return 0;
}
Expand Down
7 changes: 0 additions & 7 deletions src/tr2/game/lara/state.c
Original file line number Diff line number Diff line change
Expand Up @@ -674,13 +674,6 @@ void __cdecl Lara_State_Zipline(ITEM *item, COLL_INFO *coll)
{
g_Camera.target_angle = CAM_ZIPLINE_ANGLE;

int16_t room_num = item->room_num;
const SECTOR *sector =
Room_GetSector(item->pos.x, item->pos.y, item->pos.z, &room_num);
Room_GetHeight(sector, item->pos.x, item->pos.y, item->pos.z);

coll->trigger = g_TriggerIndex;

if (!g_Input.action) {
item->goal_anim_state = LS_FORWARD_JUMP;
Lara_Animate(item);
Expand Down
2 changes: 1 addition & 1 deletion src/tr2/global/vars_decomp.h
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@
#define g_MusicTrackFlags (*(uint16_t(*)[64])0x005261C0)
#define g_FlipStatus (*(int32_t*)0x00526240)
#define g_FlipMaps (*(int32_t(*)[10])0x00526260)
#define g_TriggerIndex (*(int16_t **)0x00526288)
#define g_Legacy_TriggerIndex (*(int16_t **)0x00526288)
#define g_LOSRooms (*(int32_t(*)[20])0x005262A0)
#define g_Items (*(ITEM **)0x005262F0)
#define g_CineLoaded (*(int16_t*)0x005262F4)
Expand Down

0 comments on commit ba773b7

Please sign in to comment.