Skip to content

Commit

Permalink
Update stores.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
kphoenix137 committed Sep 20, 2024
1 parent 4d9dd9f commit f0b326b
Showing 1 changed file with 55 additions and 55 deletions.
110 changes: 55 additions & 55 deletions Source/stores.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -326,15 +326,15 @@ 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;
ClearSText(5, 23);
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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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");
Expand All @@ -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;

Expand All @@ -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;

Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -662,7 +662,7 @@ void StoreSession::UpdateItemStatFlags(TalkID talkId)
}
}

void StoreSession::SetupTownerBuyMenu(TalkID talkId)
void StoreSession::SetupTownerBuyScreen(TalkID talkId)
{
isTextFullSize = true;
currentScrollPos = 0;
Expand All @@ -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);
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -819,7 +819,7 @@ void StoreSession::AddPlayerItemToRepairList(Item *itm, int8_t i)
playerItemIdx++;
}

void StoreSession::DrawSmithRepair()
void StoreSession::SetupTownerRepairScreen()
{
isTextFullSize = true;
playerItemIdx = 0;
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -916,7 +916,7 @@ void StoreSession::AddPlayerItemToRechargeList(Item itm, int8_t i)
playerItemIdx++;
}

void StoreSession::DrawWitchRecharge()
void StoreSession::SetupTownerRechargeScreen()
{
isTextFullSize = true;
bool rechargeok = false;
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -994,7 +994,7 @@ void StoreSession::AddPlayerItemToIdentifyList(Item itm, int8_t i)
playerItemIdx++;
}

void StoreSession::DrawStorytellerIdentify()
void StoreSession::SetupTownerIdentifyScreen()
{
bool idok = false;
isTextFullSize = true;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -2045,7 +2045,7 @@ void StoreSession::StartStore(TalkID s)
break;
}
if (hasAnyItems)
SetupTownerBuyMenu(s);
SetupTownerBuyScreen(s);
else {
activeStore = TalkID::SmithBuy;
oldTextLine = 12;
Expand All @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit f0b326b

Please sign in to comment.