Skip to content

Commit

Permalink
tr2: port Lift_Floor
Browse files Browse the repository at this point in the history
  • Loading branch information
rr- committed Oct 22, 2024
1 parent caeb329 commit 2e2eb1f
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 10 deletions.
16 changes: 8 additions & 8 deletions docs/tr2/progress.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/tr2/progress.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3588,7 +3588,7 @@ typedef enum {
0x00435700 0x0035 + void __cdecl Lift_Initialise(int16_t item_num);
0x00435740 0x00D4 + void __cdecl Lift_Control(int16_t item_num);
0x00435820 0x0179 + void __cdecl Lift_FloorCeiling(ITEM *item, int32_t x, int32_t y, int32_t z, int32_t *floor, int32_t *ceiling);
0x004359A0 0x0035 - void __cdecl Lift_Floor(ITEM *item, int32_t x, int32_t y, int32_t z, int32_t *height);
0x004359A0 0x0035 + void __cdecl Lift_Floor(ITEM *item, int32_t x, int32_t y, int32_t z, int32_t *height);
0x004359E0 0x0035 - void __cdecl Lift_Ceiling(ITEM *item, int32_t x, int32_t y, int32_t z, int32_t *height);
0x00435A20 0x0016 -R void __cdecl BridgeFlatFloor(ITEM *item, int32_t x, int32_t y, int32_t z, int32_t *height);
0x00435A40 0x001B -R void __cdecl BridgeFlatCeiling(ITEM *item, int32_t x, int32_t y, int32_t z, int32_t *height);
Expand Down
12 changes: 12 additions & 0 deletions src/tr2/game/objects/general/lift.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,15 @@ void __cdecl Lift_FloorCeiling(
}
}
}

void __cdecl Lift_Floor(
const ITEM *const item, const int32_t x, const int32_t y, const int32_t z,
int32_t *const out_height)
{
int32_t floor;
int32_t height;
Lift_FloorCeiling(item, x, y, z, &floor, &height);
if (floor < *out_height) {
*out_height = floor;
}
}
2 changes: 2 additions & 0 deletions src/tr2/game/objects/general/lift.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ void __cdecl Lift_Control(int16_t item_num);
void __cdecl Lift_FloorCeiling(
const ITEM *item, int32_t x, int32_t y, int32_t z, int32_t *out_floor,
int32_t *out_ceiling);
void __cdecl Lift_Floor(
const ITEM *item, int32_t x, int32_t y, int32_t z, int32_t *out_height);
1 change: 0 additions & 1 deletion src/tr2/global/funcs.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@
#define DrawBridgeFloor ((void __cdecl (*)(ITEM *item, int32_t x, int32_t y, int32_t z, int32_t *height))0x00435650)
#define DrawBridgeCeiling ((void __cdecl (*)(ITEM *item, int32_t x, int32_t y, int32_t z, int32_t *height))0x00435690)
#define DrawBridgeCollision ((void __cdecl (*)(int16_t item_num, ITEM *lara_item, COLL_INFO *coll))0x004356D0)
#define Lift_Floor ((void __cdecl (*)(ITEM *item, int32_t x, int32_t y, int32_t z, int32_t *height))0x004359A0)
#define Lift_Ceiling ((void __cdecl (*)(ITEM *item, int32_t x, int32_t y, int32_t z, int32_t *height))0x004359E0)
#define BridgeFlatFloor ((void __cdecl (*)(ITEM *item, int32_t x, int32_t y, int32_t z, int32_t *height))0x00435A20)
#define BridgeFlatCeiling ((void __cdecl (*)(ITEM *item, int32_t x, int32_t y, int32_t z, int32_t *height))0x00435A40)
Expand Down
1 change: 1 addition & 0 deletions src/tr2/inject_exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1020,6 +1020,7 @@ static void M_Objects(const bool enable)
INJECT(enable, 0x00435700, Lift_Initialise);
INJECT(enable, 0x00435740, Lift_Control);
INJECT(enable, 0x00435820, Lift_FloorCeiling);
INJECT(enable, 0x004359A0, Lift_Floor);
INJECT(enable, 0x00435D70, Detonator_Control);
INJECT(enable, 0x00437E70, Pickup_Collision);
INJECT(enable, 0x004382F0, Switch_Collision);
Expand Down

0 comments on commit 2e2eb1f

Please sign in to comment.