From 3d8752b3aa53030cc3aa92b9f66c114378c62542 Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Thu, 16 Feb 2023 20:10:31 -0500 Subject: [PATCH] you found greg! (#2458) adds greg to the item tracker --------- Co-authored-by: briaguya --- .../Enhancements/debugger/debugSaveEditor.cpp | 11 ++++++ .../3drando/hint_list/hint_list_item.cpp | 12 +++++++ .../randomizer/3drando/item_list.cpp | 1 + .../randomizer/3drando/item_location.cpp | 2 +- .../randomizer/3drando/item_pool.cpp | 2 +- .../Enhancements/randomizer/3drando/keys.hpp | 1 + .../Enhancements/randomizer/randomizer.cpp | 6 ++++ .../Enhancements/randomizer/randomizerTypes.h | 1 + .../Enhancements/randomizer/randomizer_inf.h | 2 ++ .../randomizer/randomizer_item_tracker.cpp | 34 +++++++++++++++++++ soh/soh/OTRGlobals.cpp | 2 +- soh/src/code/z_parameter.c | 6 ++++ 12 files changed, 77 insertions(+), 3 deletions(-) diff --git a/soh/soh/Enhancements/debugger/debugSaveEditor.cpp b/soh/soh/Enhancements/debugger/debugSaveEditor.cpp index 86af3c9c6..314358271 100644 --- a/soh/soh/Enhancements/debugger/debugSaveEditor.cpp +++ b/soh/soh/Enhancements/debugger/debugSaveEditor.cpp @@ -139,6 +139,10 @@ std::map itemMapping = { ITEM_MAP_ENTRY(ITEM_MAGIC_LARGE) }; +std::map gregMapping = { + {ITEM_RUPEE_GREEN, {ITEM_RUPEE_GREEN, "ITEM_RUPEE_GREEN", "ITEM_RUPEE_GREEN_Faded", "__OTR__textures/parameter_static/gRupeeCounterIconTex"}} +}; + // Maps entries in the GS flag array to the area name it represents std::vector gsMapping = { "Deku Tree", @@ -1783,6 +1787,13 @@ void InitSaveEditor() { SohImGui::LoadResource(entry.second.name, entry.second.texturePath); SohImGui::LoadResource(entry.second.nameFaded, entry.second.texturePath, ImVec4(1, 1, 1, 0.3f)); } + for (const auto& entry : gregMapping) { + ImVec4 gregGreen = ImVec4(42.0f / 255.0f, 169.0f / 255.0f, 40.0f / 255.0f, 1.0f); + ImVec4 gregFadedGreen = gregGreen; + gregFadedGreen.w = 0.3f; + SohImGui::LoadResource(entry.second.name, entry.second.texturePath, gregGreen); + SohImGui::LoadResource(entry.second.nameFaded, entry.second.texturePath, gregFadedGreen); + } for (const auto& entry : questMapping) { SohImGui::LoadResource(entry.second.name, entry.second.texturePath); SohImGui::LoadResource(entry.second.nameFaded, entry.second.texturePath, ImVec4(1, 1, 1, 0.3f)); diff --git a/soh/soh/Enhancements/randomizer/3drando/hint_list/hint_list_item.cpp b/soh/soh/Enhancements/randomizer/3drando/hint_list/hint_list_item.cpp index 182948828..c074ffbf2 100644 --- a/soh/soh/Enhancements/randomizer/3drando/hint_list/hint_list_item.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/hint_list/hint_list_item.cpp @@ -1629,6 +1629,18 @@ void HintTable_Init_Item() { Text{"a Green Rupee", /*french*/"un rubis vert", /*spanish*/"una rupia verde"} ); + hintTable[GREG_RUPEE] = HintText::Item({ + //obscure text + Text{"an old friend", /*french*/"Greg", /*spanish*/"Greg"}, + Text{"a glorious gem", /*french*/"Greg", /*spanish*/"Greg"}, + }, { + //ambiguous text + Text{"a Green Rupee", /*french*/"un rubis vert", /*spanish*/"una rupia verde"} + }, + //clear text + Text{"Greg", /*french*/"Greg", /*spanish*/"Greg"} + ); + hintTable[BLUE_RUPEE] = HintText::Item({ //obscure text Text{"a common coin", /*french*/"quelques sous", /*spanish*/"una moneda usual"}, diff --git a/soh/soh/Enhancements/randomizer/3drando/item_list.cpp b/soh/soh/Enhancements/randomizer/3drando/item_list.cpp index d7fc6cfcc..a8597c0fe 100644 --- a/soh/soh/Enhancements/randomizer/3drando/item_list.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/item_list.cpp @@ -177,6 +177,7 @@ void ItemTable_Init() { // RandomizerGet //Generic Items itemTable[RECOVERY_HEART] = Item(RG_RECOVERY_HEART, Text{"Recovery Heart", "Coeur de Vie", "Corazón"}, ITEMTYPE_ITEM, GI_HEART, false, &noVariable, RECOVERY_HEART); itemTable[GREEN_RUPEE] = Item(RG_GREEN_RUPEE, Text{"Green Rupee", "Rubis Vert", "Rupia verde"}, ITEMTYPE_ITEM, GI_RUPEE_GREEN, false, &noVariable, GREEN_RUPEE); + itemTable[GREG_RUPEE] = Item(RG_GREG_RUPEE, Text{"Greg Rupee", "Rubis Greg", "Rupia Greg"}, ITEMTYPE_ITEM, GI_RUPEE_GREEN, false, &noVariable, GREG_RUPEE); itemTable[BLUE_RUPEE] = Item(RG_BLUE_RUPEE, Text{"Blue Rupee", "Rubis Bleu", "Rupia azul"}, ITEMTYPE_ITEM, GI_RUPEE_BLUE, false, &noVariable, BLUE_RUPEE); itemTable[RED_RUPEE] = Item(RG_RED_RUPEE, Text{"Red Rupee", "Rubis Rouge", "Rupia roja"}, ITEMTYPE_ITEM, GI_RUPEE_RED, false, &noVariable, RED_RUPEE); itemTable[PURPLE_RUPEE] = Item(RG_PURPLE_RUPEE, Text{"Purple Rupee", "Rubis Pourpre", "Rupia morada"}, ITEMTYPE_ITEM, GI_RUPEE_PURPLE, false, &noVariable, PURPLE_RUPEE); diff --git a/soh/soh/Enhancements/randomizer/3drando/item_location.cpp b/soh/soh/Enhancements/randomizer/3drando/item_location.cpp index d91511f98..ec7e4a9a7 100644 --- a/soh/soh/Enhancements/randomizer/3drando/item_location.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/item_location.cpp @@ -19,7 +19,7 @@ void LocationTable_Init() { locationTable[KF_KOKIRI_SWORD_CHEST] = ItemLocation::Chest (RC_KF_KOKIRI_SWORD_CHEST, 0x55, 0x00, "KF Kokiri Sword Chest", KF_KOKIRI_SWORD_CHEST, KOKIRI_SWORD, {Category::cKokiriForest, Category::cForest,}, SpoilerCollectionCheckGroup::GROUP_KOKIRI_FOREST); locationTable[KF_MIDOS_TOP_LEFT_CHEST] = ItemLocation::Chest (RC_KF_MIDOS_TOP_LEFT_CHEST, 0x28, 0x00, "KF Mido Top Left Chest", KF_MIDOS_TOP_LEFT_CHEST, BLUE_RUPEE, {Category::cKokiriForest, Category::cForest,}, SpoilerCollectionCheckGroup::GROUP_KOKIRI_FOREST); locationTable[KF_MIDOS_TOP_RIGHT_CHEST] = ItemLocation::Chest (RC_KF_MIDOS_TOP_RIGHT_CHEST, 0x28, 0x01, "KF Mido Top Right Chest", KF_MIDOS_TOP_RIGHT_CHEST, BLUE_RUPEE, {Category::cKokiriForest, Category::cForest,}, SpoilerCollectionCheckGroup::GROUP_KOKIRI_FOREST); - locationTable[KF_MIDOS_BOTTOM_LEFT_CHEST] = ItemLocation::Chest (RC_KF_MIDOS_BOTTOM_LEFT_CHEST, 0x28, 0x02, "KF Mido Bottom Left Chest", KF_MIDOS_BOTTOM_LEFT_CHEST, GREEN_RUPEE, {Category::cKokiriForest, Category::cForest,}, SpoilerCollectionCheckGroup::GROUP_KOKIRI_FOREST); + locationTable[KF_MIDOS_BOTTOM_LEFT_CHEST] = ItemLocation::Chest (RC_KF_MIDOS_BOTTOM_LEFT_CHEST, 0x28, 0x02, "KF Mido Bottom Left Chest", KF_MIDOS_BOTTOM_LEFT_CHEST, GREG_RUPEE, {Category::cKokiriForest, Category::cForest,}, SpoilerCollectionCheckGroup::GROUP_KOKIRI_FOREST); locationTable[KF_MIDOS_BOTTOM_RIGHT_CHEST] = ItemLocation::Chest (RC_KF_MIDOS_BOTTOM_RIGHT_CHEST, 0x28, 0x03, "KF Mido Bottom Right Chest", KF_MIDOS_BOTTOM_RIGHT_CHEST, RECOVERY_HEART, {Category::cKokiriForest, Category::cForest,}, SpoilerCollectionCheckGroup::GROUP_KOKIRI_FOREST); locationTable[KF_STORMS_GROTTO_CHEST] = ItemLocation::Chest (RC_KF_STORMS_GROTTO_CHEST, 0x3E, 0x0C, "KF Storms Grotto Chest", KF_STORMS_GROTTO_CHEST, RED_RUPEE, {Category::cKokiriForest, Category::cForest, Category::cGrotto}, SpoilerCollectionCheckGroup::GROUP_KOKIRI_FOREST); diff --git a/soh/soh/Enhancements/randomizer/3drando/item_pool.cpp b/soh/soh/Enhancements/randomizer/3drando/item_pool.cpp index b4f4a7c52..39cf5f479 100644 --- a/soh/soh/Enhancements/randomizer/3drando/item_pool.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/item_pool.cpp @@ -64,7 +64,7 @@ const std::array alwaysItems = { DINS_FIRE, FARORES_WIND, NAYRUS_LOVE, - GREEN_RUPEE, + GREG_RUPEE, PROGRESSIVE_HOOKSHOT, //2 progressive hookshots PROGRESSIVE_HOOKSHOT, DEKU_SHIELD, diff --git a/soh/soh/Enhancements/randomizer/3drando/keys.hpp b/soh/soh/Enhancements/randomizer/3drando/keys.hpp index dea3bb051..13d0325c0 100644 --- a/soh/soh/Enhancements/randomizer/3drando/keys.hpp +++ b/soh/soh/Enhancements/randomizer/3drando/keys.hpp @@ -169,6 +169,7 @@ typedef enum { RECOVERY_HEART, GREEN_RUPEE, + GREG_RUPEE, BLUE_RUPEE, RED_RUPEE, PURPLE_RUPEE, diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index dff443f34..cde1f65d8 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -1769,6 +1769,7 @@ ItemObtainability Randomizer::GetItemObtainabilityFromRandomizerGet(RandomizerGe case RG_RECOVERY_HEART: case RG_GREEN_RUPEE: + case RG_GREG_RUPEE: case RG_BLUE_RUPEE: case RG_RED_RUPEE: case RG_PURPLE_RUPEE: @@ -4944,6 +4945,10 @@ void Randomizer::CreateCustomMessages() { // RANDTODO: Translate into french and german and replace GIMESSAGE_UNTRANSLATED // with GIMESSAGE(getItemID, itemID, english, german, french). const std::vector getItemMessages = { + GIMESSAGE(RG_GREG_RUPEE, ITEM_MASK_GORON, + "You found %gGreg%w!", + "%gGreg%w! Du hast ihn wirklich gefunden!", + "Félicitation! Vous avez trouvé %gGreg%w!"), GIMESSAGE(RG_BOTTLE_WITH_BLUE_FIRE, ITEM_BLUE_FIRE, "You got a %rBottle with Blue &Fire%w! Use it to melt Red Ice!", "Du erhältst eine %rFlasche mit&blauem Feuer%w! Nutze es um&%rRotes Eis%w zu schmelzen!", @@ -5226,6 +5231,7 @@ void InitRandoItemTable() { GET_ITEM(RG_MAGIC_SINGLE, OBJECT_GI_MAGICPOT, GID_MAGIC_SMALL, 0xE4, 0x80, CHEST_ANIM_LONG, ITEM_CATEGORY_MAJOR, MOD_RANDOMIZER, RG_MAGIC_SINGLE), GET_ITEM(RG_MAGIC_DOUBLE, OBJECT_GI_MAGICPOT, GID_MAGIC_LARGE, 0xE8, 0x80, CHEST_ANIM_LONG, ITEM_CATEGORY_LESSER, MOD_RANDOMIZER, RG_MAGIC_DOUBLE), GET_ITEM(RG_DOUBLE_DEFENSE, OBJECT_GI_HEARTS, GID_HEART_CONTAINER, 0xE9, 0x80, CHEST_ANIM_LONG, ITEM_CATEGORY_LESSER, MOD_RANDOMIZER, RG_DOUBLE_DEFENSE), + GET_ITEM(RG_GREG_RUPEE, OBJECT_GI_RUPY, GID_RUPEE_GREEN, TEXT_RANDOMIZER_CUSTOM_ITEM, 0x80, CHEST_ANIM_LONG, ITEM_CATEGORY_MAJOR, MOD_RANDOMIZER, RG_GREG_RUPEE), GET_ITEM(RG_BOTTLE_WITH_RED_POTION, OBJECT_GI_LIQUID, GID_POTION_RED, TEXT_RANDOMIZER_CUSTOM_ITEM, 0x80, CHEST_ANIM_LONG, ITEM_CATEGORY_MAJOR, MOD_RANDOMIZER, RG_BOTTLE_WITH_RED_POTION), GET_ITEM(RG_BOTTLE_WITH_GREEN_POTION, OBJECT_GI_LIQUID, GID_POTION_GREEN, TEXT_RANDOMIZER_CUSTOM_ITEM, 0x80, CHEST_ANIM_LONG, ITEM_CATEGORY_MAJOR, MOD_RANDOMIZER, RG_BOTTLE_WITH_GREEN_POTION), GET_ITEM(RG_BOTTLE_WITH_BLUE_POTION, OBJECT_GI_LIQUID, GID_POTION_BLUE, TEXT_RANDOMIZER_CUSTOM_ITEM, 0x80, CHEST_ANIM_LONG, ITEM_CATEGORY_MAJOR, MOD_RANDOMIZER, RG_BOTTLE_WITH_BLUE_POTION), diff --git a/soh/soh/Enhancements/randomizer/randomizerTypes.h b/soh/soh/Enhancements/randomizer/randomizerTypes.h index 1a7d5ebe2..1cfdeeacf 100644 --- a/soh/soh/Enhancements/randomizer/randomizerTypes.h +++ b/soh/soh/Enhancements/randomizer/randomizerTypes.h @@ -904,6 +904,7 @@ typedef enum { RG_LIGHT_MEDALLION, RG_RECOVERY_HEART, RG_GREEN_RUPEE, + RG_GREG_RUPEE, RG_BLUE_RUPEE, RG_RED_RUPEE, RG_PURPLE_RUPEE, diff --git a/soh/soh/Enhancements/randomizer/randomizer_inf.h b/soh/soh/Enhancements/randomizer/randomizer_inf.h index fa862fe9d..3595cf3dc 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_inf.h +++ b/soh/soh/Enhancements/randomizer/randomizer_inf.h @@ -151,6 +151,8 @@ typedef enum { RAND_INF_KAK_100_GOLD_SKULLTULA_REWARD, + RAND_INF_GREG_FOUND, + // If you add anything to this list, you need to update the size of randomizerInf in z64save.h to be ceil(RAND_INF_MAX / 16) RAND_INF_MAX, diff --git a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp index 11202a5ae..e074b298e 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp @@ -77,6 +77,10 @@ std::vector songItems = { ITEM_TRACKER_ITEM(QUEST_SONG_REQUIEM, 0, DrawSong), ITEM_TRACKER_ITEM(QUEST_SONG_NOCTURNE, 0, DrawSong), ITEM_TRACKER_ITEM(QUEST_SONG_PRELUDE, 0, DrawSong), }; +std::vector gregItems = { + ITEM_TRACKER_ITEM(ITEM_RUPEE_GREEN, 0, DrawItem), +}; + std::vector itemTrackerDungeonsWithMapsHorizontal = { { SCENE_YDAN, { ITEM_DUNGEON_MAP, ITEM_COMPASS } }, { SCENE_DDAN, { ITEM_DUNGEON_MAP, ITEM_COMPASS } }, @@ -508,6 +512,10 @@ void DrawItem(ItemTrackerItem item) { actualItemId = CUR_UPG_VALUE(UPG_SCALE) == 2 ? ITEM_SCALE_GOLDEN : ITEM_SCALE_SILVER; hasItem = CUR_UPG_VALUE(UPG_SCALE) > 0; break; + case ITEM_RUPEE_GREEN: + actualItemId = item.id; + hasItem = Flags_GetRandomizerInf(RAND_INF_GREG_FOUND); + break; } if (hasItem && item.id != actualItemId && actualItemTrackerItemMap.find(actualItemId) != actualItemTrackerItemMap.end()) { @@ -847,6 +855,24 @@ void UpdateVectors() { if (CVarGetInteger("gItemTrackerDungeonItemsDisplayType", 0) == 1) { mainWindowItems.insert(mainWindowItems.end(), dungeonItems.begin(), dungeonItems.end()); } + if (CVarGetInteger("gItemTrackerGregDisplayType", 0) == 1) { + // insert empty items until we're on a new row for greg + while (mainWindowItems.size() % 6) { + mainWindowItems.push_back(ITEM_TRACKER_ITEM(ITEM_NONE, 0, DrawItem)); + } + mainWindowItems.insert(mainWindowItems.end(), gregItems.begin(), gregItems.end()); + } + if (CVarGetInteger("gItemTrackerGregDisplayType", 0) == 2) { + miscItems.insert(miscItems.end(), gregItems.begin(), gregItems.end()); + } else { + for (auto it = miscItems.begin(); it != miscItems.end();) { + if (it->id == ITEM_RUPEE_GREEN) { + miscItems.erase(it); + } else { + it++; + } + } + } shouldUpdateVectors = false; } @@ -872,6 +898,7 @@ void DrawItemTracker(bool& open) { (CVarGetInteger("gItemTrackerDungeonRewardsDisplayType", 1) == 1) || (CVarGetInteger("gItemTrackerSongsDisplayType", 1) == 1) || (CVarGetInteger("gItemTrackerDungeonItemsDisplayType", 0) == 1) || + (CVarGetInteger("gItemTrackerGregDisplayType", 0) == 1) || (CVarGetInteger("gItemTrackerNotesDisplayType", 0) == 1) ) { BeginFloatingWindows("Item Tracker##main window"); @@ -936,6 +963,12 @@ void DrawItemTracker(bool& open) { EndFloatingWindows(); } + if (CVarGetInteger("gItemTrackerGregDisplayType", 0) == 3) { + BeginFloatingWindows("Greg Tracker"); + DrawItemsInRows(gregItems); + EndFloatingWindows(); + } + if (CVarGetInteger("gItemTrackerNotesDisplayType", 0) == 2 && CVarGetInteger("gItemTrackerDisplayType", 0) == 0) { ImGui::SetNextWindowSize(ImVec2(400,300), ImGuiCond_FirstUseEver); BeginFloatingWindows("Personal Notes", ImGuiWindowFlags_NoFocusOnAppearing); @@ -1023,6 +1056,7 @@ void DrawItemTrackerOptions(bool& open) { } PaddedEnhancementCheckbox("Maps and compasses", "gItemTrackerDisplayDungeonItemsMaps", 1); } + LabeledComboBoxRightAligned("Greg", "gItemTrackerGregDisplayType", { "Hidden", "Main Window", "Misc Window", "Seperate" }, 0); if (CVarGetInteger("gItemTrackerDisplayType", 0) != 1) { LabeledComboBoxRightAligned("Personal notes", "gItemTrackerNotesDisplayType", { "Hidden", "Main Window", "Seperate" }, 0); diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index 272102e97..44c451a58 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -480,7 +480,7 @@ extern "C" void VanillaItemTable_Init() { GET_ITEM(ITEM_ARROWS_SMALL, OBJECT_GI_ARROW, GID_ARROWS_SMALL, 0xE6, 0x48, CHEST_ANIM_SHORT, ITEM_CATEGORY_JUNK, MOD_NONE, GI_ARROWS_SMALL), GET_ITEM(ITEM_ARROWS_MEDIUM, OBJECT_GI_ARROW, GID_ARROWS_MEDIUM, 0xE6, 0x49, CHEST_ANIM_SHORT, ITEM_CATEGORY_JUNK, MOD_NONE, GI_ARROWS_MEDIUM), GET_ITEM(ITEM_ARROWS_LARGE, OBJECT_GI_ARROW, GID_ARROWS_LARGE, 0xE6, 0x4A, CHEST_ANIM_SHORT, ITEM_CATEGORY_JUNK, MOD_NONE, GI_ARROWS_LARGE), - GET_ITEM(ITEM_RUPEE_GREEN, OBJECT_GI_RUPY, GID_RUPEE_GREEN, 0x6F, 0x00, CHEST_ANIM_SHORT, ITEM_CATEGORY_MAJOR, MOD_NONE, GI_RUPEE_GREEN), + GET_ITEM(ITEM_RUPEE_GREEN, OBJECT_GI_RUPY, GID_RUPEE_GREEN, 0x6F, 0x00, CHEST_ANIM_SHORT, ITEM_CATEGORY_JUNK, MOD_NONE, GI_RUPEE_GREEN), GET_ITEM(ITEM_RUPEE_BLUE, OBJECT_GI_RUPY, GID_RUPEE_BLUE, 0xCC, 0x01, CHEST_ANIM_SHORT, ITEM_CATEGORY_JUNK, MOD_NONE, GI_RUPEE_BLUE), GET_ITEM(ITEM_RUPEE_RED, OBJECT_GI_RUPY, GID_RUPEE_RED, 0xF0, 0x02, CHEST_ANIM_SHORT, ITEM_CATEGORY_JUNK, MOD_NONE, GI_RUPEE_RED), GET_ITEM(ITEM_HEART_CONTAINER, OBJECT_GI_HEARTS, GID_HEART_CONTAINER, 0xC6, 0x80, CHEST_ANIM_LONG, ITEM_CATEGORY_LESSER, MOD_NONE, GI_HEART_CONTAINER_2), diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c index a694781ad..2d22afe6b 100644 --- a/soh/src/code/z_parameter.c +++ b/soh/src/code/z_parameter.c @@ -2578,6 +2578,12 @@ u16 Randomizer_Item_Give(PlayState* play, GetItemEntry giEntry) { return RG_NONE; } + if (item == RG_GREG_RUPEE) { + Rupees_ChangeBy(1); + Flags_SetRandomizerInf(RAND_INF_GREG_FOUND); + return RG_NONE; + } + temp = gSaveContext.inventory.items[slot]; osSyncPrintf("Item_Register(%d)=%d %d\n", slot, item, temp); INV_CONTENT(item) = item;