Skip to content

Commit

Permalink
types: use consistent naming for miscellaneous numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
rr- committed Sep 6, 2024
1 parent d71dc24 commit 6cc5f13
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 17 deletions.
14 changes: 7 additions & 7 deletions src/game/carrier.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void Carrier_InitialiseLevel(int32_t level_num)
CARRIED_ITEM *drop = item->carried_item;
for (int i = 0; i < data->count; i++) {
drop->object_id = data->object_ids[i];
drop->spawn_number = NO_ITEM;
drop->spawn_num = NO_ITEM;
drop->room_num = NO_ROOM;
drop->fall_speed = 0;

Expand Down Expand Up @@ -137,7 +137,7 @@ DROP_STATUS Carrier_GetSaveStatus(const CARRIED_ITEM *item)
// This allows us to save drops as still being carried to allow accurate
// placement again in Carrier_TestItemDrops on load.
if (item->status == DS_DROPPED) {
ITEM_INFO *pickup = &g_Items[item->spawn_number];
ITEM_INFO *pickup = &g_Items[item->spawn_num];
return pickup->status == IS_INVISIBLE ? DS_COLLECTED : DS_CARRIED;
} else if (item->status == DS_FALLING) {
return DS_CARRIED;
Expand Down Expand Up @@ -170,17 +170,17 @@ void Carrier_TestItemDrops(int16_t item_num)
object_id = Object_GetCognate(object_id, g_GunAmmoObjectMap);
}

item->spawn_number = Item_Spawn(carrier, object_id);
item->spawn_num = Item_Spawn(carrier, object_id);
item->status = DS_FALLING;
m_AnimatingCount++;

if (item->room_num != NO_ROOM) {
// Handle reloading a save with a falling or landed item.
ITEM_INFO *pickup = &g_Items[item->spawn_number];
ITEM_INFO *pickup = &g_Items[item->spawn_num];
pickup->pos = item->pos;
pickup->fall_speed = item->fall_speed;
if (pickup->room_num != item->room_num) {
Item_NewRoom(item->spawn_number, item->room_num);
Item_NewRoom(item->spawn_num, item->room_num);
}
}

Expand Down Expand Up @@ -238,7 +238,7 @@ static void Carrier_AnimateDrop(CARRIED_ITEM *item)
return;
}

ITEM_INFO *const pickup = &g_Items[item->spawn_number];
ITEM_INFO *const pickup = &g_Items[item->spawn_num];
int16_t room_num = pickup->room_num;
const SECTOR_INFO *const sector =
Room_GetSector(pickup->pos.x, pickup->pos.y, pickup->pos.z, &room_num);
Expand All @@ -265,7 +265,7 @@ static void Carrier_AnimateDrop(CARRIED_ITEM *item)
}

if (room_num != pickup->room_num) {
Item_NewRoom(item->spawn_number, room_num);
Item_NewRoom(item->spawn_num, room_num);
}

// Track animating status in the carrier for saving/loading.
Expand Down
2 changes: 1 addition & 1 deletion src/game/collide.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ bool Collide_CollideStaticObjects(
MESH_INFO *mesh = r->mesh;

for (int j = 0; j < r->num_meshes; j++, mesh++) {
STATIC_INFO *sinfo = &g_StaticObjects[mesh->static_number];
STATIC_INFO *sinfo = &g_StaticObjects[mesh->static_num];
if (sinfo->flags & 1) {
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion src/game/level.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ static void Level_LoadRooms(VFILE *file)
mesh->pos.z = VFile_ReadS32(file);
mesh->rot.y = VFile_ReadS16(file);
mesh->shade = VFile_ReadU16(file);
mesh->static_number = VFile_ReadU16(file);
mesh->static_num = VFile_ReadU16(file);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/game/lot.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,12 @@ void LOT_CreateZone(ITEM_INFO *item)
item->box_num = r->sectors[z_sector + x_sector * r->z_size].box;

int16_t zone_num = zone[item->box_num];
int16_t flip_number = flip[item->box_num];
int16_t flip_num = flip[item->box_num];

creature->LOT.zone_count = 0;
BOX_NODE *node = creature->LOT.node;
for (int i = 0; i < g_NumberBoxes; i++) {
if (zone[i] == zone_num || flip[i] == flip_number) {
if (zone[i] == zone_num || flip[i] == flip_num) {
node->box_num = i;
node++;
creature->LOT.zone_count++;
Expand Down
7 changes: 3 additions & 4 deletions src/game/room_draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,17 +303,16 @@ void Room_DrawSingleRoom(int16_t room_num)

for (int i = 0; i < r->num_meshes; i++) {
MESH_INFO *mesh = &r->mesh[i];
if (g_StaticObjects[mesh->static_number].flags & 2) {
if (g_StaticObjects[mesh->static_num].flags & 2) {
Matrix_Push();
Matrix_TranslateAbs(mesh->pos.x, mesh->pos.y, mesh->pos.z);
Matrix_RotY(mesh->rot.y);
int clip =
Output_GetObjectBounds(&g_StaticObjects[mesh->static_number].p);
Output_GetObjectBounds(&g_StaticObjects[mesh->static_num].p);
if (clip) {
Output_CalculateStaticLight(mesh->shade);
Output_DrawPolygons(
g_Meshes[g_StaticObjects[mesh->static_number].mesh_num],
clip);
g_Meshes[g_StaticObjects[mesh->static_num].mesh_num], clip);
}
Matrix_Pop();
}
Expand Down
4 changes: 2 additions & 2 deletions src/global/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -1232,7 +1232,7 @@ typedef struct MESH_INFO {
PHD_ANGLE y;
} rot;
uint16_t shade;
uint16_t static_number;
uint16_t static_num;
} MESH_INFO;

typedef struct ROOM_INFO {
Expand Down Expand Up @@ -1271,7 +1271,7 @@ typedef enum DROP_STATUS {

typedef struct CARRIED_ITEM {
GAME_OBJECT_ID object_id;
int16_t spawn_number;
int16_t spawn_num;
XYZ_32 pos;
XYZ_16 rot;
int16_t room_num;
Expand Down

0 comments on commit 6cc5f13

Please sign in to comment.