q2/q3 clipping fixed (hopefully finally except for bsp objects, that is)

q2 server should work.
added support for addative (and things) blends from menu.dat


git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1035 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2005-05-19 02:53:03 +00:00
parent 979df82f05
commit 077fb0d98a
17 changed files with 139 additions and 126 deletions

View file

@ -873,10 +873,8 @@ void DP5_ParseDelta(entity_state_t *s)
} }
if (bits & E5_GLOW) if (bits & E5_GLOW)
{ {
MSG_ReadByte(); s->glowsize = MSG_ReadByte();
MSG_ReadByte(); s->glowcolour = MSG_ReadByte();
// s->glowsize = MSG_ReadByte();
// s->glowcolor = MSG_ReadByte();
} }
} }
@ -925,17 +923,16 @@ void CLNQ_ParseDarkPlaces5Entities(void) //the things I do.. :o(
if (read == oldpack->entities[oldi].number) if (read == oldpack->entities[oldi].number)
{ {
from = &oldpack->entities[oldi]; from = &oldpack->entities[oldi];
from->flags |= 0x80000000; //so we don't copy it.
break; break;
} }
} }
from->flags |= 0x80000000;
if (remove) if (remove)
{ {
continue; continue;
} }
if (pack->num_entities==pack->max_entities) if (pack->num_entities==pack->max_entities)
{ {
pack->max_entities = pack->num_entities+16; pack->max_entities = pack->num_entities+16;
@ -947,6 +944,7 @@ void CLNQ_ParseDarkPlaces5Entities(void) //the things I do.. :o(
memcpy(to, from, sizeof(*to)); memcpy(to, from, sizeof(*to));
to->number = read; to->number = read;
DP5_ParseDelta(to); DP5_ParseDelta(to);
to->flags &= ~0x80000000;
if (!from || to->modelindex != from->modelindex || to->number != from->number) //model changed... or entity changed... if (!from || to->modelindex != from->modelindex || to->number != from->number) //model changed... or entity changed...
cl.lerpents[to->number].lerptime = -10; cl.lerpents[to->number].lerptime = -10;
@ -967,8 +965,8 @@ void CLNQ_ParseDarkPlaces5Entities(void) //the things I do.. :o(
cl.lerpents[to->number].frame = from->frame; cl.lerpents[to->number].frame = from->frame;
cl.lerpents[to->number].lerptime = cl.time; cl.lerpents[to->number].lerptime = cl.time;
if (cl.lerpents[to->number].lerprate>0.5) if (cl.lerpents[to->number].lerprate>0.2)
cl.lerpents[to->number].lerprate=0.1; cl.lerpents[to->number].lerprate=0.2;
//store this off for new ents to use. //store this off for new ents to use.
// if (new) // if (new)
@ -977,8 +975,6 @@ void CLNQ_ParseDarkPlaces5Entities(void) //the things I do.. :o(
if (to->frame == from->frame) if (to->frame == from->frame)
newlerprate = cl.time-cl.lerpents[to->number].lerptime; newlerprate = cl.time-cl.lerpents[to->number].lerptime;
} }
to->flags &= ~0x80000000;
} }
//the pack has all the new ones in it, now copy the old ones in that wern't removed (or changed). //the pack has all the new ones in it, now copy the old ones in that wern't removed (or changed).
@ -1967,7 +1963,7 @@ void CL_ParsePlayerinfo (void)
else else
state->weaponframe = 0; state->weaponframe = 0;
if (cl.worldmodel && cl.worldmodel->fromgame == fg_quake && cl.worldmodel->fromgame == fg_halflife) if (cl.worldmodel && (cl.worldmodel->fromgame == fg_quake || cl.worldmodel->fromgame == fg_halflife))
state->hullnum = 1; state->hullnum = 1;
else else
state->hullnum = 56; state->hullnum = 56;

View file

