diff --git a/libs/models/model.c b/libs/models/model.c index 2adf5e223..59201b892 100644 --- a/libs/models/model.c +++ b/libs/models/model.c @@ -229,7 +229,7 @@ Mod_RealLoadModel (model_t *mod, qboolean crash, cache_allocator_t allocator) // Version 38: Quake 2 .bsp Mod_LoadBrushModel (mod, buf); - if (gl_textures_external->int_val + if (gl_textures_external && gl_textures_external->int_val && mod_funcs && mod_funcs->Mod_LoadExternalTextures) mod_funcs->Mod_LoadExternalTextures (mod); break; diff --git a/nq/include/server.h b/nq/include/server.h index 129c29491..10840b966 100644 --- a/nq/include/server.h +++ b/nq/include/server.h @@ -210,6 +210,8 @@ extern struct cvar_s *coop; extern struct cvar_s *fraglimit; extern struct cvar_s *timelimit; +extern struct cvar_s *sv_rollangle; +extern struct cvar_s *sv_rollspeed; extern struct cvar_s *sv_maxvelocity; extern struct cvar_s *sv_gravity; diff --git a/nq/source/cl_view.c b/nq/source/cl_view.c index ce7de3f02..7b6d30f2a 100644 --- a/nq/source/cl_view.c +++ b/nq/source/cl_view.c @@ -91,6 +91,32 @@ cshift_t cshift_lava = { {255, 80, 0}, 150}; cshift_t cshift_bonus = { {215, 186, 60}, 50}; +/* + FIXME duplicates SV_CalcRoll in sv_user.c +*/ +float +V_CalcRoll (const vec3_t angles, const vec3_t velocity) +{ + float side, sign, value; + vec3_t forward, right, up; + + AngleVectors (angles, forward, right, up); + side = DotProduct (velocity, right); + sign = side < 0 ? -1 : 1; + side = fabs (side); + + value = cl_rollangle->value; +// if (cl.inwater) +// value *= 6; + + if (side < cl_rollspeed->value) + side = side * value / cl_rollspeed->value; + else + side = value; + + return side * sign; +} + static float V_CalcBob (void) { diff --git a/nq/source/host.c b/nq/source/host.c index 8141e68e0..23ce8cc2f 100644 --- a/nq/source/host.c +++ b/nq/source/host.c @@ -505,7 +505,8 @@ Host_ClearMemory (void) cls.signon = 0; memset (&sv, 0, sizeof (sv)); memset (&cl, 0, sizeof (cl)); - r_data->force_fullscreen = 0; + if (r_data) + r_data->force_fullscreen = 0; } /* diff --git a/nq/source/sv_ded.c b/nq/source/sv_ded.c index 89a5b1138..9f63f7451 100644 --- a/nq/source/sv_ded.c +++ b/nq/source/sv_ded.c @@ -57,9 +57,6 @@ viddef_t viddef; vid_render_data_t *r_data; vid_render_funcs_t *r_funcs; -cvar_t *cl_rollangle; -cvar_t *cl_rollspeed; - void CL_UpdateScreen (double realtime) { diff --git a/nq/source/sv_main.c b/nq/source/sv_main.c index c21936498..99a3a94af 100644 --- a/nq/source/sv_main.c +++ b/nq/source/sv_main.c @@ -93,6 +93,12 @@ SV_Init (void) sv_jump_any = Cvar_Get ("sv_jump_any", "1", CVAR_NONE, NULL, "None"); sv_friction = Cvar_Get ("sv_friction", "4", CVAR_SERVERINFO, Cvar_Info, "None"); + //NOTE: the cl/sv clash is deliberate: dedicated server will use the right + //vars, but client/server combo will use the one. + sv_rollspeed = Cvar_Get ("cl_rollspeed", "200", CVAR_NONE, NULL, + "How quickly you straighten out after strafing"); + sv_rollangle = Cvar_Get ("cl_rollangle", "2.0", CVAR_NONE, NULL, + "How much your screen tilts when strafing"); sv_edgefriction = Cvar_Get ("edgefriction", "2", CVAR_NONE, NULL, "None"); sv_stopspeed = Cvar_Get ("sv_stopspeed", "100", CVAR_NONE, NULL, "None"); sv_maxspeed = Cvar_Get ("sv_maxspeed", "320", CVAR_SERVERINFO, Cvar_Info, diff --git a/nq/source/sv_user.c b/nq/source/sv_user.c index 3772c3a2d..f40b5ade7 100644 --- a/nq/source/sv_user.c +++ b/nq/source/sv_user.c @@ -48,11 +48,10 @@ static __attribute__ ((used)) const char rcsid[] = #include "host.h" #include "server.h" #include "sv_progs.h" -#include "clview.h" //FIXME #include "world.h" -extern cvar_t *cl_rollangle; //FIXME -extern cvar_t *cl_rollspeed; //FIXME +cvar_t *sv_rollangle; +cvar_t *sv_rollspeed; edict_t *sv_player; @@ -76,6 +75,30 @@ cvar_t *sv_idealpitchscale; #define MAX_FORWARD 6 +/* + FIXME duplicates V_CalcRoll in cl_view.c +*/ +static float +SV_CalcRoll (const vec3_t angles, const vec3_t velocity) +{ + float side, sign, value; + + AngleVectors (angles, forward, right, up); + side = DotProduct (velocity, right); + sign = side < 0 ? -1 : 1; + side = fabs (side); + + value = sv_rollangle->value; +// if (cl.inwater) +// value *= 6; + + if (side < sv_rollspeed->value) + side = side * value / sv_rollspeed->value; + else + side = value; + + return side * sign; +} void SV_SetIdealPitch (void) @@ -394,8 +417,8 @@ SV_ClientThink (void) VectorAdd (SVvector (sv_player, v_angle), SVvector (sv_player, punchangle), v_angle); - angles[ROLL] = V_CalcRoll (SVvector (sv_player, angles), - SVvector (sv_player, velocity)) * 4; + angles[ROLL] = SV_CalcRoll (SVvector (sv_player, angles), + SVvector (sv_player, velocity)) * 4; if (!SVfloat (sv_player, fixangle)) { angles[PITCH] = -v_angle[PITCH] / 3; angles[YAW] = v_angle[YAW]; @@ -587,30 +610,3 @@ SV_RunClients (void) SV_ClientThink (); } } - -/* - V_CalcRoll - - Used by view and sv_user -*/ -float -V_CalcRoll (const vec3_t angles, const vec3_t velocity) -{ - float side, sign, value; - - AngleVectors (angles, forward, right, up); - side = DotProduct (velocity, right); - sign = side < 0 ? -1 : 1; - side = fabs (side); - - value = cl_rollangle->value; -// if (cl.inwater) -// value *= 6; - - if (side < cl_rollspeed->value) - side = side * value / cl_rollspeed->value; - else - side = value; - - return side * sign; -}