From 42ff9742ed66b33b2059568639f9d1e103cda3f2 Mon Sep 17 00:00:00 2001 From: Adam Bird Date: Fri, 21 Apr 2023 19:01:19 -0400 Subject: [PATCH] Tweak: Unique GetItemEntry for Progressive Bombchus with particle effects (#2732) * give progressive bombchus its own getitementry to allow custom draw effects * fix timestamp item check --- .../Enhancements/randomizer/randomizer.cpp | 10 +--- soh/src/code/z_en_item00.c | 53 +++++++++++-------- soh/src/code/z_parameter.c | 15 +++++- 3 files changed, 46 insertions(+), 32 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index 30347c308..0bffcc8bd 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -2002,14 +2002,6 @@ GetItemID Randomizer::GetItemIdFromRandomizerGet(RandomizerGet randoGet, GetItem case ITEM_OCARINA_TIME: return GI_OCARINA_OOT; } - case RG_PROGRESSIVE_BOMBCHUS: - if (INV_CONTENT(ITEM_BOMBCHU) == ITEM_NONE) { - return GI_BOMBCHUS_20; - } - if (AMMO(ITEM_BOMBCHU) < 5) { - return GI_BOMBCHUS_10; - } - return GI_BOMBCHUS_5; case RG_BOMBCHU_5: case RG_BOMBCHU_DROP: return GI_BOMBCHUS_5; @@ -2318,7 +2310,6 @@ bool Randomizer::IsItemVanilla(RandomizerGet randoGet) { case RG_PROGRESSIVE_SCALE: case RG_PROGRESSIVE_NUT_UPGRADE: case RG_PROGRESSIVE_STICK_UPGRADE: - case RG_PROGRESSIVE_BOMBCHUS: case RG_PROGRESSIVE_OCARINA: case RG_PROGRESSIVE_GORONSWORD: case RG_EMPTY_BOTTLE: @@ -5429,6 +5420,7 @@ void InitRandoItemTable() { GET_ITEM(RG_ICE_CAVERN_COMPASS, OBJECT_GI_COMPASS, GID_COMPASS, TEXT_RANDOMIZER_CUSTOM_ITEM, 0x80, CHEST_ANIM_LONG, ITEM_CATEGORY_LESSER, MOD_RANDOMIZER, RG_ICE_CAVERN_COMPASS), GET_ITEM(RG_MAGIC_BEAN_PACK, OBJECT_GI_BEAN, GID_BEAN, TEXT_RANDOMIZER_CUSTOM_ITEM, 0x80, CHEST_ANIM_LONG, ITEM_CATEGORY_MAJOR, MOD_RANDOMIZER, RG_MAGIC_BEAN_PACK), GET_ITEM(RG_TYCOON_WALLET, OBJECT_GI_PURSE, GID_WALLET_GIANT, TEXT_RANDOMIZER_CUSTOM_ITEM, 0x80, CHEST_ANIM_LONG, ITEM_CATEGORY_LESSER, MOD_RANDOMIZER, RG_TYCOON_WALLET), + GET_ITEM(RG_PROGRESSIVE_BOMBCHUS, OBJECT_GI_BOMB_2, GID_BOMBCHU, 0x33, 0x80, CHEST_ANIM_LONG, ITEM_CATEGORY_MAJOR, MOD_RANDOMIZER, RG_PROGRESSIVE_BOMBCHUS), }; ItemTableManager::Instance->AddItemTable(MOD_RANDOMIZER); for (int i = 0; i < ARRAY_COUNT(extendedVanillaGetItemTable); i++) { diff --git a/soh/src/code/z_en_item00.c b/soh/src/code/z_en_item00.c index f76490e93..6ab7c0ede 100644 --- a/soh/src/code/z_en_item00.c +++ b/soh/src/code/z_en_item00.c @@ -1307,6 +1307,9 @@ void EnItem00_CustomItemsParticles(Actor* Parent, PlayState* play, GetItemEntry case RG_DOUBLE_DEFENSE: color_slot = 8; break; + case RG_PROGRESSIVE_BOMBCHUS: + color_slot = 9; + break; default: return; } @@ -1315,34 +1318,40 @@ void EnItem00_CustomItemsParticles(Actor* Parent, PlayState* play, GetItemEntry return; } - s16* colors[9][3] = { - { 34, 255, 76 }, // Minuet and Magic Upgrades Colors - { 177, 35, 35 }, // Bolero Colors - { 115, 251, 253 }, // Serenade Color - { 177, 122, 35 }, // Requiem Color - { 177, 28, 212 }, // Nocturne Color - { 255, 255, 92 }, // Prelude Color - { 31, 152, 49 }, // Stick Upgrade Color - { 222, 182, 20 }, // Nut Upgrade Color - { 255, 255, 255 } // Double Defense Color + // Color of the circle for the particles + static Color_RGBA8 mainColors[10][3] = { + { 34, 255, 76 }, // Minuet, Bean Pack, and Magic Upgrades + { 177, 35, 35 }, // Bolero + { 115, 251, 253 }, // Serenade + { 177, 122, 35 }, // Requiem + { 177, 28, 212 }, // Nocturne + { 255, 255, 92 }, // Prelude + { 31, 152, 49 }, // Stick Upgrade + { 222, 182, 20 }, // Nut Upgrade + { 255, 255, 255 }, // Double Defense + { 19, 120, 182 } // Progressive Bombchu }; - s16* colorsEnv[9][3] = { - { 30, 110, 30 }, // Minuet and Magic Upgrades Colors - { 90, 10, 10 }, // Bolero and Double Defense Colors - { 35, 35, 177 }, // Serenade Color - { 70, 20, 10 }, // Requiem Color - { 100, 20, 140 }, // Nocturne Color - { 100, 100, 10 }, // Prelude Color - { 5, 50, 10 }, // Stick Upgrade Color - { 150, 100, 5 }, // Nut Upgrade Color - { 154, 154, 154 } // White Color placeholder + // Color of the faded flares stretching off the particles + static Color_RGBA8 flareColors[10][3] = { + { 30, 110, 30 }, // Minuet, Bean Pack, and Magic Upgrades + { 90, 10, 10 }, // Bolero + { 35, 35, 177 }, // Serenade + { 70, 20, 10 }, // Requiem + { 100, 20, 140 }, // Nocturne + { 100, 100, 10 }, // Prelude + { 5, 50, 10 }, // Stick Upgrade + { 150, 100, 5 }, // Nut Upgrade + { 154, 154, 154 }, // Double Defense + { 204, 102, 0 } // Progressive Bombchu }; static Vec3f velocity = { 0.0f, 0.0f, 0.0f }; static Vec3f accel = { 0.0f, 0.0f, 0.0f }; - Color_RGBA8 primColor = { colors[color_slot][0], colors[color_slot][1], colors[color_slot][2], 0 }; - Color_RGBA8 envColor = { colors[color_slot][0], colors[color_slot][1], colors[color_slot][2], 0 }; + Color_RGBA8 primColor; + Color_RGBA8 envColor; + Color_RGBA8_Copy(&primColor, &mainColors[color_slot]); + Color_RGBA8_Copy(&envColor, &flareColors[color_slot]); Vec3f pos; // Make particles more compact for shop items and use a different height offset for them. diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c index ff22c0e12..68db893fb 100644 --- a/soh/src/code/z_parameter.c +++ b/soh/src/code/z_parameter.c @@ -1703,7 +1703,7 @@ void Randomizer_GameplayStats_SetTimestamp(uint16_t item) { return; } // Count any bombchu pack as bombchus - if (item >= RG_BOMBCHU_5 && item <= RG_BOMBCHU_DROP) { + if ((item >= RG_BOMBCHU_5 && item <= RG_BOMBCHU_DROP) || item == RG_PROGRESSIVE_BOMBCHUS) { if (gSaveContext.sohStats.itemTimestamp[ITEM_BOMBCHU] = 0) { gSaveContext.sohStats.itemTimestamp[ITEM_BOMBCHU] = time; } @@ -2548,6 +2548,19 @@ u16 Randomizer_Item_Give(PlayState* play, GetItemEntry giEntry) { return Return_Item_Entry(giEntry, RG_NONE); } + if (item == RG_PROGRESSIVE_BOMBCHUS) { + if (INV_CONTENT(ITEM_BOMBCHU) == ITEM_NONE) { + INV_CONTENT(ITEM_BOMBCHU) = ITEM_BOMBCHU; + AMMO(ITEM_BOMBCHU) = 20; + } else { + AMMO(ITEM_BOMBCHU) += AMMO(ITEM_BOMBCHU) < 5 ? 10 : 5; + if (AMMO(ITEM_BOMBCHU) > 50) { + AMMO(ITEM_BOMBCHU) = 50; + } + } + return Return_Item_Entry(giEntry, RG_NONE); + } + temp = gSaveContext.inventory.items[slot]; osSyncPrintf("Item_Register(%d)=%d %d\n", slot, item, temp); INV_CONTENT(item) = item;