summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cgame/cg_draw.c43
-rw-r--r--src/cgame/cg_local.h5
-rw-r--r--src/cgame/cg_main.c2
-rw-r--r--src/cgame/cg_public.h3
-rw-r--r--src/cgame/cg_syscalls.asm3
-rw-r--r--src/cgame/cg_syscalls.c14
-rw-r--r--src/client/cl_cgame.c7
-rw-r--r--src/client/cl_main.c46
-rw-r--r--src/client/cl_scrn.c24
-rw-r--r--src/client/client.h3
-rw-r--r--src/qcommon/common.c24
-rw-r--r--src/qcommon/q_shared.h8
-rw-r--r--src/qcommon/vm_x86.c2
-rw-r--r--src/unix/Makefile10
14 files changed, 158 insertions, 36 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 );
+}
diff --git a/src/client/cl_cgame.c b/src/client/cl_cgame.c
index db18a8f7..5b09acfa 100644
--- a/src/client/cl_cgame.c
+++ b/src/client/cl_cgame.c
@@ -628,6 +628,13 @@ long CL_CgameSystemCalls( long *args ) {
case CG_KEY_GETKEY:
return Key_GetKey( VMA(1) );
+ case CG_GETDEMOSTATE:
+ return CL_DemoState( );
+ case CG_GETDEMOPOS:
+ return CL_DemoPos( );
+ case CG_GETDEMONAME:
+ CL_DemoName( VMA(1), args[2] );
+ return 0;
case CG_MEMSET:
diff --git a/src/client/cl_main.c b/src/client/cl_main.c
index 04d87cc1..a00f901e 100644
--- a/src/client/cl_main.c
+++ b/src/client/cl_main.c
@@ -601,6 +601,52 @@ void CL_NextDemo( void ) {
Cbuf_Execute();
}
+/*
+==================
+CL_DemoState
+
+Returns the current state of the demo system
+==================
+*/
+demoState_t CL_DemoState( void ) {
+ if( clc.demoplaying ) {
+ return DS_PLAYBACK;
+ } else if( clc.demorecording ) {
+ return DS_RECORDING;
+ } else {
+ return DS_NONE;
+ }
+}
+
+/*
+==================
+CL_DemoPos
+
+Returns the current position of the demo
+==================
+*/
+int CL_DemoPos( void ) {
+ if( clc.demoplaying || clc.demorecording ) {
+ return FS_FTell( clc.demofile );
+ } else {
+ return 0;
+ }
+}
+
+/*
+==================
+CL_DemoName
+
+Returns the name of the demo
+==================
+*/
+void CL_DemoName( char *buffer, int size ) {
+ if( clc.demoplaying || clc.demorecording ) {
+ Q_strncpyz( buffer, clc.demoName, size );
+ } else if( size >= 1 ) {
+ buffer[ 0 ] = '\0';
+ }
+}
//======================================================================
diff --git a/src/client/cl_scrn.c b/src/client/cl_scrn.c
index 8207d839..d1da0018 100644
--- a/src/client/cl_scrn.c
+++ b/src/client/cl_scrn.c
@@ -322,29 +322,6 @@ int SCR_GetBigStringWidth( const char *str ) {
//===============================================================================
/*
-=================
-SCR_DrawDemoRecording
-=================
-*/
-void SCR_DrawDemoRecording( void ) {
- char string[1024];
- int pos;
-
- if ( !clc.demorecording ) {
- return;
- }
- if ( clc.spDemoRecording ) {
- return;
- }
-
- pos = FS_FTell( clc.demofile );
- sprintf( string, "RECORDING %s: %ik", clc.demoName, pos / 1024 );
-
- SCR_DrawStringExt( 320 - strlen( string ) * 4, 20, 8, string, g_color_table[7], qtrue );
-}
-
-
-/*
===============================================================================
DEBUG GRAPH
@@ -490,7 +467,6 @@ void SCR_DrawScreenField( stereoFrame_t stereoFrame ) {
break;
case CA_ACTIVE:
CL_CGameRendering( stereoFrame );
- SCR_DrawDemoRecording();
break;
}
}
diff --git a/src/client/client.h b/src/client/client.h
index 5f609dde..1c4fa198 100644
--- a/src/client/client.h
+++ b/src/client/client.h
@@ -372,6 +372,9 @@ void CL_Snd_Restart_f (void);
void CL_StartDemoLoop( void );
void CL_NextDemo( void );
void CL_ReadDemoMessage( void );
+demoState_t CL_DemoState( void );
+int CL_DemoPos( void );
+void CL_DemoName( char *buffer, int size );
void CL_InitDownloads(void);
void CL_NextDownload(void);
diff --git a/src/qcommon/common.c b/src/qcommon/common.c
index b0cee0d3..68a750c2 100644
--- a/src/qcommon/common.c
+++ b/src/qcommon/common.c
@@ -38,9 +38,12 @@ int demo_protocols[] =
#define MAX_NUM_ARGVS 50
#define MIN_DEDICATED_COMHUNKMEGS 1
-#define MIN_COMHUNKMEGS 128
-#define DEF_COMHUNKMEGS "128"
-#define DEF_COMZONEMEGS "24"
+#define MIN_COMHUNKMEGS 128
+#define DEF_COMHUNKMEGS 128
+#define DEF_COMZONEMEGS 24
+#define STRING(x) #x
+#define DEF_COMHUNKMEGS_S STRING(DEF_COMHUNKMEGS)
+#define DEF_COMZONEMEGS_S STRING(DEF_COMZONEMEGS)
int com_argc;
char *com_argv[MAX_NUM_ARGVS+1];
@@ -409,7 +412,7 @@ Com_StartupVariable
Searches for command line parameters that are set commands.
If match is not NULL, only that cvar will be looked for.
That is necessary because cddir and basedir need to be set
-before the filesystem is started, but all other sets shouls
+before the filesystem is started, but all other sets should
be after execing the config and default.
===============
*/
@@ -1380,11 +1383,16 @@ void Com_InitSmallZoneMemory( void ) {
void Com_InitZoneMemory( void ) {
cvar_t *cv;
+
+ //FIXME: 05/01/06 com_zoneMegs is useless right now as neither q3config.cfg nor
+ // Com_StartupVariable have been executed by this point. The net result is that
+ // s_zoneTotal will always be set to the default value.
+
// allocate the random block zone
- cv = Cvar_Get( "com_zoneMegs", DEF_COMZONEMEGS, CVAR_LATCH | CVAR_ARCHIVE );
+ cv = Cvar_Get( "com_zoneMegs", DEF_COMZONEMEGS_S, CVAR_LATCH | CVAR_ARCHIVE );
- if ( cv->integer < 20 ) {
- s_zoneTotal = 1024 * 1024 * 16;
+ if ( cv->integer < DEF_COMZONEMEGS ) {
+ s_zoneTotal = 1024 * 1024 * DEF_COMZONEMEGS;
} else {
s_zoneTotal = cv->integer * 1024 * 1024;
}
@@ -1495,7 +1503,7 @@ void Com_InitHunkMemory( void ) {
}
// allocate the stack based hunk allocator
- cv = Cvar_Get( "com_hunkMegs", DEF_COMHUNKMEGS, CVAR_LATCH | CVAR_ARCHIVE );
+ cv = Cvar_Get( "com_hunkMegs", DEF_COMHUNKMEGS_S, CVAR_LATCH | CVAR_ARCHIVE );
// if we are not dedicated min allocation is 56, otherwise min is 1
if (com_dedicated && com_dedicated->integer) {
diff --git a/src/qcommon/q_shared.h b/src/qcommon/q_shared.h
index 537dee36..3955e2c4 100644
--- a/src/qcommon/q_shared.h
+++ b/src/qcommon/q_shared.h
@@ -1258,6 +1258,14 @@ typedef enum _flag_status {
FLAG_DROPPED
} flagStatus_t;
+typedef enum {
+ DS_NONE,
+
+ DS_PLAYBACK,
+ DS_RECORDING,
+
+ DS_NUM_DEMO_STATES
+} demoState_t;
#define MAX_GLOBAL_SERVERS 4096
diff --git a/src/qcommon/vm_x86.c b/src/qcommon/vm_x86.c
index de2c0eeb..617c4ac4 100644
--- a/src/qcommon/vm_x86.c
+++ b/src/qcommon/vm_x86.c
@@ -230,7 +230,7 @@ void AsmCall( void ) {
"doret: \n\t" \
" ret \n\t" \
: "=rm" (callSyscallNum), "=rm" (callProgramStack), "=rm" (callOpStack) \
- : "rm" (instructionPointers) \
+ : "m" (instructionPointers) \
: "ax", "di", "si", "cx" \
);
}
diff --git a/src/unix/Makefile b/src/unix/Makefile
index db7802dd..4769b075 100644
--- a/src/unix/Makefile
+++ b/src/unix/Makefile
@@ -108,12 +108,10 @@ UDIR=$(MOUNT_DIR)/unix
W32DIR=$(MOUNT_DIR)/win32
GDIR=$(MOUNT_DIR)/game
CGDIR=$(MOUNT_DIR)/cgame
-BAIDIR=$(GDIR)
BLIBDIR=$(MOUNT_DIR)/botlib
NDIR=$(MOUNT_DIR)/null
UIDIR=$(MOUNT_DIR)/ui
JPDIR=$(MOUNT_DIR)/jpeg-6
-SPLNDIR=$(MOUNT_DIR)/splines
# extract version info
VERSION=$(shell grep Q3_VERSION ../qcommon/q_shared.h | \
@@ -830,6 +828,13 @@ ifeq ($(ARCH),x86)
endif
ifeq ($(ARCH),x86_64)
Q3OBJ += $(B)/client/vm_x86_64.o
+
+ #FIXME: why do these need to be here?
+ Q3OBJ += \
+ $(B)/client/snd_mixa.o \
+ $(B)/client/matha.o \
+ $(B)/client/ftola.o \
+ $(B)/client/snapvectora.o
endif
ifeq ($(ARCH),ppc)
@@ -838,7 +843,6 @@ ifeq ($(ARCH),ppc)
endif
endif
-
ifeq ($(PLATFORM),mingw32)
Q3OBJ += \
$(B)/client/win_gamma.o \