mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-31 04:20:42 +00:00
- Directly set CorePlayer::ucmd
rather than copying it to a temporary array.
This commit is contained in:
parent
d90aca9640
commit
02bd017d07
13 changed files with 21 additions and 35 deletions
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
struct CorePlayer
|
struct CorePlayer
|
||||||
{
|
{
|
||||||
ticcmd_t cmd;
|
ticcmd_t lastcmd, cmd;
|
||||||
PlayerAngles Angles;
|
PlayerAngles Angles;
|
||||||
DCoreActor* actor;
|
DCoreActor* actor;
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,6 @@ struct tspritetype;
|
||||||
class DCoreActor;
|
class DCoreActor;
|
||||||
struct MapRecord;
|
struct MapRecord;
|
||||||
struct PlayerAngles;
|
struct PlayerAngles;
|
||||||
struct ticcmd_t;
|
|
||||||
|
|
||||||
struct GameStats
|
struct GameStats
|
||||||
{
|
{
|
||||||
|
@ -90,7 +89,7 @@ struct GameInterface
|
||||||
virtual void Startup() = 0;
|
virtual void Startup() = 0;
|
||||||
virtual void DrawBackground() = 0;
|
virtual void DrawBackground() = 0;
|
||||||
virtual void Render() = 0;
|
virtual void Render() = 0;
|
||||||
virtual void Ticker(const ticcmd_t* playercmds) = 0;
|
virtual void Ticker() = 0;
|
||||||
virtual int GetPlayerChecksum(int pnum) { return 0x12345678 + pnum; }
|
virtual int GetPlayerChecksum(int pnum) { return 0x12345678 + pnum; }
|
||||||
virtual const char *CheckCheatMode() { return nullptr; }
|
virtual const char *CheckCheatMode() { return nullptr; }
|
||||||
virtual const char* GenericCheat(int player, int cheat) = 0;
|
virtual const char* GenericCheat(int player, int cheat) = 0;
|
||||||
|
|
|
@ -166,8 +166,6 @@ void NewGame(MapRecord* map, int skill, bool ns = false)
|
||||||
|
|
||||||
static void GameTicker()
|
static void GameTicker()
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
|
|
||||||
handleevents();
|
handleevents();
|
||||||
|
|
||||||
// Todo: Migrate state changes to here instead of doing them ad-hoc
|
// Todo: Migrate state changes to here instead of doing them ad-hoc
|
||||||
|
@ -301,15 +299,13 @@ static void GameTicker()
|
||||||
// get commands, check consistancy, and build new consistancy check
|
// get commands, check consistancy, and build new consistancy check
|
||||||
int buf = (gametic / ticdup) % BACKUPTICS;
|
int buf = (gametic / ticdup) % BACKUPTICS;
|
||||||
|
|
||||||
// array to hold all cmds for this tic.
|
for (int i = 0; i < MAXPLAYERS; i++)
|
||||||
ticcmd_t playercmds[MAXPLAYERS];
|
|
||||||
|
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
|
||||||
{
|
{
|
||||||
if (playeringame[i])
|
if (playeringame[i])
|
||||||
{
|
{
|
||||||
ticcmd_t* cmd = &playercmds[i];
|
ticcmd_t* cmd = &PlayerArray[i]->cmd;
|
||||||
ticcmd_t* newcmd = &netcmds[i][buf];
|
ticcmd_t* newcmd = &netcmds[i][buf];
|
||||||
|
PlayerArray[i]->lastcmd = *cmd;
|
||||||
|
|
||||||
if ((gametic % ticdup) == 0)
|
if ((gametic % ticdup) == 0)
|
||||||
{
|
{
|
||||||
|
@ -358,7 +354,7 @@ static void GameTicker()
|
||||||
case GS_LEVEL:
|
case GS_LEVEL:
|
||||||
gameupdatetime.Reset();
|
gameupdatetime.Reset();
|
||||||
gameupdatetime.Clock();
|
gameupdatetime.Clock();
|
||||||
gi->Ticker(playercmds);
|
gi->Ticker();
|
||||||
TickStatusBar();
|
TickStatusBar();
|
||||||
levelTextTime--;
|
levelTextTime--;
|
||||||
gameupdatetime.Unclock();
|
gameupdatetime.Unclock();
|
||||||
|
|
|
@ -408,7 +408,7 @@ int GameInterface::GetCurrentSkill()
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void GameInterface::Ticker(const ticcmd_t* playercmds)
|
void GameInterface::Ticker()
|
||||||
{
|
{
|
||||||
BloodSpriteIterator it;
|
BloodSpriteIterator it;
|
||||||
while (DBloodActor* act = it.Next()) act->interpolated = false;
|
while (DBloodActor* act = it.Next()) act->interpolated = false;
|
||||||
|
@ -428,7 +428,6 @@ void GameInterface::Ticker(const ticcmd_t* playercmds)
|
||||||
|
|
||||||
for (int i = connecthead; i >= 0; i = connectpoint2[i])
|
for (int i = connecthead; i >= 0; i = connectpoint2[i])
|
||||||
{
|
{
|
||||||
getPlayer(i)->cmd.ucmd = playercmds[i].ucmd;
|
|
||||||
getPlayer(i)->Angles.resetCameraAngles();
|
getPlayer(i)->Angles.resetCameraAngles();
|
||||||
viewBackupView(i);
|
viewBackupView(i);
|
||||||
playerProcess(getPlayer(i));
|
playerProcess(getPlayer(i));
|
||||||
|
|
|
@ -111,7 +111,7 @@ struct GameInterface : public ::GameInterface
|
||||||
void MenuClosed() override;
|
void MenuClosed() override;
|
||||||
bool CanSave() override;
|
bool CanSave() override;
|
||||||
void UpdateSounds() override;
|
void UpdateSounds() override;
|
||||||
void Ticker(const ticcmd_t* playercmds) override;
|
void Ticker() override;
|
||||||
void DrawBackground() override;
|
void DrawBackground() override;
|
||||||
void Startup() override;
|
void Startup() override;
|
||||||
void Render() override;
|
void Render() override;
|
||||||
|
|
|
@ -44,7 +44,7 @@ struct GameInterface : public ::GameInterface
|
||||||
void Startup() override;
|
void Startup() override;
|
||||||
void DrawBackground() override;
|
void DrawBackground() override;
|
||||||
void Render() override;
|
void Render() override;
|
||||||
void Ticker(const ticcmd_t* playercmds) override;
|
void Ticker() override;
|
||||||
const char* GenericCheat(int player, int cheat) override;
|
const char* GenericCheat(int player, int cheat) override;
|
||||||
const char* CheckCheatMode() override;
|
const char* CheckCheatMode() override;
|
||||||
void NextLevel(MapRecord* map, int skill) override;
|
void NextLevel(MapRecord* map, int skill) override;
|
||||||
|
|
|
@ -44,7 +44,7 @@ BEGIN_DUKE_NS
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void GameInterface::Ticker(const ticcmd_t* playercmds)
|
void GameInterface::Ticker()
|
||||||
{
|
{
|
||||||
if (rtsplaying > 0) rtsplaying--;
|
if (rtsplaying > 0) rtsplaying--;
|
||||||
|
|
||||||
|
@ -65,7 +65,6 @@ void GameInterface::Ticker(const ticcmd_t* playercmds)
|
||||||
for (int i = connecthead; i >= 0; i = connectpoint2[i])
|
for (int i = connecthead; i >= 0; i = connectpoint2[i])
|
||||||
{
|
{
|
||||||
getPlayer(i)->Angles.resetCameraAngles();
|
getPlayer(i)->Angles.resetCameraAngles();
|
||||||
getPlayer(i)->cmd.ucmd = playercmds[i].ucmd;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// disable synchronised input if set by game.
|
// disable synchronised input if set by game.
|
||||||
|
|
|
@ -310,7 +310,7 @@ static void GameMove(void)
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void GameInterface::Ticker(const ticcmd_t* playercmds)
|
void GameInterface::Ticker()
|
||||||
{
|
{
|
||||||
if (paused)
|
if (paused)
|
||||||
{
|
{
|
||||||
|
@ -325,7 +325,6 @@ void GameInterface::Ticker(const ticcmd_t* playercmds)
|
||||||
{
|
{
|
||||||
const auto pPlayer = getPlayer(i);
|
const auto pPlayer = getPlayer(i);
|
||||||
pPlayer->Angles.resetCameraAngles();
|
pPlayer->Angles.resetCameraAngles();
|
||||||
pPlayer->cmd.ucmd = playercmds[i].ucmd;
|
|
||||||
updatePlayerTarget(pPlayer);
|
updatePlayerTarget(pPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -222,7 +222,7 @@ struct GameInterface : public ::GameInterface
|
||||||
bool CanSave() override;
|
bool CanSave() override;
|
||||||
void UpdateSounds() override;
|
void UpdateSounds() override;
|
||||||
void ErrorCleanup() override;
|
void ErrorCleanup() override;
|
||||||
void Ticker(const ticcmd_t* playercmds) override;
|
void Ticker() override;
|
||||||
void DrawBackground() override;
|
void DrawBackground() override;
|
||||||
void Render() override;
|
void Render() override;
|
||||||
//void DrawWeapons() override;
|
//void DrawWeapons() override;
|
||||||
|
|
|
@ -710,9 +710,9 @@ int GameInterface::GetCurrentSkill()
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void GameInterface::Ticker(const ticcmd_t* playercmds)
|
void GameInterface::Ticker(void)
|
||||||
{
|
{
|
||||||
domovethings(playercmds);
|
domovethings();
|
||||||
r_NoInterpolate = paused;
|
r_NoInterpolate = paused;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1745,9 +1745,6 @@ struct SWPlayer final : public CorePlayer
|
||||||
int16_t bcnt; // bob count
|
int16_t bcnt; // bob count
|
||||||
double bob_z, obob_z;
|
double bob_z, obob_z;
|
||||||
|
|
||||||
//Multiplayer variables
|
|
||||||
InputPacket lastinput;
|
|
||||||
|
|
||||||
// must start out as 0
|
// must start out as 0
|
||||||
int playerreadyflag;
|
int playerreadyflag;
|
||||||
|
|
||||||
|
@ -1883,7 +1880,7 @@ struct GameInterface : public ::GameInterface
|
||||||
void UpdateSounds() override;
|
void UpdateSounds() override;
|
||||||
void ErrorCleanup() override;
|
void ErrorCleanup() override;
|
||||||
void DrawBackground(void) override;
|
void DrawBackground(void) override;
|
||||||
void Ticker(const ticcmd_t* playercmds) override;
|
void Ticker(void) override;
|
||||||
void Render() override;
|
void Render() override;
|
||||||
//void DrawWeapons() override;
|
//void DrawWeapons() override;
|
||||||
void Startup() override;
|
void Startup() override;
|
||||||
|
|
|
@ -2459,9 +2459,9 @@ void DoPlayerMoveVehicle(SWPlayer* pp)
|
||||||
|
|
||||||
if (!Prediction)
|
if (!Prediction)
|
||||||
{
|
{
|
||||||
if (abs(pp->cmd.ucmd.fvel + pp->cmd.ucmd.svel) && !abs(pp->lastinput.fvel + pp->lastinput.svel))
|
if (abs(pp->cmd.ucmd.fvel + pp->cmd.ucmd.svel) && !abs(pp->lastcmd.ucmd.fvel + pp->lastcmd.ucmd.svel))
|
||||||
PlaySOsound(pp->sop->mid_sector,SO_DRIVE_SOUND);
|
PlaySOsound(pp->sop->mid_sector,SO_DRIVE_SOUND);
|
||||||
else if (!abs(pp->cmd.ucmd.fvel + pp->cmd.ucmd.svel) && abs(pp->lastinput.fvel + pp->lastinput.svel))
|
else if (!abs(pp->cmd.ucmd.fvel + pp->cmd.ucmd.svel) && abs(pp->lastcmd.ucmd.fvel + pp->lastcmd.ucmd.svel))
|
||||||
PlaySOsound(pp->sop->mid_sector,SO_IDLE_SOUND);
|
PlaySOsound(pp->sop->mid_sector,SO_IDLE_SOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2631,9 +2631,9 @@ void DoPlayerMoveTurret(SWPlayer* pp)
|
||||||
{
|
{
|
||||||
if (!Prediction)
|
if (!Prediction)
|
||||||
{
|
{
|
||||||
if (pp->cmd.ucmd.avel && !pp->lastinput.avel)
|
if (pp->cmd.ucmd.avel && !pp->lastcmd.ucmd.avel)
|
||||||
PlaySOsound(pp->sop->mid_sector, SO_DRIVE_SOUND);
|
PlaySOsound(pp->sop->mid_sector, SO_DRIVE_SOUND);
|
||||||
else if (!pp->cmd.ucmd.avel && pp->lastinput.avel)
|
else if (!pp->cmd.ucmd.avel && pp->lastcmd.ucmd.avel)
|
||||||
PlaySOsound(pp->sop->mid_sector, SO_IDLE_SOUND);
|
PlaySOsound(pp->sop->mid_sector, SO_IDLE_SOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6728,7 +6728,7 @@ void PauseMultiPlay(void)
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void domovethings(const ticcmd_t* playercmds)
|
void domovethings(void)
|
||||||
{
|
{
|
||||||
short pnum;
|
short pnum;
|
||||||
|
|
||||||
|
@ -6776,9 +6776,6 @@ void domovethings(const ticcmd_t* playercmds)
|
||||||
pp = getPlayer(pnum);
|
pp = getPlayer(pnum);
|
||||||
GlobPlayerP = pp;
|
GlobPlayerP = pp;
|
||||||
|
|
||||||
pp->lastinput = pp->cmd.ucmd;
|
|
||||||
pp->cmd.ucmd = playercmds[pnum].ucmd;
|
|
||||||
|
|
||||||
if (pp->cookieTime)
|
if (pp->cookieTime)
|
||||||
{
|
{
|
||||||
pp->cookieTime -= synctics;
|
pp->cookieTime -= synctics;
|
||||||
|
|
|
@ -122,7 +122,7 @@ int SetVisNorm(void);
|
||||||
void DoWeapon(void);
|
void DoWeapon(void);
|
||||||
void HeadBobStateControl(void);
|
void HeadBobStateControl(void);
|
||||||
void DoPlayer(void);
|
void DoPlayer(void);
|
||||||
void domovethings(const ticcmd_t* playercmds);
|
void domovethings(void);
|
||||||
void InitAllPlayers(void);
|
void InitAllPlayers(void);
|
||||||
void InitMultiPlayerInfo(const DVector3& spawnpos, const DAngle startang);
|
void InitMultiPlayerInfo(const DVector3& spawnpos, const DAngle startang);
|
||||||
void DoPlayerDivePalette(SWPlayer* pp);
|
void DoPlayerDivePalette(SWPlayer* pp);
|
||||||
|
|
Loading…
Reference in a new issue