mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 14:20:59 +00:00
Fix some segfaults in nq-server.
This commit is contained in:
parent
7fc700b802
commit
878764f79d
7 changed files with 65 additions and 37 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue