From f0b326b392cba47ad2dcf080aad815ddd0896ae5 Mon Sep 17 00:00:00 2001 From: Eric Robinson Date: Thu, 19 Sep 2024 21:40:01 -0400 Subject: [PATCH] Update stores.cpp --- Source/stores.cpp | 110 +++++++++++++++++++++++----------------------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/Source/stores.cpp b/Source/stores.cpp index 1b92c05b2c4..05323e57f1b 100644 --- a/Source/stores.cpp +++ b/Source/stores.cpp @@ -316,7 +316,7 @@ bool StoreSession::GiveItemToPlayer(Item &item, bool persistItem) return AutoPlaceItemInInventory(*MyPlayer, item, persistItem, true); } -void StoreSession::DrawPlayerCannotAfford() +void StoreSession::SetupCannotAffordScreen() { StartStore(oldActiveStore); hasScrollbar = false; @@ -326,7 +326,7 @@ void StoreSession::DrawPlayerCannotAfford() SetLineText(0, 14, _("You do not have enough gold"), UiFlags::ColorWhite | UiFlags::AlignCenter, true); } -void StoreSession::DrawPlayerNoRoom() +void StoreSession::SetupNoRoomScreen() { StartStore(oldActiveStore); hasScrollbar = false; @@ -334,7 +334,7 @@ void StoreSession::DrawPlayerNoRoom() SetLineText(0, 14, _("You do not have enough room in inventory"), UiFlags::ColorWhite | UiFlags::AlignCenter, true); } -void StoreSession::DrawConfirm(Item &item) +void StoreSession::SetupConfirmScreen(Item &item) { StartStore(oldActiveStore); hasScrollbar = false; @@ -378,7 +378,7 @@ void StoreSession::DrawConfirm(Item &item) SetLineText(0, 20, _("No"), UiFlags::ColorWhite | UiFlags::AlignCenter, true); } -void StoreSession::DrawGossip() +void StoreSession::SetupGossipScreen() { int la; @@ -423,7 +423,7 @@ void StoreSession::DrawGossip() SetLineAsOptionsBackButton(); } -void StoreSession::SetMainMenuHeader(const std::string &header) +void StoreSession::SetMenuHeader(const std::string &header) { // Check if the header contains "\n\n", which indicates a two-line header std::string::size_type pos = header.find("\n\n"); @@ -442,7 +442,7 @@ void StoreSession::SetMainMenuHeader(const std::string &header) } } -void StoreSession::SetMainMenuText(const TownerLine &townerInfo) +void StoreSession::SetMenuText(const TownerLine &townerInfo) { const UiFlags flags = UiFlags::ColorWhitegold | UiFlags::AlignCenter; @@ -465,7 +465,7 @@ void StoreSession::SetMainMenuText(const TownerLine &townerInfo) } } -void StoreSession::SetMainMenuOption(TalkID action, const std::string_view &text) +void StoreSession::SetMenuOption(TalkID action, const std::string_view &text) { UiFlags flags = action == TalkID::Gossip ? UiFlags::ColorBlue | UiFlags::AlignCenter : UiFlags::ColorWhite | UiFlags::AlignCenter; @@ -483,30 +483,30 @@ void StoreSession::SetMainMenuOption(TalkID action, const std::string_view &text } } -void StoreSession::SetupTownerMainMenu() +void StoreSession::SetupTownerMenuScreen() { isTextFullSize = false; hasScrollbar = false; const TownerLine &lines = TownerLines[towner]; - SetMainMenuHeader(lines.menuHeader); + SetMenuHeader(lines.menuHeader); SetLineAsDivider(MainMenuDividerLine); - SetMainMenuText(lines); + SetMenuText(lines); for (size_t i = 0; i < lines.numOptions; i++) { const StoreMenuOption &option = lines.menuOptions[i]; if (option.action == TalkID::BoyBuy && boyItem.isEmpty()) continue; - SetMainMenuOption(option.action, option.text); + SetMenuOption(option.action, option.text); } playerItemIdx = 20; } -void StoreSession::DrawItemList(TalkID talkId, Item *itemData, int storeLimit, int idx, bool selling /*= true*/) +void StoreSession::SetupItemList(TalkID talkId, Item *itemData, int storeLimit, int idx, bool selling /*= true*/) { ClearSText(5, 21); previousScrollPos = 5; @@ -544,7 +544,7 @@ void StoreSession::DrawItemList(TalkID talkId, Item *itemData, int storeLimit, i } } -void StoreSession::DrawItemListForTowner(TalkID talkId, int idx, bool selling /*= true*/) +void StoreSession::SetupTownerItemList(TalkID talkId, int idx, bool selling /*= true*/) { Item *itemArray = nullptr; int storeLimit = 0; @@ -583,11 +583,11 @@ void StoreSession::DrawItemListForTowner(TalkID talkId, int idx, bool selling /* } if (itemArray != nullptr) { - DrawItemList(talkId, itemArray, storeLimit, idx, selling); + SetupItemList(talkId, itemArray, storeLimit, idx, selling); } } -void StoreSession::SetBuyMenuHeader() +void StoreSession::SetBuyScreenHeader() { const UiFlags flags = UiFlags::ColorWhitegold; @@ -662,7 +662,7 @@ void StoreSession::UpdateItemStatFlags(TalkID talkId) } } -void StoreSession::SetupTownerBuyMenu(TalkID talkId) +void StoreSession::SetupTownerBuyScreen(TalkID talkId) { isTextFullSize = true; currentScrollPos = 0; @@ -673,11 +673,11 @@ void StoreSession::SetupTownerBuyMenu(TalkID talkId) } SetLineAsDivider(BuySellMenuDividerLine); - DrawItemListForTowner(talkId, currentScrollPos); + SetupTownerItemList(talkId, currentScrollPos); UpdateItemStatFlags(talkId); hasScrollbar = playerItemIdx > BuyLineSpace ? true : false; numTextLines = std::max(playerItemIdx - BuyLineSpace, 0); - SetBuyMenuHeader(); + SetBuyScreenHeader(); AddItemListBackButton(talkId, true); } @@ -713,7 +713,7 @@ bool StoreSession::CanSellToTowner(TalkID talkId, int i) } } -void StoreSession::SetupTownerSellMenu(TalkID talkId) +void StoreSession::SetupTownerSellScreen(TalkID talkId) { isTextFullSize = true; bool sellOk = false; @@ -774,7 +774,7 @@ void StoreSession::SetupTownerSellMenu(TalkID talkId) renderGold = true; SetLineText(20, 1, _("Which item is for sale?"), UiFlags::ColorWhitegold, false); SetLineAsDivider(BuySellMenuDividerLine); - DrawItemListForTowner(talkId, currentScrollPos, false); + SetupTownerItemList(talkId, currentScrollPos, false); AddItemListBackButton(talkId); } @@ -819,7 +819,7 @@ void StoreSession::AddPlayerItemToRepairList(Item *itm, int8_t i) playerItemIdx++; } -void StoreSession::DrawSmithRepair() +void StoreSession::SetupTownerRepairScreen() { isTextFullSize = true; playerItemIdx = 0; @@ -874,7 +874,7 @@ void StoreSession::DrawSmithRepair() SetLineText(20, 1, _("Repair which item?"), UiFlags::ColorWhitegold, false); SetLineAsDivider(3); - DrawItemListForTowner(TalkID::SmithRepair, currentScrollPos, false); + SetupTownerItemList(TalkID::SmithRepair, currentScrollPos, false); AddItemListBackButton(TalkID::SmithRepair); } @@ -916,7 +916,7 @@ void StoreSession::AddPlayerItemToRechargeList(Item itm, int8_t i) playerItemIdx++; } -void StoreSession::DrawWitchRecharge() +void StoreSession::SetupTownerRechargeScreen() { isTextFullSize = true; bool rechargeok = false; @@ -959,7 +959,7 @@ void StoreSession::DrawWitchRecharge() renderGold = true; SetLineText(20, 1, _("Recharge which item?"), UiFlags::ColorWhitegold, false); SetLineAsDivider(3); - DrawItemListForTowner(TalkID::WitchRecharge, currentScrollPos, false); + SetupTownerItemList(TalkID::WitchRecharge, currentScrollPos, false); AddItemListBackButton(TalkID::WitchRecharge); } @@ -994,7 +994,7 @@ void StoreSession::AddPlayerItemToIdentifyList(Item itm, int8_t i) playerItemIdx++; } -void StoreSession::DrawStorytellerIdentify() +void StoreSession::SetupTownerIdentifyScreen() { bool idok = false; isTextFullSize = true; @@ -1074,11 +1074,11 @@ void StoreSession::DrawStorytellerIdentify() SetLineText(20, 1, _("Identify which item?"), UiFlags::ColorWhitegold, false); SetLineAsDivider(3); - DrawItemListForTowner(TalkID::StorytellerIdentify, currentScrollPos, false); + SetupTownerItemList(TalkID::StorytellerIdentify, currentScrollPos, false); AddItemListBackButton(TalkID::StorytellerIdentify); } -void StoreSession::DrawStorytellerIdentified(Item &item) +void StoreSession::SetupTownerIdentifyResultScreen(Item &item) { StartStore(oldActiveStore); hasScrollbar = false; @@ -2036,7 +2036,7 @@ void StoreSession::StartStore(TalkID s) switch (s) { case TalkID::Smith: towner = TOWN_SMITH; - SetupTownerMainMenu(); + SetupTownerMenuScreen(); break; case TalkID::SmithBuy: { bool hasAnyItems = false; @@ -2045,7 +2045,7 @@ void StoreSession::StartStore(TalkID s) break; } if (hasAnyItems) - SetupTownerBuyMenu(s); + SetupTownerBuyScreen(s); else { activeStore = TalkID::SmithBuy; oldTextLine = 12; @@ -2055,76 +2055,76 @@ void StoreSession::StartStore(TalkID s) break; } case TalkID::SmithSell: - SetupTownerSellMenu(s); + SetupTownerSellScreen(s); break; case TalkID::SmithRepair: - DrawSmithRepair(); + SetupTownerRepairScreen(); break; case TalkID::Witch: towner = TOWN_WITCH; - SetupTownerMainMenu(); + SetupTownerMenuScreen(); break; case TalkID::WitchBuy: if (playerItemIdx > 0) - SetupTownerBuyMenu(s); + SetupTownerBuyScreen(s); break; case TalkID::WitchSell: - SetupTownerSellMenu(s); + SetupTownerSellScreen(s); break; case TalkID::WitchRecharge: - DrawWitchRecharge(); + SetupTownerRechargeScreen(); break; case TalkID::NoMoney: - DrawPlayerCannotAfford(); + SetupCannotAffordScreen(); break; case TalkID::NoRoom: - DrawPlayerNoRoom(); + SetupNoRoomScreen(); break; case TalkID::Confirm: - DrawConfirm(tempItem); + SetupConfirmScreen(tempItem); break; case TalkID::Boy: towner = TOWN_PEGBOY; - SetupTownerMainMenu(); + SetupTownerMenuScreen(); break; case TalkID::BoyBuy: - SetupTownerBuyMenu(s); + SetupTownerBuyScreen(s); break; case TalkID::Healer: towner = TOWN_HEALER; - SetupTownerMainMenu(); + SetupTownerMenuScreen(); break; case TalkID::Storyteller: towner = TOWN_STORY; - SetupTownerMainMenu(); + SetupTownerMenuScreen(); break; case TalkID::HealerBuy: if (playerItemIdx > 0) - SetupTownerBuyMenu(s); + SetupTownerBuyScreen(s); break; case TalkID::StorytellerIdentify: - DrawStorytellerIdentify(); + SetupTownerIdentifyScreen(); break; case TalkID::SmithPremiumBuy: - SetupTownerBuyMenu(s); + SetupTownerBuyScreen(s); break; case TalkID::Gossip: - DrawGossip(); + SetupGossipScreen(); break; case TalkID::StorytellerIdentifyShow: - DrawStorytellerIdentified(tempItem); + SetupTownerIdentifyResultScreen(tempItem); break; case TalkID::Tavern: towner = TOWN_TAVERN; - SetupTownerMainMenu(); + SetupTownerMenuScreen(); break; case TalkID::Drunk: towner = TOWN_DRUNK; - SetupTownerMainMenu(); + SetupTownerMenuScreen(); break; case TalkID::Barmaid: towner = TOWN_BMAID; - SetupTownerMainMenu(); + SetupTownerMenuScreen(); break; case TalkID::None: break; @@ -2151,23 +2151,23 @@ void StoreSession::DrawSText(const Surface &out) if (hasScrollbar) { switch (activeStore) { case TalkID::SmithBuy: - DrawItemListForTowner(TalkID::SmithBuy, currentScrollPos); + SetupTownerItemList(TalkID::SmithBuy, currentScrollPos); break; case TalkID::SmithSell: case TalkID::SmithRepair: case TalkID::WitchSell: case TalkID::WitchRecharge: case TalkID::StorytellerIdentify: - DrawItemListForTowner(activeStore, currentScrollPos, false); + SetupTownerItemList(activeStore, currentScrollPos, false); break; case TalkID::WitchBuy: - DrawItemListForTowner(activeStore, currentScrollPos); + SetupTownerItemList(activeStore, currentScrollPos); break; case TalkID::HealerBuy: - DrawItemListForTowner(activeStore, currentScrollPos); + SetupTownerItemList(activeStore, currentScrollPos); break; case TalkID::SmithPremiumBuy: - DrawItemListForTowner(activeStore, currentScrollPos); + SetupTownerItemList(activeStore, currentScrollPos); break; default: break;