From: cloudwalk Date: Tue, 29 Sep 2020 00:33:14 +0000 (+0000) Subject: host: Introduce host.h and use it, instead of quakedef.h X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=75bb9b3239f87d7c9e7f809dd83507166cd39079;p=xonotic%2Fdarkplaces.git host: Introduce host.h and use it, instead of quakedef.h git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12958 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/darkplaces-sdl2-vs2017.vcxproj b/darkplaces-sdl2-vs2017.vcxproj index 2b23d8e8..1c3cc255 100644 --- a/darkplaces-sdl2-vs2017.vcxproj +++ b/darkplaces-sdl2-vs2017.vcxproj @@ -344,6 +344,7 @@ + diff --git a/darkplaces-sdl2-vs2019.vcxproj b/darkplaces-sdl2-vs2019.vcxproj index 0eea6d48..2d5ff7a0 100644 --- a/darkplaces-sdl2-vs2019.vcxproj +++ b/darkplaces-sdl2-vs2019.vcxproj @@ -345,6 +345,7 @@ + diff --git a/host.h b/host.h new file mode 100644 index 00000000..15b7ab93 --- /dev/null +++ b/host.h @@ -0,0 +1,38 @@ +typedef enum host_state_e +{ + host_shutdown, + host_init, + host_loading, + host_active +} host_state_t; + +typedef struct host_s +{ + jmp_buf abortframe; + int state; + int framecount; // incremented every frame, never reset (checked by Host_Error and Host_SaveConfig_f) + double realtime; // the accumulated mainloop time since application started (with filtering), without any slowmo or clamping + double dirtytime; // the main loop wall time for this frame, equal to Sys_DirtyTime() at the start of this host frame + double sleeptime; // time spent sleeping overall + qbool restless; // don't sleep + qbool paused; // global paused state, pauses both client and server + cmd_buf_t *cbuf; + + struct + { + void (*ConnectLocal)(void); + } hook; +} host_t; + +extern host_t host; + +void Host_InitCommands(void); +void Host_Main(void); +double Host_Frame(double time); +void Host_Shutdown(void); +void Host_StartVideo(void); +void Host_Error(const char *error, ...) DP_FUNC_PRINTF(1) DP_FUNC_NORETURN; +void Host_NoOperation_f(cmd_state_t *cmd); +void Host_LockSession(void); +void Host_UnlockSession(void); +void Host_AbortCurrentFrame(void); diff --git a/quakedef.h b/quakedef.h index dfe40570..be607c0d 100644 --- a/quakedef.h +++ b/quakedef.h @@ -387,6 +387,7 @@ extern char engineversion[128]; #include "netconn.h" #include "protocol.h" #include "cmd.h" +#include "host.h" #include "sbar.h" #include "sound.h" #include "model_shared.h" @@ -532,47 +533,8 @@ qbool Sys_HaveSSE2(void); #include "glquake.h" #include "palette.h" -typedef enum host_state_e -{ - host_shutdown, - host_init, - host_loading, - host_active -} host_state_t; - -typedef struct host_s -{ - jmp_buf abortframe; - int state; - int framecount; // incremented every frame, never reset (checked by Host_Error and Host_SaveConfig_f) - double realtime; // the accumulated mainloop time since application started (with filtering), without any slowmo or clamping - double dirtytime; // the main loop wall time for this frame, equal to Sys_DirtyTime() at the start of this host frame - double sleeptime; // time spent sleeping overall - qbool restless; // don't sleep - qbool paused; // global paused state, pauses both client and server - cmd_buf_t *cbuf; - - struct - { - void (*ConnectLocal)(void); - } hook; -} host_t; - -extern host_t host; extern cvar_t host_isclient; -void Host_InitCommands(void); -void Host_Main(void); -double Host_Frame(double time); -void Host_Shutdown(void); -void Host_StartVideo(void); -void Host_Error(const char *error, ...) DP_FUNC_PRINTF(1) DP_FUNC_NORETURN; -void Host_NoOperation_f(cmd_state_t *cmd); -void Host_LockSession(void); -void Host_UnlockSession(void); - -void Host_AbortCurrentFrame(void); - /// skill level for currently loaded level (in case the user changes the cvar while the level is running, this reflects the level actually in use) extern int current_skill;