Skip to content

Commit

Permalink
objects: rename floor and ceiling routines
Browse files Browse the repository at this point in the history
  • Loading branch information
lahm86 committed Aug 6, 2024
1 parent ccbf337 commit b34422e
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 58 deletions.
28 changes: 14 additions & 14 deletions src/game/objects/general/bridge.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,35 +123,35 @@ static void Bridge_FixEmbeddedPosition(int16_t item_num)
void Bridge_SetupFlat(OBJECT_INFO *obj)
{
obj->initialise = Bridge_Initialise;
obj->floor = Bridge_FlatFloor;
obj->ceiling = Bridge_FlatCeiling;
obj->floor_height_routine = Bridge_AlterFlatFloorHeight;
obj->ceiling_height_routine = Bridge_AlterFlatCeilingHeight;
}

void Bridge_SetupTilt1(OBJECT_INFO *obj)
{
obj->initialise = Bridge_Initialise;
obj->floor = Bridge_Tilt1Floor;
obj->ceiling = Bridge_Tilt1Ceiling;
obj->floor_height_routine = Bridge_AlterTilt1FloorHeight;
obj->ceiling_height_routine = Bridge_AlterTilt1CeilingHeight;
}

void Bridge_SetupTilt2(OBJECT_INFO *obj)
{
obj->initialise = Bridge_Initialise;
obj->floor = Bridge_Tilt2Floor;
obj->ceiling = Bridge_Tilt2Ceiling;
obj->floor_height_routine = Bridge_AlterTilt2FloorHeight;
obj->ceiling_height_routine = Bridge_AlterTilt2CeilingHeight;
}

void Bridge_SetupDrawBridge(OBJECT_INFO *obj)
{
if (!obj->loaded) {
return;
}
obj->ceiling = Bridge_DrawBridgeCeiling;
obj->ceiling_height_routine = Bridge_DrawBridgeCeiling;
obj->collision = Bridge_DrawBridgeCollision;
obj->control = Cog_Control;
obj->save_anim = 1;
obj->save_flags = 1;
obj->floor = Bridge_DrawBridgeFloor;
obj->floor_height_routine = Bridge_DrawBridgeFloor;
}

void Bridge_Initialise(int16_t item_num)
Expand Down Expand Up @@ -215,7 +215,7 @@ void Bridge_DrawBridgeCollision(
}
}

