DarkPlaces
Game engine based on the Quake 1 engine by id Software, developed by LadyHavoc
 
host.h
Go to the documentation of this file.
1#ifndef HOST_H
2#define HOST_H
3
4#include <setjmp.h>
5#include "qtypes.h"
6#include "qdefs.h"
7#include "cmd.h"
8#include "cvar.h"
9
10extern cvar_t developer;
17extern cvar_t sessionid;
18
19struct cmd_state_s;
20
31static const char * const host_state_str[] =
32{
33 [host_init] = "init",
34 [host_loading] = "loading",
35 [host_active] = "normal operation",
36 [host_shutdown] = "shutdown",
37 [host_failing] = "crashing",
38 [host_failed] = "crashed",
39};
40
41typedef struct host_static_s
42{
43 jmp_buf abortframe;
44 int state;
45 unsigned int framecount;
46 double realtime;
47 double dirtytime;
48 double sleeptime;
52
53 struct
54 {
55 void (*ConnectLocal)(void);
56 void (*Disconnect)(qbool, const char *, ... );
57 void (*ToggleMenu)(void);
58 void (*CL_SendCvar)(struct cmd_state_s *);
59 void (*SV_SendCvar)(struct cmd_state_s *);
61 } hook;
63
64extern host_static_t host;
65void Host_Error(const char *error, ...) DP_FUNC_PRINTF(1) DP_FUNC_NORETURN;
66void Host_UpdateVersion(void);
67void Host_LockSession(void);
68void Host_UnlockSession(void);
70void Host_SaveConfig(const char *file);
71void Host_Init(void);
72double Host_Frame(double time);
73void Host_Shutdown(void);
74
75#endif
void() predraw
float time
cvar_t developer_insane
Definition host.c:50
void Host_LockSession(void)
Definition host.c:330
cvar_t sessionid
Definition host.c:58
cvar_t developer
Definition host.c:48
host_static_t host
Definition host.c:41
host_state_t
Definition host.h:22
@ host_loading
Definition host.h:24
@ host_failed
crashed or aborted, SDL dialog open
Definition host.h:29
@ host_init
Definition host.h:23
@ host_active
Definition host.h:25
@ host_failing
crashing (inside crash handler)
Definition host.h:28
@ host_shutdown
states >= host_shutdown cause graceful shutdown, see Sys_HandleCrash() comments
Definition host.h:27
void Host_UpdateVersion(void)
Definition host.c:162
cvar_t developer_extra
Definition host.c:49
static const char *const host_state_str[]
Definition host.h:31
void Host_Shutdown(void)
Definition host.c:571
void Host_Init(void)
Definition host.c:377
cvar_t developer_loading
Definition host.c:52
void Host_UnlockSession(void)
Definition host.c:356
void Host_Error(const char *error,...) DP_FUNC_PRINTF(1) DP_FUNC_NORETURN
Definition host.c:85
cvar_t developer_loadfile
Definition host.c:51
cvar_t developer_entityparsing
Definition host.c:53
cvar_t host_isclient
Definition host.c:61
void Host_SaveConfig(const char *file)
Definition host.c:195
double Host_Frame(double time)
Definition host.c:618
void Host_AbortCurrentFrame(void) DP_FUNC_NORETURN
Definition host.c:70
void error(string err,...)
#define DP_FUNC_PRINTF(n)
Definition qdefs.h:14
#define DP_FUNC_NORETURN
Definition qdefs.h:16
bool qbool
Definition qtypes.h:9
void SV_Shutdown(void)
Definition sv_main.c:2128
Definition cvar.h:66
double sleeptime
time spent sleeping after the last frame
Definition host.h:48
cmd_buf_t * cbuf
Definition host.h:51
qbool restless
don't sleep
Definition host.h:49
double dirtytime
the main loop wall time for this frame, equal to Sys_DirtyTime() at the start of this host frame
Definition host.h:47
jmp_buf abortframe
Definition host.h:43
int state
Definition host.h:44
unsigned int framecount
incremented every frame, never reset, >0 means Host_AbortCurrentFrame() is possible
Definition host.h:45
double realtime
the accumulated mainloop time since application started (with filtering), without any slowmo or clamp...
Definition host.h:46
qbool paused
global paused state, pauses both client and server
Definition host.h:50