summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorAndrey Nazarov <skuller@skuller.net>2008-09-27 11:36:43 +0000
committerAndrey Nazarov <skuller@skuller.net>2008-09-27 11:36:43 +0000
commit5605c38c909aaa905684b79a48ccd0abb43dc685 (patch)
treef1e2b1ef297d0f0eae5a86284c5da7f0919643f3 /source
parentb26baea5a78c8d2487544e3f162d9e4da93121e9 (diff)
Use `sv_features', `g_features' and `fs_gamedir' cvars instead of environment
variables for communications between server and the game DLL. Fixed reverted `no PHS' check on sounds MVD client did.
Diffstat (limited to 'source')
-rw-r--r--source/cl_ents.c2
-rw-r--r--source/files.c5
-rw-r--r--source/mvd_game.c5
-rw-r--r--source/mvd_parse.c3
-rw-r--r--source/sv_ents.c6
-rw-r--r--source/sv_game.c19
-rw-r--r--source/sv_local.h2
-rw-r--r--source/sv_main.c6
-rw-r--r--source/sv_user.c2
9 files changed, 19 insertions, 31 deletions
diff --git a/source/cl_ents.c b/source/cl_ents.c
index 49b5e54..4afe12b 100644
--- a/source/cl_ents.c
+++ b/source/cl_ents.c
@@ -963,7 +963,7 @@ void CL_GetEntitySoundOrigin( int entnum, vec3_t org ) {
vec3_t mid;
if( entnum < 0 || entnum >= MAX_EDICTS ) {
- Com_Error( ERR_DROP, "CL_GetEntitySoundOrigin: bad entnum: %d", entnum );
+ Com_Error( ERR_DROP, "%s: bad entnum: %d", __func__, entnum );
}
if( !entnum ) {
// should this ever happen?
diff --git a/source/files.c b/source/files.c
index 9bf7193..39d67bd 100644
--- a/source/files.c
+++ b/source/files.c
@@ -2433,7 +2433,7 @@ static void FS_DefaultGamedir( void ) {
Cvar_Set( "game", "" );
Cvar_Set( "gamedir", "" );
- Q_setenv( "QUAKE2_GAME_PATH", fs_gamedir );
+ Cvar_Set( "fs_gamedir", fs_gamedir );
}
@@ -2475,7 +2475,7 @@ static void FS_SetupGamedir( void ) {
FS_AddGameDirectory( FS_PATH_GAME, "%s/%s", sys_homedir->string, fs_game->string );
}
- Q_setenv( "QUAKE2_GAME_PATH", fs_gamedir );
+ Cvar_Set( "fs_gamedir", fs_gamedir );
}
qboolean FS_SafeToRestart( void ) {
@@ -2590,6 +2590,7 @@ void FS_Init( void ) {
fs_debug = Cvar_Get( "fs_debug", "0", 0 );
fs_restrict_mask = Cvar_Get( "fs_restrict_mask", "0", CVAR_NOSET );
+ Cvar_Get( "fs_gamedir", "", CVAR_ROM );
if( ( fs_restrict_mask->integer & 7 ) == 7 ) {
Com_WPrintf( "Invalid fs_restrict_mask value %d. "
diff --git a/source/mvd_game.c b/source/mvd_game.c
index 4a298f5..b6d2c9c 100644
--- a/source/mvd_game.c
+++ b/source/mvd_game.c
@@ -1096,7 +1096,7 @@ static void MVD_GameInit( void ) {
mvd_default_map = Cvar_Get( "mvd_default_map", "q2dm1", CVAR_LATCH );
mvd_stats_hack = Cvar_Get( "mvd_stats_hack", "0", 0 );
mvd_freeze_hack = Cvar_Get( "mvd_freeze_hack", "1", 0 );
- svs.gameFeatures = GMF_CLIENTNUM|GMF_PROPERINUSE;
+ Cvar_Set( "g_features", va( "%d", GMF_CLIENTNUM|GMF_PROPERINUSE ) );
Z_TagReserve( ( sizeof( edict_t ) +
sizeof( udpClient_t ) ) * sv_maxclients->integer +
@@ -1165,6 +1165,8 @@ static void MVD_GameShutdown( void ) {
mvd_ge.edict_size = 0;
mvd_ge.num_edicts = 0;
mvd_ge.max_edicts = 0;
+
+ Cvar_Set( "g_features", "0" );
}
static void MVD_GameSpawnEntities( const char *mapname, const char *entstring, const char *spawnpoint ) {
@@ -1186,7 +1188,6 @@ static qboolean MVD_GameClientConnect( edict_t *ent, char *userinfo ) {
// if there is exactly one active channel, assign them to it,
// otherwise, assign to Waiting Room
count = List_Count( &mvd_active );
- Com_Printf( "%d channels active\n",count);
if( count == 1 ) {
mvd = LIST_FIRST( mvd_t, &mvd_active, active );
} else {
diff --git a/source/mvd_parse.c b/source/mvd_parse.c
index dccd689..d587d1e 100644
--- a/source/mvd_parse.c
+++ b/source/mvd_parse.c
@@ -532,7 +532,7 @@ static void MVD_ParseSound( mvd_t *mvd, int extrabits ) {
}
// PHS cull this sound
- if( extrabits & 1 ) {
+ if( !( extrabits & 1 ) ) {
// get client viewpos
ps = &client->ps;
VectorMA( ps->viewoffset, 0.125f, ps->pmove.origin, origin );
@@ -561,7 +561,6 @@ static void MVD_ParseSound( mvd_t *mvd, int extrabits ) {
// reliable sounds will always have position explicitly set,
// as no one gurantees reliables to be delivered in time
- // why should this happen anyway?
if( extrabits & 2 ) {
MSG_WriteByte( svc_sound );
MSG_WriteByte( flags | SND_POS );
diff --git a/source/sv_ents.c b/source/sv_ents.c
index d60112d..79e6fdc 100644
--- a/source/sv_ents.c
+++ b/source/sv_ents.c
@@ -394,7 +394,7 @@ void SV_BuildClientFrame( client_t *client ) {
frame->ps = *ps;
// grab the current clientNum
- if( svs.gameFeatures & GMF_CLIENTNUM ) {
+ if( g_features->integer & GMF_CLIENTNUM ) {
frame->clientNum = clent->client->clientNum;
} else {
frame->clientNum = client->number;
@@ -411,7 +411,7 @@ void SV_BuildClientFrame( client_t *client ) {
ent = EDICT_POOL( client, e );
// ignore entities not in use
- if( ( svs.gameFeatures & GMF_PROPERINUSE ) && !ent->inuse ) {
+ if( ( g_features->integer & GMF_PROPERINUSE ) && !ent->inuse ) {
continue;
}
@@ -484,7 +484,7 @@ void SV_BuildClientFrame( client_t *client ) {
// XXX: hide this enitity from renderer
if( ( client->protocol != PROTOCOL_VERSION_Q2PRO ||
client->settings[CLS_RECORDING] ) &&
- ( svs.gameFeatures & GMF_CLIENTNUM ) &&
+ ( g_features->integer & GMF_CLIENTNUM ) &&
e == frame->clientNum + 1 && ent != clent )
{
state->modelindex = 0;
diff --git a/source/sv_game.c b/source/sv_game.c
index eeb842b..d526f93 100644
--- a/source/sv_game.c
+++ b/source/sv_game.c
@@ -519,7 +519,7 @@ static void PF_StartSound( edict_t *edict, int channel,
ent = NUM_FOR_EDICT( edict );
- if( ( svs.gameFeatures & GMF_PROPERINUSE ) && !edict->inuse ) {
+ if( ( g_features->integer & GMF_PROPERINUSE ) && !edict->inuse ) {
Com_DPrintf( "%s: entnum not in use: %d\n", __func__, ent );
return;
}
@@ -548,7 +548,7 @@ static void PF_StartSound( edict_t *edict, int channel,
}
// PHS cull this sound
- if( ( channel & CHAN_NO_PHS_ADD ) == 0 ) {
+ if( !( channel & CHAN_NO_PHS_ADD ) ) {
// get client viewpos
ps = &client->edict->client->ps;
VectorMA( ps->viewoffset, 0.125f, ps->pmove.origin, origin );
@@ -577,7 +577,6 @@ static void PF_StartSound( edict_t *edict, int channel,
// reliable sounds will always have position explicitly set,
// as no one gurantees reliables to be delivered in time
- // why should this happen anyway?
if( channel & CHAN_RELIABLE ) {
MSG_WriteByte( svc_sound );
MSG_WriteByte( flags | SND_POS );
@@ -731,7 +730,7 @@ void PF_Pmove( pmove_t *pm ) {
static cvar_t *PF_cvar( const char *name, const char *value, int flags ) {
if( flags & CVAR_EXTENDED_MASK ) {
- Com_WPrintf( "Game DLL attemped to set extended flags on variable '%s', cleared.\n", name );
+ Com_WPrintf( "Game attemped to set extended flags on '%s', masked out.\n", name );
flags &= ~CVAR_EXTENDED_MASK;
}
@@ -794,7 +793,7 @@ void SV_ShutdownGameProgs (void) {
Sys_FreeLibrary( game_library );
game_library = NULL;
}
- Q_setenv( "QUAKE2_GAME_FEATURES", NULL );
+ Cvar_Set( "g_features", "0" );
}
/*
@@ -808,7 +807,6 @@ void SV_InitGameProgs ( void ) {
game_import_t import;
char path[MAX_OSPATH];
game_export_t *(*entry)( game_import_t * ) = NULL;
- char *s;
// unload anything we have now
SV_ShutdownGameProgs ();
@@ -924,18 +922,9 @@ void SV_InitGameProgs ( void ) {
ge->apiversion, GAME_API_VERSION);
}
- // export server features
- Q_setenv( "QUAKE2_SERVER_FEATURES", va( "%d", GMF_CLIENTNUM|GMF_MVDSPEC ) );
-
// initialize
ge->Init ();
- // get game features
- s = getenv( "QUAKE2_GAME_FEATURES" );
- if( s && *s ) {
- svs.gameFeatures = atoi( s );
- }
-
Sys_FixFPCW();
}
diff --git a/source/sv_local.h b/source/sv_local.h
index d7ce35b..22d5457 100644
--- a/source/sv_local.h
+++ b/source/sv_local.h
@@ -358,8 +358,6 @@ typedef struct server_static_s {
qboolean initialized; // sv_init has completed
unsigned realtime; // always increasing, no clamping, etc
- int gameFeatures;
-
client_t *udp_client_pool; // [maxclients]
list_t udp_client_list; // linked list of non-free clients
diff --git a/source/sv_main.c b/source/sv_main.c
index 01d5d58..baefaef 100644
--- a/source/sv_main.c
+++ b/source/sv_main.c
@@ -91,7 +91,7 @@ cvar_t *sv_status_show;
cvar_t *sv_uptime;
cvar_t *sv_badauth_time;
-//cvar_t *g_features;
+cvar_t *g_features;
//============================================================================
@@ -1852,8 +1852,8 @@ void SV_Init( void ) {
sv_badauth_time = Cvar_Get( "sv_badauth_time", "1", 0 );
sv_badauth_time->changed = sv_badauth_time_changed;
- //Cvar_Get( "sv_features", va( "%d", GMF_CLIENTNUM|GMF_MVDSPEC ), CVAR_ROM );
- //g_features = Cvar_Ref( "g_features" );
+ Cvar_Get( "sv_features", va( "%d", GMF_CLIENTNUM|GMF_MVDSPEC ), CVAR_ROM );
+ g_features = Cvar_Get( "g_features", "0", CVAR_ROM );
// set up default pmove parameters
sv_pmp.maxspeed = 300;
diff --git a/source/sv_user.c b/source/sv_user.c
index 1ac9b4b..2432509 100644
--- a/source/sv_user.c
+++ b/source/sv_user.c
@@ -59,7 +59,7 @@ static void create_baselines( void ) {
for( i = 1; i < sv_client->pool->num_edicts; i++ ) {
ent = EDICT_POOL( sv_client, i );
- if( ( svs.gameFeatures & GMF_PROPERINUSE ) && !ent->inuse ) {
+ if( ( g_features->integer & GMF_PROPERINUSE ) && !ent->inuse ) {
continue;
}