diff options
author | Simon Howard | 2011-10-13 01:15:33 +0000 |
---|---|---|
committer | Simon Howard | 2011-10-13 01:15:33 +0000 |
commit | 687ab6c9a481ffcec476fce2add35b7ae12eee48 (patch) | |
tree | 7caef2504005c7accdc3276152c40cab106f7c77 /src/d_loop.h | |
parent | 460c3748565ba1f0fee9e39fd33e76436c6ddc78 (diff) | |
download | chocolate-doom-687ab6c9a481ffcec476fce2add35b7ae12eee48.tar.gz chocolate-doom-687ab6c9a481ffcec476fce2add35b7ae12eee48.tar.bz2 chocolate-doom-687ab6c9a481ffcec476fce2add35b7ae12eee48.zip |
Split out common main loop code into separate file, d_loop.c.
Subversion-branch: /branches/v2-branch
Subversion-revision: 2413
Diffstat (limited to 'src/d_loop.h')
-rw-r--r-- | src/d_loop.h | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/src/d_loop.h b/src/d_loop.h new file mode 100644 index 00000000..83376ea7 --- /dev/null +++ b/src/d_loop.h @@ -0,0 +1,76 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright(C) 1993-1996 Id Software, Inc. +// Copyright(C) 2005-2011 Simon Howard +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +// +// DESCRIPTION: +// Main loop stuff. +// +//----------------------------------------------------------------------------- + +#ifndef __D_LOOP__ +#define __D_LOOP__ + +#include "net_defs.h" + +typedef struct +{ + // Read events from the event queue, and process them. + + void (*ProcesEvents)(); + + // Given the current input state, fill in the fields of the specified + // ticcmd_t structure with data for a new tic. + + void (*BuildTiccmd)(ticcmd_t *cmd, int maketic); + + // Advance the game forward one tic, using the specified player input. + + void (*RunTic)(ticcmd_t *cmds, boolean *ingame); + + // Run the menu (runs independently of the game). + + void (*RunMenu)(); +} loop_interface_t; + +// Register callback functions for the main loop code to use. +void D_RegisterLoopCallbacks(loop_interface_t *i); + +// Create any new ticcmds and broadcast to other players. +void NetUpdate (void); + +// Broadcasts special packets to other players +// to notify of game exit +void D_QuitNetGame (void); + +//? how many ticks to run? +void TryRunTics (void); + +// Called at start of game loop to initialize timers +void D_StartGameLoop(void); + +// Initialize networking code; structures contain desired game settings, +// these may be changed. +boolean D_InitNetGame(net_connect_data_t *connect_data, + net_gamesettings_t *settings); + +extern boolean singletics; + +#endif + |