@ -1590,6 +1590,7 @@ CL_InitInput
void CL_InitInput (void) void CL_InitInput (void)
{ {
#define inputnetworkcvargroup "client networking options" #define inputnetworkcvargroup "client networking options"
cl.splitclients = 1;
CL_RegisterSplitCommands(); CL_RegisterSplitCommands();
Cmd_AddCommand("rotate", IN_Rotate_f); Cmd_AddCommand("rotate", IN_Rotate_f);

View file

@ -1296,7 +1296,7 @@ void CL_FullServerinfo_f (void)
#ifdef CSQC_DAT #ifdef CSQC_DAT
p = Info_ValueForKey(cl.serverinfo, "*csprogs"); p = Info_ValueForKey(cl.serverinfo, "*csprogs");
if (*p) //only allow csqc if the server says so, and the 'checksum' matches. if (*p || cls.demoplayback) //only allow csqc if the server says so, and the 'checksum' matches.
{ {
unsigned int chksum = strtoul(p, NULL, 0); unsigned int chksum = strtoul(p, NULL, 0);
if (CSQC_Init(chksum)) if (CSQC_Init(chksum))

View file

@ -1557,6 +1557,9 @@ void CLNQ_ParseServerData(void) //Doesn't change gamedir - use with caution.
R_NewMap (); R_NewMap ();
if (cls.demoplayback)
CSQC_Init(0);
SCR_EndLoadingPlaque(); SCR_EndLoadingPlaque();
Hunk_Check (); // make sure nothing is hurt Hunk_Check (); // make sure nothing is hurt

View file

@ -1167,6 +1167,11 @@ static void PF_cs_getmousepos (progfuncs_t *prinst, struct globalvars_s *pr_glob
G_FLOAT(OFS_RETURN+2) = 0; G_FLOAT(OFS_RETURN+2) = 0;
} }
static void PF_checkextension (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
G_FLOAT(OFS_RETURN) = 0;
}
#define PF_FixTen PF_Fixme,PF_Fixme,PF_Fixme,PF_Fixme,PF_Fixme,PF_Fixme,PF_Fixme,PF_Fixme,PF_Fixme,PF_Fixme #define PF_FixTen PF_Fixme,PF_Fixme,PF_Fixme,PF_Fixme,PF_Fixme,PF_Fixme,PF_Fixme,PF_Fixme,PF_Fixme,PF_Fixme
@ -1291,7 +1296,7 @@ PF_Fixme,
PF_Fixme, PF_Fixme,
PF_Fixme, PF_Fixme,
//100 //100
PF_Fixme, PF_checkextension,
PF_Fixme, PF_Fixme,
PF_Fixme, PF_Fixme,
PF_Fixme, PF_Fixme,
@ -1515,10 +1520,11 @@ void VARGS CSQC_Abort (char *format, ...) //an error occured.
{ {
static char buffer[1024*1024*8]; int size = 1024*1024*8;
int size = sizeof buffer; char *buffer = BZ_Malloc(size);
csqcprogs->save_ents(csqcprogs, buffer, &size, 3); csqcprogs->save_ents(csqcprogs, buffer, &size, 3);
COM_WriteFile("csqccore.txt", buffer, size); COM_WriteFile("csqccore.txt", buffer, size);
BZ_Free(buffer);
} }
Host_EndGame("csqc error"); Host_EndGame("csqc error");
@ -1543,6 +1549,7 @@ qbyte *CSQC_PRLoadFile (char *path, void *buffer, int bufsize)
//pretend it doesn't //pretend it doesn't
file = COM_LoadStackFile(path, buffer, bufsize); file = COM_LoadStackFile(path, buffer, bufsize);
if (!cls.demoplayback) //allow any csqc when playing a demo
if (!strcmp(path, "csprogs.dat")) //Fail to load any csprogs who's checksum doesn't match. if (!strcmp(path, "csprogs.dat")) //Fail to load any csprogs who's checksum doesn't match.
if (Com_BlockChecksum(buffer, com_filesize) != csqcchecksum) if (Com_BlockChecksum(buffer, com_filesize) != csqcchecksum)
return NULL; return NULL;

View file

@ -393,13 +393,28 @@ void PF_CL_drawpic (progfuncs_t *prinst, struct globalvars_s *pr_globals)
float *size = G_VECTOR(OFS_PARM2); float *size = G_VECTOR(OFS_PARM2);
float *rgb = G_VECTOR(OFS_PARM3); float *rgb = G_VECTOR(OFS_PARM3);
float alpha = G_FLOAT(OFS_PARM4); float alpha = G_FLOAT(OFS_PARM4);
// float flag = G_FLOAT(OFS_PARM5); float flag = G_FLOAT(OFS_PARM5);
if (qrenderer == QR_OPENGL)
{
if (flag == 1)
qglBlendFunc(GL_SRC_ALPHA, GL_ONE);
else if(flag == 2)
qglBlendFunc(GL_DST_COLOR, GL_ZERO);
else if(flag == 3)
qglBlendFunc(GL_DST_COLOR,GL_SRC_COLOR);
else
qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
if (Draw_ImageColours) if (Draw_ImageColours)
Draw_ImageColours(rgb[0], rgb[1], rgb[2], alpha); Draw_ImageColours(rgb[0], rgb[1], rgb[2], alpha);
if (Draw_Image) if (Draw_Image)
Draw_Image(pos[0], pos[1], size[0], size[1], 0, 0, 1, 1, p); Draw_Image(pos[0], pos[1], size[0], size[1], 0, 0, 1, 1, p);
if (qrenderer == QR_OPENGL)
qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
G_FLOAT(OFS_RETURN) = 1; G_FLOAT(OFS_RETURN) = 1;
} }
//float drawfill(vector position, vector size, vector rgb, float alpha, float flag) = #457; //float drawfill(vector position, vector size, vector rgb, float alpha, float flag) = #457;

View file

@ -707,7 +707,7 @@ coorddata MSG_ToCoord(float f, int bytes) //return value should be treated as (c
switch(bytes) switch(bytes)
{ {
case 2: case 2:
r.b2 = LittleShort(f*8); r.b2 = LittleShort((short)(f*8));
break; break;
case 4: case 4:
r.f = LittleFloat(f); r.f = LittleFloat(f);

View file

@ -715,10 +715,10 @@ void CM_CreateBrush ( q2cbrush_t *brush, vec3_t *verts, q2mapsurface_t *surface
side = &map_brushsides[numbrushsides++]; side = &map_brushsides[numbrushsides++];
side->plane = plane; side->plane = plane;
if (DotProduct(plane->normal, mainplane.normal) >= 0) // if (DotProduct(plane->normal, mainplane.normal) >= 0)
side->surface = surface; side->surface = surface;
else // else
side->surface = NULL; // don't clip against this side // side->surface = NULL; // don't clip against this side
brush->numsides++; brush->numsides++;
} }
@ -4142,6 +4142,8 @@ vec3_t trace_start, trace_end;
vec3_t trace_mins, trace_maxs; vec3_t trace_mins, trace_maxs;
vec3_t trace_extents; vec3_t trace_extents;
vec3_t trace_absmins, trace_absmaxs; vec3_t trace_absmins, trace_absmaxs;
float trace_truefraction;
float trace_nearfraction;
trace_t trace_trace; trace_t trace_trace;
int trace_contents; int trace_contents;
@ -4165,8 +4167,9 @@ void CM_ClipBoxToBrush (vec3_t mins, vec3_t maxs, vec3_t p1, vec3_t p2,
float f; float f;
q2cbrushside_t *side, *leadside; q2cbrushside_t *side, *leadside;
float nearfrac=0;
enterfrac = -1; enterfrac = -1;
leavefrac = 1; leavefrac = 2;
clipplane = NULL; clipplane = NULL;
if (!brush->numsides) if (!brush->numsides)
@ -4224,17 +4227,18 @@ void CM_ClipBoxToBrush (vec3_t mins, vec3_t maxs, vec3_t p1, vec3_t p2,
// crosses face // crosses face
if (d1 > d2) if (d1 > d2)
{ // enter { // enter
f = (d1-DIST_EPSILON) / (d1-d2); f = (d1) / (d1-d2);
if (f > enterfrac) if (f > enterfrac)
{ {
enterfrac = f; enterfrac = f;
nearfrac = (d1-DIST_EPSILON) / (d1-d2);
clipplane = plane; clipplane = plane;
leadside = side; leadside = side;
} }
} }
else else
{ // leave { // leave
f = (d1/*+DIST_EPSILON*/) / (d1-d2); f = (d1) / (d1-d2);
if (f < leavefrac) if (f < leavefrac)
leavefrac = f; leavefrac = f;
} }
@ -4247,13 +4251,16 @@ void CM_ClipBoxToBrush (vec3_t mins, vec3_t maxs, vec3_t p1, vec3_t p2,
trace->allsolid = true; trace->allsolid = true;
return; return;
} }
if (enterfrac - (1.0f / 1024.0f) < leavefrac) if (enterfrac <= leavefrac)
{ {
if (enterfrac > -1 && enterfrac < trace->fraction) if (enterfrac > -1 && enterfrac <= trace_truefraction)
{ {
if (enterfrac < 0) if (enterfrac < 0)
enterfrac = 0; enterfrac = 0;
trace->fraction = enterfrac;
trace_nearfraction = nearfrac;
trace_truefraction = enterfrac;
trace->plane.dist = clipplane->dist; trace->plane.dist = clipplane->dist;
VectorCopy(clipplane->normal, trace->plane.normal); VectorCopy(clipplane->normal, trace->plane.normal);
trace->surface = &(leadside->surface->c); trace->surface = &(leadside->surface->c);
@ -4267,7 +4274,7 @@ void CM_ClipBoxToPatch (vec3_t mins, vec3_t maxs, vec3_t p1, vec3_t p2,
{ {
int i, j; int i, j;
mplane_t *plane, *clipplane; mplane_t *plane, *clipplane;
float enterfrac, leavefrac; float enterfrac, leavefrac, nearfrac = 0;
vec3_t ofs; vec3_t ofs;
float d1, d2; float d1, d2;
float dist; float dist;
@ -4281,7 +4288,7 @@ void CM_ClipBoxToPatch (vec3_t mins, vec3_t maxs, vec3_t p1, vec3_t p2,
c_brush_traces++; c_brush_traces++;
enterfrac = -1; enterfrac = -1;
leavefrac = 1; leavefrac = 2;
clipplane = NULL; clipplane = NULL;
startout = false; startout = false;
leadside = NULL; leadside = NULL;
@ -4328,38 +4335,45 @@ void CM_ClipBoxToPatch (vec3_t mins, vec3_t maxs, vec3_t p1, vec3_t p2,
// crosses face // crosses face
if (d1 > d2) if (d1 > d2)
{ // enter { // enter
f = (d1-DIST_EPSILON) / (d1-d2); f = (d1) / (d1-d2);
if (f > enterfrac) if (f > enterfrac)
{ {
enterfrac = f; enterfrac = f;
nearfrac = (d1-DIST_EPSILON) / (d1-d2);
clipplane = plane; clipplane = plane;
leadside = side; leadside = side;
} }
} }
else else
{ // leave { // leave
f = (d1 /*+ DIST_EPSILON*/) / (d1-d2); f = (d1) / (d1-d2);
if (f < leavefrac) if (f < leavefrac)
leavefrac = f; leavefrac = f;
} }
} }
if (!startout) if (!startout)
{
trace->startsolid = true;
return; // original point is inside the patch return; // original point is inside the patch
}
if (enterfrac - (1.0f / 1024.0f) <= leavefrac) if (nearfrac <= leavefrac)
{ {
if (leadside && leadside->surface if (leadside && leadside->surface
&& enterfrac < trace->fraction) && enterfrac <= trace_truefraction)
{ {
if (enterfrac < 0) if (enterfrac < 0)
enterfrac = 0; enterfrac = 0;
trace->fraction = enterfrac; trace_truefraction = enterfrac;
trace_nearfraction = nearfrac;
trace->plane.dist = clipplane->dist; trace->plane.dist = clipplane->dist;
VectorCopy(clipplane->normal, trace->plane.normal); VectorCopy(clipplane->normal, trace->plane.normal);
trace->surface = &leadside->surface->c; trace->surface = &leadside->surface->c;
trace->contents = brush->contents; trace->contents = brush->contents;
} }
else if (enterfrac < trace_truefraction)
leavefrac=0;
} }
} }
@ -4505,7 +4519,7 @@ void CM_TraceToLeaf (int leafnum)
if ( !(b->contents & trace_contents)) if ( !(b->contents & trace_contents))
continue; continue;
CM_ClipBoxToBrush (trace_mins, trace_maxs, trace_start, trace_end, &trace_trace, b); CM_ClipBoxToBrush (trace_mins, trace_maxs, trace_start, trace_end, &trace_trace, b);
if (!trace_trace.fraction) if (trace_nearfraction <= 0)
return; return;
} }
@ -4528,7 +4542,7 @@ void CM_TraceToLeaf (int leafnum)
for (j = 0; j < patch->numbrushes; j++) for (j = 0; j < patch->numbrushes; j++)
{ {
CM_ClipBoxToPatch (trace_mins, trace_maxs, trace_start, trace_end, &trace_trace, &patch->brushes[j]); CM_ClipBoxToPatch (trace_mins, trace_maxs, trace_start, trace_end, &trace_trace, &patch->brushes[j]);
if (trace_trace.fraction<=0) if (trace_nearfraction<=0)
return; return;
} }
} }
@ -4614,7 +4628,7 @@ void CM_RecursiveHullCheck (int num, float p1f, float p2f, vec3_t p1, vec3_t p2)
int side; int side;
float midf; float midf;
if (trace_trace.fraction <= p1f) if (trace_truefraction <= p1f)
return; // already hit something nearer return; // already hit something nearer
// if < 0, we are in a leaf node // if < 0, we are in a leaf node
@ -4741,6 +4755,8 @@ trace_t CM_BoxTrace (vec3_t start, vec3_t end,
// fill in a default trace // fill in a default trace
memset (&trace_trace, 0, sizeof(trace_trace)); memset (&trace_trace, 0, sizeof(trace_trace));
trace_truefraction = 1;
trace_nearfraction = 1;
trace_trace.fraction = 1; trace_trace.fraction = 1;
trace_trace.surface = &(nullsurface.c); trace_trace.surface = &(nullsurface.c);
@ -4825,9 +4841,9 @@ trace_t CM_BoxTrace (vec3_t start, vec3_t end,
else else
{ {
trace_ispoint = false; trace_ispoint = false;
trace_extents[0] = (-trace_mins[0] > trace_maxs[0] ? -trace_mins[0] : trace_maxs[0])+0.1; trace_extents[0] = -trace_mins[0] > trace_maxs[0] ? -trace_mins[0] : trace_maxs[0]+1;
trace_extents[1] = (-trace_mins[1] > trace_maxs[1] ? -trace_mins[1] : trace_maxs[1])+0.1; trace_extents[1] = -trace_mins[1] > trace_maxs[1] ? -trace_mins[1] : trace_maxs[1]+1;
trace_extents[2] = (-trace_mins[2] > trace_maxs[2] ? -trace_mins[2] : trace_maxs[2])+0.1; trace_extents[2] = -trace_mins[2] > trace_maxs[2] ? -trace_mins[2] : trace_maxs[2]+1;
#if ADJ #if ADJ
if (-mins[2] != maxs[2]) //be prepared to move the thing up to counter the different min/max if (-mins[2] != maxs[2]) //be prepared to move the thing up to counter the different min/max
{ {
@ -4848,12 +4864,16 @@ trace_t CM_BoxTrace (vec3_t start, vec3_t end,
// //
CM_RecursiveHullCheck (headnode, 0, 1, trace_start, trace_end); CM_RecursiveHullCheck (headnode, 0, 1, trace_start, trace_end);
if (trace_trace.fraction == 1) if (trace_nearfraction == 1)
{ {
trace_trace.fraction = 1;
VectorCopy (trace_end, trace_trace.endpos); VectorCopy (trace_end, trace_trace.endpos);
} }
else else
{ {
if (trace_nearfraction<0)
trace_nearfraction=0;
trace_trace.fraction = trace_nearfraction;
for (i=0 ; i<3 ; i++) for (i=0 ; i<3 ; i++)
trace_trace.endpos[i] = trace_start[i] + trace_trace.fraction * (trace_end[i] - trace_start[i]); trace_trace.endpos[i] = trace_start[i] + trace_trace.fraction * (trace_end[i] - trace_start[i]);
} }
@ -4928,7 +4948,6 @@ trace_t CM_TransformedBoxTrace (vec3_t start, vec3_t end,
trace.plane.normal[0] = DotProduct (temp, forward); trace.plane.normal[0] = DotProduct (temp, forward);
trace.plane.normal[1] = -DotProduct (temp, right); trace.plane.normal[1] = -DotProduct (temp, right);
trace.plane.normal[2] = DotProduct (temp, up); trace.plane.normal[2] = DotProduct (temp, up);
}
if (trace.fraction == 1) if (trace.fraction == 1)
{ {
@ -4940,6 +4959,7 @@ trace_t CM_TransformedBoxTrace (vec3_t start, vec3_t end,
trace.endpos[1] = start[1] + trace.fraction * (end[1] - start[1]); trace.endpos[1] = start[1] + trace.fraction * (end[1] - start[1]);
trace.endpos[2] = start[2] + trace.fraction * (end[2] - start[2]); trace.endpos[2] = start[2] + trace.fraction * (end[2] - start[2]);
} }
}
return trace; return trace;
} }

View file

@ -2204,7 +2204,7 @@ void PR_TestForWierdness(progfuncs_t *progfuncs)
{ {
for (e = 0; e < sv_num_edicts; e++) for (e = 0; e < sv_num_edicts; e++)
{ {
ed = EDICT_NUM(progfuncs, e); ed = (edictrun_t*)EDICT_NUM(progfuncs, e);
if (ed->isfree) if (ed->isfree)
continue; continue;
if (((int *)ed->fields)[field[i].ofs] < 0 || ((int *)ed->fields)[field[i].ofs] >= addressableused) if (((int *)ed->fields)[field[i].ofs] < 0 || ((int *)ed->fields)[field[i].ofs] >= addressableused)

View file

@ -3508,7 +3508,11 @@ void PF_WeapIndex (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_coredump (progfuncs_t *prinst, struct globalvars_s *pr_globals) void PF_coredump (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{ {
// ED_PrintEdicts (); int size = 1024*1024*8;
char *buffer = BZ_Malloc(size);
prinst->save_ents(prinst, buffer, &size, 3);
COM_WriteFile("ssqccore.txt", buffer, size);
BZ_Free(buffer);
} }
void PF_traceon (progfuncs_t *prinst, struct globalvars_s *pr_globals) void PF_traceon (progfuncs_t *prinst, struct globalvars_s *pr_globals)
@ -4648,6 +4652,7 @@ void SV_point_tempentity (vec3_t o, int type, int count) //count (usually 1) is
SV_Error("SV_point_tempentity - type is a beam\n"); SV_Error("SV_point_tempentity - type is a beam\n");
default: default:
MSG_WriteByte (&sv.multicast, type); MSG_WriteByte (&sv.multicast, type);
MSG_WriteByte (&sv.nqmulticast, type);
} }
MSG_WriteCoord (&sv.multicast, o[0]); MSG_WriteCoord (&sv.multicast, o[0]);
MSG_WriteCoord (&sv.multicast, o[1]); MSG_WriteCoord (&sv.multicast, o[1]);
@ -8934,8 +8939,9 @@ void PR_RegisterFields(void) //it's just easier to do it this way.
fieldentity(viewmodelforclient); fieldentity(viewmodelforclient);
fieldentity(exteriormodeltoclient); fieldentity(exteriormodeltoclient);
fieldfloat(glowsize); fieldfloat(glow_size);
fieldfloat(glowcolor); fieldfloat(glow_color);
fieldfloat(glow_trail);
//UDC_EXTEFFECT... yuckie //UDC_EXTEFFECT... yuckie
PR_RegisterFieldVar(svprogfuncs, ev_float, "fieldcolor", (int)&((entvars_t*)0)->seefcolour, -1); PR_RegisterFieldVar(svprogfuncs, ev_float, "fieldcolor", (int)&((entvars_t*)0)->seefcolour, -1);

View file

@ -201,8 +201,9 @@ typedef struct entvars_s
int viewmodelforclient; int viewmodelforclient;
int exteriormodeltoclient; int exteriormodeltoclient;
float glowsize; float glow_size;
float glowcolor; float glow_color;
float glow_trail;
//EXT_DIMENSION_VISIBLE //EXT_DIMENSION_VISIBLE
float dimension_see; float dimension_see;

View file

@ -1655,7 +1655,6 @@ void SVNQ_EmitEntity(sizebuf_t *msg, edict_t *ent, int entnum)
int i, eff; int i, eff;
float miss; float miss;
unsigned int bits=0; unsigned int bits=0;
eval_t *val;
int glowsize, glowcolor; int glowsize, glowcolor;
@ -1720,16 +1719,8 @@ int glowsize, glowcolor;
bits |= DPU_EFFECTS2; bits |= DPU_EFFECTS2;
val = svprogfuncs->GetEdictFieldValue(svprogfuncs, ent, "glow_size", NULL); //ouch.. null... glowsize = ent->v->glow_size*0.25f;
if (val) glowcolor = ent->v->glow_color;
glowsize = val->_float*0.25f;
else
glowsize = 0;
val = svprogfuncs->GetEdictFieldValue(svprogfuncs, ent, "glow_color", NULL); //ouch.. null...
if (val)
glowcolor = val->_float;
else
glowcolor = 0;
if (0 != glowsize) if (0 != glowsize)
bits |= DPU_GLOWSIZE; bits |= DPU_GLOWSIZE;
@ -2370,8 +2361,8 @@ void SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg, qboolean ignore
if (!ent->v->alpha) if (!ent->v->alpha)
state->trans = 1; state->trans = 1;
state->glowsize = ent->v->glowsize*0.25; state->glowsize = ent->v->glow_size*0.25;
state->glowcolour = ent->v->glowcolor; state->glowcolour = ent->v->glow_color;
//QSG_DIMENSION_PLANES - if the only shared dimensions are ghost dimensions, Set half alpha. //QSG_DIMENSION_PLANES - if the only shared dimensions are ghost dimensions, Set half alpha.
if (client->edict) if (client->edict)

View file

@ -456,7 +456,8 @@ void SV_UnspawnServer (void) //terminate the running server.
for (i = 0; i < MAX_CLIENTS; i++) for (i = 0; i < MAX_CLIENTS; i++)
{ {
svs.clients[i].state = 0; svs.clients[i].state = 0;
*svs.clients[i].name = '\0'; *svs.clients[i].namebuf = '\0';
svs.clients[i].name = NULL;
} }
NET_CloseServer (); NET_CloseServer ();
} }
@ -561,12 +562,15 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
Mod_ClearAll (); Mod_ClearAll ();
Hunk_FreeToLowMark (host_hunklevel); Hunk_FreeToLowMark (host_hunklevel);
if (svs.gametype == GT_PROGS)
{
for (i = 0; i < MAX_LIGHTSTYLES; i++) for (i = 0; i < MAX_LIGHTSTYLES; i++)
{ {
if (sv.lightstyles[i]) if (sv.lightstyles[i])
Z_Free(sv.lightstyles[i]); Z_Free(sv.lightstyles[i]);
sv.lightstyles[i] = NULL; sv.lightstyles[i] = NULL;
} }
}
// wipe the entire per-level structure // wipe the entire per-level structure
memset (&sv, 0, sizeof(sv)); memset (&sv, 0, sizeof(sv));
@ -748,7 +752,7 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
if (svs.clients[i].state) if (svs.clients[i].state)
SV_DropClient(&svs.clients[i]); SV_DropClient(&svs.clients[i]);
svs.clients[i].name[0] = '\0'; //kill all bots svs.clients[i].namebuf[0] = '\0'; //kill all bots
} }
} }
svs.gametype = newgametype; svs.gametype = newgametype;
@ -1028,10 +1032,10 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
sprintf(sv.mapname, "%s", PR_GetString(svprogfuncs, val->string)); sprintf(sv.mapname, "%s", PR_GetString(svprogfuncs, val->string));
} }
ent->readonly = true; //lock it down! ent->readonly = true; //lock it down!
}
// look up some model indexes for specialized message compression // look up some model indexes for specialized message compression
SV_FindModelNumbers (); SV_FindModelNumbers ();
}
#ifndef SERVERONLY #ifndef SERVERONLY
current_loading_size+=10; current_loading_size+=10;
@ -1058,6 +1062,7 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
// create a baseline for more efficient communications // create a baseline for more efficient communications
// SV_CreateBaseline (); // SV_CreateBaseline ();
if (svprogfuncs)
SVNQ_CreateBaseline(); SVNQ_CreateBaseline();
sv.signon_buffer_size[sv.num_signon_buffers-1] = sv.signon.cursize; sv.signon_buffer_size[sv.num_signon_buffers-1] = sv.signon.cursize;

