diff --git a/source/sw/src/game.cpp b/source/sw/src/game.cpp index 63d3544b7..86c7037da 100644 --- a/source/sw/src/game.cpp +++ b/source/sw/src/game.cpp @@ -2409,48 +2409,6 @@ void dsprintf_null(char *str, const char *format, ...) va_list arglist; } -void MoveLoop(void) -{ - int pnum; - - getpackets(); - - if (PredictionOn && CommEnabled) - { - while (predictmovefifoplc < Player[myconnectindex].movefifoend) - { - DoPrediction(ppp); - } - } - - //While you have new input packets to process... - if (!CommEnabled) - bufferjitter = 0; - - while (Player[myconnectindex].movefifoend - movefifoplc > bufferjitter) - { - //Make sure you have at least 1 packet from everyone else - for (pnum=connecthead; pnum>=0; pnum=connectpoint2[pnum]) - { - if (movefifoplc == Player[pnum].movefifoend) - { - break; - } - } - - //Pnum is >= 0 only if last loop was broken, meaning a player wasn't caught up - if (pnum >= 0) - break; - - domovethings(); - -#if DEBUG - //if (DemoSyncRecord) - // demosync_record(); -#endif - } -} - void InitPlayerGameSettings(void) { @@ -2564,7 +2522,7 @@ void InitRunLevel(void) StartAmbientSound(); } -void faketimerhandler(); +void getinput(SW_PACKET*); void RunLevel(void) { @@ -2573,6 +2531,7 @@ void RunLevel(void) #if 0 waitforeverybody(); #endif + PLAYERp pp = Player + myconnectindex; ready2send = 1; while (TRUE) @@ -2580,7 +2539,6 @@ void RunLevel(void) handleevents(); OSD_DispatchQueued(); D_ProcessEvents(); - faketimerhandler(); if (LoadGameOutsideMoveLoop) { return; // Stop the game loop if a savegame was loaded from the menu. @@ -2592,7 +2550,18 @@ void RunLevel(void) } else { - MoveLoop(); + while ((totalclock - ototalclock) >= synctics) + { + ototalclock += synctics; + + getinput(&loc); + pp->inputfifo[Player[myconnectindex].movefifoend & (MOVEFIFOSIZ - 1)] = loc; + pp->movefifoend++; + + domovethings(); + + timerUpdate(); + } } diff --git a/source/sw/src/game.h b/source/sw/src/game.h index 8927f4095..0d6418e04 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -2230,7 +2230,6 @@ extern int lockspeed,totalsynctics; #define synctics 3 #define ACTORMOVETICS (synctics<<1) #define TICSPERMOVEMENT synctics -#define FAKETIMERHANDLER() if (totalclock >= ototalclock + synctics) faketimerhandler() // subtract value from clipdist on getzrange calls #define GETZRANGE_CLIP_ADJ 8