- avoid writing directly to a backend status variable

This commit is contained in:
Christoph Oelckers 2019-10-28 07:10:56 +01:00
parent 901b86577e
commit 21f6178ade
7 changed files with 16 additions and 10 deletions

View file

@ -1684,7 +1684,7 @@ RESTART:
} }
netUpdate(); netUpdate();
MUSIC_Update(); MUSIC_Update();
CONTROL_BindsEnabled = gInputMode == kInputGame; inputState.SetBindsEnabled(gInputMode == kInputGame);
switch (gInputMode) switch (gInputMode)
{ {
case kInputMenu: case kInputMenu:

View file

@ -316,7 +316,7 @@ void CDemo::ProcessKeys(void)
void CDemo::Playback(void) void CDemo::Playback(void)
{ {
CONTROL_BindsEnabled = false; inputState.SetBindsEnabled(false);
ready2send = 0; ready2send = 0;
int v4 = 0; int v4 = 0;
if (!CGameMenuMgr::m_bActive) if (!CGameMenuMgr::m_bActive)

View file

@ -27,7 +27,7 @@ enum
}; };
extern consolekeybind_t CONTROL_KeyBinds[NUMKEYS + MAXMOUSEBUTTONS]; extern consolekeybind_t CONTROL_KeyBinds[NUMKEYS + MAXMOUSEBUTTONS];
extern bool CONTROL_BindsEnabled;
// Order is that of EDuke32 by necessity because it exposes the key binds to scripting by index instead of by name. // Order is that of EDuke32 by necessity because it exposes the key binds to scripting by index instead of by name.
enum GameFunction_t enum GameFunction_t
@ -212,6 +212,12 @@ public:
return !!KeyStatus[sc_Escape]; return !!KeyStatus[sc_Escape];
} }
void SetBindsEnabled(bool on)
{
// This just forwards the setting
CONTROL_BindsEnabled = on;
}
}; };

View file

@ -192,7 +192,7 @@ void G_HandleSpecialKeys(void)
auto &myplayer = *g_player[myconnectindex].ps; auto &myplayer = *g_player[myconnectindex].ps;
// we need CONTROL_GetInput in order to pick up joystick button presses // we need CONTROL_GetInput in order to pick up joystick button presses
if (CONTROL_Started && (!(myplayer.gm & MODE_GAME) || (myplayer.gm & MODE_MENU))) if ((!(myplayer.gm & MODE_GAME) || (myplayer.gm & MODE_MENU)))
{ {
ControlInfo noshareinfo; ControlInfo noshareinfo;
CONTROL_GetInput(&noshareinfo); CONTROL_GetInput(&noshareinfo);
@ -6686,7 +6686,7 @@ MAIN_LOOP_RESTART:
} }
// only allow binds to function if the player is actually in a game (not in a menu, typing, et cetera) or demo // only allow binds to function if the player is actually in a game (not in a menu, typing, et cetera) or demo
CONTROL_BindsEnabled = !!(myplayer.gm & (MODE_GAME|MODE_DEMO)); inputState.SetBindsEnabled(!!(myplayer.gm & (MODE_GAME|MODE_DEMO)));
#ifndef _WIN32 #ifndef _WIN32
// stdin -> OSD input for dedicated server // stdin -> OSD input for dedicated server

View file

@ -2176,7 +2176,7 @@ void G_BonusScreen(int32_t bonusonly)
FX_StopAllSounds(); FX_StopAllSounds();
S_ClearSoundLocks(); S_ClearSoundLocks();
FX_SetReverb(0L); FX_SetReverb(0L);
CONTROL_BindsEnabled = 1; // so you can use your screenshot bind on the score screens inputState.SetBindsEnabled(1); // so you can use your screenshot bind on the score screens
#ifndef EDUKE32_STANDALONE #ifndef EDUKE32_STANDALONE
if (!bonusonly) if (!bonusonly)

View file

@ -167,7 +167,7 @@ enum gametokens
void G_HandleSpecialKeys(void) void G_HandleSpecialKeys(void)
{ {
// we need CONTROL_GetInput in order to pick up joystick button presses // we need CONTROL_GetInput in order to pick up joystick button presses
if (CONTROL_Started && !(g_player[myconnectindex].ps->gm & MODE_GAME)) if (!(g_player[myconnectindex].ps->gm & MODE_GAME))
{ {
ControlInfo noshareinfo; ControlInfo noshareinfo;
CONTROL_GetInput(&noshareinfo); CONTROL_GetInput(&noshareinfo);
@ -8057,7 +8057,7 @@ MAIN_LOOP_RESTART:
Net_GetPackets(); Net_GetPackets();
// only allow binds to function if the player is actually in a game (not in a menu, typing, et cetera) or demo // only allow binds to function if the player is actually in a game (not in a menu, typing, et cetera) or demo
CONTROL_BindsEnabled = !!(g_player[myconnectindex].ps->gm & (MODE_GAME|MODE_DEMO)); inputState.SetBindsEnabled(!!(g_player[myconnectindex].ps->gm & (MODE_GAME|MODE_DEMO)));
#if 0 #if 0
//#ifndef _WIN32 //#ifndef _WIN32

View file

@ -2204,7 +2204,7 @@ void G_BonusScreen(int32_t bonusonly)
FX_StopAllSounds(); FX_StopAllSounds();
S_ClearSoundLocks(); S_ClearSoundLocks();
FX_SetReverb(0L); FX_SetReverb(0L);
CONTROL_BindsEnabled = 1; // so you can use your screenshot bind on the score screens inputState.SetBindsEnabled(1); // so you can use your screenshot bind on the score screens
if (!bonusonly) if (!bonusonly)
G_BonusCutscenes(); G_BonusCutscenes();
@ -2783,7 +2783,7 @@ void G_BonusScreenRRRA(int32_t bonusonly)
FX_StopAllSounds(); FX_StopAllSounds();
S_ClearSoundLocks(); S_ClearSoundLocks();
FX_SetReverb(0L); FX_SetReverb(0L);
CONTROL_BindsEnabled = 1; // so you can use your screenshot bind on the score screens inputState.SetBindsEnabled(1); // so you can use your screenshot bind on the score screens
if (boardfilename[0] == 0 && numplayers < 2) if (boardfilename[0] == 0 && numplayers < 2)
{ {