diff --git a/include/d/d_menu_dmap.h b/include/d/d_menu_dmap.h index 81baea1446..7740927f4e 100644 --- a/include/d/d_menu_dmap.h +++ b/include/d/d_menu_dmap.h @@ -183,6 +183,11 @@ public: /* 0xDD8 */ u8 field_0xdd8; /* 0xDD9 */ u8 field_0xdd9; /* 0xDDA */ u8 field_0xdda; + +#if TARGET_PC + J2DTextBox* mpPoeCountPane; + J2DPicture* mpPoeCountIcon; +#endif }; class dMenu_Dmap_c { diff --git a/include/d/d_menu_fmap2D.h b/include/d/d_menu_fmap2D.h index aa64129ccf..3c37c3da74 100644 --- a/include/d/d_menu_fmap2D.h +++ b/include/d/d_menu_fmap2D.h @@ -424,7 +424,6 @@ public: #if TARGET_PC J2DTextBox* mpPoeCountPane; - ResTIMG* mpPoeCountIconTex; J2DPicture* mpPoeCountIcon; u8 mSelectRegionNo; #endif diff --git a/include/dusk/settings.h b/include/dusk/settings.h index 1c77ae992b..fe037cc3f3 100644 --- a/include/dusk/settings.h +++ b/include/dusk/settings.h @@ -133,7 +133,7 @@ struct UserSettings { ConfigVar instantText; ConfigVar sunsSong; ConfigVar autoSave; - ConfigVar showMapPoeCounter; + ConfigVar enhancedMapMenus; // Preferences ConfigVar enableMirrorMode; diff --git a/src/d/d_menu_dmap.cpp b/src/d/d_menu_dmap.cpp index 51cb11cdd1..cd6b94ed4f 100644 --- a/src/d/d_menu_dmap.cpp +++ b/src/d/d_menu_dmap.cpp @@ -135,6 +135,16 @@ dMenu_DmapBg_c::dMenu_DmapBg_c(JKRExpHeap* i_heap, STControl* i_stick) { memset(&field_0xd80, 0, 20); buttonIconScreenInit(); field_0xdd0 = 0; + +#if TARGET_PC + mpPoeCountIcon = JKR_NEW J2DPicture((ResTIMG*)JKRGetNameResource("ni_item_icon_pou.bti", dComIfGp_getItemIconArchive())); + + mpPoeCountPane = JKR_NEW J2DTextBox(); + if (mpPoeCountPane != nullptr) { + mpPoeCountPane->setFontSize(15.0f, 15.0f); + mpPoeCountPane->setFont(mDoExt_getMesgFont()); + } +#endif } void dMenu_DmapBg_c::mapScreenInit() { @@ -762,6 +772,14 @@ dMenu_DmapBg_c::~dMenu_DmapBg_c() { mDoExt_destroyExpHeap(mpTalkHeap); mpTalkHeap = NULL; } + +#if TARGET_PC + JKR_DELETE(mpPoeCountIcon); + mpPoeCountIcon = NULL; + + JKR_DELETE(mpPoeCountPane); + mpPoeCountPane = NULL; +#endif } void dMenu_DmapBg_c::setAllAlphaRate(f32 i_rate, bool param_2) { @@ -1014,6 +1032,35 @@ void dMenu_DmapBg_c::draw() { } mButtonScreen->draw(field_0xd94, field_0xd98, grafContext); + +#if TARGET_PC + if (dusk::getSettings().game.enhancedMapMenus) { + int nowPoeCount = 0; + int totalPoeCount = 0; + dMenuMapCommon_c::getDmapPoeCount(dComIfGp_getStartStageName(), nowPoeCount, totalPoeCount); + if (dComIfGs_isEventBit(dSv_event_flag_c::F_0456) && totalPoeCount > 0) { + const f32 x = field_0xd94 + mDoGph_gInf_c::ScaleHUDXLeft(80.0f); + const f32 y = 410.0f; + constexpr f32 iconsize = 48.0f * 0.8f; + + if (mpPoeCountIcon != nullptr) + mpPoeCountIcon->draw(x - 35.0f, y - 25.0f, iconsize, iconsize, false, false, false); + + char counter_text[6]; + snprintf(counter_text, sizeof(counter_text), "%d/%d", nowPoeCount, totalPoeCount); + mpPoeCountPane->setString(counter_text); + + mpPoeCountPane->setCharColor(0x000000FF); + mpPoeCountPane->setGradColor(0x000000FF); + mpPoeCountPane->draw(x + 1, y + 1, FB_WIDTH, HBIND_LEFT); + + mpPoeCountPane->setCharColor(0xC8C8C8FF); + mpPoeCountPane->setGradColor(0xC8C8C8FF); + mpPoeCountPane->draw(x, y, FB_WIDTH, HBIND_LEFT); + } + } +#endif + grafContext->scissor(scissor_left, scissor_top, scissor_width, scissor_height); grafContext->setScissor(); grafContext->setup2D(); diff --git a/src/d/d_menu_fmap2D.cpp b/src/d/d_menu_fmap2D.cpp index 39ec07e5d7..100fd1c067 100644 --- a/src/d/d_menu_fmap2D.cpp +++ b/src/d/d_menu_fmap2D.cpp @@ -2658,7 +2658,7 @@ void dMenu_Fmap2DTop_c::draw() { mpTitleScreen->draw(mTransX, mTransY, ctx); #if TARGET_PC - if (dusk::getSettings().game.showMapPoeCounter) { + if (dusk::getSettings().game.enhancedMapMenus) { int nowPoeCount = 0; int totalPoeCount = 0; dMenuMapCommon_c::getFmapPoeCount(mSelectRegionNo, nowPoeCount, totalPoeCount); diff --git a/src/dusk/settings.cpp b/src/dusk/settings.cpp index 05e1217322..3e6941b829 100644 --- a/src/dusk/settings.cpp +++ b/src/dusk/settings.cpp @@ -45,7 +45,7 @@ UserSettings g_userSettings = { .instantText {"game.instantText", false}, .sunsSong {"game.sunsSong", false}, .autoSave {"game.autoSave", false}, - .showMapPoeCounter {"game.showMapPoeCounter", false}, + .enhancedMapMenus {"game.enhancedMapMenus", false}, // Preferences .enableMirrorMode {"game.enableMirrorMode", false}, @@ -212,7 +212,7 @@ void registerSettings() { Register(g_userSettings.game.instantText); Register(g_userSettings.game.sunsSong); Register(g_userSettings.game.autoSave); - Register(g_userSettings.game.showMapPoeCounter); + Register(g_userSettings.game.enhancedMapMenus); Register(g_userSettings.game.enableMirrorMode); Register(g_userSettings.game.invertCameraXAxis); Register(g_userSettings.game.invertCameraYAxis); diff --git a/src/dusk/ui/preset.cpp b/src/dusk/ui/preset.cpp index ef11d9b857..00bbe08871 100644 --- a/src/dusk/ui/preset.cpp +++ b/src/dusk/ui/preset.cpp @@ -47,7 +47,7 @@ void applyPresetDusk() { s.game.shadowResolutionMultiplier.setValue(4); s.game.enableGyroAim.setValue(true); s.game.autoSave.setValue(true); - s.game.showMapPoeCounter.setValue(true); + s.game.enhancedMapMenus.setValue(true); } } // namespace diff --git a/src/dusk/ui/settings.cpp b/src/dusk/ui/settings.cpp index a38003e129..567418347b 100644 --- a/src/dusk/ui/settings.cpp +++ b/src/dusk/ui/settings.cpp @@ -1161,7 +1161,7 @@ SettingsWindow::SettingsWindow(bool prelaunch) : mPrelaunch(prelaunch) { "Link will not recoil when his sword hits walls."); addOption("No 2nd Fish for Cat", getSettings().game.no2ndFishForCat, "Skip needing to catch a second fish for Sera's cat."); - addOption("Show Poe Count on Map", getSettings().game.showMapPoeCounter, + addOption("Show Poe Count on Map", getSettings().game.enhancedMapMenus, "Displays collected/total number of Poe Souls for a region on the map."); addSpeedrunDisabledOption("Sun's Song (R+X)", getSettings().game.sunsSong, "Allows Wolf Link to howl and change the time of day.");