Skip to content

Commit

Permalink
Add name
Browse files Browse the repository at this point in the history
  • Loading branch information
kphoenix137 committed Oct 10, 2024
1 parent baa1755 commit 3f77b6d
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 29 deletions.
2 changes: 1 addition & 1 deletion Source/engine/render/scrollrt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
41 changes: 21 additions & 20 deletions Source/stores.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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" },
Expand All @@ -129,23 +129,23 @@ 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" }
};

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" }
};

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" },
Expand All @@ -155,29 +155,29 @@ 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" }
};

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" }
};
Expand Down Expand Up @@ -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);
Expand Down
17 changes: 9 additions & 8 deletions Source/stores.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,25 +98,26 @@ extern DVL_API_FOR_TEST std::vector<IndexedItem> 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)
, resourceType(resource)
{
}

public:
std::string name;
std::vector<Item> basicItems; // Used for the blacksmith store that only displays non-magical items
std::vector<Item> 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;
Expand Down

0 comments on commit 3f77b6d

Please sign in to comment.