mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-18 22:51:50 +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
|
||||
{
|
||||
ticcmd_t cmd;
|
||||
ticcmd_t lastcmd, cmd;
|
||||
PlayerAngles Angles;
|
||||
DCoreActor* actor;
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@ struct tspritetype;
|
|||
class DCoreActor;
|
||||
struct MapRecord;
|
||||
struct PlayerAngles;
|
||||
struct ticcmd_t;
|
||||
|
||||
struct GameStats
|
||||
{
|
||||
|
@ -90,7 +89,7 @@ struct GameInterface
|
|||
virtual void Startup() = 0;
|
||||
virtual void DrawBackground() = 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 const char *CheckCheatMode() { return nullptr; }
|
||||
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()
|
||||
{
|
||||
int i;
|
||||
|
||||
handleevents();
|
||||
|
||||
// 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
|
||||
int buf = (gametic / ticdup) % BACKUPTICS;
|
||||
|
||||
// array to hold all cmds for this tic.
|
||||
ticcmd_t playercmds[MAXPLAYERS];
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
for (int i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (playeringame[i])
|
||||
{
|
||||
ticcmd_t* cmd = &playercmds[i];
|
||||
ticcmd_t* cmd = &PlayerArray[i]->cmd;
|
||||
ticcmd_t* newcmd = &netcmds[i][buf];
|
||||
PlayerArray[i]->lastcmd = *cmd;
|
||||
|
||||
if ((gametic % ticdup) == 0)
|
||||
{
|
||||
|
@ -358,7 +354,7 @@ static void GameTicker()
|
|||
case GS_LEVEL:
|
||||
gameupdatetime.Reset();
|
||||
gameupdatetime.Clock();
|
||||
gi->Ticker(playercmds);
|
||||
gi->Ticker();
|
||||
TickStatusBar();
|
||||
levelTextTime--;
|
||||
gameupdatetime.Unclock();
|
||||
|
|
|
@ -408,7 +408,7 @@ int GameInterface::GetCurrentSkill()
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void GameInterface::Ticker(const ticcmd_t* playercmds)
|
||||
void GameInterface::Ticker()
|
||||
{
|
||||
BloodSpriteIterator it;
|
||||
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])
|
||||
{
|
||||
getPlayer(i)->cmd.ucmd = playercmds[i].ucmd;
|
||||
getPlayer(i)->Angles.resetCameraAngles();
|
||||
viewBackupView(i);
|
||||
playerProcess(getPlayer(i));
|
||||
|
|
|
@ -111,7 +111,7 @@ struct GameInterface : public ::GameInterface
|
|||
void MenuClosed() override;
|
||||
bool CanSave() override;
|
||||
void UpdateSounds() override;
|
||||
void Ticker(const ticcmd_t* playercmds) override;
|
||||
void Ticker() override;
|
||||
void DrawBackground() override;
|
||||
void Startup() override;
|
||||
void Render() override;
|
||||
|
|
|
@ -44,7 +44,7 @@ struct GameInterface : public ::GameInterface
|
|||
void Startup() override;
|
||||
void DrawBackground() override;
|
||||
void Render() override;
|
||||
void Ticker(const ticcmd_t* playercmds) override;
|
||||
void Ticker() override;
|
||||
const char* GenericCheat(int player, int cheat) override;
|
||||
const char* CheckCheatMode() 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--;
|
||||
|
||||
|
@ -65,7 +65,6 @@ void GameInterface::Ticker(const ticcmd_t* playercmds)
|
|||
for (int i = connecthead; i >= 0; i = connectpoint2[i])
|
||||
{
|
||||
getPlayer(i)->Angles.resetCameraAngles();
|
||||
getPlayer(i)->cmd.ucmd = playercmds[i].ucmd;
|
||||
}
|
||||
|
||||
// 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)
|
||||
{
|
||||
|
@ -325,7 +325,6 @@ void GameInterface::Ticker(const ticcmd_t* playercmds)
|
|||
{
|
||||
const auto pPlayer = getPlayer(i);
|
||||
pPlayer->Angles.resetCameraAngles();
|
||||
pPlayer->cmd.ucmd = playercmds[i].ucmd;
|
||||
updatePlayerTarget(pPlayer);
|
||||
}
|
||||
|
||||
|
|
|
@ -222,7 +222,7 @@ struct GameInterface : public ::GameInterface
|
|||
bool CanSave() override;
|
||||
void UpdateSounds() override;
|
||||
void ErrorCleanup() override;
|
||||
void Ticker(const ticcmd_t* playercmds) override;
|
||||
void Ticker() override;
|
||||
void DrawBackground() override;
|
||||
void Render() 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -1745,9 +1745,6 @@ struct SWPlayer final : public CorePlayer
|
|||
int16_t bcnt; // bob count
|
||||
double bob_z, obob_z;
|
||||
|
||||
//Multiplayer variables
|
||||
InputPacket lastinput;
|
||||
|
||||
// must start out as 0
|
||||
int playerreadyflag;
|
||||
|
||||
|
@ -1883,7 +1880,7 @@ struct GameInterface : public ::GameInterface
|
|||
void UpdateSounds() override;
|
||||
void ErrorCleanup() override;
|
||||
void DrawBackground(void) override;
|
||||
void Ticker(const ticcmd_t* playercmds) override;
|
||||
void Ticker(void) override;
|
||||
void Render() override;
|
||||
//void DrawWeapons() override;
|
||||
void Startup() override;
|
||||
|
|
|
@ -2459,9 +2459,9 @@ void DoPlayerMoveVehicle(SWPlayer* pp)
|
|||
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -2631,9 +2631,9 @@ void DoPlayerMoveTurret(SWPlayer* pp)
|
|||
{
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -6728,7 +6728,7 @@ void PauseMultiPlay(void)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void domovethings(const ticcmd_t* playercmds)
|
||||
void domovethings(void)
|
||||
{
|
||||
short pnum;
|
||||
|
||||
|
@ -6776,9 +6776,6 @@ void domovethings(const ticcmd_t* playercmds)
|
|||
pp = getPlayer(pnum);
|
||||
GlobPlayerP = pp;
|
||||
|
||||
pp->lastinput = pp->cmd.ucmd;
|
||||
pp->cmd.ucmd = playercmds[pnum].ucmd;
|
||||
|
||||
if (pp->cookieTime)
|
||||
{
|
||||
pp->cookieTime -= synctics;
|
||||
|
|
|
@ -122,7 +122,7 @@ int SetVisNorm(void);
|
|||
void DoWeapon(void);
|
||||
void HeadBobStateControl(void);
|
||||
void DoPlayer(void);
|
||||
void domovethings(const ticcmd_t* playercmds);
|
||||
void domovethings(void);
|
||||
void InitAllPlayers(void);
|
||||
void InitMultiPlayerInfo(const DVector3& spawnpos, const DAngle startang);
|
||||
void DoPlayerDivePalette(SWPlayer* pp);
|
||||
|
|
Loading…
Reference in a new issue