diff options
Diffstat (limited to 'src/cgame')
-rw-r--r-- | src/cgame/cg_draw.c | 43 | ||||
-rw-r--r-- | src/cgame/cg_local.h | 5 | ||||
-rw-r--r-- | src/cgame/cg_main.c | 2 | ||||
-rw-r--r-- | src/cgame/cg_public.h | 3 | ||||
-rw-r--r-- | src/cgame/cg_syscalls.asm | 3 | ||||
-rw-r--r-- | src/cgame/cg_syscalls.c | 14 |
6 files changed, 70 insertions, 0 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index 071f10ad..a3959ed7 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -1403,6 +1403,42 @@ static void CG_DrawHostname( rectDef_t *rect, float text_x, float text_y, } /* +============== +CG_DrawDemoPlayback +============== +*/ +static void CG_DrawDemoPlayback( rectDef_t *rect, vec4_t color, qhandle_t shader ) +{ + if( !cg_drawDemoState.integer ) + return; + + if( trap_GetDemoState( ) != DS_PLAYBACK ) + return; + + trap_R_SetColor( color ); + CG_DrawPic( rect->x, rect->y, rect->w, rect->h, shader ); + trap_R_SetColor( NULL ); +} + +/* +============== +CG_DrawDemoRecording +============== +*/ +static void CG_DrawDemoRecording( rectDef_t *rect, vec4_t color, qhandle_t shader ) +{ + if( !cg_drawDemoState.integer ) + return; + + if( trap_GetDemoState( ) != DS_RECORDING ) + return; + + trap_R_SetColor( color ); + CG_DrawPic( rect->x, rect->y, rect->w, rect->h, shader ); + trap_R_SetColor( NULL ); +} + +/* ====================== CG_UpdateMediaFraction @@ -2684,6 +2720,13 @@ void CG_OwnerDraw( float x, float y, float w, float h, float text_x, CG_DrawLagometer( &rect, text_x, text_y, scale, color ); break; + case CG_DEMO_PLAYBACK: + CG_DrawDemoPlayback( &rect, color, shader ); + break; + case CG_DEMO_RECORDING: + CG_DrawDemoRecording( &rect, color, shader ); + break; + case CG_CONSOLE: CG_DrawConsole( &rect, text_x, text_y, color, scale, align, textStyle ); break; diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index f31e2cde..43d924d0 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -1383,6 +1383,7 @@ extern vmCvar_t cg_shadows; extern vmCvar_t cg_gibs; extern vmCvar_t cg_drawTimer; extern vmCvar_t cg_drawFPS; +extern vmCvar_t cg_drawDemoState; extern vmCvar_t cg_drawSnapshot; extern vmCvar_t cg_draw3dIcons; extern vmCvar_t cg_drawIcons; @@ -2021,3 +2022,7 @@ void trap_startCamera( int time ); qboolean trap_getCameraInfo( int time, vec3_t *origin, vec3_t *angles ); qboolean trap_GetEntityToken( char *buffer, int bufferSize ); + +int trap_GetDemoState( void ); +int trap_GetDemoPos( void ); +void trap_GetDemoName( char *buffer, int size ); diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index beda0462..34928132 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -121,6 +121,7 @@ vmCvar_t cg_shadows; vmCvar_t cg_gibs; vmCvar_t cg_drawTimer; vmCvar_t cg_drawFPS; +vmCvar_t cg_drawDemoState; vmCvar_t cg_drawSnapshot; vmCvar_t cg_draw3dIcons; vmCvar_t cg_drawIcons; @@ -259,6 +260,7 @@ static cvarTable_t cvarTable[ ] = { &cg_drawStatus, "cg_drawStatus", "1", CVAR_ARCHIVE }, { &cg_drawTimer, "cg_drawTimer", "1", CVAR_ARCHIVE }, { &cg_drawFPS, "cg_drawFPS", "1", CVAR_ARCHIVE }, + { &cg_drawDemoState, "cg_drawDemoState", "1", CVAR_ARCHIVE }, { &cg_drawSnapshot, "cg_drawSnapshot", "0", CVAR_ARCHIVE }, { &cg_draw3dIcons, "cg_draw3dIcons", "1", CVAR_ARCHIVE }, { &cg_drawIcons, "cg_drawIcons", "1", CVAR_ARCHIVE }, diff --git a/src/cgame/cg_public.h b/src/cgame/cg_public.h index 958e96a6..0687cdfd 100644 --- a/src/cgame/cg_public.h +++ b/src/cgame/cg_public.h @@ -169,6 +169,9 @@ typedef enum CG_LITERAL_ARGS, CG_CM_BISPHERETRACE, CG_CM_TRANSFORMEDBISPHERETRACE, + CG_GETDEMOSTATE, + CG_GETDEMOPOS, + CG_GETDEMONAME, CG_MEMSET = 100, CG_MEMCPY, diff --git a/src/cgame/cg_syscalls.asm b/src/cgame/cg_syscalls.asm index ee2ad7ab..cf373b8c 100644 --- a/src/cgame/cg_syscalls.asm +++ b/src/cgame/cg_syscalls.asm @@ -94,6 +94,9 @@ equ trap_FS_GetFileList -91 equ trap_LiteralArgs -92 equ trap_CM_BiSphereTrace -93 equ trap_CM_TransformedBiSphereTrace -94 +equ trap_GetDemoState -95 +equ trap_GetDemoPos -96 +equ trap_GetDemoName -97 equ memset -101 equ memcpy -102 diff --git a/src/cgame/cg_syscalls.c b/src/cgame/cg_syscalls.c index a5c42229..37820fb4 100644 --- a/src/cgame/cg_syscalls.c +++ b/src/cgame/cg_syscalls.c @@ -541,3 +541,17 @@ void trap_CIN_SetExtents( int handle, int x, int y, int w, int h ) syscall(CG_CIN_SETEXTENTS, handle, x, y, w, h); } +int trap_GetDemoState( void ) +{ + return syscall( CG_GETDEMOSTATE ); +} + +int trap_GetDemoPos( void ) +{ + return syscall( CG_GETDEMOPOS ); +} + +void trap_GetDemoName( char *buffer, int size ) +{ + syscall( CG_GETDEMONAME, buffer, size ); +} |