View file

@ -1746,7 +1746,12 @@ void SVC_DirectConnect
void SV_ClearClient(client_t *cl) void SV_ClearClient(client_t *cl)
{ {
client_frame_t *frames = cl->frames; client_frame_t *frames = cl->frames;
char *on, *ot;
on = cl->name;
ot = cl->team;
memset(cl, 0, sizeof(client_t)); memset(cl, 0, sizeof(client_t));
cl->name = on;
cl->team = ot;
cl->frames = frames; cl->frames = frames;
if (frames) if (frames)
memset(frames, 0, sizeof(client_frame_t)*UPDATE_BACKUP); memset(frames, 0, sizeof(client_frame_t)*UPDATE_BACKUP);

View file

@ -274,9 +274,6 @@ int SV_FlyMove (edict_t *ent, float time, trace_t *steptrace)
for (i=0 ; i<3 ; i++) for (i=0 ; i<3 ; i++)
end[i] = ent->v->origin[i] + time_left * ent->v->velocity[i]; end[i] = ent->v->origin[i] + time_left * ent->v->velocity[i];
if (SV_TestEntityPosition(ent))
Con_Printf("stuck point 1a\n");
trace = SV_Move (ent->v->origin, ent->v->mins, ent->v->maxs, end, false, ent); trace = SV_Move (ent->v->origin, ent->v->mins, ent->v->maxs, end, false, ent);
if (trace.startsolid) if (trace.startsolid)
@ -1541,17 +1538,11 @@ void SV_WalkMove (edict_t *ent)
VectorCopy (ent->v->origin, start_origin); VectorCopy (ent->v->origin, start_origin);
VectorCopy (ent->v->velocity, start_velocity); VectorCopy (ent->v->velocity, start_velocity);
if (SV_TestEntityPosition(ent))
Con_Printf("stuck point 0\n");
clip = SV_FlyMove (ent, host_frametime, NULL); clip = SV_FlyMove (ent, host_frametime, NULL);
SV_SetOnGround (ent); SV_SetOnGround (ent);
SV_CheckVelocity(ent); SV_CheckVelocity(ent);
if (SV_TestEntityPosition(ent))
Con_Printf("stuck point 1\n");
VectorCopy(ent->v->origin, originalmove_origin); VectorCopy(ent->v->origin, originalmove_origin);
VectorCopy(ent->v->velocity, originalmove_velocity); VectorCopy(ent->v->velocity, originalmove_velocity);
originalmove_clip = clip; originalmove_clip = clip;
@ -1594,17 +1585,11 @@ void SV_WalkMove (edict_t *ent)
// FIXME: don't link? // FIXME: don't link?
SV_PushEntity(ent, upmove); SV_PushEntity(ent, upmove);
if (SV_TestEntityPosition(ent))
Con_Printf("stuck point 2\n");
// move forward // move forward
ent->v->velocity[2] = 0; ent->v->velocity[2] = 0;
clip = SV_FlyMove (ent, host_frametime, &steptrace); clip = SV_FlyMove (ent, host_frametime, &steptrace);
ent->v->velocity[2] += start_velocity[2]; ent->v->velocity[2] += start_velocity[2];
if (SV_TestEntityPosition(ent))
Con_Printf("stuck point 3\n");
SV_CheckVelocity(ent); SV_CheckVelocity(ent);
// check for stuckness, possibly due to the limited precision of floats // check for stuckness, possibly due to the limited precision of floats
@ -1633,9 +1618,6 @@ void SV_WalkMove (edict_t *ent)
// Con_Printf("wall\n"); // Con_Printf("wall\n");
SV_WallFriction (ent, &steptrace); SV_WallFriction (ent, &steptrace);
} }
if (SV_TestEntityPosition(ent))
Con_Printf("stuck point 4\n");
} }
else if (/*!sv_gameplayfix_stepdown.integer || */!oldonground || start_velocity[2] > 0 || ((int)ent->v->flags & FL_ONGROUND) || ent->v->waterlevel >= 2) else if (/*!sv_gameplayfix_stepdown.integer || */!oldonground || start_velocity[2] > 0 || ((int)ent->v->flags & FL_ONGROUND) || ent->v->waterlevel >= 2)
return; return;
@ -1646,9 +1628,6 @@ void SV_WalkMove (edict_t *ent)
// FIXME: don't link? // FIXME: don't link?
downtrace = SV_PushEntity (ent, downmove); downtrace = SV_PushEntity (ent, downmove);
if (SV_TestEntityPosition(ent))
Con_Printf("stuck point 5\n");
if (downtrace.fraction < 1 && downtrace.plane.normal[2] > 0.7) if (downtrace.fraction < 1 && downtrace.plane.normal[2] > 0.7)
{ {
// LordHavoc: disabled this check so you can walk on monsters/players // LordHavoc: disabled this check so you can walk on monsters/players
@ -1674,9 +1653,6 @@ void SV_WalkMove (edict_t *ent)
SV_SetOnGround (ent); SV_SetOnGround (ent);
SV_CheckVelocity(ent); SV_CheckVelocity(ent);
if (SV_TestEntityPosition(ent))
Con_Printf("stuck point 6\n");
} }
@ -1739,25 +1715,8 @@ void SV_Physics_Client (edict_t *ent, int num)
if (!SV_CheckWater (ent) && ! ((int)ent->v->flags & FL_WATERJUMP) ) if (!SV_CheckWater (ent) && ! ((int)ent->v->flags & FL_WATERJUMP) )
SV_AddGravity (ent, ent->v->gravity); SV_AddGravity (ent, ent->v->gravity);
// if (fabs(oldvel - ent->v->velocity[0])> 100)
// Con_Printf("grav: %f -> %f\n", oldvel, ent->v->velocity[0]);
// if (SV_TestEntityPosition(ent))
// Con_Printf("Player starts stuck\n");
SV_CheckStuck (ent); SV_CheckStuck (ent);
// if (SV_TestEntityPosition(ent))
// Con_Printf("becomes stuck\n");
SV_WalkMove (ent); SV_WalkMove (ent);
// if (SV_TestEntityPosition(ent))
// Con_Printf("Player ends stuck\n");
// if (fabs(oldvel - ent->v->velocity[0])> 100)
// Con_Printf("walk: %f -> %f\n", oldvel, ent->v->velocity[0]);
break; break;
case MOVETYPE_FOLLOW: case MOVETYPE_FOLLOW:

