From 3f77b6dd523b80b515761050ebafa14571adf3f6 Mon Sep 17 00:00:00 2001 From: Eric Robinson Date: Wed, 9 Oct 2024 22:32:59 -0400 Subject: [PATCH] Add name --- Source/engine/render/scrollrt.cpp | 2 +- Source/stores.cpp | 41 ++++++++++++++++--------------- Source/stores.h | 17 +++++++------ 3 files changed, 31 insertions(+), 29 deletions(-) diff --git a/Source/engine/render/scrollrt.cpp b/Source/engine/render/scrollrt.cpp index 39dca0e1b93..ed9fe9c08b5 100644 --- a/Source/engine/render/scrollrt.cpp +++ b/Source/engine/render/scrollrt.cpp @@ -1198,7 +1198,7 @@ void DrawView(const Surface &out, Point startPosition) DrawFloatingNumbers(out, startPosition, offset); if (IsPlayerInStore() && !qtextflag) - DrawStoreText(out); + DrawStore(out); if (invflag) { DrawInv(out); } else if (SpellbookFlag) { diff --git a/Source/stores.cpp b/Source/stores.cpp index 882bf4d7fe8..34347810004 100644 --- a/Source/stores.cpp +++ b/Source/stores.cpp @@ -28,16 +28,16 @@ namespace devilution { -TownerStore Blacksmith(TalkID::BasicBuy, TalkID::Buy, TalkID::Sell, TalkID::Repair, ResourceType::Invalid); -TownerStore Healer(TalkID::Invalid, TalkID::Buy, TalkID::Invalid, TalkID::Invalid, ResourceType::Life); -TownerStore Witch(TalkID::Invalid, TalkID::Buy, TalkID::Sell, TalkID::Recharge, ResourceType::Mana); -TownerStore Boy(TalkID::Invalid, TalkID::Buy, TalkID::Invalid, TalkID::Invalid, ResourceType::Invalid); -TownerStore Storyteller(TalkID::Invalid, TalkID::Invalid, TalkID::Invalid, TalkID::Identify, ResourceType::Invalid); -TownerStore Barmaid(TalkID::Invalid, TalkID::Invalid, TalkID::Invalid, TalkID::Stash, ResourceType::Invalid); -TownerStore Tavern(TalkID::Invalid, TalkID::Invalid, TalkID::Invalid, TalkID::Invalid, ResourceType::Invalid); -TownerStore Drunk(TalkID::Invalid, TalkID::Invalid, TalkID::Invalid, TalkID::Invalid, ResourceType::Invalid); -TownerStore CowFarmer(TalkID::Invalid, TalkID::Invalid, TalkID::Invalid, TalkID::Invalid, ResourceType::Invalid); -TownerStore Farmer(TalkID::Invalid, TalkID::Invalid, TalkID::Invalid, TalkID::Invalid, ResourceType::Invalid); +TownerStore Blacksmith("Griswold", TalkID::BasicBuy, TalkID::Buy, TalkID::Sell, TalkID::Repair, ResourceType::Invalid); +TownerStore Healer("Pepin", TalkID::Invalid, TalkID::Buy, TalkID::Invalid, TalkID::Invalid, ResourceType::Life); +TownerStore Witch("Adria", TalkID::Invalid, TalkID::Buy, TalkID::Sell, TalkID::Recharge, ResourceType::Mana); +TownerStore Boy("Wirt", TalkID::Invalid, TalkID::Buy, TalkID::Invalid, TalkID::Invalid, ResourceType::Invalid); +TownerStore Storyteller("Cain", TalkID::Invalid, TalkID::Invalid, TalkID::Invalid, TalkID::Identify, ResourceType::Invalid); +TownerStore Barmaid("Gillian", TalkID::Invalid, TalkID::Invalid, TalkID::Invalid, TalkID::Stash, ResourceType::Invalid); +TownerStore Tavern("Ogden", TalkID::Invalid, TalkID::Invalid, TalkID::Invalid, TalkID::Invalid, ResourceType::Invalid); +TownerStore Drunk("Farnham", TalkID::Invalid, TalkID::Invalid, TalkID::Invalid, TalkID::Invalid, ResourceType::Invalid); +TownerStore CowFarmer("Cow Farmer", TalkID::Invalid, TalkID::Invalid, TalkID::Invalid, TalkID::Invalid, ResourceType::Invalid); +TownerStore Farmer("Lester", TalkID::Invalid, TalkID::Invalid, TalkID::Invalid, TalkID::Invalid, ResourceType::Invalid); TalkID ActiveStore; // The current store screen _talker_id TownerId; // The current towner being interacted with @@ -118,7 +118,7 @@ int CurrentMenuDrawLine; const std::string SmithMenuHeader = "Welcome to the\n\nBlacksmith's shop"; const StoreMenuOption SmithMenuOptions[] = { - { TalkID::Gossip, "Talk to Griswold" }, + { TalkID::Gossip, fmt::format("Talk to {:s}", Blacksmith.name) }, { TalkID::BasicBuy, "Buy basic items" }, { TalkID::Buy, "Buy premium items" }, { TalkID::Sell, "Sell items" }, @@ -129,7 +129,7 @@ const StoreMenuOption SmithMenuOptions[] = { const std::string HealerMenuHeader = "Welcome to the\n\nHealer's home"; const StoreMenuOption HealerMenuOptions[] = { - { TalkID::Gossip, "Talk to Pepin" }, + { TalkID::Gossip, fmt::format("Talk to {:s}", Healer.name) }, { TalkID::Buy, "Buy items" }, { TalkID::Exit, "Leave Healer's home" } }; @@ -137,7 +137,7 @@ const StoreMenuOption HealerMenuOptions[] = { const std::string BoyMenuHeader = "Wirt the Peg-legged boy"; const StoreMenuOption BoyMenuOptions[] = { - { TalkID::Gossip, "Talk to Wirt" }, + { TalkID::Gossip, fmt::format("Talk to {:s}", Boy.name) }, { TalkID::Buy, "What have you got?" }, { TalkID::Exit, "Say goodbye" } }; @@ -145,7 +145,7 @@ const StoreMenuOption BoyMenuOptions[] = { const std::string WitchMenuHeader = "Welcome to the\n\nWitch's shack"; const StoreMenuOption WitchMenuOptions[] = { - { TalkID::Gossip, "Talk to Adria" }, + { TalkID::Gossip, fmt::format("Talk to {:s}", Witch.name) }, { TalkID::Buy, "Buy items" }, { TalkID::Sell, "Sell items" }, { TalkID::Recharge, "Recharge staves" }, @@ -155,14 +155,14 @@ const StoreMenuOption WitchMenuOptions[] = { const std::string TavernMenuHeader = "Welcome to the\n\nRising Sun"; const StoreMenuOption TavernMenuOptions[] = { - { TalkID::Gossip, "Talk to Ogden" }, + { TalkID::Gossip, fmt::format("Talk to {:s}", Tavern.name) }, { TalkID::Exit, "Leave the tavern" } }; const std::string BarmaidMenuHeader = "Gillian"; const StoreMenuOption BarmaidMenuOptions[] = { - { TalkID::Gossip, "Talk to Gillian" }, + { TalkID::Gossip, fmt::format("Talk to {:s}", Barmaid.name) }, { TalkID::Stash, "Access Stash" }, { TalkID::Exit, "Say goodbye" } }; @@ -170,14 +170,14 @@ const StoreMenuOption BarmaidMenuOptions[] = { const std::string DrunkMenuHeader = "Farnham the Drunk"; const StoreMenuOption DrunkMenuOptions[] = { - { TalkID::Gossip, "Talk to Farnham" }, + { TalkID::Gossip, fmt::format("Talk to {:s}", Drunk.name) }, { TalkID::Exit, "Say goodbye" } }; const std::string StorytellerMenuHeader = "The Town Elder"; const StoreMenuOption StorytellerMenuOptions[] = { - { TalkID::Gossip, "Talk to Cain" }, + { TalkID::Gossip, fmt::format("Talk to {:s}", Storyteller.name) }, { TalkID::Identify, "Identify an item" }, { TalkID::Exit, "Say goodbye" } }; @@ -650,13 +650,14 @@ void SetupConfirmScreen() void SetupGossipScreen() { int la; + TownerStore *towner = townerStores[TownerId]; IsTextFullSize = false; - SetLineText(0, 2, fmt::format(fmt::runtime(_("Talk to {:s}")), "" /*towner name*/), UiFlags::ColorWhitegold | UiFlags::AlignCenter, false); + SetLineText(0, 2, fmt::format(fmt::runtime(_("Talk to {:s}")), towner->name), UiFlags::ColorWhitegold | UiFlags::AlignCenter, false); SetLineAsDivider(5); if (gbIsSpawn) { - SetLineText(0, 10, fmt::format(fmt::runtime(_("Talking to {:s}")), "" /*towner name*/), UiFlags::ColorWhite | UiFlags::AlignCenter, false); + SetLineText(0, 10, fmt::format(fmt::runtime(_("Talking to {:s}")), towner->name), UiFlags::ColorWhite | UiFlags::AlignCenter, false); SetLineText(0, 12, _("is not available"), UiFlags::ColorWhite | UiFlags::AlignCenter, false); SetLineText(0, 14, _("in the shareware"), UiFlags::ColorWhite | UiFlags::AlignCenter, false); diff --git a/Source/stores.h b/Source/stores.h index 6f9bd665171..469e2518e5f 100644 --- a/Source/stores.h +++ b/Source/stores.h @@ -98,8 +98,9 @@ extern DVL_API_FOR_TEST std::vector playerItems; // Pointers to pla class TownerStore { public: - TownerStore(TalkID buyBasic, TalkID buy, TalkID sell, TalkID special, ResourceType resource) - : buyBasic(buyBasic) + TownerStore(std::string name, TalkID buyBasic, TalkID buy, TalkID sell, TalkID special, ResourceType resource) + : name(name) + , buyBasic(buyBasic) , buy(buy) , sell(sell) , special(special) @@ -107,16 +108,16 @@ class TownerStore { { } -public: + std::string name; std::vector basicItems; // Used for the blacksmith store that only displays non-magical items std::vector items; uint8_t itemLevel; - TalkID buyBasic = TalkID::Invalid; - TalkID buy = TalkID::Invalid; - TalkID sell = TalkID::Invalid; - TalkID special = TalkID::Invalid; - ResourceType resourceType = ResourceType::Invalid; // Resource type to restore for stores that restore player's resources + TalkID buyBasic; + TalkID buy; + TalkID sell; + TalkID special; + ResourceType resourceType; // Resource type to restore for stores that restore player's resources }; extern TownerStore Blacksmith;