From b34422e925f5eff7af726a75187b08e9736e21f2 Mon Sep 17 00:00:00 2001 From: lahm86 <33758420+lahm86@users.noreply.github.com> Date: Tue, 6 Aug 2024 19:37:27 +0100 Subject: [PATCH] objects: rename floor and ceiling routines --- src/game/objects/general/bridge.c | 28 ++++++++++---------- src/game/objects/general/bridge.h | 12 ++++----- src/game/objects/general/trapdoor.c | 8 +++--- src/game/objects/general/trapdoor.h | 4 +-- src/game/objects/traps/falling_block.c | 8 +++--- src/game/objects/traps/falling_block.h | 4 +-- src/game/room.c | 12 ++++----- src/game/setup.c | 36 +++++++++++++------------- src/global/types.h | 4 +-- 9 files changed, 58 insertions(+), 58 deletions(-) diff --git a/src/game/objects/general/bridge.c b/src/game/objects/general/bridge.c index 1cdf050a3f..7d63a3b8a1 100644 --- a/src/game/objects/general/bridge.c +++ b/src/game/objects/general/bridge.c @@ -123,22 +123,22 @@ 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) @@ -146,12 +146,12 @@ 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) @@ -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)) { @@ -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)) { @@ -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)) { @@ -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)) { @@ -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)) { @@ -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)) { diff --git a/src/game/objects/general/bridge.h b/src/game/objects/general/bridge.h index 0b3fbd993d..d2d36634fc 100644 --- a/src/game/objects/general/bridge.h +++ b/src/game/objects/general/bridge.h @@ -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); diff --git a/src/game/objects/general/trapdoor.c b/src/game/objects/general/trapdoor.c index 8bbe8a6eca..df49d5dd11 100644 --- a/src/game/objects/general/trapdoor.c +++ b/src/game/objects/general/trapdoor.c @@ -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; } @@ -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)) { @@ -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)) { diff --git a/src/game/objects/general/trapdoor.h b/src/game/objects/general/trapdoor.h index ac38b3dc93..30262783e8 100644 --- a/src/game/objects/general/trapdoor.h +++ b/src/game/objects/general/trapdoor.h @@ -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); diff --git a/src/game/objects/traps/falling_block.c b/src/game/objects/traps/falling_block.c index 9a6597e99d..fc06f2fe7d 100644 --- a/src/game/objects/traps/falling_block.c +++ b/src/game/objects/traps/falling_block.c @@ -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; @@ -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 @@ -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 diff --git a/src/game/objects/traps/falling_block.h b/src/game/objects/traps/falling_block.h index 8fadf63527..1f88b8b518 100644 --- a/src/game/objects/traps/falling_block.h +++ b/src/game/objects/traps/falling_block.h @@ -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); diff --git a/src/game/room.c b/src/game/room.c index 75424d1e4b..ea3e75178c 100644 --- a/src/game/room.c +++ b/src/game/room.c @@ -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)); @@ -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)); @@ -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) { diff --git a/src/game/setup.c b/src/game/setup.c index c6180adaf6..36daf888dd 100644 --- a/src/game/setup.c +++ b/src/game/setup.c @@ -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; @@ -268,15 +268,15 @@ 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) { @@ -284,15 +284,15 @@ void Setup_AllObjects(void) 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) { @@ -300,15 +300,15 @@ void Setup_AllObjects(void) 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) { @@ -316,14 +316,14 @@ void Setup_AllObjects(void) 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; } } diff --git a/src/global/types.h b/src/global/types.h index 05716c0ee0..c1bcd2c7bf 100644 --- a/src/global/types.h +++ b/src/global/types.h @@ -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);