View file

@ -829,7 +829,7 @@ void SV_FindModelNumbers (void)
for (i=0 ; i<MAX_MODELS ; i++) for (i=0 ; i<MAX_MODELS ; i++)
{ {
if (!*sv.model_precache[i]) if (!sv.model_precache[i])
break; break;
if (!strcmp(sv.model_precache[i],"progs/spike.mdl")) if (!strcmp(sv.model_precache[i],"progs/spike.mdl"))
sv_nailmodel = i; sv_nailmodel = i;

View file

@ -289,7 +289,7 @@ void SVNQ_New_f (void)
MSG_WriteString (&host_client->netchan.message,message); MSG_WriteString (&host_client->netchan.message,message);
for (i = 1; *sv.model_precache[i] ; i++) for (i = 1; sv.model_precache[i] ; i++)
MSG_WriteString (&host_client->netchan.message, sv.model_precache[i]); MSG_WriteString (&host_client->netchan.message, sv.model_precache[i]);
MSG_WriteByte (&host_client->netchan.message, 0); MSG_WriteByte (&host_client->netchan.message, 0);
@ -3349,6 +3349,10 @@ ucmd_t nqucmds[] =
{"ban", NULL}, {"ban", NULL},
{"vote", SV_Vote_f}, {"vote", SV_Vote_f},
{"playermodel", NULL},
{"playerskin", NULL},
{"rate", NULL},
#ifdef SVRANKING #ifdef SVRANKING
{"topten", Rank_ListTop10_f}, {"topten", Rank_ListTop10_f},
#endif #endif