- Ensure crouch_toggle bool from 6e3d414b3c is serialised when saving game, and cleared when InputState::ClearAllInput() is called.

This commit is contained in:
Mitchell Richters 2020-11-08 07:30:48 +11:00
parent 59c72c923e
commit f9f365a593
3 changed files with 19 additions and 3 deletions

View file

@ -21,6 +21,7 @@ extern bool GUICapture;
extern bool AppActive;
extern cycle_t drawtime, actortime, thinktime, gameupdatetime;
extern bool r_NoInterpolate;
extern bool crouch_toggle;
struct MapRecord;
extern MapRecord* g_nextmap;

View file

@ -46,7 +46,7 @@ static int WeaponToSend = 0;
ESyncBits ActionsToSend = 0;
static int dpad_lock = 0;
bool sendPause;
bool crouch_toggle;
static double lastCheck;
CVAR(Float, m_pitch, 1.f, CVAR_GLOBALCONFIG | CVAR_ARCHIVE) // Mouse speeds
@ -120,6 +120,7 @@ void InputState::ClearAllInput()
WeaponToSend = 0;
dpad_lock = 0;
lastCheck = 0;
crouch_toggle = false;
buttonMap.ResetButtonStates(); // this is important. If all input is cleared, the buttons must be cleared as well.
gi->clearlocalinputstate(); // also clear game local input state.
}
@ -327,8 +328,6 @@ CCMD(pause)
}
static bool crouch_toggle;
void ApplyGlobalInput(InputPacket& input, ControlInfo* hidInput, bool const crouchable, bool const disableToggle)
{
if (WeaponToSend != 0) input.setNewWeapon(WeaponToSend);

View file

@ -75,6 +75,21 @@ CVAR(String, cl_savedir, "", CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
//
//=============================================================================
static void SerializeGlobals(FSerializer& arc)
{
if (arc.BeginObject("globals"))
{
arc("crouch_toggle", crouch_toggle)
.EndObject();
}
}
//=============================================================================
//
//
//
//=============================================================================
static void SerializeSession(FSerializer& arc)
{
SerializeMap(arc);
@ -85,6 +100,7 @@ static void SerializeSession(FSerializer& arc)
S_SerializeSounds(arc);
SerializeAutomap(arc);
SerializeHud(arc);
SerializeGlobals(arc);
}
//=============================================================================