Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename stores.cpp global variables #7425

Merged
merged 6 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Source/DiabloUI/credits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ const int LINE_H = 22;
class CreditsRenderer {

public:
CreditsRenderer(char const *const *text, std::size_t textLines)
CreditsRenderer(char const *const *text, std::size_t TextLines)
{
for (size_t i = 0; i < textLines; i++) {
for (size_t i = 0; i < TextLines; i++) {
kphoenix137 marked this conversation as resolved.
Show resolved Hide resolved
std::string_view orgText = _(text[i]);

uint16_t offset = 0;
Expand Down Expand Up @@ -132,9 +132,9 @@ void CreditsRenderer::Render()
}
}

bool TextDialog(char const *const *text, std::size_t textLines)
bool TextDialog(char const *const *text, std::size_t TextLines)
{
CreditsRenderer creditsRenderer(text, textLines);
CreditsRenderer creditsRenderer(text, TextLines);
kphoenix137 marked this conversation as resolved.
Show resolved Hide resolved
bool endMenu = false;

if (IsHardwareCursor())
Expand Down
2 changes: 1 addition & 1 deletion Source/control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ bool IsLevelUpButtonVisible()
if (ControlMode == ControlTypes::VirtualGamepad) {
return false;
}
if (stextflag != TalkID::None || IsStashOpen) {
if (ActiveStore != TalkID::None || IsStashOpen) {
return false;
}
if (QuestLogIsOpen && GetLeftPanel().contains(GetMainPanel().position + Displacement { 0, -74 })) {
Expand Down
8 changes: 4 additions & 4 deletions Source/controls/game_controls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ bool GetGameAction(const SDL_Event &event, ControllerButtonEvent ctrlEvent, Game
if (ControllerActionHeld == GameActionType_NONE) {
ControllerActionHeld = GameActionType_PRIMARY_ACTION;
}
} else if (sgpCurrentMenu != nullptr || stextflag != TalkID::None || QuestLogIsOpen) {
} else if (sgpCurrentMenu != nullptr || ActiveStore != TalkID::None || QuestLogIsOpen) {
*action = GameActionSendKey { SDLK_RETURN, false };
} else {
*action = GameActionSendKey { SDLK_SPACE, false };
Expand Down Expand Up @@ -171,12 +171,12 @@ bool GetGameAction(const SDL_Event &event, ControllerButtonEvent ctrlEvent, Game
return true;
}
if (VirtualGamepadState.healthButton.isHeld && VirtualGamepadState.healthButton.didStateChange) {
if (!QuestLogIsOpen && !SpellbookFlag && stextflag == TalkID::None)
if (!QuestLogIsOpen && !SpellbookFlag && ActiveStore == TalkID::None)
*action = GameAction(GameActionType_USE_HEALTH_POTION);
return true;
}
if (VirtualGamepadState.manaButton.isHeld && VirtualGamepadState.manaButton.didStateChange) {
if (!QuestLogIsOpen && !SpellbookFlag && stextflag == TalkID::None)
if (!QuestLogIsOpen && !SpellbookFlag && ActiveStore == TalkID::None)
*action = GameAction(GameActionType_USE_MANA_POTION);
return true;
}
Expand All @@ -196,7 +196,7 @@ bool GetGameAction(const SDL_Event &event, ControllerButtonEvent ctrlEvent, Game

SDL_Keycode translation = SDLK_UNKNOWN;

if (gmenu_is_active() || stextflag != TalkID::None)
if (gmenu_is_active() || ActiveStore != TalkID::None)
translation = TranslateControllerButtonToGameMenuKey(ctrlEvent.button);
else if (inGameMenu)
translation = TranslateControllerButtonToMenuKey(ctrlEvent.button);
Expand Down
4 changes: 2 additions & 2 deletions Source/controls/plrctrls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ quest_id pcursquest = Q_INVALID;
*/
bool InGameMenu()
{
return stextflag != TalkID::None
return ActiveStore != TalkID::None
|| HelpFlag
|| ChatLogFlag
|| ChatFlag
Expand Down Expand Up @@ -1347,7 +1347,7 @@ HandleLeftStickOrDPadFn GetLeftStickOrDPadGameUIHandler()
if (QuestLogIsOpen) {
return &QuestLogMove;
}
if (stextflag != TalkID::None) {
if (ActiveStore != TalkID::None) {
return &StoreMove;
}
return nullptr;
Expand Down
2 changes: 1 addition & 1 deletion Source/controls/touch/event_handlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ bool HandleGameMenuInteraction(const SDL_Event &event)

bool HandleStoreInteraction(const SDL_Event &event)
{
if (stextflag == TalkID::None)
if (ActiveStore == TalkID::None)
return false;
if (event.type == SDL_FINGERDOWN)
CheckStoreBtn();
Expand Down
2 changes: 1 addition & 1 deletion Source/controls/touch/renderers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ VirtualGamepadButtonType PrimaryActionButtonRenderer::GetButtonType()

VirtualGamepadButtonType PrimaryActionButtonRenderer::GetTownButtonType()
{
if (stextflag != TalkID::None || pcursmonst != -1)
if (ActiveStore != TalkID::None || pcursmonst != -1)
return GetTalkButtonType(virtualPadButton->isHeld);
return GetBlankButtonType(virtualPadButton->isHeld);
}
Expand Down
40 changes: 20 additions & 20 deletions Source/diablo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ void LeftMouseDown(uint16_t modState)
return;
}

if (stextflag != TalkID::None) {
if (ActiveStore != TalkID::None) {
CheckStoreBtn();
return;
}
Expand Down Expand Up @@ -417,7 +417,7 @@ void LeftMouseUp(uint16_t modState)
}
if (LevelButtonDown)
CheckLevelButtonUp();
if (stextflag != TalkID::None)
if (ActiveStore != TalkID::None)
ReleaseStoreBtn();
}

Expand All @@ -439,7 +439,7 @@ void RightMouseDown(bool isShiftHeld)
doom_close();
return;
}
if (stextflag != TalkID::None)
if (ActiveStore != TalkID::None)
return;
if (SpellSelectFlag) {
SetSpell();
Expand Down Expand Up @@ -576,7 +576,7 @@ void PressKey(SDL_Keycode vkey, uint16_t modState)
if ((modState & KMOD_ALT) != 0) {
sgOptions.Graphics.fullscreen.SetValue(!IsFullScreen());
SaveOptions();
} else if (stextflag != TalkID::None) {
} else if (ActiveStore != TalkID::None) {
StoreEnter();
} else if (QuestLogIsOpen) {
QuestlogEnter();
Expand All @@ -585,7 +585,7 @@ void PressKey(SDL_Keycode vkey, uint16_t modState)
}
return;
case SDLK_UP:
if (stextflag != TalkID::None) {
if (ActiveStore != TalkID::None) {
StoreUp();
} else if (QuestLogIsOpen) {
QuestlogUp();
Expand All @@ -600,7 +600,7 @@ void PressKey(SDL_Keycode vkey, uint16_t modState)
}
return;
case SDLK_DOWN:
if (stextflag != TalkID::None) {
if (ActiveStore != TalkID::None) {
StoreDown();
} else if (QuestLogIsOpen) {
QuestlogDown();
Expand All @@ -615,14 +615,14 @@ void PressKey(SDL_Keycode vkey, uint16_t modState)
}
return;
case SDLK_PAGEUP:
if (stextflag != TalkID::None) {
if (ActiveStore != TalkID::None) {
StorePrior();
} else if (ChatLogFlag) {
ChatLogScrollTop();
}
return;
case SDLK_PAGEDOWN:
if (stextflag != TalkID::None) {
if (ActiveStore != TalkID::None) {
StoreNext();
} else if (ChatLogFlag) {
ChatLogScrollBottom();
Expand All @@ -643,7 +643,7 @@ void PressKey(SDL_Keycode vkey, uint16_t modState)

void HandleMouseButtonDown(Uint8 button, uint16_t modState)
{
if (stextflag != TalkID::None && (button == SDL_BUTTON_X1
if (ActiveStore != TalkID::None && (button == SDL_BUTTON_X1
#if !SDL_VERSION_ATLEAST(2, 0, 0)
|| button == 8
#endif
Expand Down Expand Up @@ -752,7 +752,7 @@ void GameEventHandler(const SDL_Event &event, uint16_t modState)
#if SDL_VERSION_ATLEAST(2, 0, 0)
case SDL_MOUSEWHEEL:
if (event.wheel.y > 0) { // Up
if (stextflag != TalkID::None) {
if (ActiveStore != TalkID::None) {
StoreUp();
} else if (QuestLogIsOpen) {
QuestlogUp();
Expand All @@ -766,7 +766,7 @@ void GameEventHandler(const SDL_Event &event, uint16_t modState)
sgOptions.Keymapper.KeyPressed(MouseScrollUpButton);
}
} else if (event.wheel.y < 0) { // down
if (stextflag != TalkID::None) {
if (ActiveStore != TalkID::None) {
StoreDown();
} else if (QuestLogIsOpen) {
QuestlogDown();
Expand Down Expand Up @@ -1492,7 +1492,7 @@ void HelpKeyPressed()
{
if (HelpFlag) {
HelpFlag = false;
} else if (stextflag != TalkID::None) {
} else if (ActiveStore != TalkID::None) {
InfoString = StringOrView {};
AddInfoBoxString(_("No help available")); /// BUGFIX: message isn't displayed
AddInfoBoxString(_("while in stores"));
Expand All @@ -1516,7 +1516,7 @@ void HelpKeyPressed()

void InventoryKeyPressed()
{
if (stextflag != TalkID::None)
if (ActiveStore != TalkID::None)
return;
invflag = !invflag;
if (!IsLeftPanelOpen() && CanPanelsCoverView()) {
Expand All @@ -1537,7 +1537,7 @@ void InventoryKeyPressed()

void CharacterSheetKeyPressed()
{
if (stextflag != TalkID::None)
if (ActiveStore != TalkID::None)
return;
if (!IsRightPanelOpen() && CanPanelsCoverView()) {
if (CharFlag) { // We are closing the character sheet
Expand All @@ -1555,7 +1555,7 @@ void CharacterSheetKeyPressed()

void QuestLogKeyPressed()
{
if (stextflag != TalkID::None)
if (ActiveStore != TalkID::None)
return;
if (!QuestLogIsOpen) {
StartQuestlog();
Expand All @@ -1580,7 +1580,7 @@ void QuestLogKeyPressed()

void DisplaySpellsKeyPressed()
{
if (stextflag != TalkID::None)
if (ActiveStore != TalkID::None)
return;
CloseCharPanel();
QuestLogIsOpen = false;
Expand All @@ -1596,7 +1596,7 @@ void DisplaySpellsKeyPressed()

void SpellBookKeyPressed()
{
if (stextflag != TalkID::None)
if (ActiveStore != TalkID::None)
return;
SpellbookFlag = !SpellbookFlag;
if (!IsLeftPanelOpen() && CanPanelsCoverView()) {
Expand Down Expand Up @@ -1761,7 +1761,7 @@ void InitKeymapActions()
SDLK_F3,
[] { gamemenu_load_game(false); },
nullptr,
[&]() { return !gbIsMultiplayer && gbValidSaveFile && stextflag == TalkID::None && IsGameRunning(); });
[&]() { return !gbIsMultiplayer && gbValidSaveFile && ActiveStore == TalkID::None && IsGameRunning(); });
#ifndef NOEXIT
sgOptions.Keymapper.AddAction(
"QuitGame",
Expand Down Expand Up @@ -2328,7 +2328,7 @@ void InitPadmapActions()
ControllerButton_NONE,
[] { gamemenu_load_game(false); },
nullptr,
[&]() { return !gbIsMultiplayer && gbValidSaveFile && stextflag == TalkID::None && IsGameRunning(); });
[&]() { return !gbIsMultiplayer && gbValidSaveFile && ActiveStore == TalkID::None && IsGameRunning(); });
sgOptions.Padmapper.AddAction(
"Item Highlighting",
N_("Item highlighting"),
Expand Down Expand Up @@ -2778,7 +2778,7 @@ bool PressEscKey()
rv = true;
}

if (stextflag != TalkID::None) {
if (ActiveStore != TalkID::None) {
StoreESC();
rv = true;
}
Expand Down
4 changes: 2 additions & 2 deletions Source/engine/render/scrollrt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ void DrawItem(const Surface &out, int8_t itemIndex, Point targetBufferPosition,
const Item &item = Items[itemIndex];
const ClxSprite sprite = item.AnimInfo.currentSprite();
const Point position = targetBufferPosition + item.getRenderingOffset(sprite);
if (stextflag == TalkID::None && (itemIndex == pcursitem || AutoMapShowItems)) {
if (ActiveStore == TalkID::None && (itemIndex == pcursitem || AutoMapShowItems)) {
ClxDrawOutlineSkipColorZero(out, GetOutlineColor(item, false), position, sprite);
}
ClxDrawLight(out, position, sprite, lightTableIndex);
Expand Down Expand Up @@ -1197,7 +1197,7 @@ void DrawView(const Surface &out, Point startPosition)
DrawMonsterHealthBar(out);
DrawFloatingNumbers(out, startPosition, offset);

if (stextflag != TalkID::None && !qtextflag)
if (ActiveStore != TalkID::None && !qtextflag)
DrawSText(out);
if (invflag) {
DrawInv(out);
Expand Down
2 changes: 1 addition & 1 deletion Source/inv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2007,7 +2007,7 @@ bool UseInvItem(int cii)
return true;
if (pcurs != CURSOR_HAND)
return true;
if (stextflag != TalkID::None)
if (ActiveStore != TalkID::None)
return true;
if (cii < INVITEM_INV_FIRST)
return false;
Expand Down
Loading
Loading