Skip to content

Commit

Permalink
Refactor: Separated dedicated mode main loop
Browse files Browse the repository at this point in the history
The dedicated/server mode main loop callback is now separated
into its own code path for clarity.
  • Loading branch information
skyjake committed May 1, 2012
1 parent 7c70c90 commit 4f0373a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 17 deletions.
36 changes: 20 additions & 16 deletions doomsday/engine/portable/src/dd_loop.c
Expand Up @@ -127,32 +127,36 @@ void DD_GameLoopCallback(void)
if(ddPlayers[i].shared.inGame) count++;

LegacyCore_SetLoopRate(de2LegacyCore, count? 35 : 3);

runTics();

// Update clients at regular intervals.
Sv_TransmitFrame();
}
else
{
// Normal client-side/singleplayer mode.
assert(!novideo);

// We may be performing GL operations.
Window_GLActivate(Window_Main());
// We may be performing GL operations.
Window_GLActivate(Window_Main());

// Run at least one (fractional) tic.
runTics();
// Run at least one (fractional) tic.
runTics();

// We may have received a Quit message from the windowing system
// during events/tics processing.
if(Sys_IsShuttingDown())
return;
// We may have received a Quit message from the windowing system
// during events/tics processing.
if(Sys_IsShuttingDown())
return;

// Update clients at regular intervals.
Sv_TransmitFrame();
GL_ProcessDeferredTasks(FRAME_DEFERRED_UPLOAD_TIMEOUT);

if(!novideo)
{
// Request update of window contents.
Window_Draw(Window_Main());

GL_ProcessDeferredTasks(FRAME_DEFERRED_UPLOAD_TIMEOUT);
// After the first frame, start timedemo.
DD_CheckTimeDemo();
}

// After the first frame, start timedemo.
DD_CheckTimeDemo();
}

void DD_GameLoopDrawer(void)
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/portable/src/sv_frame.c
Expand Up @@ -98,7 +98,7 @@ void Sv_TransmitFrame(void)
int i, cTime, numInGame, pCount;

// Obviously clients don't transmit anything.
if(!allowFrames || isClient)
if(!allowFrames || isClient || Sys_IsShuttingDown())
{
return;
}
Expand Down

0 comments on commit 4f0373a

Please sign in to comment.