diff options
-rw-r--r-- | source/sv_game.c | 9 | ||||
-rw-r--r-- | source/sv_init.c | 11 | ||||
-rw-r--r-- | source/sv_local.h | 2 | ||||
-rw-r--r-- | source/sv_main.c | 58 | ||||
-rw-r--r-- | source/sv_world.c | 57 |
5 files changed, 49 insertions, 88 deletions
diff --git a/source/sv_game.c b/source/sv_game.c index 17de8bd..24074f4 100644 --- a/source/sv_game.c +++ b/source/sv_game.c @@ -698,12 +698,11 @@ static void PF_PositionedSound( vec3_t origin, edict_t *entity, int channel, void PF_Pmove( pmove_t *pm ) { - if( !sv_client ) { - //Pmove( pm ); // TODO - return; + if( sv_client ) { + Pmove( pm, &sv_client->pmp ); + } else { + Pmove( pm, &sv.pmp ); } - - Pmove( pm, &sv_client->pmp ); } static cvar_t *PF_cvar( const char *name, const char *value, int flags ) { diff --git a/source/sv_init.c b/source/sv_init.c index 5d9fe4e..b6c1741 100644 --- a/source/sv_init.c +++ b/source/sv_init.c @@ -107,6 +107,17 @@ void SV_SpawnServer( const char *server, const char *spawnpoint ) { } // + // set up default pmove parameters + // + sv.pmp.maxspeed = 300; + sv.pmp.upspeed = 350; + sv.pmp.friction = 6; + sv.pmp.flyfriction = 9; + sv.pmp.waterfriction = 1; + sv.pmp.airaccelerate = sv_airaccelerate->integer ? qtrue : qfalse; + sv.pmp.speedMultiplier = 1; + + // // clear physics interaction links // SV_ClearWorld(); diff --git a/source/sv_local.h b/source/sv_local.h index 0479928..5bbd9db 100644 --- a/source/sv_local.h +++ b/source/sv_local.h @@ -75,6 +75,8 @@ typedef struct server_s { byte dcs[CS_BITMAP_BYTES]; } mvd; + pmoveParams_t pmp; + uint32 tracecount; } server_t; diff --git a/source/sv_main.c b/source/sv_main.c index 89529a8..02f4d56 100644 --- a/source/sv_main.c +++ b/source/sv_main.c @@ -798,13 +798,8 @@ static void SVC_DirectConnect( void ) { strcpy( newcl->reconnect_var, reconnect_var ); strcpy( newcl->reconnect_val, reconnect_val ); - // default pmove parameters - newcl->pmp.maxspeed = 300; - newcl->pmp.upspeed = 350; - newcl->pmp.friction = 6; - newcl->pmp.flyfriction = 9; - newcl->pmp.waterfriction = 1; - newcl->pmp.airaccelerate = sv_airaccelerate->integer ? qtrue : qfalse; + // copy default pmove parameters + newcl->pmp = sv.pmp; #ifdef PMOVE_HACK newcl->pmp.highprec = qtrue; #endif @@ -815,9 +810,6 @@ static void SVC_DirectConnect( void ) { { newcl->pmp.speedMultiplier = 2; newcl->pmp.strafeHack = sv_strafejump_hack->integer ? qtrue : qfalse; - } else { - newcl->pmp.speedMultiplier = 1; - newcl->pmp.strafeHack = qfalse; } // q2pro extensions @@ -1345,39 +1337,6 @@ static void SV_RunGameFrame( void ) { } -#ifndef DEDICATED_ONLY -static qboolean SV_CheckPaused( void ) { - client_t *client; - - if( sv.state == ss_broadcast ) { - goto nopause; // never pause in MVD client mode - } - - if( cl_paused->integer ) { - FOR_EACH_CLIENT( client ) { - if( client->state != cs_spawned ) { - break; // never pause if loading - } - if( !NET_IsLocalAddress( &client->netchan->remote_address ) ) { - goto nopause; // never pause in multiplayer - } - } - if( !sv_paused->integer ) { - Cvar_Set( "sv_paused", "1" ); - CL_InputActivate(); - } - return qtrue; // don't run if paused - } - -nopause: - if( sv_paused->integer ) { - Cvar_Set( "sv_paused", "0" ); - CL_InputActivate(); - } - return qfalse; -} -#endif - /* ================== SV_Frame @@ -1402,9 +1361,18 @@ void SV_Frame( int msec ) { } #ifndef DEDICATED_ONLY - if( SV_CheckPaused() ) { - return; + if( cl_paused->integer && sv_maxclients->integer == 1 ) { + if( !sv_paused->integer ) { + Cvar_Set( "sv_paused", "1" ); + CL_InputActivate(); + } + return; // don't run if paused } + + if( sv_paused->integer ) { + Cvar_Set( "sv_paused", "0" ); + CL_InputActivate(); + } #endif time = 1000 * sv_timeout->value; diff --git a/source/sv_world.c b/source/sv_world.c index 9f5b71d..cffc332 100644 --- a/source/sv_world.c +++ b/source/sv_world.c @@ -323,7 +323,6 @@ void PF_LinkEdict (edict_t *ent) { List_Append( &node->trigger_edicts, &ent->area ); else List_Append( &node->solid_edicts, &ent->area ); - } @@ -467,9 +466,8 @@ int SV_PointContents (vec3_t p) typedef struct { vec3_t boxmins, boxmaxs;// enclose the test object along entire move - float *mins, *maxs; // size of the moving object - vec3_t mins2, maxs2; // size when clipping against mosnters - float *start, *end; + vec_t *mins, *maxs; // size of the moving object + vec_t *start, *end; trace_t *trace; edict_t *passedict; int contentmask; @@ -521,14 +519,9 @@ void SV_ClipMoveToEntities ( moveclip_t *clip ) if (touch->solid != SOLID_BSP) angles = vec3_origin; // boxes don't rotate - if (touch->svflags & SVF_MONSTER) - CM_TransformedBoxTrace (&trace, clip->start, clip->end, - clip->mins2, clip->maxs2, headnode, clip->contentmask, - touch->s.origin, angles); - else - CM_TransformedBoxTrace (&trace, clip->start, clip->end, - clip->mins, clip->maxs, headnode, clip->contentmask, - touch->s.origin, angles); + CM_TransformedBoxTrace (&trace, clip->start, clip->end, + clip->mins, clip->maxs, headnode, clip->contentmask, + touch->s.origin, angles); clip->trace->allsolid |= trace.allsolid; clip->trace->startsolid |= trace.startsolid; @@ -549,21 +542,16 @@ void SV_ClipMoveToEntities ( moveclip_t *clip ) SV_TraceBounds ================== */ -static void SV_TraceBounds (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, vec3_t boxmins, vec3_t boxmaxs) -{ +static void SV_TraceBounds (moveclip_t *clip) { int i; - for (i=0 ; i<3 ; i++) - { - if (end[i] > start[i]) - { - boxmins[i] = start[i] + mins[i] - 1; - boxmaxs[i] = end[i] + maxs[i] + 1; - } - else - { - boxmins[i] = end[i] + mins[i] - 1; - boxmaxs[i] = start[i] + maxs[i] + 1; + for (i=0 ; i<3 ; i++) { + if (clip->end[i] > clip->start[i]) { + clip->boxmins[i] = clip->start[i] + clip->mins[i] - 1; + clip->boxmaxs[i] = clip->end[i] + clip->maxs[i] + 1; + } else { + clip->boxmins[i] = clip->end[i] + clip->mins[i] - 1; + clip->boxmaxs[i] = clip->start[i] + clip->maxs[i] + 1; } } } @@ -608,7 +596,7 @@ trace_t SV_Trace (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, edict_t *p return trace; // blocked by the world } - memset ( &clip, 0, sizeof ( moveclip_t ) ); + memset( &clip, 0, sizeof( clip ) ); clip.trace = &trace; clip.contentmask = contentmask; clip.start = start; @@ -616,18 +604,14 @@ trace_t SV_Trace (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, edict_t *p clip.mins = mins; clip.maxs = maxs; clip.passedict = passedict; - - VectorCopy (mins, clip.mins2); - VectorCopy (maxs, clip.maxs2); // create the bounding box of the entire move - SV_TraceBounds ( start, clip.mins2, clip.maxs2, end, clip.boxmins, clip.boxmaxs ); + SV_TraceBounds( &clip ); // clip to other solid entities - SV_ClipMoveToEntities ( &clip ); + SV_ClipMoveToEntities( &clip ); return trace; - } /* @@ -677,7 +661,7 @@ trace_t *SV_Trace_Old (trace_t *trace, vec3_t start, vec3_t mins, vec3_t maxs, v return trace; // blocked by the world } - memset ( &clip, 0, sizeof ( moveclip_t ) ); + memset( &clip, 0, sizeof( clip ) ); clip.trace = trace; clip.contentmask = contentmask; clip.start = start; @@ -685,15 +669,12 @@ trace_t *SV_Trace_Old (trace_t *trace, vec3_t start, vec3_t mins, vec3_t maxs, v clip.mins = mins; clip.maxs = maxs; clip.passedict = passedict; - - VectorCopy (mins, clip.mins2); - VectorCopy (maxs, clip.maxs2); // create the bounding box of the entire move - SV_TraceBounds ( start, clip.mins2, clip.maxs2, end, clip.boxmins, clip.boxmaxs ); + SV_TraceBounds( &clip ); // clip to other solid entities - SV_ClipMoveToEntities ( &clip ); + SV_ClipMoveToEntities( &clip ); return trace; } |