void Bridge_FlatFloor(
void Bridge_AlterFlatFloorHeight(
ITEM_INFO *item, int32_t x, int32_t y, int32_t z, int16_t *height)
{
if (g_Config.fix_bridge_collision && !Bridge_IsSameSector(x, z, item)) {
Expand All @@ -233,7 +233,7 @@ void Bridge_FlatFloor(
*height = item->pos.y;
}

void Bridge_FlatCeiling(
void Bridge_AlterFlatCeilingHeight(
ITEM_INFO *item, int32_t x, int32_t y, int32_t z, int16_t *height)
{
if (g_Config.fix_bridge_collision && !Bridge_IsSameSector(x, z, item)) {
Expand All @@ -251,7 +251,7 @@ void Bridge_FlatCeiling(
*height = item->pos.y + STEP_L;
}

void Bridge_Tilt1Floor(
void Bridge_AlterTilt1FloorHeight(
ITEM_INFO *item, int32_t x, int32_t y, int32_t z, int16_t *height)
{
if (g_Config.fix_bridge_collision && !Bridge_IsSameSector(x, z, item)) {
Expand All @@ -271,7 +271,7 @@ void Bridge_Tilt1Floor(
*height = offset_height;
}

void Bridge_Tilt1Ceiling(
void Bridge_AlterTilt1CeilingHeight(
ITEM_INFO *item, int32_t x, int32_t y, int32_t z, int16_t *height)
{
if (g_Config.fix_bridge_collision && !Bridge_IsSameSector(x, z, item)) {
Expand All @@ -291,7 +291,7 @@ void Bridge_Tilt1Ceiling(
*height = offset_height + STEP_L;
}

void Bridge_Tilt2Floor(
void Bridge_AlterTilt2FloorHeight(
ITEM_INFO *item, int32_t x, int32_t y, int32_t z, int16_t *height)
{
if (g_Config.fix_bridge_collision && !Bridge_IsSameSector(x, z, item)) {
Expand All @@ -311,7 +311,7 @@ void Bridge_Tilt2Floor(
*height = offset_height;
}

void Bridge_Tilt2Ceiling(
void Bridge_AlterTilt2CeilingHeight(
ITEM_INFO *item, int32_t x, int32_t y, int32_t z, int16_t *height)
{
if (g_Config.fix_bridge_collision && !Bridge_IsSameSector(x, z, item)) {
Expand Down
12 changes: 6 additions & 6 deletions src/game/objects/general/bridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ void Bridge_DrawBridgeCollision(
int16_t item_num, ITEM_INFO *lara_item, COLL_INFO *coll);
void Bridge_DrawBridgeControl(int16_t item_num);

void Bridge_FlatFloor(
void Bridge_AlterFlatFloorHeight(
ITEM_INFO *item, int32_t x, int32_t y, int32_t z, int16_t *height);
void Bridge_FlatCeiling(
void Bridge_AlterFlatCeilingHeight(
ITEM_INFO *item, int32_t x, int32_t y, int32_t z, int16_t *height);

void Bridge_Tilt1Floor(
void Bridge_AlterTilt1FloorHeight(
ITEM_INFO *item, int32_t x, int32_t y, int32_t z, int16_t *height);
void Bridge_Tilt1Ceiling(
void Bridge_AlterTilt1CeilingHeight(
ITEM_INFO *item, int32_t x, int32_t y, int32_t z, int16_t *height);

void Bridge_Tilt2Floor(
void Bridge_AlterTilt2FloorHeight(
ITEM_INFO *item, int32_t x, int32_t y, int32_t z, int16_t *height);
void Bridge_Tilt2Ceiling(
void Bridge_AlterTilt2CeilingHeight(
ITEM_INFO *item, int32_t x, int32_t y, int32_t z, int16_t *height);
8 changes: 4 additions & 4 deletions src/game/objects/general/trapdoor.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ static bool TrapDoor_StandingOn(ITEM_INFO *item, int32_t x, int32_t z)
void TrapDoor_Setup(OBJECT_INFO *obj)
{
obj->control = TrapDoor_Control;
obj->floor = TrapDoor_Floor;
obj->ceiling = TrapDoor_Ceiling;
obj->floor_height_routine = TrapDoor_AlterFloorHeight;
obj->ceiling_height_routine = TrapDoor_AlterCeilingHeight;
obj->save_anim = 1;
obj->save_flags = 1;
}
Expand All @@ -48,7 +48,7 @@ void TrapDoor_Control(int16_t item_num)
Item_Animate(item);
}

void TrapDoor_Floor(
void TrapDoor_AlterFloorHeight(
ITEM_INFO *item, int32_t x, int32_t y, int32_t z, int16_t *height)
{
if (!TrapDoor_StandingOn(item, x, z)) {
Expand All @@ -63,7 +63,7 @@ void TrapDoor_Floor(
*height = item->pos.y;
}

void TrapDoor_Ceiling(
void TrapDoor_AlterCeilingHeight(
ITEM_INFO *item, int32_t x, int32_t y, int32_t z, int16_t *height)
{
if (!TrapDoor_StandingOn(item, x, z)) {
Expand Down
4 changes: 2 additions & 2 deletions src/game/objects/general/trapdoor.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

void TrapDoor_Setup(OBJECT_INFO *obj);
void TrapDoor_Control(int16_t item_num);
void TrapDoor_Floor(
void TrapDoor_AlterFloorHeight(
ITEM_INFO *item, int32_t x, int32_t y, int32_t z, int16_t *height);
void TrapDoor_Ceiling(
void TrapDoor_AlterCeilingHeight(
ITEM_INFO *item, int32_t x, int32_t y, int32_t z, int16_t *height);
8 changes: 4 additions & 4 deletions src/game/objects/traps/falling_block.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
void FallingBlock_Setup(OBJECT_INFO *obj)
{
obj->control = FallingBlock_Control;
obj->floor = FallingBlock_Floor;
obj->ceiling = FallingBlock_Ceiling;
obj->floor_height_routine = FallingBlock_AlterFloorHeight;
obj->ceiling_height_routine = FallingBlock_AlterCeilingHeight;
obj->save_position = 1;
obj->save_anim = 1;
obj->save_flags = 1;
Expand Down Expand Up @@ -65,7 +65,7 @@ void FallingBlock_Control(int16_t item_num)
}
}

void FallingBlock_Floor(
void FallingBlock_AlterFloorHeight(
ITEM_INFO *item, int32_t x, int32_t y, int32_t z, int16_t *height)
{
if (y <= item->pos.y - STEP_L * 2
Expand All @@ -75,7 +75,7 @@ void FallingBlock_Floor(
}
}

void FallingBlock_Ceiling(
void FallingBlock_AlterCeilingHeight(
ITEM_INFO *item, int32_t x, int32_t y, int32_t z, int16_t *height)
{
if (y > item->pos.y - STEP_L * 2
Expand Down
4 changes: 2 additions & 2 deletions src/game/objects/traps/falling_block.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

void FallingBlock_Setup(OBJECT_INFO *obj);
void FallingBlock_Control(int16_t item_num);
void FallingBlock_Floor(
void FallingBlock_AlterFloorHeight(
ITEM_INFO *item, int32_t x, int32_t y, int32_t z, int16_t *height);
void FallingBlock_Ceiling(
void FallingBlock_AlterCeilingHeight(
ITEM_INFO *item, int32_t x, int32_t y, int32_t z, int16_t *height);
12 changes: 6 additions & 6 deletions src/game/room.c
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,8 @@ int16_t Room_GetCeiling(
} else {
ITEM_INFO *item = &g_Items[trigger & VALUE_BITS];
OBJECT_INFO *object = &g_Objects[item->object_number];
if (object->ceiling) {
object->ceiling(item, x, y, z, &height);
if (object->ceiling_height_routine) {
object->ceiling_height_routine(item, x, y, z, &height);
}
}
} while (!(trigger & END_BIT));
Expand Down Expand Up @@ -518,8 +518,8 @@ int16_t Room_GetHeight(
} else {
ITEM_INFO *item = &g_Items[trigger & VALUE_BITS];
OBJECT_INFO *object = &g_Objects[item->object_number];
if (object->floor) {
object->floor(item, x, y, z, &height);
if (object->floor_height_routine) {
object->floor_height_routine(item, x, y, z, &height);
}
}
} while (!(trigger & END_BIT));
Expand Down Expand Up @@ -1026,8 +1026,8 @@ bool Room_IsOnWalkable(
const int16_t item_num = trigger & VALUE_BITS;
ITEM_INFO *item = &g_Items[item_num];
OBJECT_INFO *object = &g_Objects[item->object_number];
if (object->floor) {
object->floor(item, x, y, z, &height);
if (object->floor_height_routine) {
object->floor_height_routine(item, x, y, z, &height);
object_found = true;
}
} else if (TRIG_BITS(trigger) == TO_CAMERA) {
Expand Down
36 changes: 18 additions & 18 deletions src/game/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ void Setup_AllObjects(void)
obj->collision = NULL;
obj->control = NULL;
obj->draw_routine = Object_DrawAnimatingItem;
obj->ceiling = NULL;
obj->floor = NULL;
obj->ceiling_height_routine = NULL;
obj->floor_height_routine = NULL;
obj->pivot_length = 0;
obj->radius = DEFAULT_RADIUS;
obj->shadow_size = 0;
Expand All @@ -268,62 +268,62 @@ void Setup_AllObjects(void)
g_Objects[O_MEDI_ITEM].collision = NULL;
g_Objects[O_MEDI_ITEM].control = NULL;
g_Objects[O_MEDI_ITEM].draw_routine = Object_DrawDummyItem;
g_Objects[O_MEDI_ITEM].floor = NULL;
g_Objects[O_MEDI_ITEM].ceiling = NULL;
g_Objects[O_MEDI_ITEM].floor_height_routine = NULL;
g_Objects[O_MEDI_ITEM].ceiling_height_routine = NULL;

g_Objects[O_BIGMEDI_ITEM].initialise = NULL;
g_Objects[O_BIGMEDI_ITEM].collision = NULL;
g_Objects[O_BIGMEDI_ITEM].control = NULL;
g_Objects[O_BIGMEDI_ITEM].draw_routine = Object_DrawDummyItem;
g_Objects[O_BIGMEDI_ITEM].floor = NULL;
g_Objects[O_BIGMEDI_ITEM].ceiling = NULL;
g_Objects[O_BIGMEDI_ITEM].floor_height_routine = NULL;
g_Objects[O_BIGMEDI_ITEM].ceiling_height_routine = NULL;
}

if (g_Config.disable_magnums) {
g_Objects[O_MAGNUM_ITEM].initialise = NULL;
g_Objects[O_MAGNUM_ITEM].collision = NULL;
g_Objects[O_MAGNUM_ITEM].control = NULL;
g_Objects[O_MAGNUM_ITEM].draw_routine = Object_DrawDummyItem;
g_Objects[O_MAGNUM_ITEM].floor = NULL;
g_Objects[O_MAGNUM_ITEM].ceiling = NULL;
g_Objects[O_MAGNUM_ITEM].floor_height_routine = NULL;
g_Objects[O_MAGNUM_ITEM].ceiling_height_routine = NULL;

g_Objects[O_MAG_AMMO_ITEM].initialise = NULL;
g_Objects[O_MAG_AMMO_ITEM].collision = NULL;
g_Objects[O_MAG_AMMO_ITEM].control = NULL;
g_Objects[O_MAG_AMMO_ITEM].draw_routine = Object_DrawDummyItem;
g_Objects[O_MAG_AMMO_ITEM].floor = NULL;
g_Objects[O_MAG_AMMO_ITEM].ceiling = NULL;
g_Objects[O_MAG_AMMO_ITEM].floor_height_routine = NULL;
g_Objects[O_MAG_AMMO_ITEM].ceiling_height_routine = NULL;
}

if (g_Config.disable_uzis) {
g_Objects[O_UZI_ITEM].initialise = NULL;
g_Objects[O_UZI_ITEM].collision = NULL;
g_Objects[O_UZI_ITEM].control = NULL;
g_Objects[O_UZI_ITEM].draw_routine = Object_DrawDummyItem;
g_Objects[O_UZI_ITEM].floor = NULL;
g_Objects[O_UZI_ITEM].ceiling = NULL;
g_Objects[O_UZI_ITEM].floor_height_routine = NULL;
g_Objects[O_UZI_ITEM].ceiling_height_routine = NULL;

g_Objects[O_UZI_AMMO_ITEM].initialise = NULL;
g_Objects[O_UZI_AMMO_ITEM].collision = NULL;
g_Objects[O_UZI_AMMO_ITEM].control = NULL;
g_Objects[O_UZI_AMMO_ITEM].draw_routine = Object_DrawDummyItem;
g_Objects[O_UZI_AMMO_ITEM].floor = NULL;
g_Objects[O_UZI_AMMO_ITEM].ceiling = NULL;
g_Objects[O_UZI_AMMO_ITEM].floor_height_routine = NULL;
g_Objects[O_UZI_AMMO_ITEM].ceiling_height_routine = NULL;
}

if (g_Config.disable_shotgun) {
g_Objects[O_SHOTGUN_ITEM].initialise = NULL;
g_Objects[O_SHOTGUN_ITEM].collision = NULL;
g_Objects[O_SHOTGUN_ITEM].control = NULL;
g_Objects[O_SHOTGUN_ITEM].draw_routine = Object_DrawDummyItem;
g_Objects[O_SHOTGUN_ITEM].floor = NULL;
g_Objects[O_SHOTGUN_ITEM].ceiling = NULL;
g_Objects[O_SHOTGUN_ITEM].floor_height_routine = NULL;
g_Objects[O_SHOTGUN_ITEM].ceiling_height_routine = NULL;

g_Objects[O_SG_AMMO_ITEM].initialise = NULL;
g_Objects[O_SG_AMMO_ITEM].collision = NULL;
g_Objects[O_SG_AMMO_ITEM].control = NULL;
g_Objects[O_SG_AMMO_ITEM].draw_routine = Object_DrawDummyItem;
g_Objects[O_SG_AMMO_ITEM].floor = NULL;
g_Objects[O_SG_AMMO_ITEM].ceiling = NULL;
g_Objects[O_SG_AMMO_ITEM].floor_height_routine = NULL;
g_Objects[O_SG_AMMO_ITEM].ceiling_height_routine = NULL;
}
}
4 changes: 2 additions & 2 deletions src/global/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -1644,9 +1644,9 @@ typedef struct OBJECT_INFO {
FRAME_INFO *frame_base;
void (*initialise)(int16_t item_num);
void (*control)(int16_t item_num);
void (*floor)(
void (*floor_height_routine)(
ITEM_INFO *item, int32_t x, int32_t y, int32_t z, int16_t *height);
void (*ceiling)(
void (*ceiling_height_routine)(
ITEM_INFO *item, int32_t x, int32_t y, int32_t z, int16_t *height);
void (*draw_routine)(ITEM_INFO *item);
void (*collision)(int16_t item_num, ITEM_INFO *lara_item, COLL_INFO *coll);
Expand Down

0 comments on commit b34422e

Please sign in to comment.