- Added two new net commands: DEM_WIPEON and DEM_WIPEOFF. They keep track of

when a player is going through a screen wipe and act like a pause, so the
  game doesn't run several tics afterward to catch up with it.


SVN r485 (trunk)
This commit is contained in:
Randy Heit 2007-02-15 00:01:21 +00:00
parent 01cd91fd9e
commit ecc45d5d6e
8 changed files with 34 additions and 11 deletions

View file

@ -1,4 +1,7 @@
February 14, 2007 February 14, 2007
- Added two new net commands: DEM_WIPEON and DEM_WIPEOFF. They keep track of
when a player is going through a screen wipe and act like a pause, so the
game doesn't run several tics afterward to catch up with it.
- Fixed: EV_Teleport() did not set players to their idle state, so if they - Fixed: EV_Teleport() did not set players to their idle state, so if they
were running when the teleported, they would still be running afterward were running when the teleported, they would still be running afterward
even though they weren't moving anywhere. Normally, P_XYMovement() does even though they weren't moving anywhere. Normally, P_XYMovement() does

View file

@ -584,10 +584,9 @@ void D_Display (bool screenshot)
NoWipe = 10; NoWipe = 10;
} }
NetUpdate (); // send out any new accumulation
if (!wipe || screenshot || NoWipe < 0) if (!wipe || screenshot || NoWipe < 0)
{ {
NetUpdate (); // send out any new accumulation
// normal update // normal update
C_DrawConsole (); // draw console C_DrawConsole (); // draw console
M_Drawer (); // menu is drawn even on top of everything M_Drawer (); // menu is drawn even on top of everything
@ -604,22 +603,25 @@ void D_Display (bool screenshot)
wipe_EndScreen (); wipe_EndScreen ();
screen->Unlock (); screen->Unlock ();
wipestart = I_GetTime (false) - 1; wipestart = I_GetTime (false);
Net_WriteByte (DEM_WIPEON);
NetUpdate (); // send out any new accumulation
do do
{ {
do nowtime = I_WaitForTic (wipestart);
{ tics = nowtime - wipestart;
nowtime = I_GetTime (false);
tics = nowtime - wipestart;
} while (!tics);
wipestart = nowtime; wipestart = nowtime;
screen->Lock (true); screen->Lock (true);
done = wipe_ScreenWipe (tics); done = wipe_ScreenWipe (tics);
C_DrawConsole (); C_DrawConsole ();
M_Drawer (); // menu is drawn even on top of wipes M_Drawer (); // menu is drawn even on top of wipes
screen->Update (); // page flip or blit buffer screen->Update (); // page flip or blit buffer
NetUpdate ();
} while (!done); } while (!done);
Net_WriteByte (DEM_WIPEOFF);
} }
unclock (cycles); unclock (cycles);
@ -2363,6 +2365,8 @@ void D_DoomMain (void)
{ {
if (autostart || netgame) if (autostart || netgame)
{ {
// Do not do any screenwipes when autostarting a game.
NoWipe = 35;
CheckWarpTransMap (startmap, true); CheckWarpTransMap (startmap, true);
if (demorecording) if (demorecording)
G_BeginRecording (startmap); G_BeginRecording (startmap);

View file

@ -602,6 +602,7 @@ void PlayerIsGone (int netnode, int netconsole)
nodeingame[netnode] = false; nodeingame[netnode] = false;
playeringame[netconsole] = false; playeringame[netconsole] = false;
nodejustleft[netnode] = false; nodejustleft[netnode] = false;
playerswiping &= ~(1 << netconsole);
if (deathmatch) if (deathmatch)
{ {
@ -2293,6 +2294,14 @@ void Net_DoCommand (int type, BYTE **stream, int player)
} }
break; break;
case DEM_WIPEON:
playerswiping |= 1 << player;
break;
case DEM_WIPEOFF:
playerswiping &= ~(1 << player);
break;
default: default:
I_Error ("Unknown net command: %d", type); I_Error ("Unknown net command: %d", type);
break; break;

View file

@ -339,6 +339,7 @@ typedef player_s player_t;
// Bookkeeping on players - state. // Bookkeeping on players - state.
extern player_s players[MAXPLAYERS]; extern player_s players[MAXPLAYERS];
extern DWORD playerswiping;
inline FArchive &operator<< (FArchive &arc, player_s *&p) inline FArchive &operator<< (FArchive &arc, player_s *&p)
{ {

View file

@ -144,6 +144,8 @@ enum EDemoCommand
DEM_DOAUTOSAVE, // 42 An autosave should be made DEM_DOAUTOSAVE, // 42 An autosave should be made
DEM_MORPHEX, // 43 String: The class to morph to. DEM_MORPHEX, // 43 String: The class to morph to.
DEM_SUMMONFOE, // 44 String: Thing to fabricate DEM_SUMMONFOE, // 44 String: Thing to fabricate
DEM_WIPEON, // 45 Player started a screen wipe
DEM_WIPEOFF, // 46 Player finished a screen wipe
}; };
// The following are implemented by cht_DoCheat in m_cheat.cpp // The following are implemented by cht_DoCheat in m_cheat.cpp

View file

@ -125,6 +125,7 @@ bool netgame; // only true if packets are broadcast
bool multiplayer; bool multiplayer;
player_t players[MAXPLAYERS]; player_t players[MAXPLAYERS];
bool playeringame[MAXPLAYERS]; bool playeringame[MAXPLAYERS];
DWORD playerswiping;
int consoleplayer; // player taking events int consoleplayer; // player taking events
int gametic; int gametic;
@ -2116,7 +2117,10 @@ void G_ReadDemoTiccmd (ticcmd_t *cmd, int player)
{ {
BYTE i = ReadByte (&demo_p); BYTE i = ReadByte (&demo_p);
if (i < MAXPLAYERS) if (i < MAXPLAYERS)
{
playeringame[i] = false; playeringame[i] = false;
playerswiping &= ~(1 << i);
}
} }
break; break;

View file

@ -72,7 +72,7 @@ void P_Ticker (void)
r_NoInterpolate = true; r_NoInterpolate = true;
// run the tic // run the tic
if (paused || P_CheckTickerPaused()) if (paused || playerswiping || P_CheckTickerPaused())
return; return;
S_ResumeSound (); S_ResumeSound ();

View file

@ -54,7 +54,7 @@
// Version identifier for network games. // Version identifier for network games.
// Bump it every time you do a release unless you're certain you // Bump it every time you do a release unless you're certain you
// didn't change anything that will affect sync. // didn't change anything that will affect sync.
#define NETGAMEVERSION 212 #define NETGAMEVERSION 213
// Version stored in the ini's [LastRun] section. // Version stored in the ini's [LastRun] section.
// Bump it if you made some configuration change that you want to // Bump it if you made some configuration change that you want to
@ -64,7 +64,7 @@
// Protocol version used in demos. // Protocol version used in demos.
// Bump it if you change existing DEM_ commands or add new ones. // Bump it if you change existing DEM_ commands or add new ones.
// Otherwise, it should be safe to leave it alone. // Otherwise, it should be safe to leave it alone.
#define DEMOGAMEVERSION 0x208 #define DEMOGAMEVERSION 0x209
// Minimum demo version we can play. // Minimum demo version we can play.
// Bump it whenever you change or remove existing DEM_ commands. // Bump it whenever you change or remove existing DEM_ commands.