@@ -353,8 +353,8 @@ void LeftMouseDown(uint16_t modState)
353353 return ;
354354 }
355355
356- if (ActiveStore != TalkID::None ) {
357- CheckStoreBtn ();
356+ if (IsPlayerInStore () ) {
357+ CheckStoreButton ();
358358 return ;
359359 }
360360
@@ -417,8 +417,8 @@ void LeftMouseUp(uint16_t modState)
417417 }
418418 if (LevelButtonDown)
419419 CheckLevelButtonUp ();
420- if (ActiveStore != TalkID::None )
421- ReleaseStoreBtn ();
420+ if (IsPlayerInStore () )
421+ ReleaseStoreButton ();
422422}
423423
424424void RightMouseDown (bool isShiftHeld)
@@ -439,7 +439,7 @@ void RightMouseDown(bool isShiftHeld)
439439 doom_close ();
440440 return ;
441441 }
442- if (ActiveStore != TalkID::None )
442+ if (IsPlayerInStore () )
443443 return ;
444444 if (SpellSelectFlag) {
445445 SetSpell ();
@@ -576,7 +576,7 @@ void PressKey(SDL_Keycode vkey, uint16_t modState)
576576 if ((modState & KMOD_ALT) != 0 ) {
577577 sgOptions.Graphics .fullscreen .SetValue (!IsFullScreen ());
578578 SaveOptions ();
579- } else if (ActiveStore != TalkID::None ) {
579+ } else if (IsPlayerInStore () ) {
580580 StoreEnter ();
581581 } else if (QuestLogIsOpen) {
582582 QuestlogEnter ();
@@ -585,7 +585,7 @@ void PressKey(SDL_Keycode vkey, uint16_t modState)
585585 }
586586 return ;
587587 case SDLK_UP:
588- if (ActiveStore != TalkID::None ) {
588+ if (IsPlayerInStore () ) {
589589 StoreUp ();
590590 } else if (QuestLogIsOpen) {
591591 QuestlogUp ();
@@ -600,7 +600,7 @@ void PressKey(SDL_Keycode vkey, uint16_t modState)
600600 }
601601 return ;
602602 case SDLK_DOWN:
603- if (ActiveStore != TalkID::None ) {
603+ if (IsPlayerInStore () ) {
604604 StoreDown ();
605605 } else if (QuestLogIsOpen) {
606606 QuestlogDown ();
@@ -615,14 +615,14 @@ void PressKey(SDL_Keycode vkey, uint16_t modState)
615615 }
616616 return ;
617617 case SDLK_PAGEUP:
618- if (ActiveStore != TalkID::None ) {
618+ if (IsPlayerInStore () ) {
619619 StorePrior ();
620620 } else if (ChatLogFlag) {
621621 ChatLogScrollTop ();
622622 }
623623 return ;
624624 case SDLK_PAGEDOWN:
625- if (ActiveStore != TalkID::None ) {
625+ if (IsPlayerInStore () ) {
626626 StoreNext ();
627627 } else if (ChatLogFlag) {
628628 ChatLogScrollBottom ();
@@ -643,7 +643,7 @@ void PressKey(SDL_Keycode vkey, uint16_t modState)
643643
644644void HandleMouseButtonDown (Uint8 button, uint16_t modState)
645645{
646- if (ActiveStore != TalkID::None && (button == SDL_BUTTON_X1
646+ if (IsPlayerInStore () && (button == SDL_BUTTON_X1
647647#if !SDL_VERSION_ATLEAST(2, 0, 0)
648648 || button == 8
649649#endif
@@ -752,7 +752,7 @@ void GameEventHandler(const SDL_Event &event, uint16_t modState)
752752#if SDL_VERSION_ATLEAST(2, 0, 0)
753753 case SDL_MOUSEWHEEL:
754754 if (event.wheel .y > 0 ) { // Up
755- if (ActiveStore != TalkID::None ) {
755+ if (IsPlayerInStore () ) {
756756 StoreUp ();
757757 } else if (QuestLogIsOpen) {
758758 QuestlogUp ();
@@ -766,7 +766,7 @@ void GameEventHandler(const SDL_Event &event, uint16_t modState)
766766 sgOptions.Keymapper .KeyPressed (MouseScrollUpButton);
767767 }
768768 } else if (event.wheel .y < 0 ) { // down
769- if (ActiveStore != TalkID::None ) {
769+ if (IsPlayerInStore () ) {
770770 StoreDown ();
771771 } else if (QuestLogIsOpen) {
772772 QuestlogDown ();
@@ -1492,7 +1492,7 @@ void HelpKeyPressed()
14921492{
14931493 if (HelpFlag) {
14941494 HelpFlag = false ;
1495- } else if (ActiveStore != TalkID::None ) {
1495+ } else if (IsPlayerInStore () ) {
14961496 InfoString = StringOrView {};
14971497 AddInfoBoxString (_ (" No help available" )); // / BUGFIX: message isn't displayed
14981498 AddInfoBoxString (_ (" while in stores" ));
@@ -1516,7 +1516,7 @@ void HelpKeyPressed()
15161516
15171517void InventoryKeyPressed ()
15181518{
1519- if (ActiveStore != TalkID::None )
1519+ if (IsPlayerInStore () )
15201520 return ;
15211521 invflag = !invflag;
15221522 if (!IsLeftPanelOpen () && CanPanelsCoverView ()) {
@@ -1537,7 +1537,7 @@ void InventoryKeyPressed()
15371537
15381538void CharacterSheetKeyPressed ()
15391539{
1540- if (ActiveStore != TalkID::None )
1540+ if (IsPlayerInStore () )
15411541 return ;
15421542 if (!IsRightPanelOpen () && CanPanelsCoverView ()) {
15431543 if (CharFlag) { // We are closing the character sheet
@@ -1555,7 +1555,7 @@ void CharacterSheetKeyPressed()
15551555
15561556void QuestLogKeyPressed ()
15571557{
1558- if (ActiveStore != TalkID::None )
1558+ if (IsPlayerInStore () )
15591559 return ;
15601560 if (!QuestLogIsOpen) {
15611561 StartQuestlog ();
@@ -1580,7 +1580,7 @@ void QuestLogKeyPressed()
15801580
15811581void DisplaySpellsKeyPressed ()
15821582{
1583- if (ActiveStore != TalkID::None )
1583+ if (IsPlayerInStore () )
15841584 return ;
15851585 CloseCharPanel ();
15861586 QuestLogIsOpen = false ;
@@ -1596,7 +1596,7 @@ void DisplaySpellsKeyPressed()
15961596
15971597void SpellBookKeyPressed ()
15981598{
1599- if (ActiveStore != TalkID::None )
1599+ if (IsPlayerInStore () )
16001600 return ;
16011601 SpellbookFlag = !SpellbookFlag;
16021602 if (!IsLeftPanelOpen () && CanPanelsCoverView ()) {
@@ -1761,7 +1761,7 @@ void InitKeymapActions()
17611761 SDLK_F3,
17621762 [] { gamemenu_load_game (false ); },
17631763 nullptr ,
1764- [&]() { return !gbIsMultiplayer && gbValidSaveFile && ActiveStore == TalkID::None && IsGameRunning (); });
1764+ [&]() { return !gbIsMultiplayer && gbValidSaveFile && ! IsPlayerInStore () && IsGameRunning (); });
17651765#ifndef NOEXIT
17661766 sgOptions.Keymapper .AddAction (
17671767 " QuitGame" ,
@@ -2328,7 +2328,7 @@ void InitPadmapActions()
23282328 ControllerButton_NONE,
23292329 [] { gamemenu_load_game (false ); },
23302330 nullptr ,
2331- [&]() { return !gbIsMultiplayer && gbValidSaveFile && ActiveStore == TalkID::None && IsGameRunning (); });
2331+ [&]() { return !gbIsMultiplayer && gbValidSaveFile && ! IsPlayerInStore () && IsGameRunning (); });
23322332 sgOptions.Padmapper .AddAction (
23332333 " Item Highlighting" ,
23342334 N_ (" Item highlighting" ),
@@ -2778,7 +2778,7 @@ bool PressEscKey()
27782778 rv = true ;
27792779 }
27802780
2781- if (ActiveStore != TalkID::None ) {
2781+ if (IsPlayerInStore () ) {
27822782 StoreESC ();
27832783 rv = true ;
27842784 }
0 commit comments