From 45b278175159f07a65b7c1c4f87093e11f119c66 Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Fri, 13 Sep 2024 21:52:16 +0200 Subject: [PATCH] objects: further clean up --- src/game/carrier.c | 4 +- src/game/effect_routines/bubbles.c | 2 +- src/game/effects/blood.c | 2 +- src/game/effects/gun.c | 4 +- src/game/gun/gun_misc.c | 2 +- src/game/inventory/inventory_func.c | 44 ++++---- src/game/inventory/inventory_ring.c | 20 ++-- src/game/inventory/inventory_vars.c | 20 ++-- src/game/lara/lara.c | 42 ++++---- src/game/lara/lara_cheat.c | 60 +++++------ src/game/lot.c | 2 +- src/game/objects/common.c | 137 ++++++++++++------------ src/game/objects/creatures/mutant.c | 8 +- src/game/objects/creatures/pod.c | 6 +- src/game/objects/effects/body_part.c | 4 +- src/game/objects/effects/missile.c | 12 +-- src/game/objects/effects/natla_gun.c | 2 +- src/game/objects/effects/ricochet.c | 2 +- src/game/objects/effects/splash.c | 2 +- src/game/objects/general/puzzle_hole.c | 16 +-- src/game/objects/general/scion1.c | 8 +- src/game/objects/general/scion1.h | 3 + src/game/objects/general/scion2.c | 5 +- src/game/objects/general/scion2.h | 2 + src/game/objects/general/scion3.c | 8 +- src/game/objects/general/scion3.h | 2 + src/game/objects/general/scion4.c | 8 +- src/game/objects/general/scion4.h | 2 + src/game/objects/general/scion_holder.c | 8 +- src/game/objects/general/waterfall.c | 6 +- src/game/objects/names.c | 128 +++++++++++----------- src/game/objects/setup.c | 116 ++++++++++---------- src/game/objects/traps/dart.c | 2 +- src/game/objects/traps/midas_touch.c | 4 +- src/game/option/option.c | 20 ++-- src/game/phase/phase_inventory.c | 16 +-- src/game/room.c | 16 +-- src/game/savegame/savegame.c | 4 +- src/game/savegame/savegame_bson.c | 54 +++++----- src/game/savegame/savegame_legacy.c | 42 ++++---- src/game/stats.c | 65 ++++------- subprojects/libtrx | 2 +- 42 files changed, 451 insertions(+), 461 deletions(-) diff --git a/src/game/carrier.c b/src/game/carrier.c index 94e8878f4..23d63bba9 100644 --- a/src/game/carrier.c +++ b/src/game/carrier.c @@ -26,8 +26,8 @@ static ITEM_INFO *Carrier_GetCarrier(int16_t item_num); static void Carrier_AnimateDrop(CARRIED_ITEM *item); static const GAME_OBJECT_PAIR m_LegacyMap[] = { - { O_PIERRE, O_SCION_ITEM2 }, { O_COWBOY, O_MAGNUM_ITEM }, - { O_SKATEKID, O_UZI_ITEM }, { O_BALDY, O_SHOTGUN_ITEM }, + { O_PIERRE, O_SCION_ITEM_2 }, { O_COWBOY, O_MAGNUM_ITEM }, + { O_SKATEKID, O_UZI_ITEM }, { O_BALDY, O_SHOTGUN_ITEM }, { NO_OBJECT, NO_OBJECT }, }; diff --git a/src/game/effect_routines/bubbles.c b/src/game/effect_routines/bubbles.c index cf12b17d4..4ae1f8285 100644 --- a/src/game/effect_routines/bubbles.c +++ b/src/game/effect_routines/bubbles.c @@ -38,7 +38,7 @@ void FX_Bubbles(ITEM_INFO *item) fx->pos.x = offset.x; fx->pos.y = offset.y; fx->pos.z = offset.z; - fx->object_id = O_BUBBLES1; + fx->object_id = O_BUBBLES_1; fx->frame_num = -((Random_GetDraw() * 3) / 0x8000); fx->speed = 10 + ((Random_GetDraw() * 6) / 0x8000); } diff --git a/src/game/effects/blood.c b/src/game/effects/blood.c index c5e98ad6f..4afa87e25 100644 --- a/src/game/effects/blood.c +++ b/src/game/effects/blood.c @@ -15,7 +15,7 @@ int16_t Effect_Blood( fx->pos.y = y; fx->pos.z = z; fx->rot.y = direction; - fx->object_id = O_BLOOD1; + fx->object_id = O_BLOOD_1; fx->frame_num = 0; fx->counter = 0; fx->speed = speed; diff --git a/src/game/effects/gun.c b/src/game/effects/gun.c index bad62067a..51a162fe0 100644 --- a/src/game/effects/gun.c +++ b/src/game/effects/gun.c @@ -44,7 +44,7 @@ int16_t Effect_ShardGun( fx->rot.x = 0; fx->rot.y = y_rot; fx->rot.z = 0; - fx->object_id = O_MISSILE2; + fx->object_id = O_MISSILE_2; fx->frame_num = 0; fx->speed = SHARD_SPEED; fx->shade = 3584; @@ -67,7 +67,7 @@ int16_t Effect_RocketGun( fx->rot.x = 0; fx->rot.y = y_rot; fx->rot.z = 0; - fx->object_id = O_MISSILE3; + fx->object_id = O_MISSILE_3; fx->frame_num = 0; fx->speed = ROCKET_SPEED; fx->shade = 4096; diff --git a/src/game/gun/gun_misc.c b/src/game/gun/gun_misc.c index 083826f26..f4ae2f29a 100644 --- a/src/game/gun/gun_misc.c +++ b/src/game/gun/gun_misc.c @@ -499,7 +499,7 @@ void Gun_HitTarget(ITEM_INFO *item, GAME_VECTOR *hitpos, int16_t damage) } Item_TakeDamage(item, damage, true); - if (g_Config.fix_texture_issues && item->object_id == O_SCION_ITEM3) { + if (g_Config.fix_texture_issues && item->object_id == O_SCION_ITEM_3) { GAME_VECTOR pos; pos.x = hitpos->x; pos.y = hitpos->y; diff --git a/src/game/inventory/inventory_func.c b/src/game/inventory/inventory_func.c index 582e82044..80fa0d703 100644 --- a/src/game/inventory/inventory_func.c +++ b/src/game/inventory/inventory_func.c @@ -118,23 +118,23 @@ bool Inv_AddItem(const GAME_OBJECT_ID object_id) Inv_InsertItem(&g_InvItemBigMedi); return true; - case O_PUZZLE_ITEM1: - case O_PUZZLE_OPTION1: + case O_PUZZLE_ITEM_1: + case O_PUZZLE_OPTION_1: Inv_InsertItem(&g_InvItemPuzzle1); return true; - case O_PUZZLE_ITEM2: - case O_PUZZLE_OPTION2: + case O_PUZZLE_ITEM_2: + case O_PUZZLE_OPTION_2: Inv_InsertItem(&g_InvItemPuzzle2); return true; - case O_PUZZLE_ITEM3: - case O_PUZZLE_OPTION3: + case O_PUZZLE_ITEM_3: + case O_PUZZLE_OPTION_3: Inv_InsertItem(&g_InvItemPuzzle3); return true; - case O_PUZZLE_ITEM4: - case O_PUZZLE_OPTION4: + case O_PUZZLE_ITEM_4: + case O_PUZZLE_OPTION_4: Inv_InsertItem(&g_InvItemPuzzle4); return true; @@ -143,38 +143,38 @@ bool Inv_AddItem(const GAME_OBJECT_ID object_id) Inv_InsertItem(&g_InvItemLeadBar); return true; - case O_KEY_ITEM1: - case O_KEY_OPTION1: + case O_KEY_ITEM_1: + case O_KEY_OPTION_1: Inv_InsertItem(&g_InvItemKey1); return true; - case O_KEY_ITEM2: - case O_KEY_OPTION2: + case O_KEY_ITEM_2: + case O_KEY_OPTION_2: Inv_InsertItem(&g_InvItemKey2); return true; - case O_KEY_ITEM3: - case O_KEY_OPTION3: + case O_KEY_ITEM_3: + case O_KEY_OPTION_3: Inv_InsertItem(&g_InvItemKey3); return true; - case O_KEY_ITEM4: - case O_KEY_OPTION4: + case O_KEY_ITEM_4: + case O_KEY_OPTION_4: Inv_InsertItem(&g_InvItemKey4); return true; - case O_PICKUP_ITEM1: - case O_PICKUP_OPTION1: + case O_PICKUP_ITEM_1: + case O_PICKUP_OPTION_1: Inv_InsertItem(&g_InvItemPickup1); return true; - case O_PICKUP_ITEM2: - case O_PICKUP_OPTION2: + case O_PICKUP_ITEM_2: + case O_PICKUP_OPTION_2: Inv_InsertItem(&g_InvItemPickup2); return true; - case O_SCION_ITEM: - case O_SCION_ITEM2: + case O_SCION_ITEM_1: + case O_SCION_ITEM_2: case O_SCION_OPTION: Inv_InsertItem(&g_InvItemScion); return true; diff --git a/src/game/inventory/inventory_ring.c b/src/game/inventory/inventory_ring.c index 5694a1bc4..d8d0d15b7 100644 --- a/src/game/inventory/inventory_ring.c +++ b/src/game/inventory/inventory_ring.c @@ -256,17 +256,17 @@ void Inv_Ring_Active(INVENTORY_ITEM *inv_item) } break; - case O_KEY_OPTION1: - case O_KEY_OPTION2: - case O_KEY_OPTION3: - case O_KEY_OPTION4: + case O_KEY_OPTION_1: + case O_KEY_OPTION_2: + case O_KEY_OPTION_3: + case O_KEY_OPTION_4: case O_LEADBAR_OPTION: - case O_PICKUP_OPTION1: - case O_PICKUP_OPTION2: - case O_PUZZLE_OPTION1: - case O_PUZZLE_OPTION2: - case O_PUZZLE_OPTION3: - case O_PUZZLE_OPTION4: + case O_PICKUP_OPTION_1: + case O_PICKUP_OPTION_2: + case O_PUZZLE_OPTION_1: + case O_PUZZLE_OPTION_2: + case O_PUZZLE_OPTION_3: + case O_PUZZLE_OPTION_4: case O_SCION_OPTION: if (!g_InvItemText[IT_QTY] && qty > 1) { sprintf(temp_text, "%d", qty); diff --git a/src/game/inventory/inventory_vars.c b/src/game/inventory/inventory_vars.c index 421ad7ddb..c21c36d7b 100644 --- a/src/game/inventory/inventory_vars.c +++ b/src/game/inventory/inventory_vars.c @@ -173,7 +173,7 @@ INVENTORY_ITEM g_InvItemLeadBar = { INVENTORY_ITEM g_InvItemPickup1 = { .string = "Pickup", - .object_id = O_PICKUP_OPTION1, + .object_id = O_PICKUP_OPTION_1, .frames_total = 1, .current_frame = 0, .goal_frame = 0, @@ -197,7 +197,7 @@ INVENTORY_ITEM g_InvItemPickup1 = { INVENTORY_ITEM g_InvItemPickup2 = { .string = "Pickup", - .object_id = O_PICKUP_OPTION2, + .object_id = O_PICKUP_OPTION_2, .frames_total = 1, .current_frame = 0, .goal_frame = 0, @@ -245,7 +245,7 @@ INVENTORY_ITEM g_InvItemScion = { INVENTORY_ITEM g_InvItemPuzzle1 = { .string = "Puzzle", - .object_id = O_PUZZLE_OPTION1, + .object_id = O_PUZZLE_OPTION_1, .frames_total = 1, .current_frame = 0, .goal_frame = 0, @@ -269,7 +269,7 @@ INVENTORY_ITEM g_InvItemPuzzle1 = { INVENTORY_ITEM g_InvItemPuzzle2 = { .string = "Puzzle", - .object_id = O_PUZZLE_OPTION2, + .object_id = O_PUZZLE_OPTION_2, .frames_total = 1, .current_frame = 0, .goal_frame = 0, @@ -293,7 +293,7 @@ INVENTORY_ITEM g_InvItemPuzzle2 = { INVENTORY_ITEM g_InvItemPuzzle3 = { .string = "Puzzle", - .object_id = O_PUZZLE_OPTION3, + .object_id = O_PUZZLE_OPTION_3, .frames_total = 1, .current_frame = 0, .goal_frame = 0, @@ -317,7 +317,7 @@ INVENTORY_ITEM g_InvItemPuzzle3 = { INVENTORY_ITEM g_InvItemPuzzle4 = { .string = "Puzzle", - .object_id = O_PUZZLE_OPTION4, + .object_id = O_PUZZLE_OPTION_4, .frames_total = 1, .current_frame = 0, .goal_frame = 0, @@ -341,7 +341,7 @@ INVENTORY_ITEM g_InvItemPuzzle4 = { INVENTORY_ITEM g_InvItemKey1 = { .string = "Key", - .object_id = O_KEY_OPTION1, + .object_id = O_KEY_OPTION_1, .frames_total = 1, .current_frame = 0, .goal_frame = 0, @@ -365,7 +365,7 @@ INVENTORY_ITEM g_InvItemKey1 = { INVENTORY_ITEM g_InvItemKey2 = { .string = "Key", - .object_id = O_KEY_OPTION2, + .object_id = O_KEY_OPTION_2, .frames_total = 1, .current_frame = 0, .goal_frame = 0, @@ -389,7 +389,7 @@ INVENTORY_ITEM g_InvItemKey2 = { INVENTORY_ITEM g_InvItemKey3 = { .string = "Key", - .object_id = O_KEY_OPTION3, + .object_id = O_KEY_OPTION_3, .frames_total = 1, .current_frame = 0, .goal_frame = 0, @@ -413,7 +413,7 @@ INVENTORY_ITEM g_InvItemKey3 = { INVENTORY_ITEM g_InvItemKey4 = { .string = "Key", - .object_id = O_KEY_OPTION4, + .object_id = O_KEY_OPTION_4, .frames_total = 1, .current_frame = 0, .goal_frame = 0, diff --git a/src/game/lara/lara.c b/src/game/lara/lara.c index e7d0cb16f..e3986349a 100644 --- a/src/game/lara/lara.c +++ b/src/game/lara/lara.c @@ -391,28 +391,28 @@ void Lara_UseItem(GAME_OBJECT_ID object_id) Sound_Effect(SFX_MENU_MEDI, NULL, SPM_ALWAYS); break; - case O_KEY_ITEM1: - case O_KEY_OPTION1: - case O_KEY_ITEM2: - case O_KEY_OPTION2: - case O_KEY_ITEM3: - case O_KEY_OPTION3: - case O_KEY_ITEM4: - case O_KEY_OPTION4: - case O_PUZZLE_ITEM1: - case O_PUZZLE_OPTION1: - case O_PUZZLE_ITEM2: - case O_PUZZLE_OPTION2: - case O_PUZZLE_ITEM3: - case O_PUZZLE_OPTION3: - case O_PUZZLE_ITEM4: - case O_PUZZLE_OPTION4: + case O_KEY_ITEM_1: + case O_KEY_OPTION_1: + case O_KEY_ITEM_2: + case O_KEY_OPTION_2: + case O_KEY_ITEM_3: + case O_KEY_OPTION_3: + case O_KEY_ITEM_4: + case O_KEY_OPTION_4: + case O_PUZZLE_ITEM_1: + case O_PUZZLE_OPTION_1: + case O_PUZZLE_ITEM_2: + case O_PUZZLE_OPTION_2: + case O_PUZZLE_ITEM_3: + case O_PUZZLE_OPTION_3: + case O_PUZZLE_ITEM_4: + case O_PUZZLE_OPTION_4: case O_LEADBAR_ITEM: case O_LEADBAR_OPTION: - case O_SCION_ITEM: - case O_SCION_ITEM2: - case O_SCION_ITEM3: - case O_SCION_ITEM4: + case O_SCION_ITEM_1: + case O_SCION_ITEM_2: + case O_SCION_ITEM_3: + case O_SCION_ITEM_4: case O_SCION_OPTION: { int16_t receptacle_item_num = Object_FindReceptacle(object_id); if (receptacle_item_num == NO_OBJECT) { @@ -581,7 +581,7 @@ void Lara_InitialiseInventory(int32_t level_num) } for (int i = 0; i < resume->num_scions; i++) { - Inv_AddItem(O_SCION_ITEM); + Inv_AddItem(O_SCION_ITEM_1); } for (int i = 0; i < resume->num_medis; i++) { diff --git a/src/game/lara/lara_cheat.c b/src/game/lara/lara_cheat.c index 2ea96b266..3e6719c57 100644 --- a/src/game/lara/lara_cheat.c +++ b/src/game/lara/lara_cheat.c @@ -203,16 +203,16 @@ bool Lara_Cheat_GiveAllKeys(void) return false; } - Inv_AddItem(O_PUZZLE_ITEM1); - Inv_AddItem(O_PUZZLE_ITEM2); - Inv_AddItem(O_PUZZLE_ITEM3); - Inv_AddItem(O_PUZZLE_ITEM4); - Inv_AddItem(O_KEY_ITEM1); - Inv_AddItem(O_KEY_ITEM2); - Inv_AddItem(O_KEY_ITEM3); - Inv_AddItem(O_KEY_ITEM4); - Inv_AddItem(O_PICKUP_ITEM1); - Inv_AddItem(O_PICKUP_ITEM2); + Inv_AddItem(O_PUZZLE_ITEM_1); + Inv_AddItem(O_PUZZLE_ITEM_2); + Inv_AddItem(O_PUZZLE_ITEM_3); + Inv_AddItem(O_PUZZLE_ITEM_4); + Inv_AddItem(O_KEY_ITEM_1); + Inv_AddItem(O_KEY_ITEM_2); + Inv_AddItem(O_KEY_ITEM_3); + Inv_AddItem(O_KEY_ITEM_4); + Inv_AddItem(O_PICKUP_ITEM_1); + Inv_AddItem(O_PICKUP_ITEM_2); Sound_Effect(SFX_LARA_KEY, NULL, SPM_ALWAYS); Console_Log(GS(OSD_GIVE_ITEM_ALL_KEYS)); @@ -270,35 +270,35 @@ bool Lara_Cheat_GiveAllItems(void) } } - if (!Inv_RequestItem(O_KEY_ITEM1)) { - Inv_AddItem(O_KEY_ITEM1); + if (!Inv_RequestItem(O_KEY_ITEM_1)) { + Inv_AddItem(O_KEY_ITEM_1); } - if (!Inv_RequestItem(O_KEY_ITEM2)) { - Inv_AddItem(O_KEY_ITEM2); + if (!Inv_RequestItem(O_KEY_ITEM_2)) { + Inv_AddItem(O_KEY_ITEM_2); } - if (!Inv_RequestItem(O_KEY_ITEM3)) { - Inv_AddItem(O_KEY_ITEM3); + if (!Inv_RequestItem(O_KEY_ITEM_3)) { + Inv_AddItem(O_KEY_ITEM_3); } - if (!Inv_RequestItem(O_KEY_ITEM4)) { - Inv_AddItem(O_KEY_ITEM4); + if (!Inv_RequestItem(O_KEY_ITEM_4)) { + Inv_AddItem(O_KEY_ITEM_4); } - if (!Inv_RequestItem(O_PUZZLE_ITEM1)) { - Inv_AddItem(O_PUZZLE_ITEM1); + if (!Inv_RequestItem(O_PUZZLE_ITEM_1)) { + Inv_AddItem(O_PUZZLE_ITEM_1); } - if (!Inv_RequestItem(O_PUZZLE_ITEM2)) { - Inv_AddItem(O_PUZZLE_ITEM2); + if (!Inv_RequestItem(O_PUZZLE_ITEM_2)) { + Inv_AddItem(O_PUZZLE_ITEM_2); } - if (!Inv_RequestItem(O_PUZZLE_ITEM3)) { - Inv_AddItem(O_PUZZLE_ITEM3); + if (!Inv_RequestItem(O_PUZZLE_ITEM_3)) { + Inv_AddItem(O_PUZZLE_ITEM_3); } - if (!Inv_RequestItem(O_PUZZLE_ITEM4)) { - Inv_AddItem(O_PUZZLE_ITEM4); + if (!Inv_RequestItem(O_PUZZLE_ITEM_4)) { + Inv_AddItem(O_PUZZLE_ITEM_4); } - if (!Inv_RequestItem(O_PICKUP_ITEM1)) { - Inv_AddItem(O_PICKUP_ITEM1); + if (!Inv_RequestItem(O_PICKUP_ITEM_1)) { + Inv_AddItem(O_PICKUP_ITEM_1); } - if (!Inv_RequestItem(O_PICKUP_ITEM2)) { - Inv_AddItem(O_PICKUP_ITEM2); + if (!Inv_RequestItem(O_PICKUP_ITEM_2)) { + Inv_AddItem(O_PICKUP_ITEM_2); } Sound_Effect(SFX_LARA_HOLSTER, &g_LaraItem->pos, SPM_NORMAL); diff --git a/src/game/lot.c b/src/game/lot.c index 285949719..69c43adaf 100644 --- a/src/game/lot.c +++ b/src/game/lot.c @@ -114,7 +114,7 @@ void LOT_InitialiseSlot(int16_t item_num, int32_t slot) break; case O_TREX: - case O_WARRIOR1: + case O_WARRIOR_1: case O_CENTAUR: creature->LOT.block_mask = BLOCKABLE; break; diff --git a/src/game/objects/common.c b/src/game/objects/common.c index 9912e414b..d750bcf02 100644 --- a/src/game/objects/common.c +++ b/src/game/objects/common.c @@ -32,18 +32,22 @@ const GAME_OBJECT_ID g_EnemyObjects[] = { O_VOLE, O_TREX, O_RAPTOR, - O_WARRIOR1, - O_WARRIOR2, - O_WARRIOR3, + O_WARRIOR_1, + O_WARRIOR_2, + O_WARRIOR_3, O_CENTAUR, O_MUMMY, + O_TORSO, + O_DINO_WARRIOR, + O_FISH, O_LARSON, O_PIERRE, O_SKATEKID, O_COWBOY, O_BALDY, O_NATLA, - O_TORSO, + O_SCION_ITEM_3, + O_STATUE, NO_OBJECT, // clang-format on }; @@ -83,18 +87,19 @@ const GAME_OBJECT_ID g_PickupObjects[] = { O_UZI_AMMO_ITEM, O_MEDI_ITEM, O_BIGMEDI_ITEM, - O_PUZZLE_ITEM1, - O_PUZZLE_ITEM2, - O_PUZZLE_ITEM3, - O_PUZZLE_ITEM4, - O_KEY_ITEM1, - O_KEY_ITEM2, - O_KEY_ITEM3, - O_KEY_ITEM4, - O_PICKUP_ITEM1, - O_PICKUP_ITEM2, + O_EXPLOSIVE_ITEM, + O_PUZZLE_ITEM_1, + O_PUZZLE_ITEM_2, + O_PUZZLE_ITEM_3, + O_PUZZLE_ITEM_4, + O_KEY_ITEM_1, + O_KEY_ITEM_2, + O_KEY_ITEM_3, + O_KEY_ITEM_4, + O_PICKUP_ITEM_1, + O_PICKUP_ITEM_2, O_LEADBAR_ITEM, - O_SCION_ITEM2, + O_SCION_ITEM_2, NO_OBJECT, // clang-format on }; @@ -111,24 +116,24 @@ const GAME_OBJECT_ID g_GunObjects[] = { const GAME_OBJECT_ID g_DoorObjects[] = { // clang-format off - O_DOOR_TYPE1, - O_DOOR_TYPE2, - O_DOOR_TYPE3, - O_DOOR_TYPE4, - O_DOOR_TYPE5, - O_DOOR_TYPE6, - O_DOOR_TYPE7, - O_DOOR_TYPE8, + O_DOOR_TYPE_1, + O_DOOR_TYPE_2, + O_DOOR_TYPE_3, + O_DOOR_TYPE_4, + O_DOOR_TYPE_5, + O_DOOR_TYPE_6, + O_DOOR_TYPE_7, + O_DOOR_TYPE_8, NO_OBJECT, // clang-format on }; const GAME_OBJECT_ID g_TrapdoorObjects[] = { // clang-format off - O_TRAPDOOR, - O_TRAPDOOR2, + O_TRAPDOOR_1, + O_TRAPDOOR_2, O_BIGTRAPDOOR, - O_DRAW_BRIDGE, + O_DRAWBRIDGE, NO_OBJECT, // clang-format on }; @@ -145,17 +150,17 @@ const GAME_OBJECT_ID g_InvObjects[] = { O_EXPLOSIVE_OPTION, O_MEDI_OPTION, O_BIGMEDI_OPTION, - O_PUZZLE_OPTION1, - O_PUZZLE_OPTION2, - O_PUZZLE_OPTION3, - O_PUZZLE_OPTION4, + O_PUZZLE_OPTION_1, + O_PUZZLE_OPTION_2, + O_PUZZLE_OPTION_3, + O_PUZZLE_OPTION_4, O_LEADBAR_OPTION, - O_KEY_OPTION1, - O_KEY_OPTION2, - O_KEY_OPTION3, - O_KEY_OPTION4, - O_PICKUP_OPTION1, - O_PICKUP_OPTION2, + O_KEY_OPTION_1, + O_KEY_OPTION_2, + O_KEY_OPTION_3, + O_KEY_OPTION_4, + O_PICKUP_OPTION_1, + O_PICKUP_OPTION_2, O_SCION_OPTION, O_DETAIL_OPTION, O_SOUND_OPTION, @@ -180,14 +185,14 @@ const GAME_OBJECT_PAIR g_GunAmmoObjectMap[] = { static const GAME_OBJECT_PAIR m_KeyItemToReceptacleMap[] = { // clang-format off - { O_KEY_OPTION1, O_KEY_HOLE1 }, - { O_KEY_OPTION2, O_KEY_HOLE2 }, - { O_KEY_OPTION3, O_KEY_HOLE3 }, - { O_KEY_OPTION4, O_KEY_HOLE4 }, - { O_PUZZLE_OPTION1, O_PUZZLE_HOLE1 }, - { O_PUZZLE_OPTION2, O_PUZZLE_HOLE2 }, - { O_PUZZLE_OPTION3, O_PUZZLE_HOLE3 }, - { O_PUZZLE_OPTION4, O_PUZZLE_HOLE4 }, + { O_KEY_OPTION_1, O_KEY_HOLE_1 }, + { O_KEY_OPTION_2, O_KEY_HOLE_2 }, + { O_KEY_OPTION_3, O_KEY_HOLE_3 }, + { O_KEY_OPTION_4, O_KEY_HOLE_4 }, + { O_PUZZLE_OPTION_1, O_PUZZLE_HOLE_1 }, + { O_PUZZLE_OPTION_2, O_PUZZLE_HOLE_2 }, + { O_PUZZLE_OPTION_3, O_PUZZLE_HOLE_3 }, + { O_PUZZLE_OPTION_4, O_PUZZLE_HOLE_4 }, { O_LEADBAR_OPTION, O_MIDAS_TOUCH }, { NO_OBJECT, NO_OBJECT }, // clang-format on @@ -205,19 +210,19 @@ const GAME_OBJECT_PAIR g_ItemToInvObjectMap[] = { { O_EXPLOSIVE_ITEM, O_EXPLOSIVE_OPTION }, { O_MEDI_ITEM, O_MEDI_OPTION }, { O_BIGMEDI_ITEM, O_BIGMEDI_OPTION }, - { O_PUZZLE_ITEM1, O_PUZZLE_OPTION1 }, - { O_PUZZLE_ITEM2, O_PUZZLE_OPTION2 }, - { O_PUZZLE_ITEM3, O_PUZZLE_OPTION3 }, - { O_PUZZLE_ITEM4, O_PUZZLE_OPTION4 }, + { O_PUZZLE_ITEM_1, O_PUZZLE_OPTION_1 }, + { O_PUZZLE_ITEM_2, O_PUZZLE_OPTION_2 }, + { O_PUZZLE_ITEM_3, O_PUZZLE_OPTION_3 }, + { O_PUZZLE_ITEM_4, O_PUZZLE_OPTION_4 }, { O_LEADBAR_ITEM, O_LEADBAR_OPTION }, - { O_KEY_ITEM1, O_KEY_OPTION1 }, - { O_KEY_ITEM2, O_KEY_OPTION2 }, - { O_KEY_ITEM3, O_KEY_OPTION3 }, - { O_KEY_ITEM4, O_KEY_OPTION4 }, - { O_PICKUP_ITEM1, O_PICKUP_OPTION1 }, - { O_PICKUP_ITEM2, O_PICKUP_OPTION2 }, - { O_SCION_ITEM, O_SCION_OPTION }, - { O_SCION_ITEM2, O_SCION_OPTION }, + { O_KEY_ITEM_1, O_KEY_OPTION_1 }, + { O_KEY_ITEM_2, O_KEY_OPTION_2 }, + { O_KEY_ITEM_3, O_KEY_OPTION_3 }, + { O_KEY_ITEM_4, O_KEY_OPTION_4 }, + { O_PICKUP_ITEM_1, O_PICKUP_OPTION_1 }, + { O_PICKUP_ITEM_2, O_PICKUP_OPTION_2 }, + { O_SCION_ITEM_1, O_SCION_OPTION }, + { O_SCION_ITEM_2, O_SCION_OPTION }, { NO_OBJECT, NO_OBJECT }, // clang-format on }; @@ -385,8 +390,8 @@ void Object_DrawPickupItem(ITEM_INFO *item) case O_UZI_AMMO_OPTION: case O_EXPLOSIVE_OPTION: case O_LEADBAR_OPTION: - case O_PICKUP_OPTION1: - case O_PICKUP_OPTION2: + case O_PICKUP_OPTION_1: + case O_PICKUP_OPTION_2: case O_SCION_OPTION: // Ignore the sprite and just position based upon the anim. offset = item->pos.y + (min_y - anim_y) / 2; @@ -394,14 +399,14 @@ void Object_DrawPickupItem(ITEM_INFO *item) case O_MEDI_OPTION: case O_BIGMEDI_OPTION: case O_SG_AMMO_OPTION: - case O_PUZZLE_OPTION1: - case O_PUZZLE_OPTION2: - case O_PUZZLE_OPTION3: - case O_PUZZLE_OPTION4: - case O_KEY_OPTION1: - case O_KEY_OPTION2: - case O_KEY_OPTION3: - case O_KEY_OPTION4: { + case O_PUZZLE_OPTION_1: + case O_PUZZLE_OPTION_2: + case O_PUZZLE_OPTION_3: + case O_PUZZLE_OPTION_4: + case O_KEY_OPTION_1: + case O_KEY_OPTION_2: + case O_KEY_OPTION_3: + case O_KEY_OPTION_4: { // Take the difference from the bottom of the sprite and the bottom // of the animation and divide it by 8. // 8 was chosen because in testing it positioned objects correctly. diff --git a/src/game/objects/creatures/mutant.c b/src/game/objects/creatures/mutant.c index 188a14724..4ee953862 100644 --- a/src/game/objects/creatures/mutant.c +++ b/src/game/objects/creatures/mutant.c @@ -87,7 +87,7 @@ void Mutant_Setup2(OBJECT_INFO *obj) if (!obj->loaded) { return; } - *obj = g_Objects[O_WARRIOR1]; + *obj = g_Objects[O_WARRIOR_1]; obj->initialise = Mutant_Initialise2; obj->smartness = WARRIOR2_SMARTNESS; } @@ -97,7 +97,7 @@ void Mutant_Setup3(OBJECT_INFO *obj) if (!obj->loaded) { return; } - *obj = g_Objects[O_WARRIOR1]; + *obj = g_Objects[O_WARRIOR_1]; obj->initialise = Mutant_Initialise2; } @@ -135,7 +135,7 @@ void Mutant_FlyerControl(int16_t item_num) int32_t shoot1 = 0; int32_t shoot2 = 0; - if (item->object_id != O_WARRIOR3 + if (item->object_id != O_WARRIOR_3 && Creature_CanTargetEnemy(item, &info) && (info.zone_num != info.enemy_zone || info.distance > FLYER_ATTACK_RANGE)) { @@ -146,7 +146,7 @@ void Mutant_FlyerControl(int16_t item_num) } } - if (item->object_id == O_WARRIOR1) { + if (item->object_id == O_WARRIOR_1) { if (item->current_anim_state == FLYER_FLY) { if ((flyer->flags & FLYER_FLYMODE) && flyer->mood != MOOD_ESCAPE && info.zone_num == info.enemy_zone) { diff --git a/src/game/objects/creatures/pod.c b/src/game/objects/creatures/pod.c index 382204eca..63dff13cb 100644 --- a/src/game/objects/creatures/pod.c +++ b/src/game/objects/creatures/pod.c @@ -39,7 +39,7 @@ void Pod_Initialise(int16_t item_num) switch ((item->flags & IF_CODE_BITS) >> 9) { case 1: - bug->object_id = O_WARRIOR2; + bug->object_id = O_WARRIOR_2; break; case 2: bug->object_id = O_CENTAUR; @@ -48,10 +48,10 @@ void Pod_Initialise(int16_t item_num) bug->object_id = O_TORSO; break; case 8: - bug->object_id = O_WARRIOR3; + bug->object_id = O_WARRIOR_3; break; default: - bug->object_id = O_WARRIOR1; + bug->object_id = O_WARRIOR_1; break; } diff --git a/src/game/objects/effects/body_part.c b/src/game/objects/effects/body_part.c index 58226563d..e91e01c4e 100644 --- a/src/game/objects/effects/body_part.c +++ b/src/game/objects/effects/body_part.c @@ -43,7 +43,7 @@ void BodyPart_Control(int16_t fx_num) fx->speed = 0; fx->frame_num = 0; fx->counter = 0; - fx->object_id = O_EXPLOSION1; + fx->object_id = O_EXPLOSION_1; Sound_Effect(SFX_ATLANTEAN_EXPLODE, &fx->pos, SPM_NORMAL); } else { Effect_Kill(fx_num); @@ -58,7 +58,7 @@ void BodyPart_Control(int16_t fx_num) fx->speed = 0; fx->frame_num = 0; fx->counter = 0; - fx->object_id = O_EXPLOSION1; + fx->object_id = O_EXPLOSION_1; Sound_Effect(SFX_ATLANTEAN_EXPLODE, &fx->pos, SPM_NORMAL); g_Lara.spaz_effect_count = 5; diff --git a/src/game/objects/effects/missile.c b/src/game/objects/effects/missile.c index 963411eae..24b39c445 100644 --- a/src/game/objects/effects/missile.c +++ b/src/game/objects/effects/missile.c @@ -40,14 +40,14 @@ void Missile_Control(int16_t fx_num) Room_GetCeiling(sector, fx->pos.x, fx->pos.y, fx->pos.z); if (fx->pos.y >= height || fx->pos.y <= ceiling) { - if (fx->object_id == O_MISSILE2) { - fx->object_id = O_RICOCHET1; + if (fx->object_id == O_MISSILE_2) { + fx->object_id = O_RICOCHET_1; fx->frame_num = -Random_GetControl() / 11000; fx->speed = 0; fx->counter = 6; Sound_Effect(SFX_LARA_RICOCHET, &fx->pos, SPM_NORMAL); } else { - fx->object_id = O_EXPLOSION1; + fx->object_id = O_EXPLOSION_1; fx->frame_num = 0; fx->speed = 0; fx->counter = 0; @@ -74,13 +74,13 @@ void Missile_Control(int16_t fx_num) return; } - if (fx->object_id == O_MISSILE2) { + if (fx->object_id == O_MISSILE_2) { Lara_TakeDamage(SHARD_DAMAGE, true); - fx->object_id = O_BLOOD1; + fx->object_id = O_BLOOD_1; Sound_Effect(SFX_LARA_BULLETHIT, &fx->pos, SPM_NORMAL); } else { Lara_TakeDamage(ROCKET_DAMAGE, true); - fx->object_id = O_EXPLOSION1; + fx->object_id = O_EXPLOSION_1; if (g_LaraItem->hit_points > 0) { Sound_Effect(SFX_LARA_INJURY, &g_LaraItem->pos, SPM_NORMAL); g_Lara.spaz_effect = fx; diff --git a/src/game/objects/effects/natla_gun.c b/src/game/objects/effects/natla_gun.c index 9aee61042..08a50ccfd 100644 --- a/src/game/objects/effects/natla_gun.c +++ b/src/game/objects/effects/natla_gun.c @@ -45,6 +45,6 @@ void NatlaGun_Control(int16_t fx_num) newfx->room_num = room_num; newfx->speed = fx->speed; newfx->frame_num = 0; - newfx->object_id = O_MISSILE1; + newfx->object_id = O_MISSILE_1; } } diff --git a/src/game/objects/effects/ricochet.c b/src/game/objects/effects/ricochet.c index 5a88b7c3b..f5e9e17c8 100644 --- a/src/game/objects/effects/ricochet.c +++ b/src/game/objects/effects/ricochet.c @@ -28,7 +28,7 @@ void Ricochet_Spawn(GAME_VECTOR *pos) fx->pos.y = pos->y; fx->pos.z = pos->z; fx->counter = 4; - fx->object_id = O_RICOCHET1; + fx->object_id = O_RICOCHET_1; fx->frame_num = -3 * Random_GetDraw() / 0x8000; Sound_Effect(SFX_LARA_RICOCHET, &fx->pos, SPM_NORMAL); } diff --git a/src/game/objects/effects/splash.c b/src/game/objects/effects/splash.c index c82241ef2..878192e66 100644 --- a/src/game/objects/effects/splash.c +++ b/src/game/objects/effects/splash.c @@ -43,7 +43,7 @@ void Splash_Spawn(ITEM_INFO *item) fx->pos.y = wh; fx->pos.z = item->pos.z; fx->rot.y = PHD_180 + 2 * Random_GetDraw(); - fx->object_id = O_SPLASH1; + fx->object_id = O_SPLASH_1; fx->frame_num = 0; fx->speed = Random_GetDraw() / 256; } diff --git a/src/game/objects/general/puzzle_hole.c b/src/game/objects/general/puzzle_hole.c index cff54578e..77e838d92 100644 --- a/src/game/objects/general/puzzle_hole.c +++ b/src/game/objects/general/puzzle_hole.c @@ -65,20 +65,20 @@ void PuzzleHole_Collision( if (Item_TestFrameEqual(lara_item, LF_USEPUZZLE)) { switch (item->object_id) { - case O_PUZZLE_HOLE1: - item->object_id = O_PUZZLE_DONE1; + case O_PUZZLE_HOLE_1: + item->object_id = O_PUZZLE_DONE_1; break; - case O_PUZZLE_HOLE2: - item->object_id = O_PUZZLE_DONE2; + case O_PUZZLE_HOLE_2: + item->object_id = O_PUZZLE_DONE_2; break; - case O_PUZZLE_HOLE3: - item->object_id = O_PUZZLE_DONE3; + case O_PUZZLE_HOLE_3: + item->object_id = O_PUZZLE_DONE_3; break; - case O_PUZZLE_HOLE4: - item->object_id = O_PUZZLE_DONE4; + case O_PUZZLE_HOLE_4: + item->object_id = O_PUZZLE_DONE_4; break; default: diff --git a/src/game/objects/general/scion1.c b/src/game/objects/general/scion1.c index 4936d892d..a57faa492 100644 --- a/src/game/objects/general/scion1.c +++ b/src/game/objects/general/scion1.c @@ -33,10 +33,10 @@ static const OBJECT_BOUNDS *Scion1_Bounds(void) void Scion1_Setup(OBJECT_INFO *obj) { - g_Objects[O_SCION_ITEM].draw_routine = Object_DrawPickupItem; - g_Objects[O_SCION_ITEM].collision = Scion1_Collision; - g_Objects[O_SCION_ITEM].save_flags = 1; - g_Objects[O_SCION_ITEM].bounds = Scion1_Bounds; + obj->draw_routine = Object_DrawPickupItem; + obj->collision = Scion1_Collision; + obj->save_flags = 1; + obj->bounds = Scion1_Bounds; } void Scion1_Collision(int16_t item_num, ITEM_INFO *lara_item, COLL_INFO *coll) diff --git a/src/game/objects/general/scion1.h b/src/game/objects/general/scion1.h index df306a641..f076f9b89 100644 --- a/src/game/objects/general/scion1.h +++ b/src/game/objects/general/scion1.h @@ -2,5 +2,8 @@ #include "global/types.h" +// Tomb of Qualopec and Sanctuary Scion pickup. +// Triggers O_LARA_EXTRA pedestal pickup animation. + void Scion1_Setup(OBJECT_INFO *obj); void Scion1_Collision(int16_t item_num, ITEM_INFO *lara_item, COLL_INFO *coll); diff --git a/src/game/objects/general/scion2.c b/src/game/objects/general/scion2.c index 08e2ede67..710a745c8 100644 --- a/src/game/objects/general/scion2.c +++ b/src/game/objects/general/scion2.c @@ -7,8 +7,5 @@ void Scion2_Setup(OBJECT_INFO *obj) { - g_Objects[O_SCION_ITEM2].draw_routine = Object_DrawPickupItem; - g_Objects[O_SCION_ITEM2].collision = Pickup_Collision; - g_Objects[O_SCION_ITEM2].save_flags = 1; - g_Objects[O_SCION_ITEM2].bounds = Pickup_Bounds; + Pickup_Setup(obj); } diff --git a/src/game/objects/general/scion2.h b/src/game/objects/general/scion2.h index 540f85a79..11ecc49ee 100644 --- a/src/game/objects/general/scion2.h +++ b/src/game/objects/general/scion2.h @@ -2,4 +2,6 @@ #include "global/types.h" +// Normal pickup Scion. + void Scion2_Setup(OBJECT_INFO *obj); diff --git a/src/game/objects/general/scion3.c b/src/game/objects/general/scion3.c index de11359a9..e08486a08 100644 --- a/src/game/objects/general/scion3.c +++ b/src/game/objects/general/scion3.c @@ -9,9 +9,9 @@ void Scion3_Setup(OBJECT_INFO *obj) { - g_Objects[O_SCION_ITEM3].control = Scion3_Control; - g_Objects[O_SCION_ITEM3].hit_points = 5; - g_Objects[O_SCION_ITEM3].save_flags = 1; + obj->control = Scion3_Control; + obj->hit_points = 5; + obj->save_flags = 1; } void Scion3_Control(int16_t item_num) @@ -42,7 +42,7 @@ void Scion3_Control(int16_t item_num) fx->pos.z = item->pos.z + (Random_GetControl() - 0x4000) / 32; fx->speed = 0; fx->frame_num = 0; - fx->object_id = O_EXPLOSION1; + fx->object_id = O_EXPLOSION_1; fx->counter = 0; Sound_Effect(SFX_ATLANTEAN_EXPLODE, &fx->pos, SPM_NORMAL); g_Camera.bounce = -200; diff --git a/src/game/objects/general/scion3.h b/src/game/objects/general/scion3.h index e94fb8192..c2ad94b05 100644 --- a/src/game/objects/general/scion3.h +++ b/src/game/objects/general/scion3.h @@ -2,5 +2,7 @@ #include "global/types.h" +// The Great Pyramid shootable Scion. + void Scion3_Setup(OBJECT_INFO *obj); void Scion3_Control(int16_t item_num); diff --git a/src/game/objects/general/scion4.c b/src/game/objects/general/scion4.c index f6112cd29..eb8a8487b 100644 --- a/src/game/objects/general/scion4.c +++ b/src/game/objects/general/scion4.c @@ -29,10 +29,10 @@ static const OBJECT_BOUNDS *Scion4_Bounds(void) void Scion4_Setup(OBJECT_INFO *obj) { - g_Objects[O_SCION_ITEM4].control = Scion4_Control; - g_Objects[O_SCION_ITEM4].collision = Scion4_Collision; - g_Objects[O_SCION_ITEM4].save_flags = 1; - g_Objects[O_SCION_ITEM4].bounds = Scion4_Bounds; + obj->control = Scion4_Control; + obj->collision = Scion4_Collision; + obj->save_flags = 1; + obj->bounds = Scion4_Bounds; } void Scion4_Control(int16_t item_num) diff --git a/src/game/objects/general/scion4.h b/src/game/objects/general/scion4.h index db15e9607..31fb364d8 100644 --- a/src/game/objects/general/scion4.h +++ b/src/game/objects/general/scion4.h @@ -2,6 +2,8 @@ #include "global/types.h" +// Atlantis Scion - triggers O_LARA_EXTRA reach anim. + void Scion4_Setup(OBJECT_INFO *obj); void Scion4_Control(int16_t item_num); void Scion4_Collision(int16_t item_num, ITEM_INFO *lara_item, COLL_INFO *coll); diff --git a/src/game/objects/general/scion_holder.c b/src/game/objects/general/scion_holder.c index 39b66fb92..8c28b2ee4 100644 --- a/src/game/objects/general/scion_holder.c +++ b/src/game/objects/general/scion_holder.c @@ -6,10 +6,10 @@ void ScionHolder_Setup(OBJECT_INFO *obj) { - g_Objects[O_SCION_HOLDER].control = ScionHolder_Control; - g_Objects[O_SCION_HOLDER].collision = Object_Collision; - g_Objects[O_SCION_HOLDER].save_anim = 1; - g_Objects[O_SCION_HOLDER].save_flags = 1; + obj->control = ScionHolder_Control; + obj->collision = Object_Collision; + obj->save_anim = 1; + obj->save_flags = 1; } void ScionHolder_Control(int16_t item_num) diff --git a/src/game/objects/general/waterfall.c b/src/game/objects/general/waterfall.c index c25aa05a4..0d277888b 100644 --- a/src/game/objects/general/waterfall.c +++ b/src/game/objects/general/waterfall.c @@ -13,8 +13,8 @@ void Waterfall_Setup(OBJECT_INFO *obj) { - g_Objects[O_WATERFALL].control = Waterfall_Control; - g_Objects[O_WATERFALL].draw_routine = Object_DrawDummyItem; + obj->control = Waterfall_Control; + obj->draw_routine = Object_DrawDummyItem; obj->save_flags = 1; } @@ -41,7 +41,7 @@ void Waterfall_Control(int16_t item_num) fx->pos.y = item->pos.y; fx->speed = 0; fx->frame_num = 0; - fx->object_id = O_SPLASH1; + fx->object_id = O_SPLASH_1; } } } diff --git a/src/game/objects/names.c b/src/game/objects/names.c index 132922c14..3c13594b3 100644 --- a/src/game/objects/names.c +++ b/src/game/objects/names.c @@ -77,9 +77,9 @@ static const ITEM_NAME m_ItemNames[] = { { O_VOLE, "^(rat|vole)$" }, { O_TREX, "^(t-?rex|barney)$" }, { O_RAPTOR, "^raptor$" }, - { O_WARRIOR1, "^(mutant|flyer|(flying|winged)[- ]?mutant)$" }, - { O_WARRIOR2, "^mutant$" }, - { O_WARRIOR3, "^mutant$" }, + { O_WARRIOR_1, "^(mutant|flyer|(flying|winged)[- ]?mutant)$" }, + { O_WARRIOR_2, "^mutant$" }, + { O_WARRIOR_3, "^mutant$" }, { O_CENTAUR, "^(centaur|mutant)$" }, { O_MUMMY, "^mummy$" }, { O_DINO_WARRIOR, "^dino[- ]?warrior$" }, @@ -100,36 +100,36 @@ static const ITEM_NAME m_ItemNames[] = { { O_ROLLING_BALL, "^(rolling[- ]?ball|boulder)$" }, { O_DARTS, "^darts$" }, { O_DART_EMITTER, "^(darts?|darts?[- ]?emitter)$" }, - { O_DRAW_BRIDGE, "^draw[- ]?bridge$" }, + { O_DRAWBRIDGE, "^draw[- ]?bridge$" }, { O_TEETH_TRAP, "^(clang[- ]?clang([- ]?door)?|teeth( trap)?)$" }, { O_DAMOCLES_SWORD, "^(damocles[- ]?sword|swords?)$" }, { O_THORS_HANDLE, "^thors[- ]?hammer$" }, { O_THORS_HEAD, "^thors[- ]?hammer$" }, { O_LIGHTNING_EMITTER, "^lightning[- ]?emitter$" }, { O_MOVING_BAR, "^moving[- ]?bar$" }, - { O_MOVABLE_BLOCK, "^(movable|push(able)?)[- ]?block$" }, - { O_MOVABLE_BLOCK2, "^(movable|push(able)?)[- ]?block$" }, - { O_MOVABLE_BLOCK3, "^(movable|push(able)?)[- ]?block$" }, - { O_MOVABLE_BLOCK4, "^(movable|push(able)?)[- ]?block$" }, + { O_MOVABLE_BLOCK_1, "^(movable|push(able)?)[- ]?block$" }, + { O_MOVABLE_BLOCK_2, "^(movable|push(able)?)[- ]?block$" }, + { O_MOVABLE_BLOCK_3, "^(movable|push(able)?)[- ]?block$" }, + { O_MOVABLE_BLOCK_4, "^(movable|push(able)?)[- ]?block$" }, { O_SLIDING_PILLAR, "^sliding[- ]?pillar$" }, - { O_FALLING_CEILING1, "^falling[- ]?ceiling( 1)?$" }, - { O_FALLING_CEILING2, "^falling[- ]?ceiling( 2)?$" }, - { O_SWITCH_TYPE1, "^(switch|lever)([- ]?1)?$" }, - { O_SWITCH_TYPE2, "^(switch|lever)([- ]?2)?$" }, - { O_DOOR_TYPE1, "^door([- ]?1)?$" }, - { O_DOOR_TYPE2, "^door([- ]?2)?$" }, - { O_DOOR_TYPE3, "^door([- ]?3)?$" }, - { O_DOOR_TYPE4, "^door([- ]?4)?$" }, - { O_DOOR_TYPE5, "^door([- ]?5)?$" }, - { O_DOOR_TYPE6, "^door([- ]?6)?$" }, - { O_DOOR_TYPE7, "^door([- ]?7)?$" }, - { O_DOOR_TYPE8, "^door([- ]?8)?$" }, - { O_TRAPDOOR, "^trap[- ]?door([- ]?1)?$" }, - { O_TRAPDOOR2, "^trap[- ]?door([- ]?2)?$" }, + { O_FALLING_CEILING_1, "^falling[- ]?ceiling( 1)?$" }, + { O_FALLING_CEILING_2, "^falling[- ]?ceiling( 2)?$" }, + { O_SWITCH_TYPE_1, "^(switch|lever)([- ]?1)?$" }, + { O_SWITCH_TYPE_2, "^(switch|lever)([- ]?2)?$" }, + { O_DOOR_TYPE_1, "^door([- ]?1)?$" }, + { O_DOOR_TYPE_2, "^door([- ]?2)?$" }, + { O_DOOR_TYPE_3, "^door([- ]?3)?$" }, + { O_DOOR_TYPE_4, "^door([- ]?4)?$" }, + { O_DOOR_TYPE_5, "^door([- ]?5)?$" }, + { O_DOOR_TYPE_6, "^door([- ]?6)?$" }, + { O_DOOR_TYPE_7, "^door([- ]?7)?$" }, + { O_DOOR_TYPE_8, "^door([- ]?8)?$" }, + { O_TRAPDOOR_1, "^trap[- ]?door([- ]?1)?$" }, + { O_TRAPDOOR_2, "^trap[- ]?door([- ]?2)?$" }, { O_BIGTRAPDOOR, "^(trap[- ]?door([- ]?3)?|big[- ]?trap[- ]?door)$" }, { O_BRIDGE_FLAT, "^bridge([- ]?flat)?$" }, - { O_BRIDGE_TILT1, "^bridge([- ]?tilt)?([- ]?1)?$" }, - { O_BRIDGE_TILT2, "^bridge([- ]?tilt)?([- ]?2)?$" }, + { O_BRIDGE_TILT_1, "^bridge([- ]?tilt)?([- ]?1)?$" }, + { O_BRIDGE_TILT_2, "^bridge([- ]?tilt)?([- ]?2)?$" }, { O_COG_1, "^cog([- ]?1)?$" }, { O_COG_2, "^cog([- ]?2)?$" }, { O_COG_3, "^cog([- ]?3)?$" }, @@ -149,61 +149,61 @@ static const ITEM_NAME m_ItemNames[] = { { O_EXPLOSIVE_ITEM, "^grenade$" }, { O_MEDI_ITEM, "^(small[- ]?)?medi?([- ]?pack)?$" }, { O_BIGMEDI_ITEM, "^((big|large)[- ]?)?medi?([- ]?pack)?$" }, - { O_PUZZLE_ITEM1, "^puzzle([- ]?item)?([- ]?1)?$" }, - { O_PUZZLE_ITEM2, "^puzzle([- ]?item)?([- ]?2)?$" }, - { O_PUZZLE_ITEM3, "^puzzle([- ]?item)?([- ]?3)?$" }, - { O_PUZZLE_ITEM4, "^puzzle([- ]?item)?([- ]?4)?$" }, - { O_PUZZLE_HOLE1, "^puzzle[- ]?hole([- ]?1)?$" }, - { O_PUZZLE_HOLE2, "^puzzle[- ]?hole([- ]?2)?$" }, - { O_PUZZLE_HOLE3, "^puzzle[- ]?hole([- ]?3)?$" }, - { O_PUZZLE_HOLE4, "^puzzle[- ]?hole([- ]?4)?$" }, - { O_PUZZLE_DONE1, "^puzzle[- ]?hole([- ]?1)?$" }, - { O_PUZZLE_DONE2, "^puzzle[- ]?hole([- ]?2)?$" }, - { O_PUZZLE_DONE3, "^puzzle[- ]?hole([- ]?3)?$" }, - { O_PUZZLE_DONE4, "^puzzle[- ]?hole([- ]?4)?$" }, + { O_PUZZLE_ITEM_1, "^puzzle([- ]?item)?([- ]?1)?$" }, + { O_PUZZLE_ITEM_2, "^puzzle([- ]?item)?([- ]?2)?$" }, + { O_PUZZLE_ITEM_3, "^puzzle([- ]?item)?([- ]?3)?$" }, + { O_PUZZLE_ITEM_4, "^puzzle([- ]?item)?([- ]?4)?$" }, + { O_PUZZLE_HOLE_1, "^puzzle[- ]?hole([- ]?1)?$" }, + { O_PUZZLE_HOLE_2, "^puzzle[- ]?hole([- ]?2)?$" }, + { O_PUZZLE_HOLE_3, "^puzzle[- ]?hole([- ]?3)?$" }, + { O_PUZZLE_HOLE_4, "^puzzle[- ]?hole([- ]?4)?$" }, + { O_PUZZLE_DONE_1, "^puzzle[- ]?hole([- ]?1)?$" }, + { O_PUZZLE_DONE_2, "^puzzle[- ]?hole([- ]?2)?$" }, + { O_PUZZLE_DONE_3, "^puzzle[- ]?hole([- ]?3)?$" }, + { O_PUZZLE_DONE_4, "^puzzle[- ]?hole([- ]?4)?$" }, { O_LEADBAR_ITEM, "^lead[- ]?bar$" }, { O_MIDAS_TOUCH, "^midas[- ]?hand$" }, - { O_KEY_ITEM1, "^key([- ]?1)?$" }, - { O_KEY_ITEM2, "^key([- ]?2)?$" }, - { O_KEY_ITEM3, "^key([- ]?3)?$" }, - { O_KEY_ITEM4, "^key([- ]?4)?$" }, - { O_KEY_HOLE1, "^key[- ]?hole([- ]?1)?$" }, - { O_KEY_HOLE2, "^key[- ]?hole([- ]?2)?$" }, - { O_KEY_HOLE3, "^key[- ]?hole([- ]?3)?$" }, - { O_KEY_HOLE4, "^key[- ]?hole([- ]?4)?$" }, - { O_PICKUP_ITEM1, "^pickup([- ]?1)?$" }, - { O_PICKUP_ITEM2, "^pickup([- ]?2)?$" }, - { O_SCION_ITEM, "^scion([- ]?1)?$" }, - { O_SCION_ITEM2, "^scion([- ]?2)?$" }, - { O_SCION_ITEM3, "^scion([- ]?3)?$" }, - { O_SCION_ITEM4, "^scion([- ]?4)?$" }, + { O_KEY_ITEM_1, "^key([- ]?1)?$" }, + { O_KEY_ITEM_2, "^key([- ]?2)?$" }, + { O_KEY_ITEM_3, "^key([- ]?3)?$" }, + { O_KEY_ITEM_4, "^key([- ]?4)?$" }, + { O_KEY_HOLE_1, "^key[- ]?hole([- ]?1)?$" }, + { O_KEY_HOLE_2, "^key[- ]?hole([- ]?2)?$" }, + { O_KEY_HOLE_3, "^key[- ]?hole([- ]?3)?$" }, + { O_KEY_HOLE_4, "^key[- ]?hole([- ]?4)?$" }, + { O_PICKUP_ITEM_1, "^pickup([- ]?1)?$" }, + { O_PICKUP_ITEM_2, "^pickup([- ]?2)?$" }, + { O_SCION_ITEM_1, "^scion([- ]?1)?$" }, + { O_SCION_ITEM_2, "^scion([- ]?2)?$" }, + { O_SCION_ITEM_3, "^scion([- ]?3)?$" }, + { O_SCION_ITEM_4, "^scion([- ]?4)?$" }, { O_SCION_HOLDER, "^scion[- ]?holder$" }, - { O_EXPLOSION1, "^explosion([- ]?1)?$" }, - { O_EXPLOSION2, "^explosion([- ]?2)?$" }, - { O_SPLASH1, "^splash([- ]?1)?$" }, - { O_SPLASH2, "^splash([- ]?2)?$" }, - { O_BUBBLES1, "^bubble([- ]?1)?$" }, - { O_BUBBLES2, "^bubble([- ]?2)?$" }, + { O_EXPLOSION_1, "^explosion([- ]?1)?$" }, + { O_EXPLOSION_2, "^explosion([- ]?2)?$" }, + { O_SPLASH_1, "^splash([- ]?1)?$" }, + { O_SPLASH_2, "^splash([- ]?2)?$" }, + { O_BUBBLES_1, "^bubble([- ]?1)?$" }, + { O_BUBBLES_2, "^bubble([- ]?2)?$" }, { O_BUBBLE_EMITTER, "^bubble[- ]?emitter$" }, - { O_BLOOD1, "^blood([- ]?1)?$" }, - { O_BLOOD2, "^blood([- ]?2)?$" }, + { O_BLOOD_1, "^blood([- ]?1)?$" }, + { O_BLOOD_2, "^blood([- ]?2)?$" }, { O_DART_EFFECT, "^dart[- ]?effect$" }, { O_STATUE, "^statue$" }, { O_PORTACABIN, "^cabin$" }, { O_PORTACABIN, "^porta[- ]?cabin$" }, { O_PODS, "^pod$" }, - { O_RICOCHET1, "^ricochet$" }, + { O_RICOCHET_1, "^ricochet$" }, { O_TWINKLE, "^twinkle$" }, { O_GUN_FLASH, "^gun[- ]?flash$" }, { O_DUST, "^dust$" }, { O_BODY_PART, "^body[- ]?part$" }, { O_CAMERA_TARGET, "^camera[- ]?target$" }, { O_WATERFALL, "^waterfall$" }, - { O_MISSILE1, "^missile([- ]?1)?$" }, - { O_MISSILE2, "^missile([- ]?2)?$" }, - { O_MISSILE3, "^missile([- ]?3)?$" }, - { O_MISSILE4, "^missile([- ]?4)?$" }, - { O_MISSILE5, "^missile([- ]?5)?$" }, + { O_MISSILE_1, "^missile([- ]?1)?$" }, + { O_MISSILE_2, "^missile([- ]?2)?$" }, + { O_MISSILE_3, "^missile([- ]?3)?$" }, + { O_MISSILE_4, "^missile([- ]?4)?$" }, + { O_MISSILE_5, "^missile([- ]?5)?$" }, { O_EMBER, "^ember$" }, { O_EMBER_EMITTER, "^ember[- ]?emitter$" }, { O_FLAME, "^flame$" }, diff --git a/src/game/objects/setup.c b/src/game/objects/setup.c index 45aa41903..d29707889 100644 --- a/src/game/objects/setup.c +++ b/src/game/objects/setup.c @@ -118,9 +118,9 @@ static void Object_SetupCreatures(void) Croc_Setup(&g_Objects[O_CROCODILE]); Alligator_Setup(&g_Objects[O_ALLIGATOR]); Ape_Setup(&g_Objects[O_APE]); - Mutant_Setup(&g_Objects[O_WARRIOR1]); - Mutant_Setup2(&g_Objects[O_WARRIOR2]); - Mutant_Setup3(&g_Objects[O_WARRIOR3]); + Mutant_Setup(&g_Objects[O_WARRIOR_1]); + Mutant_Setup2(&g_Objects[O_WARRIOR_2]); + Mutant_Setup3(&g_Objects[O_WARRIOR_3]); Centaur_Setup(&g_Objects[O_CENTAUR]); Mummy_Setup(&g_Objects[O_MUMMY]); SkateKid_Setup(&g_Objects[O_SKATEKID]); @@ -140,13 +140,13 @@ static void Object_SetupTraps(void) TeethTrap_Setup(&g_Objects[O_TEETH_TRAP]); RollingBall_Setup(&g_Objects[O_ROLLING_BALL]); Spikes_Setup(&g_Objects[O_SPIKES]); - FallingCeiling_Setup(&g_Objects[O_FALLING_CEILING1]); - FallingCeiling_Setup(&g_Objects[O_FALLING_CEILING2]); + FallingCeiling_Setup(&g_Objects[O_FALLING_CEILING_1]); + FallingCeiling_Setup(&g_Objects[O_FALLING_CEILING_2]); DamoclesSword_Setup(&g_Objects[O_DAMOCLES_SWORD]); - MovableBlock_Setup(&g_Objects[O_MOVABLE_BLOCK]); - MovableBlock_Setup(&g_Objects[O_MOVABLE_BLOCK2]); - MovableBlock_Setup(&g_Objects[O_MOVABLE_BLOCK3]); - MovableBlock_Setup(&g_Objects[O_MOVABLE_BLOCK4]); + MovableBlock_Setup(&g_Objects[O_MOVABLE_BLOCK_1]); + MovableBlock_Setup(&g_Objects[O_MOVABLE_BLOCK_2]); + MovableBlock_Setup(&g_Objects[O_MOVABLE_BLOCK_3]); + MovableBlock_Setup(&g_Objects[O_MOVABLE_BLOCK_4]); SlidingPillar_Setup(&g_Objects[O_SLIDING_PILLAR]); LightningEmitter_Setup(&g_Objects[O_LIGHTNING_EMITTER]); ThorsHammerHandle_Setup(&g_Objects[O_THORS_HANDLE]); @@ -166,36 +166,36 @@ static void Object_SetupMiscObjects(void) { CameraTarget_Setup(&g_Objects[O_CAMERA_TARGET]); BridgeFlat_Setup(&g_Objects[O_BRIDGE_FLAT]); - BridgeTilt1_Setup(&g_Objects[O_BRIDGE_TILT1]); - BridgeTilt2_Setup(&g_Objects[O_BRIDGE_TILT2]); - Drawbridge_Setup(&g_Objects[O_DRAW_BRIDGE]); - Switch_Setup(&g_Objects[O_SWITCH_TYPE1]); - Switch_SetupUW(&g_Objects[O_SWITCH_TYPE2]); - Door_Setup(&g_Objects[O_DOOR_TYPE1]); - Door_Setup(&g_Objects[O_DOOR_TYPE2]); - Door_Setup(&g_Objects[O_DOOR_TYPE3]); - Door_Setup(&g_Objects[O_DOOR_TYPE4]); - Door_Setup(&g_Objects[O_DOOR_TYPE5]); - Door_Setup(&g_Objects[O_DOOR_TYPE6]); - Door_Setup(&g_Objects[O_DOOR_TYPE7]); - Door_Setup(&g_Objects[O_DOOR_TYPE8]); - TrapDoor_Setup(&g_Objects[O_TRAPDOOR]); - TrapDoor_Setup(&g_Objects[O_TRAPDOOR2]); + BridgeTilt1_Setup(&g_Objects[O_BRIDGE_TILT_1]); + BridgeTilt2_Setup(&g_Objects[O_BRIDGE_TILT_2]); + Drawbridge_Setup(&g_Objects[O_DRAWBRIDGE]); + Switch_Setup(&g_Objects[O_SWITCH_TYPE_1]); + Switch_SetupUW(&g_Objects[O_SWITCH_TYPE_2]); + Door_Setup(&g_Objects[O_DOOR_TYPE_1]); + Door_Setup(&g_Objects[O_DOOR_TYPE_2]); + Door_Setup(&g_Objects[O_DOOR_TYPE_3]); + Door_Setup(&g_Objects[O_DOOR_TYPE_4]); + Door_Setup(&g_Objects[O_DOOR_TYPE_5]); + Door_Setup(&g_Objects[O_DOOR_TYPE_6]); + Door_Setup(&g_Objects[O_DOOR_TYPE_7]); + Door_Setup(&g_Objects[O_DOOR_TYPE_8]); + TrapDoor_Setup(&g_Objects[O_TRAPDOOR_1]); + TrapDoor_Setup(&g_Objects[O_TRAPDOOR_2]); Cog_Setup(&g_Objects[O_COG_1]); Cog_Setup(&g_Objects[O_COG_2]); Cog_Setup(&g_Objects[O_COG_3]); MovingBar_Setup(&g_Objects[O_MOVING_BAR]); - Pickup_Setup(&g_Objects[O_PICKUP_ITEM1]); - Pickup_Setup(&g_Objects[O_PICKUP_ITEM2]); - Pickup_Setup(&g_Objects[O_KEY_ITEM1]); - Pickup_Setup(&g_Objects[O_KEY_ITEM2]); - Pickup_Setup(&g_Objects[O_KEY_ITEM3]); - Pickup_Setup(&g_Objects[O_KEY_ITEM4]); - Pickup_Setup(&g_Objects[O_PUZZLE_ITEM1]); - Pickup_Setup(&g_Objects[O_PUZZLE_ITEM2]); - Pickup_Setup(&g_Objects[O_PUZZLE_ITEM3]); - Pickup_Setup(&g_Objects[O_PUZZLE_ITEM4]); + Pickup_Setup(&g_Objects[O_PICKUP_ITEM_1]); + Pickup_Setup(&g_Objects[O_PICKUP_ITEM_2]); + Pickup_Setup(&g_Objects[O_KEY_ITEM_1]); + Pickup_Setup(&g_Objects[O_KEY_ITEM_2]); + Pickup_Setup(&g_Objects[O_KEY_ITEM_3]); + Pickup_Setup(&g_Objects[O_KEY_ITEM_4]); + Pickup_Setup(&g_Objects[O_PUZZLE_ITEM_1]); + Pickup_Setup(&g_Objects[O_PUZZLE_ITEM_2]); + Pickup_Setup(&g_Objects[O_PUZZLE_ITEM_3]); + Pickup_Setup(&g_Objects[O_PUZZLE_ITEM_4]); Pickup_Setup(&g_Objects[O_PISTOL_ITEM]); Pickup_Setup(&g_Objects[O_SHOTGUN_ITEM]); Pickup_Setup(&g_Objects[O_MAGNUM_ITEM]); @@ -208,27 +208,27 @@ static void Object_SetupMiscObjects(void) Pickup_Setup(&g_Objects[O_MEDI_ITEM]); Pickup_Setup(&g_Objects[O_BIGMEDI_ITEM]); - Scion1_Setup(&g_Objects[O_SCION_ITEM]); - Scion2_Setup(&g_Objects[O_SCION_ITEM2]); - Scion3_Setup(&g_Objects[O_SCION_ITEM3]); - Scion4_Setup(&g_Objects[O_SCION_ITEM4]); + Scion1_Setup(&g_Objects[O_SCION_ITEM_1]); + Scion2_Setup(&g_Objects[O_SCION_ITEM_2]); + Scion3_Setup(&g_Objects[O_SCION_ITEM_3]); + Scion4_Setup(&g_Objects[O_SCION_ITEM_4]); ScionHolder_Setup(&g_Objects[O_SCION_HOLDER]); Pickup_Setup(&g_Objects[O_LEADBAR_ITEM]); SaveCrystal_Setup(&g_Objects[O_SAVEGAME_ITEM]); - KeyHole_Setup(&g_Objects[O_KEY_HOLE1]); - KeyHole_Setup(&g_Objects[O_KEY_HOLE2]); - KeyHole_Setup(&g_Objects[O_KEY_HOLE3]); - KeyHole_Setup(&g_Objects[O_KEY_HOLE4]); + KeyHole_Setup(&g_Objects[O_KEY_HOLE_1]); + KeyHole_Setup(&g_Objects[O_KEY_HOLE_2]); + KeyHole_Setup(&g_Objects[O_KEY_HOLE_3]); + KeyHole_Setup(&g_Objects[O_KEY_HOLE_4]); - PuzzleHole_Setup(&g_Objects[O_PUZZLE_HOLE1]); - PuzzleHole_Setup(&g_Objects[O_PUZZLE_HOLE2]); - PuzzleHole_Setup(&g_Objects[O_PUZZLE_HOLE3]); - PuzzleHole_Setup(&g_Objects[O_PUZZLE_HOLE4]); - PuzzleHole_SetupDone(&g_Objects[O_PUZZLE_DONE1]); - PuzzleHole_SetupDone(&g_Objects[O_PUZZLE_DONE2]); - PuzzleHole_SetupDone(&g_Objects[O_PUZZLE_DONE3]); - PuzzleHole_SetupDone(&g_Objects[O_PUZZLE_DONE4]); + PuzzleHole_Setup(&g_Objects[O_PUZZLE_HOLE_1]); + PuzzleHole_Setup(&g_Objects[O_PUZZLE_HOLE_2]); + PuzzleHole_Setup(&g_Objects[O_PUZZLE_HOLE_3]); + PuzzleHole_Setup(&g_Objects[O_PUZZLE_HOLE_4]); + PuzzleHole_SetupDone(&g_Objects[O_PUZZLE_DONE_1]); + PuzzleHole_SetupDone(&g_Objects[O_PUZZLE_DONE_2]); + PuzzleHole_SetupDone(&g_Objects[O_PUZZLE_DONE_3]); + PuzzleHole_SetupDone(&g_Objects[O_PUZZLE_DONE_4]); Cabin_Setup(&g_Objects[O_PORTACABIN]); Boat_Setup(&g_Objects[O_BOAT]); @@ -239,17 +239,17 @@ static void Object_SetupMiscObjects(void) CutscenePlayer_Setup(&g_Objects[O_PLAYER_3]); CutscenePlayer_Setup(&g_Objects[O_PLAYER_4]); - Blood_Setup(&g_Objects[O_BLOOD1]); - Bubble_Setup(&g_Objects[O_BUBBLES1]); - Explosion_Setup(&g_Objects[O_EXPLOSION1]); - Ricochet_Setup(&g_Objects[O_RICOCHET1]); + Blood_Setup(&g_Objects[O_BLOOD_1]); + Bubble_Setup(&g_Objects[O_BUBBLES_1]); + Explosion_Setup(&g_Objects[O_EXPLOSION_1]); + Ricochet_Setup(&g_Objects[O_RICOCHET_1]); Twinkle_Setup(&g_Objects[O_TWINKLE]); - Splash_Setup(&g_Objects[O_SPLASH1]); + Splash_Setup(&g_Objects[O_SPLASH_1]); Waterfall_Setup(&g_Objects[O_WATERFALL]); BodyPart_Setup(&g_Objects[O_BODY_PART]); - NatlaGun_Setup(&g_Objects[O_MISSILE1]); - Missile_Setup(&g_Objects[O_MISSILE2]); - Missile_Setup(&g_Objects[O_MISSILE3]); + NatlaGun_Setup(&g_Objects[O_MISSILE_1]); + Missile_Setup(&g_Objects[O_MISSILE_2]); + Missile_Setup(&g_Objects[O_MISSILE_3]); GunShot_Setup(&g_Objects[O_GUN_FLASH]); } diff --git a/src/game/objects/traps/dart.c b/src/game/objects/traps/dart.c index d7548ca6d..216a8a36a 100644 --- a/src/game/objects/traps/dart.c +++ b/src/game/objects/traps/dart.c @@ -52,7 +52,7 @@ void Dart_Control(int16_t item_num) fx->speed = 0; fx->counter = 6; fx->frame_num = -3 * Random_GetControl() / 0x8000; - fx->object_id = O_RICOCHET1; + fx->object_id = O_RICOCHET_1; } } } diff --git a/src/game/objects/traps/midas_touch.c b/src/game/objects/traps/midas_touch.c index 46799396b..b6e43c278 100644 --- a/src/game/objects/traps/midas_touch.c +++ b/src/game/objects/traps/midas_touch.c @@ -63,8 +63,8 @@ void MidasTouch_Collision( if (lara_item->current_anim_state == LS_USE_MIDAS && g_Lara.interact_target.item_num == item_num && Item_TestFrameEqual(lara_item, LF_PICKUP_GOLD_BAR)) { - Overlay_AddPickup(O_PUZZLE_ITEM1); - Inv_AddItem(O_PUZZLE_ITEM1); + Overlay_AddPickup(O_PUZZLE_ITEM_1); + Inv_AddItem(O_PUZZLE_ITEM_1); g_Lara.interact_target.item_num = NO_OBJECT; } diff --git a/src/game/option/option.c b/src/game/option/option.c index 0ff1fc6f9..a55adc14f 100644 --- a/src/game/option/option.c +++ b/src/game/option/option.c @@ -81,16 +81,16 @@ void Option_DoInventory(INVENTORY_ITEM *inv_item) case O_EXPLOSIVE_OPTION: case O_MEDI_OPTION: case O_BIGMEDI_OPTION: - case O_PUZZLE_OPTION1: - case O_PUZZLE_OPTION2: - case O_PUZZLE_OPTION3: - case O_PUZZLE_OPTION4: - case O_KEY_OPTION1: - case O_KEY_OPTION2: - case O_KEY_OPTION3: - case O_KEY_OPTION4: - case O_PICKUP_OPTION1: - case O_PICKUP_OPTION2: + case O_PUZZLE_OPTION_1: + case O_PUZZLE_OPTION_2: + case O_PUZZLE_OPTION_3: + case O_PUZZLE_OPTION_4: + case O_KEY_OPTION_1: + case O_KEY_OPTION_2: + case O_KEY_OPTION_3: + case O_KEY_OPTION_4: + case O_PICKUP_OPTION_1: + case O_PICKUP_OPTION_2: case O_SCION_OPTION: g_InputDB.menu_confirm = 1; break; diff --git a/src/game/phase/phase_inventory.c b/src/game/phase/phase_inventory.c index 4438d7612..1b563c7c8 100644 --- a/src/game/phase/phase_inventory.c +++ b/src/game/phase/phase_inventory.c @@ -320,14 +320,14 @@ static PHASE_CONTROL Inv_Close(GAME_OBJECT_ID inv_chosen) case O_UZI_OPTION: case O_MEDI_OPTION: case O_BIGMEDI_OPTION: - case O_KEY_OPTION1: - case O_KEY_OPTION2: - case O_KEY_OPTION3: - case O_KEY_OPTION4: - case O_PUZZLE_OPTION1: - case O_PUZZLE_OPTION2: - case O_PUZZLE_OPTION3: - case O_PUZZLE_OPTION4: + case O_KEY_OPTION_1: + case O_KEY_OPTION_2: + case O_KEY_OPTION_3: + case O_KEY_OPTION_4: + case O_PUZZLE_OPTION_1: + case O_PUZZLE_OPTION_2: + case O_PUZZLE_OPTION_3: + case O_PUZZLE_OPTION_4: case O_LEADBAR_OPTION: case O_SCION_OPTION: Lara_UseItem(inv_chosen); diff --git a/src/game/room.c b/src/game/room.c index 99cdf52c1..2a3c33e56 100644 --- a/src/game/room.c +++ b/src/game/room.c @@ -132,10 +132,10 @@ static void Room_AddFlipItems(ROOM_INFO *r) ITEM_INFO *item = &g_Items[item_num]; switch (item->object_id) { - case O_MOVABLE_BLOCK: - case O_MOVABLE_BLOCK2: - case O_MOVABLE_BLOCK3: - case O_MOVABLE_BLOCK4: + case O_MOVABLE_BLOCK_1: + case O_MOVABLE_BLOCK_2: + case O_MOVABLE_BLOCK_3: + case O_MOVABLE_BLOCK_4: Room_AlterFloorHeight(item, -WALL_L); break; @@ -156,10 +156,10 @@ static void Room_RemoveFlipItems(ROOM_INFO *r) ITEM_INFO *item = &g_Items[item_num]; switch (item->object_id) { - case O_MOVABLE_BLOCK: - case O_MOVABLE_BLOCK2: - case O_MOVABLE_BLOCK3: - case O_MOVABLE_BLOCK4: + case O_MOVABLE_BLOCK_1: + case O_MOVABLE_BLOCK_2: + case O_MOVABLE_BLOCK_3: + case O_MOVABLE_BLOCK_4: Room_AlterFloorHeight(item, WALL_L); break; diff --git a/src/game/savegame/savegame.c b/src/game/savegame/savegame.c index 7ba4cd06c..26db7e145 100644 --- a/src/game/savegame/savegame.c +++ b/src/game/savegame/savegame.c @@ -101,7 +101,7 @@ static void Savegame_LoadPostprocess(void) if (obj->collision == PuzzleHole_Collision && (item->status == IS_DEACTIVATED || item->status == IS_ACTIVE)) { - item->object_id += O_PUZZLE_DONE1 - O_PUZZLE_HOLE1; + item->object_id += O_PUZZLE_DONE_1 - O_PUZZLE_HOLE_1; } if (obj->control == Pod_Control && item->status == IS_DEACTIVATED) { @@ -379,7 +379,7 @@ void Savegame_PersistGameToCurrentInfo(int level_num) current->num_medis = Inv_RequestItem(O_MEDI_ITEM); current->num_big_medis = Inv_RequestItem(O_BIGMEDI_ITEM); - current->num_scions = Inv_RequestItem(O_SCION_ITEM); + current->num_scions = Inv_RequestItem(O_SCION_ITEM_1); current->equipped_gun_type = g_Lara.gun_type; current->holsters_gun_type = g_Lara.holsters_gun_type; diff --git a/src/game/savegame/savegame_bson.c b/src/game/savegame/savegame_bson.c index 976f5abdc..920c7ad77 100644 --- a/src/game/savegame/savegame_bson.c +++ b/src/game/savegame/savegame_bson.c @@ -148,10 +148,10 @@ static bool Savegame_BSON_IsValidItemObject( // clang-format off switch (saved_object_id) { // used keyholes - case O_PUZZLE_DONE1: return initial_object_id == O_PUZZLE_HOLE1; - case O_PUZZLE_DONE2: return initial_object_id == O_PUZZLE_HOLE2; - case O_PUZZLE_DONE3: return initial_object_id == O_PUZZLE_HOLE3; - case O_PUZZLE_DONE4: return initial_object_id == O_PUZZLE_HOLE4; + case O_PUZZLE_DONE_1: return initial_object_id == O_PUZZLE_HOLE_1; + case O_PUZZLE_DONE_2: return initial_object_id == O_PUZZLE_HOLE_2; + case O_PUZZLE_DONE_3: return initial_object_id == O_PUZZLE_HOLE_3; + case O_PUZZLE_DONE_4: return initial_object_id == O_PUZZLE_HOLE_4; // pickups case O_PISTOL_AMMO_ITEM: return initial_object_id == O_PISTOL_ANIM; case O_SG_AMMO_ITEM: return initial_object_id == O_SHOTGUN_ITEM; @@ -407,21 +407,21 @@ static bool Savegame_BSON_LoadInventory(struct json_object_s *inv_obj) } Lara_InitialiseInventory(g_CurrentLevel); Inv_AddItemNTimes( - O_PICKUP_ITEM1, json_object_get_int(inv_obj, "pickup1", 0)); + O_PICKUP_ITEM_1, json_object_get_int(inv_obj, "pickup1", 0)); Inv_AddItemNTimes( - O_PICKUP_ITEM2, json_object_get_int(inv_obj, "pickup2", 0)); + O_PICKUP_ITEM_2, json_object_get_int(inv_obj, "pickup2", 0)); Inv_AddItemNTimes( - O_PUZZLE_ITEM1, json_object_get_int(inv_obj, "puzzle1", 0)); + O_PUZZLE_ITEM_1, json_object_get_int(inv_obj, "puzzle1", 0)); Inv_AddItemNTimes( - O_PUZZLE_ITEM2, json_object_get_int(inv_obj, "puzzle2", 0)); + O_PUZZLE_ITEM_2, json_object_get_int(inv_obj, "puzzle2", 0)); Inv_AddItemNTimes( - O_PUZZLE_ITEM3, json_object_get_int(inv_obj, "puzzle3", 0)); + O_PUZZLE_ITEM_3, json_object_get_int(inv_obj, "puzzle3", 0)); Inv_AddItemNTimes( - O_PUZZLE_ITEM4, json_object_get_int(inv_obj, "puzzle4", 0)); - Inv_AddItemNTimes(O_KEY_ITEM1, json_object_get_int(inv_obj, "key1", 0)); - Inv_AddItemNTimes(O_KEY_ITEM2, json_object_get_int(inv_obj, "key2", 0)); - Inv_AddItemNTimes(O_KEY_ITEM3, json_object_get_int(inv_obj, "key3", 0)); - Inv_AddItemNTimes(O_KEY_ITEM4, json_object_get_int(inv_obj, "key4", 0)); + O_PUZZLE_ITEM_4, json_object_get_int(inv_obj, "puzzle4", 0)); + Inv_AddItemNTimes(O_KEY_ITEM_1, json_object_get_int(inv_obj, "key1", 0)); + Inv_AddItemNTimes(O_KEY_ITEM_2, json_object_get_int(inv_obj, "key2", 0)); + Inv_AddItemNTimes(O_KEY_ITEM_3, json_object_get_int(inv_obj, "key3", 0)); + Inv_AddItemNTimes(O_KEY_ITEM_4, json_object_get_int(inv_obj, "key4", 0)); Inv_AddItemNTimes( O_LEADBAR_ITEM, json_object_get_int(inv_obj, "leadbar", 0)); return true; @@ -995,16 +995,22 @@ static struct json_object_s *Savegame_BSON_DumpMisc(GAME_INFO *game_info) static struct json_object_s *Savegame_BSON_DumpInventory(void) { struct json_object_s *inv_obj = json_object_new(); - json_object_append_int(inv_obj, "pickup1", Inv_RequestItem(O_PICKUP_ITEM1)); - json_object_append_int(inv_obj, "pickup2", Inv_RequestItem(O_PICKUP_ITEM2)); - json_object_append_int(inv_obj, "puzzle1", Inv_RequestItem(O_PUZZLE_ITEM1)); - json_object_append_int(inv_obj, "puzzle2", Inv_RequestItem(O_PUZZLE_ITEM2)); - json_object_append_int(inv_obj, "puzzle3", Inv_RequestItem(O_PUZZLE_ITEM3)); - json_object_append_int(inv_obj, "puzzle4", Inv_RequestItem(O_PUZZLE_ITEM4)); - json_object_append_int(inv_obj, "key1", Inv_RequestItem(O_KEY_ITEM1)); - json_object_append_int(inv_obj, "key2", Inv_RequestItem(O_KEY_ITEM2)); - json_object_append_int(inv_obj, "key3", Inv_RequestItem(O_KEY_ITEM3)); - json_object_append_int(inv_obj, "key4", Inv_RequestItem(O_KEY_ITEM4)); + json_object_append_int( + inv_obj, "pickup1", Inv_RequestItem(O_PICKUP_ITEM_1)); + json_object_append_int( + inv_obj, "pickup2", Inv_RequestItem(O_PICKUP_ITEM_2)); + json_object_append_int( + inv_obj, "puzzle1", Inv_RequestItem(O_PUZZLE_ITEM_1)); + json_object_append_int( + inv_obj, "puzzle2", Inv_RequestItem(O_PUZZLE_ITEM_2)); + json_object_append_int( + inv_obj, "puzzle3", Inv_RequestItem(O_PUZZLE_ITEM_3)); + json_object_append_int( + inv_obj, "puzzle4", Inv_RequestItem(O_PUZZLE_ITEM_4)); + json_object_append_int(inv_obj, "key1", Inv_RequestItem(O_KEY_ITEM_1)); + json_object_append_int(inv_obj, "key2", Inv_RequestItem(O_KEY_ITEM_2)); + json_object_append_int(inv_obj, "key3", Inv_RequestItem(O_KEY_ITEM_3)); + json_object_append_int(inv_obj, "key4", Inv_RequestItem(O_KEY_ITEM_4)); json_object_append_int(inv_obj, "leadbar", Inv_RequestItem(O_LEADBAR_ITEM)); return inv_obj; } diff --git a/src/game/savegame/savegame_legacy.c b/src/game/savegame/savegame_legacy.c index a21bd2e91..e16313ef2 100644 --- a/src/game/savegame/savegame_legacy.c +++ b/src/game/savegame/savegame_legacy.c @@ -76,7 +76,7 @@ static bool Savegame_Legacy_ItemHasSaveFlags(OBJECT_INFO *obj, ITEM_INFO *item) return ( obj->save_flags && item->object_id != O_EMBER_EMITTER && item->object_id != O_FLAME_EMITTER && item->object_id != O_WATERFALL - && item->object_id != O_SCION_ITEM + && item->object_id != O_SCION_ITEM_1 && item->object_id != O_DART_EMITTER); } @@ -537,16 +537,16 @@ bool Savegame_Legacy_LoadFromFile(MYFILE *fp, GAME_INFO *game_info) Lara_InitialiseInventory(g_CurrentLevel); SAVEGAME_LEGACY_ITEM_STATS item_stats = { 0 }; Savegame_Legacy_Read(&item_stats, sizeof(SAVEGAME_LEGACY_ITEM_STATS)); - Inv_AddItemNTimes(O_PICKUP_ITEM1, item_stats.num_pickup1); - Inv_AddItemNTimes(O_PICKUP_ITEM2, item_stats.num_pickup2); - Inv_AddItemNTimes(O_PUZZLE_ITEM1, item_stats.num_puzzle1); - Inv_AddItemNTimes(O_PUZZLE_ITEM2, item_stats.num_puzzle2); - Inv_AddItemNTimes(O_PUZZLE_ITEM3, item_stats.num_puzzle3); - Inv_AddItemNTimes(O_PUZZLE_ITEM4, item_stats.num_puzzle4); - Inv_AddItemNTimes(O_KEY_ITEM1, item_stats.num_key1); - Inv_AddItemNTimes(O_KEY_ITEM2, item_stats.num_key2); - Inv_AddItemNTimes(O_KEY_ITEM3, item_stats.num_key3); - Inv_AddItemNTimes(O_KEY_ITEM4, item_stats.num_key4); + Inv_AddItemNTimes(O_PICKUP_ITEM_1, item_stats.num_pickup1); + Inv_AddItemNTimes(O_PICKUP_ITEM_2, item_stats.num_pickup2); + Inv_AddItemNTimes(O_PUZZLE_ITEM_1, item_stats.num_puzzle1); + Inv_AddItemNTimes(O_PUZZLE_ITEM_2, item_stats.num_puzzle2); + Inv_AddItemNTimes(O_PUZZLE_ITEM_3, item_stats.num_puzzle3); + Inv_AddItemNTimes(O_PUZZLE_ITEM_4, item_stats.num_puzzle4); + Inv_AddItemNTimes(O_KEY_ITEM_1, item_stats.num_key1); + Inv_AddItemNTimes(O_KEY_ITEM_2, item_stats.num_key2); + Inv_AddItemNTimes(O_KEY_ITEM_3, item_stats.num_key3); + Inv_AddItemNTimes(O_KEY_ITEM_4, item_stats.num_key4); Inv_AddItemNTimes(O_LEADBAR_ITEM, item_stats.num_leadbar); Savegame_Legacy_Read(&tmp32, sizeof(int32_t)); @@ -716,16 +716,16 @@ void Savegame_Legacy_SaveToFile(MYFILE *fp, GAME_INFO *game_info) Savegame_Legacy_Write(&game_info->bonus_flag, sizeof(uint8_t)); SAVEGAME_LEGACY_ITEM_STATS item_stats = { - .num_pickup1 = Inv_RequestItem(O_PICKUP_ITEM1), - .num_pickup2 = Inv_RequestItem(O_PICKUP_ITEM2), - .num_puzzle1 = Inv_RequestItem(O_PUZZLE_ITEM1), - .num_puzzle2 = Inv_RequestItem(O_PUZZLE_ITEM2), - .num_puzzle3 = Inv_RequestItem(O_PUZZLE_ITEM3), - .num_puzzle4 = Inv_RequestItem(O_PUZZLE_ITEM4), - .num_key1 = Inv_RequestItem(O_KEY_ITEM1), - .num_key2 = Inv_RequestItem(O_KEY_ITEM2), - .num_key3 = Inv_RequestItem(O_KEY_ITEM3), - .num_key4 = Inv_RequestItem(O_KEY_ITEM4), + .num_pickup1 = Inv_RequestItem(O_PICKUP_ITEM_1), + .num_pickup2 = Inv_RequestItem(O_PICKUP_ITEM_2), + .num_puzzle1 = Inv_RequestItem(O_PUZZLE_ITEM_1), + .num_puzzle2 = Inv_RequestItem(O_PUZZLE_ITEM_2), + .num_puzzle3 = Inv_RequestItem(O_PUZZLE_ITEM_3), + .num_puzzle4 = Inv_RequestItem(O_PUZZLE_ITEM_4), + .num_key1 = Inv_RequestItem(O_KEY_ITEM_1), + .num_key2 = Inv_RequestItem(O_KEY_ITEM_2), + .num_key3 = Inv_RequestItem(O_KEY_ITEM_3), + .num_key4 = Inv_RequestItem(O_KEY_ITEM_4), .num_leadbar = Inv_RequestItem(O_LEADBAR_ITEM), 0 }; diff --git a/src/game/stats.c b/src/game/stats.c index 828dfc579..e7342cbb4 100644 --- a/src/game/stats.c +++ b/src/game/stats.c @@ -5,6 +5,7 @@ #include "game/gamebuf.h" #include "game/gameflow.h" #include "game/items.h" +#include "game/objects/common.h" #include "global/const.h" #include "global/types.h" #include "global/vars.h" @@ -31,30 +32,9 @@ static struct { int32_t start_timer; } m_StatsTimer = { 0 }; -int16_t m_PickupObjs[] = { - O_PICKUP_ITEM1, O_PICKUP_ITEM2, O_KEY_ITEM1, O_KEY_ITEM2, - O_KEY_ITEM3, O_KEY_ITEM4, O_PUZZLE_ITEM1, O_PUZZLE_ITEM2, - O_PUZZLE_ITEM3, O_PUZZLE_ITEM4, O_PISTOL_ITEM, O_SHOTGUN_ITEM, - O_MAGNUM_ITEM, O_UZI_ITEM, O_PISTOL_AMMO_ITEM, O_SG_AMMO_ITEM, - O_MAG_AMMO_ITEM, O_UZI_AMMO_ITEM, O_EXPLOSIVE_ITEM, O_MEDI_ITEM, - O_BIGMEDI_ITEM, O_SCION_ITEM, O_SCION_ITEM2, O_LEADBAR_ITEM, - NO_ITEM -}; - -// Pierre and pods have special trigger check -int16_t m_KillableObjs[] = { - O_WOLF, O_BEAR, O_BAT, O_CROCODILE, O_ALLIGATOR, - O_LION, O_LIONESS, O_PUMA, O_APE, O_RAT, - O_VOLE, O_TREX, O_RAPTOR, O_WARRIOR1, O_WARRIOR2, - O_WARRIOR3, O_CENTAUR, O_MUMMY, O_TORSO, O_DINO_WARRIOR, - O_FISH, O_LARSON, O_SKATEKID, O_COWBOY, O_BALDY, - O_NATLA, O_SCION_ITEM3, O_STATUE, NO_ITEM -}; - static void Stats_TraverseFloor(void); static void Stats_CheckTriggers( ROOM_INFO *r, int room_num, int z_sector, int x_sector); -static bool Stats_IsObjectKillable(GAME_OBJECT_ID object_id); static void Stats_IncludeKillableItem(int16_t item_num); static void Stats_TraverseFloor(void) @@ -104,39 +84,34 @@ static void Stats_CheckTriggers( const ITEM_INFO *const item = &g_Items[item_num]; - // Add Pierre pickup and kills if oneshot - if (item->object_id == O_PIERRE && sector->trigger->one_shot) { - Stats_IncludeKillableItem(item_num); + if (item->object_id == O_PIERRE) { + // Add Pierre pickup and kills if oneshot + if (sector->trigger->one_shot) { + Stats_IncludeKillableItem(item_num); + } + continue; } - // Check for only valid pods - if ((item->object_id == O_PODS || item->object_id == O_BIG_POD) - && item->data != NULL) { - const int16_t bug_item_num = *(int16_t *)item->data; - const ITEM_INFO *const bug_item = &g_Items[bug_item_num]; - if (g_Objects[bug_item->object_id].loaded) { - Stats_IncludeKillableItem(item_num); + if (item->object_id == O_PODS || item->object_id == O_BIG_POD) { + // Check for only valid pods + if (item->data != NULL) { + const int16_t bug_item_num = *(int16_t *)item->data; + const ITEM_INFO *const bug_item = &g_Items[bug_item_num]; + if (g_Objects[bug_item->object_id].loaded) { + Stats_IncludeKillableItem(item_num); + } } + continue; } // Add killable if object triggered - if (Stats_IsObjectKillable(item->object_id)) { + if (Object_IsObjectType(item->object_id, g_EnemyObjects)) { Stats_IncludeKillableItem(item_num); } } } } -static bool Stats_IsObjectKillable(const GAME_OBJECT_ID object_id) -{ - for (int i = 0; m_KillableObjs[i] != NO_ITEM; i++) { - if (m_KillableObjs[i] == object_id) { - return true; - } - } - return false; -} - static void Stats_IncludeKillableItem(int16_t item_num) { m_KillableItems[item_num] = true; @@ -219,10 +194,8 @@ void Stats_CalculateStats(void) continue; } - for (int j = 0; m_PickupObjs[j] != NO_ITEM; j++) { - if (item->object_id == m_PickupObjs[j]) { - m_LevelPickups++; - } + if (Object_IsObjectType(item->object_id, g_PickupObjects)) { + m_LevelPickups++; } } } diff --git a/subprojects/libtrx b/subprojects/libtrx index 255ff44fe..77e0cbab2 160000 --- a/subprojects/libtrx +++ b/subprojects/libtrx @@ -1 +1 @@ -Subproject commit 255ff44fed19f085a43cf94a6d0b5a5d80b9f718 +Subproject commit 77e0cbab276bf83ab242fbfa4335a8379e5ac2f0