Skip to content

Commit

Permalink
Merge pull request #1312 from JRF-github/master
Browse files Browse the repository at this point in the history
Fix: Buttons stay disabled after leaving the shop keeper interface
  • Loading branch information
selaux committed Jan 23, 2021
2 parents ff5d9b4 + 631cb19 commit a5d448c
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 35 deletions.
10 changes: 4 additions & 6 deletions src/game/Editor/Sector_Summary.cc
Expand Up @@ -47,7 +47,6 @@
#include <string_theory/format>
#include <string_theory/string>

#include <algorithm>
#include <vector>

#define DEVINFO_DIR "../DevInfo"
Expand Down Expand Up @@ -594,7 +593,6 @@ static void RenderItemDetails(void)
OBJECTTYPE *pItem;
INT32 index, i;
UINT32 uiQuantity, uiExistChance, uiStatus;
UINT32 uiTriggerQuantity[8], uiActionQuantity[8], uiTriggerExistChance[8], uiActionExistChance[8];
UINT32 xp, yp;
INT8 bFreqIndex;
SetFontAttributes(FONT10ARIAL, FONT_GRAY2);
Expand All @@ -605,10 +603,10 @@ static void RenderItemDetails(void)
xp = 5;
if (gubSummaryItemMode != ITEMMODE_ENEMY)
{
std::fill_n(uiTriggerQuantity, 32, 0);
std::fill_n(uiActionQuantity, 32, 0);
std::fill_n(uiTriggerExistChance, 32, 0);
std::fill_n(uiActionExistChance, 32, 0);
UINT32 uiTriggerQuantity[8] {};
UINT32 uiActionQuantity[8] {};
UINT32 uiTriggerExistChance[8] {};
UINT32 uiActionExistChance[8] {};
for( index = 1; index < MAXITEMS; index++ )
{
uiQuantity = 0;
Expand Down
52 changes: 26 additions & 26 deletions src/game/Tactical/Interface_Panels.cc
Expand Up @@ -3566,38 +3566,38 @@ void KeyRingSlotInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason )
}


