XenevaOS
Loading...
Searching...
No Matches
d_loop.h
Go to the documentation of this file.
1//
2// Copyright(C) 1993-1996 Id Software, Inc.
3// Copyright(C) 2005-2014 Simon Howard
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// DESCRIPTION:
16// Main loop stuff.
17//
18
19#ifndef __D_LOOP__
20#define __D_LOOP__
21
22#include "net_defs.h"
23
24// Callback function invoked while waiting for the netgame to start.
25// The callback is invoked when new players are ready. The callback
26// should return true, or return false to abort startup.
27
28typedef boolean (*netgame_startup_callback_t)(int ready_players,
29 int num_players);
30
31typedef struct
32{
33 // Read events from the event queue, and process them.
34
35 void (*ProcessEvents)();
36
37 // Given the current input state, fill in the fields of the specified
38 // ticcmd_t structure with data for a new tic.
39
40 void (*BuildTiccmd)(ticcmd_t *cmd, int maketic);
41
42 // Advance the game forward one tic, using the specified player input.
43
44 void (*RunTic)(ticcmd_t *cmds, boolean *ingame);
45
46 // Run the menu (runs independently of the game).
47
48 void (*RunMenu)();
50
51// Register callback functions for the main loop code to use.
53
54// Create any new ticcmds and broadcast to other players.
55void NetUpdate (void);
56
57// Broadcasts special packets to other players
58// to notify of game exit
59void D_QuitNetGame (void);
60
61//? how many ticks to run?
62void TryRunTics (void);
63
64// Called at start of game loop to initialize timers
65void D_StartGameLoop(void);
66
67// Initialize networking code and connect to server.
68
69boolean D_InitNetGame(net_connect_data_t *connect_data);
70
71// Start game with specified settings. The structure will be updated
72// with the actual settings for the game.
73
76
77extern boolean singletics;
78extern int gametic, ticdup;
79
80#endif
81
void D_StartGameLoop(void)
Definition d_loop.c:305
boolean singletics
Definition d_loop.c:77
void TryRunTics(void)
Definition d_loop.c:706
void D_StartNetGame(net_gamesettings_t *settings, netgame_startup_callback_t callback)
Definition d_loop.c:340
boolean D_InitNetGame(net_connect_data_t *connect_data)
Definition d_loop.c:452
boolean(* netgame_startup_callback_t)(int ready_players, int num_players)
Definition d_loop.h:28
void D_RegisterLoopCallbacks(loop_interface_t *i)
Definition d_loop.c:823
int gametic
Definition d_loop.c:72
void NetUpdate(void)
Definition d_loop.c:203
void D_QuitNetGame(void)
Definition d_loop.c:560
int ticdup
Definition d_loop.h:78
boolean
Definition doomtype.h:74
Definition d_loop.h:32
Definition net_defs.h:148
Definition net_defs.h:164
Definition d_ticcmd.h:33