diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 4c591adf47..8e0cdb59ce 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,7 @@ 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 were running when the teleported, they would still be running afterward even though they weren't moving anywhere. Normally, P_XYMovement() does diff --git a/src/d_main.cpp b/src/d_main.cpp index 537c6d8adc..d6b1260a2b 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -584,10 +584,9 @@ void D_Display (bool screenshot) NoWipe = 10; } - NetUpdate (); // send out any new accumulation - if (!wipe || screenshot || NoWipe < 0) { + NetUpdate (); // send out any new accumulation // normal update C_DrawConsole (); // draw console M_Drawer (); // menu is drawn even on top of everything @@ -604,22 +603,25 @@ void D_Display (bool screenshot) wipe_EndScreen (); screen->Unlock (); - wipestart = I_GetTime (false) - 1; + wipestart = I_GetTime (false); + + Net_WriteByte (DEM_WIPEON); + NetUpdate (); // send out any new accumulation do { - do - { - nowtime = I_GetTime (false); - tics = nowtime - wipestart; - } while (!tics); + nowtime = I_WaitForTic (wipestart); + tics = nowtime - wipestart; wipestart = nowtime; screen->Lock (true); done = wipe_ScreenWipe (tics); C_DrawConsole (); M_Drawer (); // menu is drawn even on top of wipes screen->Update (); // page flip or blit buffer + NetUpdate (); } while (!done); + + Net_WriteByte (DEM_WIPEOFF); } unclock (cycles); @@ -2363,6 +2365,8 @@ void D_DoomMain (void) { if (autostart || netgame) { + // Do not do any screenwipes when autostarting a game. + NoWipe = 35; CheckWarpTransMap (startmap, true); if (demorecording) G_BeginRecording (startmap); diff --git a/src/d_net.cpp b/src/d_net.cpp index 6f5d320642..2ad61972e6 100644 --- a/src/d_net.cpp +++ b/src/d_net.cpp @@ -602,6 +602,7 @@ void PlayerIsGone (int netnode, int netconsole) nodeingame[netnode] = false; playeringame[netconsole] = false; nodejustleft[netnode] = false; + playerswiping &= ~(1 << netconsole); if (deathmatch) { @@ -2293,6 +2294,14 @@ void Net_DoCommand (int type, BYTE **stream, int player) } break; + case DEM_WIPEON: + playerswiping |= 1 << player; + break; + + case DEM_WIPEOFF: + playerswiping &= ~(1 << player); + break; + default: I_Error ("Unknown net command: %d", type); break; diff --git a/src/d_player.h b/src/d_player.h index 9bcd399d75..4ac2d16ba0 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -339,6 +339,7 @@ typedef player_s player_t; // Bookkeeping on players - state. extern player_s players[MAXPLAYERS]; +extern DWORD playerswiping; inline FArchive &operator<< (FArchive &arc, player_s *&p) { diff --git a/src/d_protocol.h b/src/d_protocol.h index c164d0c108..24c21c3ddc 100644 --- a/src/d_protocol.h +++ b/src/d_protocol.h @@ -144,6 +144,8 @@ enum EDemoCommand DEM_DOAUTOSAVE, // 42 An autosave should be made DEM_MORPHEX, // 43 String: The class to morph to. 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 diff --git a/src/g_game.cpp b/src/g_game.cpp index 301cf59279..e39003006f 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -125,6 +125,7 @@ bool netgame; // only true if packets are broadcast bool multiplayer; player_t players[MAXPLAYERS]; bool playeringame[MAXPLAYERS]; +DWORD playerswiping; int consoleplayer; // player taking events int gametic; @@ -2116,7 +2117,10 @@ void G_ReadDemoTiccmd (ticcmd_t *cmd, int player) { BYTE i = ReadByte (&demo_p); if (i < MAXPLAYERS) + { playeringame[i] = false; + playerswiping &= ~(1 << i); + } } break; diff --git a/src/p_tick.cpp b/src/p_tick.cpp index 33a0a688d8..89f75914ce 100644 --- a/src/p_tick.cpp +++ b/src/p_tick.cpp @@ -72,7 +72,7 @@ void P_Ticker (void) r_NoInterpolate = true; // run the tic - if (paused || P_CheckTickerPaused()) + if (paused || playerswiping || P_CheckTickerPaused()) return; S_ResumeSound (); diff --git a/src/version.h b/src/version.h index 95458dcea3..5467d0adc7 100644 --- a/src/version.h +++ b/src/version.h @@ -54,7 +54,7 @@ // Version identifier for network games. // Bump it every time you do a release unless you're certain you // didn't change anything that will affect sync. -#define NETGAMEVERSION 212 +#define NETGAMEVERSION 213 // Version stored in the ini's [LastRun] section. // Bump it if you made some configuration change that you want to @@ -64,7 +64,7 @@ // Protocol version used in demos. // Bump it if you change existing DEM_ commands or add new ones. // Otherwise, it should be safe to leave it alone. -#define DEMOGAMEVERSION 0x208 +#define DEMOGAMEVERSION 0x209 // Minimum demo version we can play. // Bump it whenever you change or remove existing DEM_ commands.