Skip to content

Commit

Permalink
tr2: port FallingBlock_Ceiling
Browse files Browse the repository at this point in the history
  • Loading branch information
rr- committed Nov 14, 2024
1 parent 58377eb commit 2751441
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 @@ -3768,7 +3768,7 @@ typedef enum {
0x004423F0 0x010A - void __cdecl Pendulum_Control(int16_t item_num);
0x00442500 0x0105 + void __cdecl FallingBlock_Control(int16_t item_num);
0x00442610 0x003E + void __cdecl FallingBlock_Floor(const ITEM *item, int32_t x, int32_t y, int32_t z, int32_t *out_height);
0x00442650 0x0044 - void __cdecl FallingBlock_Ceiling(const ITEM *item, int32_t x, int32_t y, int32_t z, int32_t *out_height);
0x00442650 0x0044 + void __cdecl FallingBlock_Ceiling(const ITEM *item, int32_t x, int32_t y, int32_t z, int32_t *out_height);
0x004426A0 0x00BD - void __cdecl TeethTrap_Control(int16_t item_num);
0x00442760 0x00E0 - void __cdecl FallingCeiling_Control(int16_t item_num);
0x00442840 0x013E - void __cdecl DartEmitter_Control(int16_t item_num);
Expand Down
12 changes: 12 additions & 0 deletions src/tr2/game/objects/traps/falling_block.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,15 @@ void __cdecl FallingBlock_Floor(
*out_height = item->pos.y - origin;
}
}

void __cdecl FallingBlock_Ceiling(
const ITEM *const item, const int32_t x, const int32_t y, const int32_t z,
int32_t *const out_height)
{
const int32_t origin = M_GetOrigin(item->object_id);
if (y > item->pos.y - origin
&& (item->current_anim_state == TRAP_SET
|| item->current_anim_state == TRAP_ACTIVATE)) {
*out_height = item->pos.y - origin + STEP_L;
}
}
2 changes: 2 additions & 0 deletions src/tr2/game/objects/traps/falling_block.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
void __cdecl FallingBlock_Control(int16_t item_num);
void __cdecl FallingBlock_Floor(
const ITEM *item, int32_t x, int32_t y, int32_t z, int32_t *out_height);
void __cdecl FallingBlock_Ceiling(
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 @@ -128,7 +128,6 @@
#define SpringBoard_Control ((void __cdecl (*)(int16_t item_num))0x00441A50)
#define Spike_Collision ((void __cdecl (*)(int16_t item_num, ITEM *litem, COLL_INFO *coll))0x00442110)
#define Pendulum_Control ((void __cdecl (*)(int16_t item_num))0x004423F0)
#define FallingBlock_Ceiling ((void __cdecl (*)(const ITEM *item, int32_t x, int32_t y, int32_t z, int32_t *out_height))0x00442650)
#define TeethTrap_Control ((void __cdecl (*)(int16_t item_num))0x004426A0)
#define FallingCeiling_Control ((void __cdecl (*)(int16_t item_num))0x00442760)
#define DartEmitter_Control ((void __cdecl (*)(int16_t item_num))0x00442840)
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 @@ -1138,6 +1138,7 @@ static void M_Objects(const bool enable)
INJECT(enable, 0x00442340, Trapdoor_IsItemOnTop);
INJECT(enable, 0x00442500, FallingBlock_Control);
INJECT(enable, 0x00442610, FallingBlock_Floor);
INJECT(enable, 0x00442650, FallingBlock_Ceiling);
INJECT(enable, 0x00442B30, FlameEmitter_Control);
INJECT(enable, 0x00442BC0, Flame_Control);
INJECT(enable, 0x00442E70, EmberEmitter_Control);
Expand Down

0 comments on commit 2751441

Please sign in to comment.