void DisableSMPpanelButtonsWhenInShopKeeperInterface(void)
void ShopKeeperInterface_SetSMpanelButtonsState(bool const enabled)
{
//Go through the buttons that will be under the ShopKeepers ATM panel and disable them
DisableButton( iSMPanelButtons[ STANCEUP_BUTTON ] );
DisableButton( iSMPanelButtons[ UPDOWN_BUTTON ] );
DisableButton( iSMPanelButtons[ CLIMB_BUTTON ] );
DisableButton( iSMPanelButtons[ STANCEDOWN_BUTTON ] );
DisableButton( iSMPanelButtons[ HANDCURSOR_BUTTON ] );
DisableButton( iSMPanelButtons[ BURSTMODE_BUTTON ] );
DisableButton( iSMPanelButtons[ LOOK_BUTTON ] );
DisableButton( iSMPanelButtons[ TALK_BUTTON ] );
DisableButton( iSMPanelButtons[ MUTE_BUTTON ] );

DisableButton( giSMStealthButton );
EnableButton( iSMPanelButtons[ STANCEUP_BUTTON ], enabled );
EnableButton( iSMPanelButtons[ UPDOWN_BUTTON ], enabled );
EnableButton( iSMPanelButtons[ CLIMB_BUTTON ], enabled );
EnableButton( iSMPanelButtons[ STANCEDOWN_BUTTON ], enabled );
EnableButton( iSMPanelButtons[ HANDCURSOR_BUTTON ], enabled );
EnableButton( iSMPanelButtons[ BURSTMODE_BUTTON ], enabled );
EnableButton( iSMPanelButtons[ LOOK_BUTTON ], enabled );
EnableButton( iSMPanelButtons[ TALK_BUTTON ], enabled );
EnableButton( iSMPanelButtons[ MUTE_BUTTON ], enabled );

EnableButton( giSMStealthButton, enabled );

//Make sure the options button is disabled
DisableButton( iSMPanelButtons[ OPTIONS_BUTTON ] );
EnableButton( iSMPanelButtons[ OPTIONS_BUTTON ], enabled );

//Make sure the mapscreen button is disabled
DisableButton( iSMPanelButtons[ SM_MAP_SCREEN_BUTTON ] );

DisableButton( iSMPanelButtons[ STANCEUP_BUTTON ] );
DisableButton( iSMPanelButtons[ UPDOWN_BUTTON ] );
DisableButton( iSMPanelButtons[ CLIMB_BUTTON ] );
DisableButton( iSMPanelButtons[ STANCEDOWN_BUTTON ] );
DisableButton( iSMPanelButtons[ HANDCURSOR_BUTTON ] );
DisableButton( iSMPanelButtons[ BURSTMODE_BUTTON ] );
DisableButton( iSMPanelButtons[ LOOK_BUTTON ] );
DisableButton( iSMPanelButtons[ TALK_BUTTON ] );
DisableButton( iSMPanelButtons[ MUTE_BUTTON ] );

DisableButton( giSMStealthButton );
EnableButton( iSMPanelButtons[ SM_MAP_SCREEN_BUTTON ], enabled );

EnableButton( iSMPanelButtons[ STANCEUP_BUTTON ], enabled );
EnableButton( iSMPanelButtons[ UPDOWN_BUTTON ], enabled );
EnableButton( iSMPanelButtons[ CLIMB_BUTTON ], enabled );
EnableButton( iSMPanelButtons[ STANCEDOWN_BUTTON ], enabled );
EnableButton( iSMPanelButtons[ HANDCURSOR_BUTTON ], enabled );
EnableButton( iSMPanelButtons[ BURSTMODE_BUTTON ], enabled );
EnableButton( iSMPanelButtons[ LOOK_BUTTON ], enabled );
EnableButton( iSMPanelButtons[ TALK_BUTTON ], enabled );
EnableButton( iSMPanelButtons[ MUTE_BUTTON ], enabled );

EnableButton( giSMStealthButton, enabled );
}


Expand Down
2 changes: 1 addition & 1 deletion src/game/Tactical/Interface_Panels.h
Expand Up @@ -89,7 +89,7 @@ extern BOOLEAN gfDisableTacticalPanelButtons;


//Used when the shop keeper interface is active
void DisableSMPpanelButtonsWhenInShopKeeperInterface(void);
void ShopKeeperInterface_SetSMpanelButtonsState(bool enabled);

void ReEvaluateDisabledINVPanelButtons(void);

Expand Down
5 changes: 3 additions & 2 deletions src/game/Tactical/ShopKeeper_Interface.cc
Expand Up @@ -479,7 +479,7 @@ ScreenID ShopKeeperScreenHandle()
}

// render buttons marked dirty
DisableSMPpanelButtonsWhenInShopKeeperInterface();
ShopKeeperInterface_SetSMpanelButtonsState(false);
RenderButtons( );

// render help
Expand Down Expand Up @@ -846,6 +846,7 @@ static void ExitShopKeeperInterface(void)
gRadarRegion.Enable();

gfSMDisableForItems = FALSE;
ShopKeeperInterface_SetSMpanelButtonsState(true);
}

static void DisplayArmsDealerCurrentInventoryPage(void);
Expand All @@ -867,7 +868,7 @@ static void HandleShopKeeperInterface(void)
//if we are in the item desc panel, disable the buttons
if( InItemDescriptionBox( ) && pShopKeeperItemDescObject != NULL )
{
DisableSMPpanelButtonsWhenInShopKeeperInterface();
ShopKeeperInterface_SetSMpanelButtonsState(false);
DisableButton( guiSKI_InvPageUpButton );
DisableButton( guiSKI_InvPageDownButton );
DisableButton( guiSKI_TransactionButton );
Expand Down

0 comments on commit a5d448c

Please sign in to comment.