mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-31 12:30:40 +00:00
- Make setForcedSyncInput()
require a player index.
* This should only ever apply to the console player.
This commit is contained in:
parent
7da3b097fb
commit
e5f3f5f149
13 changed files with 29 additions and 27 deletions
|
@ -1524,9 +1524,9 @@ bool SyncInput()
|
||||||
return gamesetinput || cl_syncinput || cl_capfps;
|
return gamesetinput || cl_syncinput || cl_capfps;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setForcedSyncInput()
|
void setForcedSyncInput(const int playeridx)
|
||||||
{
|
{
|
||||||
gamesetinput = true;
|
if (playeridx == myconnectindex) gamesetinput = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void resetForcedSyncInput()
|
void resetForcedSyncInput()
|
||||||
|
@ -1536,7 +1536,9 @@ void resetForcedSyncInput()
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION_NATIVE(_Raze, forceSyncInput, setForcedSyncInput)
|
DEFINE_ACTION_FUNCTION_NATIVE(_Raze, forceSyncInput, setForcedSyncInput)
|
||||||
{
|
{
|
||||||
setForcedSyncInput();
|
PARAM_PROLOGUE;
|
||||||
|
PARAM_INT(playeridx);
|
||||||
|
setForcedSyncInput(playeridx);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ void CompleteLevel(MapRecord* map);
|
||||||
bool CheckCheatmode(bool printmsg = true, bool sponly = false);
|
bool CheckCheatmode(bool printmsg = true, bool sponly = false);
|
||||||
void setVideoMode();
|
void setVideoMode();
|
||||||
bool SyncInput();
|
bool SyncInput();
|
||||||
void setForcedSyncInput();
|
void setForcedSyncInput(const int playeridx);
|
||||||
void resetForcedSyncInput();
|
void resetForcedSyncInput();
|
||||||
|
|
||||||
void TITLE_InformName(const char* newname);
|
void TITLE_InformName(const char* newname);
|
||||||
|
|
|
@ -2188,7 +2188,7 @@ void trPlayerCtrlSetLookAngle(int value, PLAYER* pPlayer)
|
||||||
|
|
||||||
if (const double adjustment = clamp(value * 0.125 * (value > 0 ? lookStepUp : lookStepDown), downAngle, upAngle))
|
if (const double adjustment = clamp(value * 0.125 * (value > 0 ? lookStepUp : lookStepDown), downAngle, upAngle))
|
||||||
{
|
{
|
||||||
setForcedSyncInput();
|
setForcedSyncInput(pPlayer->nPlayer);
|
||||||
pPlayer->actor->spr.Angles.Pitch = maphoriz(-100. * tan(adjustment * pi::pi() * (1. / 1024.)));
|
pPlayer->actor->spr.Angles.Pitch = maphoriz(-100. * tan(adjustment * pi::pi() * (1. / 1024.)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6060,12 +6060,12 @@ bool modernTypeOperateSprite(DBloodActor* actor, EVENT& event)
|
||||||
if (actor->xspr.data4 != 0) break;
|
if (actor->xspr.data4 != 0) break;
|
||||||
else if (actor->spr.flags & kModernTypeFlag1)
|
else if (actor->spr.flags & kModernTypeFlag1)
|
||||||
{
|
{
|
||||||
setForcedSyncInput();
|
setForcedSyncInput(pPlayer->nPlayer);
|
||||||
pPlayer->actor->spr.Angles.Yaw = actor->spr.Angles.Yaw;
|
pPlayer->actor->spr.Angles.Yaw = actor->spr.Angles.Yaw;
|
||||||
}
|
}
|
||||||
else if (valueIsBetween(actor->xspr.data2, -kAng360, kAng360))
|
else if (valueIsBetween(actor->xspr.data2, -kAng360, kAng360))
|
||||||
{
|
{
|
||||||
setForcedSyncInput();
|
setForcedSyncInput(pPlayer->nPlayer);
|
||||||
pPlayer->actor->spr.Angles.Yaw = mapangle(actor->xspr.data2);
|
pPlayer->actor->spr.Angles.Yaw = mapangle(actor->xspr.data2);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1525,7 +1525,7 @@ void ProcessInput(PLAYER* pPlayer)
|
||||||
if (actor->xspr.health == 0)
|
if (actor->xspr.health == 0)
|
||||||
{
|
{
|
||||||
// force synchronised input upon death.
|
// force synchronised input upon death.
|
||||||
setForcedSyncInput();
|
setForcedSyncInput(pPlayer->nPlayer);
|
||||||
|
|
||||||
bool bSeqStat = playerSeqPlaying(pPlayer, 16);
|
bool bSeqStat = playerSeqPlaying(pPlayer, 16);
|
||||||
DBloodActor* fragger = pPlayer->fragger;
|
DBloodActor* fragger = pPlayer->fragger;
|
||||||
|
|
|
@ -551,7 +551,7 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PLAYER_NEWOWNER:
|
case PLAYER_NEWOWNER:
|
||||||
if (bSet && (ps[iPlayer].newOwner = vValue.safeActor())) setForcedSyncInput();
|
if (bSet && (ps[iPlayer].newOwner = vValue.safeActor())) setForcedSyncInput(iPlayer);
|
||||||
else SetGameVarID(lVar2, ps[iPlayer].newOwner, sActor, sPlayer);
|
else SetGameVarID(lVar2, ps[iPlayer].newOwner, sActor, sPlayer);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -621,7 +621,7 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PLAYER_ON_CRANE:
|
case PLAYER_ON_CRANE:
|
||||||
if (bSet && (ps[iPlayer].on_crane = vValue.safeActor())) setForcedSyncInput();
|
if (bSet && (ps[iPlayer].on_crane = vValue.safeActor())) setForcedSyncInput(iPlayer);
|
||||||
else SetGameVarID(lVar2, (ps[iPlayer].on_crane), sActor, sPlayer);
|
else SetGameVarID(lVar2, (ps[iPlayer].on_crane), sActor, sPlayer);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -546,7 +546,7 @@ void playerisdead(int snum, int psectlotag, double floorz, double ceilingz)
|
||||||
auto actor = p->GetActor();
|
auto actor = p->GetActor();
|
||||||
|
|
||||||
// lock input when dead.
|
// lock input when dead.
|
||||||
setForcedSyncInput();
|
setForcedSyncInput(snum);
|
||||||
|
|
||||||
if (p->dead_flag == 0)
|
if (p->dead_flag == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2714,7 +2714,7 @@ void processinput_d(int snum)
|
||||||
|
|
||||||
if (p->newOwner != nullptr)
|
if (p->newOwner != nullptr)
|
||||||
{
|
{
|
||||||
setForcedSyncInput();
|
setForcedSyncInput(snum);
|
||||||
p->vel.X = p->vel.Y = 0;
|
p->vel.X = p->vel.Y = 0;
|
||||||
pact->vel.X = 0;
|
pact->vel.X = 0;
|
||||||
|
|
||||||
|
@ -2733,12 +2733,12 @@ void processinput_d(int snum)
|
||||||
if (p->centeringView())
|
if (p->centeringView())
|
||||||
{
|
{
|
||||||
p->sync.horz = 0;
|
p->sync.horz = 0;
|
||||||
setForcedSyncInput();
|
setForcedSyncInput(snum);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p->on_crane != nullptr)
|
if (p->on_crane != nullptr)
|
||||||
{
|
{
|
||||||
setForcedSyncInput();
|
setForcedSyncInput(snum);
|
||||||
goto HORIZONLY;
|
goto HORIZONLY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2774,7 +2774,7 @@ void processinput_d(int snum)
|
||||||
doubvel = 0;
|
doubvel = 0;
|
||||||
p->vel.X = 0;
|
p->vel.X = 0;
|
||||||
p->vel.Y = 0;
|
p->vel.Y = 0;
|
||||||
setForcedSyncInput();
|
setForcedSyncInput(snum);
|
||||||
}
|
}
|
||||||
else if (SyncInput())
|
else if (SyncInput())
|
||||||
{
|
{
|
||||||
|
|
|
@ -3302,7 +3302,7 @@ void processinput_r(int snum)
|
||||||
|
|
||||||
if (p->newOwner != nullptr)
|
if (p->newOwner != nullptr)
|
||||||
{
|
{
|
||||||
setForcedSyncInput();
|
setForcedSyncInput(snum);
|
||||||
p->vel.X = p->vel.Y = 0;
|
p->vel.X = p->vel.Y = 0;
|
||||||
pact->vel.X = 0;
|
pact->vel.X = 0;
|
||||||
|
|
||||||
|
@ -3321,12 +3321,12 @@ void processinput_r(int snum)
|
||||||
if (p->centeringView())
|
if (p->centeringView())
|
||||||
{
|
{
|
||||||
p->sync.horz = 0;
|
p->sync.horz = 0;
|
||||||
setForcedSyncInput();
|
setForcedSyncInput(snum);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p->on_crane != nullptr)
|
if (p->on_crane != nullptr)
|
||||||
{
|
{
|
||||||
setForcedSyncInput();
|
setForcedSyncInput(snum);
|
||||||
goto HORIZONLY;
|
goto HORIZONLY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3376,7 +3376,7 @@ void processinput_r(int snum)
|
||||||
doubvel = 0;
|
doubvel = 0;
|
||||||
p->vel.X = 0;
|
p->vel.X = 0;
|
||||||
p->vel.Y = 0;
|
p->vel.Y = 0;
|
||||||
setForcedSyncInput();
|
setForcedSyncInput(snum);
|
||||||
}
|
}
|
||||||
else if (SyncInput())
|
else if (SyncInput())
|
||||||
{
|
{
|
||||||
|
|
|
@ -1058,7 +1058,7 @@ void AIPlayer::Tick(RunListEvent* ev)
|
||||||
{
|
{
|
||||||
if (nTotalPlayers <= 1)
|
if (nTotalPlayers <= 1)
|
||||||
{
|
{
|
||||||
setForcedSyncInput();
|
setForcedSyncInput(nPlayer);
|
||||||
pPlayerActor->spr.Angles = DRotator(nullAngle, GetAngleToSprite(pPlayerActor, pSpiritSprite), nullAngle);
|
pPlayerActor->spr.Angles = DRotator(nullAngle, GetAngleToSprite(pPlayerActor, pSpiritSprite), nullAngle);
|
||||||
pPlayerActor->backupang();
|
pPlayerActor->backupang();
|
||||||
|
|
||||||
|
@ -2491,7 +2491,7 @@ sectdone:
|
||||||
}
|
}
|
||||||
else // else, player's health is less than 0
|
else // else, player's health is less than 0
|
||||||
{
|
{
|
||||||
setForcedSyncInput();
|
setForcedSyncInput(nPlayer);
|
||||||
|
|
||||||
// loc_1C0E9
|
// loc_1C0E9
|
||||||
if (actions & SB_OPEN)
|
if (actions & SB_OPEN)
|
||||||
|
|
|
@ -2630,7 +2630,7 @@ void DoPlayerMoveVehicle(PLAYER* pp)
|
||||||
pp->setcursector(pp->sop->op_main_sector); // for speed
|
pp->setcursector(pp->sop->op_main_sector); // for speed
|
||||||
|
|
||||||
double floordist = abs(zz - pp->sop->floor_loz);
|
double floordist = abs(zz - pp->sop->floor_loz);
|
||||||
setForcedSyncInput();
|
setForcedSyncInput(pp->pnum);
|
||||||
|
|
||||||
if (RectClip)
|
if (RectClip)
|
||||||
{
|
{
|
||||||
|
@ -2751,7 +2751,7 @@ void DoPlayerMoveTurret(PLAYER* pp)
|
||||||
PlaySOsound(pp->sop->mid_sector, SO_IDLE_SOUND);
|
PlaySOsound(pp->sop->mid_sector, SO_IDLE_SOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
setForcedSyncInput();
|
setForcedSyncInput(pp->pnum);
|
||||||
DoPlayerTurnTurret(pp);
|
DoPlayerTurnTurret(pp);
|
||||||
|
|
||||||
if (PLAYER_MOVING(pp) == 0)
|
if (PLAYER_MOVING(pp) == 0)
|
||||||
|
@ -5868,7 +5868,7 @@ void DoPlayerBeginDie(PLAYER* pp)
|
||||||
pp->Flags |= (PF_DEAD);
|
pp->Flags |= (PF_DEAD);
|
||||||
plActor->user.Flags &= ~(SPR_BOUNCE);
|
plActor->user.Flags &= ~(SPR_BOUNCE);
|
||||||
pp->Flags &= ~(PF_HEAD_CONTROL);
|
pp->Flags &= ~(PF_HEAD_CONTROL);
|
||||||
setForcedSyncInput();
|
setForcedSyncInput(pp->pnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
|
@ -151,7 +151,7 @@ class DukeCrane : DukeActor
|
||||||
plr.on_crane = self;
|
plr.on_crane = self;
|
||||||
plr.actor.PlayActorSound("CRANEGRAB");
|
plr.actor.PlayActorSound("CRANEGRAB");
|
||||||
plr.settargetangle(self.angle + 180);
|
plr.settargetangle(self.angle + 180);
|
||||||
Raze.forceSyncInput();
|
Raze.forceSyncInput(Duke.GetPlayerIndex(plr));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -47,7 +47,7 @@ class DukeViewscreen : DukeActor
|
||||||
camsprite = self;
|
camsprite = self;
|
||||||
|
|
||||||
user.newOwner = acti;
|
user.newOwner = acti;
|
||||||
Raze.forceSyncInput();
|
Raze.forceSyncInput(Duke.GetPlayerIndex(user));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,7 +171,7 @@ struct Raze
|
||||||
static double bobval(double angle) { return sin(angle * (360. / 2048)); }
|
static double bobval(double angle) { return sin(angle * (360. / 2048)); }
|
||||||
native static TextureID PickTexture(TextureID texid);
|
native static TextureID PickTexture(TextureID texid);
|
||||||
native static int GetBuildTime();
|
native static int GetBuildTime();
|
||||||
native static void forceSyncInput();
|
native static void forceSyncInput(int playeridx);
|
||||||
native static Font PickBigFont(String cmptext = "");
|
native static Font PickBigFont(String cmptext = "");
|
||||||
native static Font PickSmallFont(String cmptext = "");
|
native static Font PickSmallFont(String cmptext = "");
|
||||||
native static int SoundEnabled();
|
native static int SoundEnabled();
|
||||||
|
|
Loading…
Reference in a new issue