- Exhumed/SW: Move code to trigger synchronised input for edge cases where its needed into gamecontrol.

This commit is contained in:
Mitchell Richters 2020-12-01 07:31:47 +11:00
parent 0b797b0ccd
commit 22f7fc93f4
4 changed files with 25 additions and 17 deletions

View file

@ -152,6 +152,8 @@ extern int hud_size_max;
int paused;
bool pausedWithKey;
bool gamesetinput = false;
CUSTOM_CVAR(Int, cl_gender, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
{
if (self < 0 || self > 3) self = 0;

View file

@ -226,3 +226,20 @@ extern int chatmodeon;
extern bool sendPause;
extern int lastTic;
//---------------------------------------------------------------------------
//
// Inline functions to help with edge cases where synchronised input is needed.
//
//---------------------------------------------------------------------------
extern bool gamesetinput;
inline void setForcedSyncInput()
{
if (!cl_syncinput) gamesetinput = cl_syncinput = true;
}
inline void resetForcedSyncInput()
{
if (gamesetinput) gamesetinput = cl_syncinput = false;
}

View file

@ -34,8 +34,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_PS_NS
static bool gamesetinput = false;
void GameInterface::WarpToCoords(int x, int y, int z, int ang, int horz)
{
Player *nPlayer = &PlayerList[nLocalPlayer];
@ -107,15 +105,15 @@ void GameInterface::ToggleThirdPerson()
{
bCamera = !bCamera;
if (bCamera && !cl_syncinput)
if (bCamera)
{
gamesetinput = cl_syncinput = true;
setForcedSyncInput();
GrabPalette();
}
}
if (gamesetinput && !bCamera)
if (!bCamera)
{
gamesetinput = cl_syncinput = false;
resetForcedSyncInput();
}
}

View file

@ -133,9 +133,6 @@ PLAYER Player[MAX_SW_PLAYERS_REG + 1];
short NormalVisibility;
// bool for determining whether game has set cl_syncinput or not.
static bool gamesetinput = false;
int InitBloodSpray(int16_t SpriteNum, bool dogib, short velocity);
SPRITEp FindNearSprite(SPRITEp sp, short stat);
@ -2815,10 +2812,7 @@ DoPlayerMoveVehicle(PLAYERp pp)
}
// force synchronised input here for now.
if (!cl_syncinput)
{
gamesetinput = cl_syncinput = true;
}
setForcedSyncInput();
if (PLAYER_MOVING(pp) == 0)
RESET(pp->Flags, PF_PLAYER_MOVED);
@ -7236,10 +7230,7 @@ domovethings(void)
pp->angle.resetadjustment();
// disable synchronised input if set by game.
if (gamesetinput)
{
gamesetinput = cl_syncinput = false;
}
resetForcedSyncInput();
if (pp->DoPlayerAction) pp->DoPlayerAction(pp);