1
0
Fork 0
forked from fte/fteqw

Big huge mega-whooping commit.

I wonder how many things this'll break...
On the plus side, nexuiz works well, and ktpro works as well as in mvdsv. Hurrah!


git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1122 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2005-07-01 19:23:00 +00:00
parent 28e6b70ba7
commit f85340b9a2
42 changed files with 1339 additions and 855 deletions

View file

@ -323,15 +323,15 @@ void CL_ParseDelta (entity_state_t *from, entity_state_t *to, int bits, qboolean
#ifdef PEXT_SCALE
if (morebits & U_SCALE && cls.fteprotocolextensions & PEXT_SCALE)
to->scale = (float)MSG_ReadByte() / 100.0;
to->scale = MSG_ReadByte();
#endif
#ifdef PEXT_TRANS
if (morebits & U_TRANS && cls.fteprotocolextensions & PEXT_TRANS)
to->trans = (float)MSG_ReadByte() / 255;
to->trans = MSG_ReadByte();
#endif
#ifdef PEXT_FATNESS
if (morebits & U_FATNESS && cls.fteprotocolextensions & PEXT_FATNESS)
to->trans = (float)MSG_ReadChar() / 2;
to->fatness = MSG_ReadChar();
#endif
if (morebits & U_DRAWFLAGS && cls.fteprotocolextensions & PEXT_HEXEN2)
@ -367,16 +367,25 @@ void CL_ParseDelta (entity_state_t *from, entity_state_t *to, int bits, qboolean
if (i & RENDER_EXTERIORMODEL)
to->flags |= Q2RF_EXTERNALMODEL;
}
if (morebits & U_TAGINFO)
{
to->tagentity = MSG_ReadShort();
to->tagindex = MSG_ReadShort();
}
VectorSubtract(to->origin, from->origin, move);
#ifdef HALFLIFEMODELS
if (to->frame != from->frame)
{
cl.lerpents[to->number].oldframechange = cl.lerpents[to->number].framechange; //marked for hl models
cl.lerpents[to->number].framechange = cl.time; //marked for hl models
}
#endif
if (to->modelindex != from->modelindex || to->number != from->number || VectorLength(move)>500) //model changed... or entity changed...
{
#ifdef HALFLIFEMODELS
cl.lerpents[to->number].oldframechange = cl.lerpents[to->number].framechange; //marked for hl models
cl.lerpents[to->number].framechange = cl.time; //marked for hl models
#endif
cl.lerpents[to->number].lerptime = -10;
@ -846,15 +855,15 @@ void DP5_ParseDelta(entity_state_t *s)
s->effects = MSG_ReadByte();
}
if (bits & E5_ALPHA)
s->trans = MSG_ReadByte()/255.0f;
s->trans = MSG_ReadByte();
if (bits & E5_SCALE)
s->scale = MSG_ReadByte()/255.0f;
s->scale = MSG_ReadByte();
if (bits & E5_COLORMAP)
s->colormap = MSG_ReadByte();
if (bits & E5_ATTACHMENT)
{
cl.lerpents[s->number].tagent = MSG_ReadShort();
cl.lerpents[s->number].tagindex = MSG_ReadByte();
s->tagentity = MSG_ReadShort();
s->tagindex = MSG_ReadByte();
}
if (bits & E5_LIGHT)
{
@ -1260,16 +1269,14 @@ void CL_RotateAroundTag(entity_t *ent, int num, int tagent, int tagnum)
int frame2 = cl.lerpents[tagent].frame;
float frame2ness;
// ent->keynum = tagent;
if (cl.lerpents[tagent].tagent)
CL_RotateAroundTag(ent, num, cl.lerpents[tagent].tagent, cl.lerpents[tagent].tagindex);
ent->keynum = tagent;
ps = CL_FindPacketEntity(tagent);
if (ps)
{
if (ps->tagentity)
CL_RotateAroundTag(ent, num, ps->tagentity, ps->tagindex);
org = ps->origin;
ang = ps->angles;
model = ps->modelindex;
@ -1302,7 +1309,7 @@ void CL_RotateAroundTag(entity_t *ent, int num, int tagent, int tagnum)
VectorInverse(axis[1]);
frame2ness = CL_EntLerpFactor(tagent);
if (Mod_GetTag && Mod_GetTag(cl.model_precache[model], tagnum, frame, frame2, frame2ness, cl.time - cl.lerpents[tagent].framechange, cl.time - cl.lerpents[tagent].framechange, transform))
if (Mod_GetTag && Mod_GetTag(cl.model_precache[model], tagnum, frame, frame2, frame2ness, cl.time - cl.lerpents[tagent].framechange, cl.time - cl.lerpents[tagent].oldframechange, transform))
{
old[0] = ent->axis[0][0];
old[1] = ent->axis[1][0];
@ -1345,17 +1352,6 @@ void CL_RotateAroundTag(entity_t *ent, int num, int tagent, int tagnum)
ent->axis[1][2] = result[9];
ent->axis[2][2] = result[10];
ent->origin[2] = result[11];
/*
VectorAdd(org, ent->origin, destorg);
VectorMA(destorg, tagorg[0], ent->axis[0], destorg);
VectorMA(destorg, tagorg[1], ent->axis[1], destorg);
VectorMA(destorg, tagorg[2], ent->axis[2], destorg);
VectorCopy(destorg, ent->origin);
// Con_Printf("Found tag %i\n", cl.lerpents[tagent].tagindex);
Matrix3_Multiply(axis, ent->axis, temp); //the ent->axis here is the result of the parent's transforms
Matrix3_Multiply((void*)tagaxis, temp, ent->axis);
*/
}
else //hrm.
{
@ -1363,8 +1359,6 @@ void CL_RotateAroundTag(entity_t *ent, int num, int tagent, int tagnum)
VectorCopy(org, ent->origin);
}
}
// if (org)
// VectorAdd(ent->origin, org, ent->origin);
}
void V_AddEntity(entity_t *in)
@ -1515,7 +1509,7 @@ void CL_LinkPacketEntities (void)
ent->keynum = s1->number;
if (cl_r2g.value && s1->modelindex == cl_rocketindex && cl_rocketindex)
if (cl_r2g.value && s1->modelindex == cl_rocketindex && cl_rocketindex && cl_grenadeindex)
ent->model = cl.model_precache[cl_grenadeindex];
else
ent->model = model;
@ -1547,24 +1541,22 @@ void CL_LinkPacketEntities (void)
ent->frame = s1->frame;
ent->oldframe = cl.lerpents[s1->number].frame;
ent->frame1time = cl.time - cl.lerpents[s1->number].framechange;
ent->frame2time = cl.time - cl.lerpents[s1->number].oldframechange;
// f = (sin(realtime)+1)/2;
#ifdef PEXT_SCALE
//set scale
ent->scale = s1->scale;
if (!ent->scale)
ent->scale=1;
ent->scale = s1->scale/16.0;
#endif
#ifdef PEXT_TRANS
//set trans
ent->alpha = s1->trans;
if (!ent->alpha)
ent->alpha=1;
ent->alpha = s1->trans/255.0;
#endif
#ifdef PEXT_FATNESS
//set trans
ent->fatness = s1->fatness;
ent->fatness = s1->fatness/2.0;
#endif
// rotate binary objects locally
@ -1598,18 +1590,18 @@ void CL_LinkPacketEntities (void)
AngleVectors(angles, ent->axis[0], ent->axis[1], ent->axis[2]);
VectorInverse(ent->axis[1]);
if (cl.lerpents[s1->number].tagent)
{ //ent is attached to a tag, rotate this ent accordingly.
CL_RotateAroundTag(ent, s1->number, cl.lerpents[s1->number].tagent, cl.lerpents[s1->number].tagindex);
}
if (ent->keynum <= MAX_CLIENTS
#ifdef NQPROT
&& cls.protocol != CP_NETQUAKE
&& cls.protocol == CP_QUAKEWORLD
#endif
)
ent->keynum += MAX_EDICTS;
if (s1->tagentity)
{ //ent is attached to a tag, rotate this ent accordingly.
CL_RotateAroundTag(ent, s1->number, s1->tagentity, s1->tagindex);
}
// add automatic particle trails
if (!model || (!(model->flags&~EF_ROTATE) && model->particletrail<0))
continue;
@ -1933,8 +1925,8 @@ void CL_ParsePlayerinfo (void)
state->weaponframe = MSG_ReadByte ();
state->hullnum = 1;
state->scale = 1;
state->trans = 1;
state->scale = 1*16;
state->trans = 255;
state->fatness = 0;
state->pm_type = PM_NORMAL;
@ -2039,35 +2031,35 @@ void CL_ParsePlayerinfo (void)
state->hullnum = 1;
else
state->hullnum = 56;
state->scale = 1;
state->trans = 1;
state->scale = 1*16;
state->trans = 255;
state->fatness = 0;
#ifdef PEXT_SCALE
if (flags & PF_SCALE_Z && cls.fteprotocolextensions & PEXT_SCALE)
state->scale = (float)MSG_ReadByte() / 100;
#endif
#ifdef PEXT_TRANS
if (flags & PF_TRANS_Z && cls.fteprotocolextensions & PEXT_TRANS)
state->trans = (float)MSG_ReadByte() / 255;
#endif
#ifdef PEXT_FATNESS
if (flags & PF_FATNESS_Z && cls.fteprotocolextensions & PEXT_FATNESS)
state->fatness = (float)MSG_ReadChar() / 2;
#endif
#ifdef PEXT_HULLSIZE
if (cls.fteprotocolextensions & PEXT_HULLSIZE)
{
if (flags & PF_HULLSIZE_Z)
state->hullnum = MSG_ReadByte();
}
//should be passed to player move func.
#endif
if (cls.z_ext & Z_EXT_PM_TYPE)
{
int pm_code;
#ifdef PEXT_SCALE
if (flags & PF_SCALE_Z && cls.fteprotocolextensions & PEXT_SCALE)
state->scale = (float)MSG_ReadByte() / 100;
#endif
#ifdef PEXT_TRANS
if (flags & PF_TRANS_Z && cls.fteprotocolextensions & PEXT_TRANS)
state->trans = (float)MSG_ReadByte() / 255;
#endif
#ifdef PEXT_FATNESS
if (flags & PF_FATNESS_Z && cls.fteprotocolextensions & PEXT_FATNESS)
state->fatness = (float)MSG_ReadChar() / 2;
#endif
#ifdef PEXT_HULLSIZE
if (cls.fteprotocolextensions & PEXT_HULLSIZE)
{
if (flags & PF_HULLSIZE_Z)
state->hullnum = MSG_ReadByte();
}
//should be passed to player move func.
#endif
pm_code = (flags&PF_PMC_MASK) >> PF_PMC_SHIFT;
if (pm_code == PMC_NORMAL || pm_code == PMC_NORMAL_JUMP_HELD)
{
@ -2107,24 +2099,6 @@ void CL_ParsePlayerinfo (void)
}
else
{
#ifdef PEXT_SCALE
if (flags & PF_SCALE_NOZ && cls.fteprotocolextensions & PEXT_SCALE)
state->scale = (float)MSG_ReadByte() / 100;
#endif
#ifdef PEXT_TRANS
if (flags & PF_TRANS_NOZ && cls.fteprotocolextensions & PEXT_TRANS)
state->trans = (float)MSG_ReadByte() / 255;
#endif
#ifdef PEXT_FATNESS
if (flags & PF_FATNESS_NOZ && cls.fteprotocolextensions & PEXT_FATNESS)
state->fatness = (float)MSG_ReadChar() / 2;
#endif
#ifdef PEXT_HULLSIZE
if (flags & PF_HULLSIZE_NOZ && cls.fteprotocolextensions & PEXT_HULLSIZE)
state->hullnum = MSG_ReadByte();
//should be passed to player move func.
#endif
guess_pm_type:
if (cl.players[num].spectator)
state->pm_type = PM_OLD_SPECTATOR;
@ -2228,15 +2202,6 @@ void CL_AddVWeapModel(entity_t *player, int model)
VectorInverse(newent->axis[1]);
}
void CL_ParseAttachment(void)
{
int e = (unsigned short)MSG_ReadShort();
int o = (unsigned short)MSG_ReadShort();
int i = (unsigned short)MSG_ReadShort();
cl.lerpents[e].tagent = o;
cl.lerpents[e].tagindex = i;
}
/*
=============
CL_LinkPlayers
@ -2306,6 +2271,9 @@ void CL_LinkPlayers (void)
ent->model = cl.model_precache[state->modelindex];
ent->skinnum = state->skinnum;
ent->frame1time = cl.time - cl.lerpents[j].framechange;
ent->frame2time = cl.time - cl.lerpents[j].oldframechange;
ent->frame = state->frame;
ent->oldframe = state->oldframe;
if (state->lerpstarttime)
@ -2326,16 +2294,12 @@ void CL_LinkPlayers (void)
ent->scoreboard = NULL;
#ifdef PEXT_SCALE
ent->scale = state->scale;
if (!ent->scale)
ent->scale = 1;
ent->scale = state->scale/16.0f;
#endif
#ifdef PEXT_TRANS
ent->alpha = state->trans;
if (!ent->alpha)
ent->alpha = 1;
ent->alpha = state->trans/255.0f;
#endif
ent->fatness = state->fatness/2;
//
// angles
//

View file

@ -399,7 +399,7 @@ void CL_SendConnectPacket (
Info_SetValueForStarKey (playerinfo2, "name", "Second player", MAX_INFO_STRING);
clients = 1;
if (cl_splitscreen.value)
if (cl_splitscreen.value && (fteprotextsupported & PEXT_SPLITSCREEN))
{
// if (adr.type == NA_LOOPBACK)
clients = cl_splitscreen.value+1;
@ -827,6 +827,14 @@ void CL_ClearState (void)
memset (cl_baselines, 0, sizeof(cl_baselines));
for (i = 0; i < MAX_EDICTS; i++)
{
cl_baselines[i].scale = 1*16;
cl_baselines[i].trans = 255;
}
//
// allocate the efrags and chain together into a free list
//
@ -980,13 +988,13 @@ void CL_Disconnect (void)
void CL_Disconnect_f (void)
{
CL_Disconnect ();
#ifndef CLIENTONLY
if (sv.state)
SV_UnspawnServer();
#endif
CL_Disconnect ();
Alias_WipeStuffedAliaes();
}
@ -2945,6 +2953,8 @@ void Host_Init (quakeparms_t *parms)
host_initialized = true;
Cbuf_Execute (); //if the server initialisation causes a problem, give it a place to abort to
Cmd_StuffCmds();
Cbuf_Execute (); //if the server initialisation causes a problem, give it a place to abort to

View file

@ -2027,10 +2027,10 @@ void CL_ParseBaseline (entity_state_t *es)
es->angles[i] = MSG_ReadAngle ();
}
#ifdef PEXT_SCALE
es->scale = 1;
es->scale = 1*16;
#endif
#ifdef PEXT_TRANS
es->trans = 1;
es->trans = 255;
#endif
}
void CL_ParseBaseline2 (void)
@ -2114,12 +2114,12 @@ void CL_ParseStatic (int version)
ent->drawflags = es.hexen2flags;
#ifdef PEXT_SCALE
ent->scale = es.scale;
ent->scale = es.scale/16.0;
#endif
#ifdef PEXT_TRANS
ent->alpha = es.trans;
ent->alpha = es.trans/255.0;
#endif
ent->fatness = es.fatness;
ent->fatness = es.fatness/2.0;
ent->abslight = es.abslight;
VectorCopy (es.origin, ent->origin);
@ -3581,10 +3581,6 @@ void CL_ParseServerMessage (void)
SCR_ShowPic_Update();
break;
case svc_setattachment:
CL_ParseAttachment();
break;
case svcqw_effect:
CL_ParseEffect(false);
break;

View file

@ -1542,10 +1542,8 @@ void SCR_DrawCharToSnap (int num, qbyte *dest, int width)
while (drawline--)
{
for (x=0 ; x<8 ; x++)
if (source[x])
if (source[x]!=255)
dest[x] = source[x];
else
dest[x] = 98;
source += 128;
dest -= width;
}
@ -1645,8 +1643,8 @@ qboolean SCR_RSShot (void)
g /= count;
b /= count;
*dest++ = r;
*dest++ = b;
*dest++ = g;
*dest++ = b;
}
}

View file

@ -967,8 +967,7 @@ void CL_ParseTEnt (void)
// use a particle effect and let the user decide what to do with it?
break;
case 76:
#pragma message("CL_ParseTEnt: effect 76 not implemented")
case DPTE_TEI_G3: //nexuiz's nex beam
pos[0] = MSG_ReadCoord ();
pos[1] = MSG_ReadCoord ();
pos[2] = MSG_ReadCoord ();
@ -982,19 +981,19 @@ void CL_ParseTEnt (void)
MSG_ReadCoord ();
MSG_ReadCoord ();
CLQ2_RailTrail (pos, pos2);
P_ParticleTrail(pos, pos2, P_FindParticleType("te_nexbeam"), NULL);
break;
case DPTE_SMOKE:
//org
pos[0] = MSG_ReadCoord ();
pos[0] = MSG_ReadCoord ();
pos[0] = MSG_ReadCoord ();
pos[1] = MSG_ReadCoord ();
pos[2] = MSG_ReadCoord ();
//dir
pos2[0] = MSG_ReadCoord ();
pos2[0] = MSG_ReadCoord ();
pos2[0] = MSG_ReadCoord ();
pos2[1] = MSG_ReadCoord ();
pos2[2] = MSG_ReadCoord ();
//count
cnt = MSG_ReadByte ();
@ -1004,7 +1003,7 @@ void CL_ParseTEnt (void)
}
break;
case 79:
case DPTE_TEI_PLASMAHIT:
pos[0] = MSG_ReadCoord ();
pos[1] = MSG_ReadCoord ();
pos[2] = MSG_ReadCoord ();
@ -1240,12 +1239,27 @@ void CL_ParseParticleEffect4 (void)
P_RunParticleEffect4 (org, radius, color, effect, msgcount);
}
void CL_SpawnSpriteEffect(vec3_t org, model_t *model, int startframe, int framecount, int framerate)
{
explosion_t *ex;
ex = CL_AllocExplosion ();
VectorCopy (org, ex->origin);
ex->start = cl.time;
ex->model = model;
ex->firstframe = startframe;
ex->numframes = framecount;
ex->framerate = framerate;
ex->angles[0] = 0;
ex->angles[1] = 0;
ex->angles[2] = 0;
}
// [vector] org [byte] modelindex [byte] startframe [byte] framecount [byte] framerate
// [vector] org [short] modelindex [short] startframe [byte] framecount [byte] framerate
void CL_ParseEffect (qboolean effect2)
{
explosion_t *ex;
vec3_t org;
int modelindex;
int startframe;
@ -1270,17 +1284,7 @@ void CL_ParseEffect (qboolean effect2)
framerate = MSG_ReadByte();
ex = CL_AllocExplosion ();
VectorCopy (org, ex->origin);
ex->start = cl.time;
ex->model = cl.model_precache[modelindex];
ex->firstframe = startframe;
ex->numframes = framecount;
ex->framerate = framerate;
ex->angles[0] = 0;
ex->angles[1] = 0;
ex->angles[2] = 0;
CL_SpawnSpriteEffect(org, cl.model_precache[modelindex], startframe, framecount, framerate);
}
#ifdef Q2CLIENT

View file

@ -391,8 +391,6 @@ typedef struct {
vec3_t angles;
trailstate_t *trailstate; //when to next throw out a trail
unsigned short frame;
unsigned short tagent;
unsigned short tagindex;
} lerpents_t;
//
// the client_state_t structure is wiped completely at every
@ -713,7 +711,6 @@ void CL_StartUpload (qbyte *data, int size);
void CL_StopUpload(void);
void CL_RequestNextDownload (void);
void CL_ParseAttachment(void);
//
// view.c

File diff suppressed because it is too large Load diff

View file

@ -398,13 +398,13 @@ void PF_CL_drawpic (progfuncs_t *prinst, struct globalvars_s *pr_globals)
#ifdef RGLQUAKE
if (qrenderer == QR_OPENGL)
{
if (flag == 1)
if (flag == 1) //add
qglBlendFunc(GL_SRC_ALPHA, GL_ONE);
else if(flag == 2)
else if(flag == 2) //modulate
qglBlendFunc(GL_DST_COLOR, GL_ZERO);
else if(flag == 3)
else if(flag == 3) //modulate*2
qglBlendFunc(GL_DST_COLOR,GL_SRC_COLOR);
else
else //blend
qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
#endif

View file

@ -261,7 +261,8 @@ static part_type_t *P_GetParticleType(char *name)
int P_AllocateParticleType(char *name) //guarentees that the particle type exists, returning it's index.
{
return P_GetParticleType(name) - part_type;
part_type_t *pt = P_GetParticleType(name);
return pt - part_type;
}
int P_ParticleTypeForName(char *name)
@ -289,14 +290,16 @@ int P_FindParticleType(char *name) //checks if particle description 'name' exist
return -1;
}
qboolean P_DescriptionIsLoaded(char *name)
int P_DescriptionIsLoaded(char *name)
{
int i = P_FindParticleType(name);
part_type_t *ptype;
if (i < 0)
return false;
ptype = &part_type[i];
return ptype->loaded;
if (!ptype->loaded)
return false;
return i+1;
}
static void P_SetModified(void) //called when the particle system changes (from console).
@ -322,7 +325,7 @@ static int CheckAssosiation(char *name, int from)
{
if (to == from)
{
Con_Printf("Assosiation would cause infinate loop\n");
Con_Printf("Assosiation of %s would cause infinate loop\n", name);
return -1;
}
to = part_type[to].assoc;
@ -470,7 +473,11 @@ void P_ParticleEffect_f(void)
}
else if (!strcmp(var, "scale"))
{
ptype->scale = atof(value);
if (Cmd_Argc()>2)
ptype->randscale = atof(Cmd_Argv(2)) - ptype->scale;
}
else if (!strcmp(var, "scalerand"))
ptype->randscale = atof(value);
@ -2410,7 +2417,7 @@ int P_ParticleTrail (vec3_t startpos, vec3_t end, int type, trailstate_t **tsk)
float randvel = ptype->randomvel;
float step;
float stop;
float tdegree = 1/50; /* MSVC whine */
float tdegree = 2*M_PI/256; /* MSVC whine */
if (!ptype->loaded)
return 1;

View file

@ -267,7 +267,7 @@ char *particle_set_spikeset =
"r_part randomspark\n"
"{\n"
" count 1\n"
" texture \"\"\n"
" texture \"ball\"\n"
" red 255\n"
" green 128\n"
" blue 76\n"
@ -278,12 +278,13 @@ char *particle_set_spikeset =
" randomvel 128\n"
" veladd 0\n"
" cliptype randomspark\n"
" type texturedspark\n"
"}\n"
"r_part insaneshrapnal\n"
"{\n"
" count 24\n"
" texture \"\"\n"
" texture \"ball\"\n"
" red 255\n"
" green 128\n"
" blue 76\n"
@ -294,6 +295,7 @@ char *particle_set_spikeset =
" veladd 1\n"
" cliptype randomspark\n"
" clipcount 5\n"
" type texturedspark\n"
"}\n"
"r_part ember\n"

View file

@ -56,7 +56,8 @@ typedef struct entity_s
struct player_info_s *scoreboard; // identify player
float syncbase;
float frame1time;
float frame2time;
struct efrag_s *efrag; // linked list of efrags (FIXME)
int visframe; // last frame this entity was

View file

@ -1679,7 +1679,7 @@ void Cmd_ExecuteString (char *text, int level)
Cbuf_InsertText (a->value, level);
if (Cmd_FromGamecode())
if (level>=RESTRICT_SERVER)
return; //don't do the cmd_argc/cmd_argv stuff. When it's from the server, we had a tendancy to lock aliases, so don't set them anymore.
Cbuf_InsertText (va("set cmd_argc \"%i\"\n", cmd_argc), level);

View file

@ -460,6 +460,9 @@ float Q_atof (char *str)
int sign;
int c;
int decimal, total;
while(*str == ' ')
str++;
if (*str == '-')
{
@ -4229,7 +4232,7 @@ gamemode_info_t gamemode_info[] = {
{"Darkplaces-Quake", "darkplaces", "-quake", "id1/pak0.pak", "id1", "qw", "fte"},
{"Darkplaces-Hipnotic", "hipnotic", "-hipnotic", NULL/*"hipnotic/pak0.pak"*/,"id1", "qw", "hipnotic", "fte"},
{"Darkplaces-Rogue", "rogue", "-rogue", NULL/*"rogue/pak0.pak", "id1"*/, "qw", "rogue", "fte"},
{"Nexuiz", "nexuiz", "-nexuiz", "data/data.pk3", "id1", "qw", "data", "fte"},
{"Nexuiz", "nexuiz", "-nexuiz", "data/data20050531.pk3", "id1", "qw", "data", "fte"},
//supported commercial mods (some are currently only partially supported)
{"FTE-Hexen2", "hexen", "-hexen2", "data1/pak0.pak", "data1", "fte"},
@ -4274,7 +4277,7 @@ void COM_InitFilesystem (void)
for (i = 0; gamemode_info[i].gamename; i++)
{
if (!gamemode_info[i].auniquefile)
return;
continue; //no more
f = fopen(va("%s/%s", com_quakedir, gamemode_info[i].auniquefile), "rb");
if (f)
{

View file

@ -563,6 +563,7 @@ qboolean Cvar_Command (int level)
Con_Printf ("\"%s\" is \"%s\"\n", v->name, v->string);
if (v->latched_string)
Con_Printf ("Latched as \"%s\"\n", v->latched_string);
Con_Printf("Default: \"%s\"\n", v->defaultstr);
return true;
}

View file

@ -3261,8 +3261,8 @@ void CMQ3_CalcPHS (void)
continue;
// OR this pvs row into the phs
index = (j<<3) + k;
if (index >= numclusters)
Host_Error ("CM_CalcPHS: Bad bit in PVS"); // pad bits should be 0
// if (index >= numclusters)
// Host_Error ("CM_CalcPHS: Bad bit in PVS"); // pad bits should be 0
src = (unsigned *)((qbyte*)map_q3pvs->data) + index*rowwords;
for (l=0 ; l<rowwords ; l++)
dest[l] |= src[l];
@ -4483,6 +4483,7 @@ void CM_TestBoxInBrush (vec3_t mins, vec3_t maxs, vec3_t p1,
vec3_t ofs;
float d1;
q2cbrushside_t *side;
qboolean issky = false;
if (!brush->numsides)
return;
@ -4511,6 +4512,12 @@ void CM_TestBoxInBrush (vec3_t mins, vec3_t maxs, vec3_t p1,
d1 = DotProduct (p1, plane->normal) - dist;
if (side->surface->c.flags & 4)
{
issky = true;
d1 -= DIST_EPSILON*2;
}
// if completely in front of face, no intersection
if (d1 > 0)
return;
@ -4520,7 +4527,10 @@ void CM_TestBoxInBrush (vec3_t mins, vec3_t maxs, vec3_t p1,
// inside this brush
trace->startsolid = trace->allsolid = true;
trace->fraction = 0;
trace->contents = brush->contents;
if (issky)
trace->contents |= FTECONTENTS_SKY;
else
trace->contents |= brush->contents;
}
void CM_TestBoxInPatch (vec3_t mins, vec3_t maxs, vec3_t p1,

View file

@ -237,8 +237,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define svc_movepic 71
#define svc_updatepic 72
#define svc_setattachment 73
#define svcqw_effect 74 // [vector] org [byte] modelindex [byte] startframe [byte] framecount [byte] framerate
#define svcqw_effect2 75 // [vector] org [short] modelindex [short] startframe [byte] framecount [byte] framerate
@ -334,19 +332,15 @@ enum clcq2_ops_e
// bits 11..13 are player move type bits
#ifdef PEXT_SCALE
#define PF_SCALE_NOZ (1<<12)
#define PF_SCALE_Z (1<<16)
#endif
#ifdef PEXT_TRANS
#define PF_TRANS_NOZ (1<<13)
#define PF_TRANS_Z (1<<17)
#endif
#ifdef PEXT_FATNESS
#define PF_FATNESS_NOZ (1<<14)
#define PF_FATNESS_Z (1<<18)
#endif
#ifdef PEXT_HULLSIZE
#define PF_HULLSIZE_NOZ (1<<15)
#define PF_HULLSIZE_Z (1<<14)
#endif
@ -448,6 +442,9 @@ enum clcq2_ops_e
#endif
#define U_DPFLAGS (1<<11)
#define U_TAGINFO (1<<12)
#define U_FARMORE (1<<15)
#endif
@ -614,8 +611,10 @@ enum {
#define DPTE_CUSTOMFLASH 73
#define DPTE_FLAMEJET 74
#define DPTE_PLASMABURN 75
#define DPTE_TEI_G3 76
#define DPTE_SMOKE 77
#define DPTE_TEI_BIGEXPLOSION 78
#define DPTE_TEI_PLASMAHIT 79
#define TE_SEEF_BRIGHTFIELD 200
#define TE_SEEF_DARKLIGHT 201
@ -661,42 +660,38 @@ enum {
typedef struct entity_state_s
{
int number; // edict index
unsigned short number; // edict index
unsigned short modelindex;
int bitmask; // for dp ents, so lost state can be repeated in replacement packets.
int flags; // nolerp, etc
vec3_t origin;
vec3_t old_origin; //q2
vec3_t angles;
unsigned short modelindex;
unsigned short modelindex2; //q2
unsigned short modelindex3; //q2
unsigned short modelindex4; //q2
qbyte modelindex3; //q2
qbyte modelindex4; //q2
unsigned short frame;
unsigned short colormap;
unsigned short skinnum;
int effects;
int renderfx; //q2
int sound; //q2
int event; //q2
qbyte sound; //q2
qbyte event; //q2
qbyte glowsize;
qbyte glowcolour;
#ifdef PEXT_SCALE
float scale;
#endif
#ifdef PEXT_TRANS
float trans;
#endif
#ifdef PEXT_FATNESS
float fatness;
#endif
qbyte scale;
qbyte trans;
char fatness;
qbyte hexen2flags;
qbyte abslight;
qbyte dpflags;
qbyte solid;
qbyte glowsize;
qbyte glowcolour;
unsigned short tagentity;
unsigned short tagindex;
} entity_state_t;

View file

@ -422,7 +422,7 @@ static void R_GAliasAddDlights(mesh_t *mesh, vec3_t org, vec3_t angles)
}
}
static qboolean R_GAliasBuildMesh(mesh_t *mesh, galiasinfo_t *inf, int frame1, int frame2, float lerp, float alpha)
static qboolean R_GAliasBuildMesh(mesh_t *mesh, galiasinfo_t *inf, int frame1, int frame2, float lerp, float alpha, float fg1time, float fg2time)
{
galiasgroup_t *g1, *g2;
@ -509,7 +509,7 @@ static qboolean R_GAliasBuildMesh(mesh_t *mesh, galiasinfo_t *inf, int frame1, i
float *pose[4];
float mlerp; //minor lerp, poses within a group.
mlerp = (cl.time-cl.lerpents[currententity->keynum].lerptime)*g1->rate;
mlerp = (fg1time)*g1->rate;
frame1=mlerp;
frame2=frame1+1;
mlerp-=frame1;
@ -523,19 +523,22 @@ static qboolean R_GAliasBuildMesh(mesh_t *mesh, galiasinfo_t *inf, int frame1, i
if (plerp[l]>0)
pose[l++] = (float *)((char *)g1 + g1->poseofs + sizeof(float)*inf->numbones*12*frame2);
mlerp = (cl.time-cl.lerpents[currententity->keynum].lerptime)*g2->rate;
frame1=mlerp;
frame2=frame1+1;
mlerp-=frame1;
frame1=frame1%g2->numposes;
frame2=frame2%g2->numposes;
if (lerp)
{
mlerp = (fg2time)*g2->rate;
frame1=mlerp;
frame2=frame1+1;
mlerp-=frame1;
frame1=frame1%g2->numposes;
frame2=frame2%g2->numposes;
plerp[l] = (1-mlerp)*(lerp);
if (plerp[l]>0)
pose[l++] = (float *)((char *)g2 + g2->poseofs + sizeof(float)*inf->numbones*12*frame1);
plerp[l] = (mlerp)*(lerp);
if (plerp[l]>0)
pose[l++] = (float *)((char *)g2 + g2->poseofs + sizeof(float)*inf->numbones*12*frame2);
plerp[l] = (1-mlerp)*(lerp);
if (plerp[l]>0)
pose[l++] = (float *)((char *)g2 + g2->poseofs + sizeof(float)*inf->numbones*12*frame1);
plerp[l] = (mlerp)*(lerp);
if (plerp[l]>0)
pose[l++] = (float *)((char *)g2 + g2->poseofs + sizeof(float)*inf->numbones*12*frame2);
}
/*
pose[0] = (float *)((char *)g1 + g1->poseofs);
plerp[0] = 1;
@ -551,7 +554,7 @@ static qboolean R_GAliasBuildMesh(mesh_t *mesh, galiasinfo_t *inf, int frame1, i
if (g1 == g2) //lerping within group is only done if not changing group
{
lerp = cl.time*g1->rate;
lerp = fg1time*g1->rate;
frame1=lerp;
frame2=frame1+1;
lerp-=frame1;
@ -1480,7 +1483,7 @@ void R_DrawGAliasModel (entity_t *e)
memset(&mesh, 0, sizeof(mesh));
for(; inf; ((inf->nextsurf)?(inf = (galiasinfo_t*)((char *)inf + inf->nextsurf)):(inf=NULL)))
{
if (R_GAliasBuildMesh(&mesh, inf, e->frame, e->oldframe, e->lerpfrac, e->alpha) && r_vertexdlights.value)
if (R_GAliasBuildMesh(&mesh, inf, e->frame, e->oldframe, e->lerpfrac, e->alpha, e->frame1time, e->frame2time) && r_vertexdlights.value)
if (mesh.colors_array)
R_GAliasAddDlights(&mesh, e->origin, e->angles);
@ -1799,7 +1802,7 @@ void R_DrawGAliasShadowVolume(entity_t *e, vec3_t lightpos, float radius)
{
if (inf->ofs_trineighbours)
{
R_GAliasBuildMesh(&mesh, inf, e->frame, e->oldframe, e->lerpfrac, e->alpha);
R_GAliasBuildMesh(&mesh, inf, e->frame, e->oldframe, e->lerpfrac, e->alpha, e->frame1time, e->frame2time);
R_CalcFacing(&mesh, lightorg);
R_ProjectShadowVolume(&mesh, lightorg);
R_DrawShadowVolume(&mesh);
@ -2863,6 +2866,7 @@ qboolean GLMod_GetTag(model_t *model, int tagnum, int frame1, int frame2, float
g1 = (galiasgroup_t*)((char *)inf + inf->groupofs + sizeof(galiasgroup_t)*frame1);
g2 = (galiasgroup_t*)((char *)inf + inf->groupofs + sizeof(galiasgroup_t)*frame2);
f1time *= g1->rate;
frame1 = (int)f1time%g1->numposes;
frame2 = ((int)f1time+1)%g1->numposes;
f1time = f1time - (int)f1time;
@ -2877,6 +2881,7 @@ qboolean GLMod_GetTag(model_t *model, int tagnum, int frame1, int frame2, float
}
if (f2ness)
{
f2time *= g2->rate;
frame1 = (int)f2time%g2->numposes;
frame2 = ((int)f2time+1)%g2->numposes;
f2time = f2time - (int)f2time;

View file

@ -881,9 +881,9 @@ void R_DeformVertices ( meshbuffer_t *mb )
VectorNormalizeFast ( m0[2] );
VectorVectors ( m0[2], m0[1], m0[0] );
VectorCopy ( (&r_world_matrix[0]), m1[0] );
VectorCopy ( (&r_world_matrix[4]), m1[1] );
VectorCopy ( (&r_world_matrix[8]), m1[2] );
VectorCopy ( (&r_view_matrix[0]), m1[0] );
VectorCopy ( (&r_view_matrix[4]), m1[1] );
VectorCopy ( (&r_view_matrix[8]), m1[2] );
Matrix3_Multiply ( m1, m0, result );

View file

@ -1545,7 +1545,7 @@ void PPL_BaseTextures(model_t *model)
}
}
}
if (!r_inmirror && mirrortexturenum>=0 && model == cl.worldmodel && r_mirroralpha.value != 1.0)
if (mirrortexturenum>=0 && model == cl.worldmodel && r_mirroralpha.value != 1.0)
{
t = model->textures[mirrortexturenum];
if (t)
@ -1554,7 +1554,8 @@ void PPL_BaseTextures(model_t *model)
if (s)
{
t->texturechain = NULL;
R_MirrorChain (s);
if (!r_inmirror)
R_MirrorChain (s);
}
}
}
@ -1749,21 +1750,10 @@ void PPL_BaseEntTextures(void)
{
if (currententity->flags & Q2RF_EXTERNALMODEL)
continue;
j = currententity->keynum;
while(j)
{
if (j == (cl.viewentity[r_refdef.currentplayernum]?cl.viewentity[r_refdef.currentplayernum]:(cl.playernum[r_refdef.currentplayernum]+1)))
break;
j = cl.lerpents[j].tagent;
}
if (j)
continue;
if (cl.viewentity[r_refdef.currentplayernum] && currententity->keynum == cl.viewentity[r_refdef.currentplayernum])
if (currententity->keynum == (cl.viewentity[r_refdef.currentplayernum]?cl.viewentity[r_refdef.currentplayernum]:(cl.playernum[r_refdef.currentplayernum]+1)))
continue;
// if (cl.viewentity[r_refdef.currentplayernum] && currententity->keynum == cl.viewentity[r_refdef.currentplayernum])
// continue;
if (!Cam_DrawPlayer(0, currententity->keynum-1))
continue;
}
@ -2481,20 +2471,10 @@ void PPL_DrawEntLighting(dlight_t *light, vec3_t colour)
}
else
{
j = currententity->keynum;
while(j)
{
if (j == (cl.viewentity[r_refdef.currentplayernum]?cl.viewentity[r_refdef.currentplayernum]:(cl.playernum[r_refdef.currentplayernum]+1)))
break;
j = cl.lerpents[j].tagent;
}
if (j)
continue;
if (cl.viewentity[r_refdef.currentplayernum] && currententity->keynum == cl.viewentity[r_refdef.currentplayernum])
if (currententity->keynum == (cl.viewentity[r_refdef.currentplayernum]?cl.viewentity[r_refdef.currentplayernum]:(cl.playernum[r_refdef.currentplayernum]+1)))
continue;
// if (cl.viewentity[r_refdef.currentplayernum] && currententity->keynum == cl.viewentity[r_refdef.currentplayernum])
// continue;
if (!Cam_DrawPlayer(0, currententity->keynum-1))
continue;
}

View file

@ -78,8 +78,8 @@ vec3_t vpn;
vec3_t vright;
vec3_t r_origin;
float r_world_matrix[16];
float r_base_world_matrix[16];
float r_projection_matrix[16];
float r_view_matrix[16];
//
// screen size info
@ -416,7 +416,7 @@ mspriteframe_t *R_GetSpriteFrame (entity_t *currententity)
if ((frame >= psprite->numframes) || (frame < 0))
{
Con_Printf ("R_DrawSprite: no such frame %d (%s)\n", frame, currententity->model->name);
Con_DPrintf ("R_DrawSprite: no such frame %d (%s)\n", frame, currententity->model->name);
frame = 0;
}
@ -436,7 +436,7 @@ mspriteframe_t *R_GetSpriteFrame (entity_t *currententity)
numframes = pspritegroup->numframes;
fullinterval = pintervals[numframes-1];
time = cl.time + currententity->syncbase;
time = currententity->frame1time;
// when loading in Mod_LoadSpriteGroup, we guaranteed all interval values
// are positive, so we don't have to worry about division by 0
@ -758,20 +758,10 @@ void GLR_DrawEntitiesOnList (void)
}
else
{
j = currententity->keynum;
while(j)
{
if (j == (cl.viewentity[r_refdef.currentplayernum]?cl.viewentity[r_refdef.currentplayernum]:(cl.playernum[r_refdef.currentplayernum]+1)))
break;
j = cl.lerpents[j].tagent;
}
if (j)
continue;
if (cl.viewentity[r_refdef.currentplayernum] && currententity->keynum == cl.viewentity[r_refdef.currentplayernum])
if (currententity->keynum == (cl.viewentity[r_refdef.currentplayernum]?cl.viewentity[r_refdef.currentplayernum]:(cl.playernum[r_refdef.currentplayernum]+1)))
continue;
// if (cl.viewentity[r_refdef.currentplayernum] && currententity->keynum == cl.viewentity[r_refdef.currentplayernum])
// continue;
if (!Cam_DrawPlayer(0, currententity->keynum-1))
continue;
}
@ -842,20 +832,10 @@ void GLR_DrawEntitiesOnList (void)
}
else
{
j = currententity->keynum;
while(j)
{
if (j == (cl.viewentity[r_refdef.currentplayernum]?cl.viewentity[r_refdef.currentplayernum]:(cl.playernum[r_refdef.currentplayernum]+1)))
break;
j = cl.lerpents[j].tagent;
}
if (j)
continue;
if (cl.viewentity[r_refdef.currentplayernum] && currententity->keynum == cl.viewentity[r_refdef.currentplayernum])
if (currententity->keynum == (cl.viewentity[r_refdef.currentplayernum]?cl.viewentity[r_refdef.currentplayernum]:(cl.playernum[r_refdef.currentplayernum]+1)))
continue;
// if (cl.viewentity[r_refdef.currentplayernum] && currententity->keynum == cl.viewentity[r_refdef.currentplayernum])
// continue;
if (!Cam_DrawPlayer(0, currententity->keynum-1))
continue;
}
@ -1125,8 +1105,46 @@ int SignbitsForPlane (mplane_t *out)
}
return bits;
}
#if 1
void R_SetFrustum (void)
{
float scale;
int i;
float mvp[16];
if ((int)r_novis.value & 4)
return;
Matrix4_Multiply(r_projection_matrix, r_view_matrix, mvp);
for (i = 0; i < 4; i++)
{
if (i & 1)
{
frustum[i].normal[0] = mvp[3] + mvp[0+i/2];
frustum[i].normal[1] = mvp[7] + mvp[4+i/2];
frustum[i].normal[2] = mvp[11] + mvp[8+i/2];
frustum[i].dist = mvp[15] + mvp[12+i/2];
}
else
{
frustum[i].normal[0] = mvp[3] - mvp[0+i/2];
frustum[i].normal[1] = mvp[7] - mvp[4+i/2];
frustum[i].normal[2] = mvp[11] - mvp[8+i/2];
frustum[i].dist = mvp[15] - mvp[12+i/2];
}
scale = 1/sqrt(DotProduct(frustum[i].normal, frustum[i].normal));
frustum[i].normal[0] *= scale;
frustum[i].normal[1] *= scale;
frustum[i].normal[2] *= scale;
frustum[i].dist *= -scale;
frustum[i].type = PLANE_ANYZ;
frustum[i].signbits = SignbitsForPlane (&frustum[i]);
}
}
#else
void R_SetFrustum (void)
{
int i;
@ -1166,7 +1184,7 @@ void R_SetFrustum (void)
frustum[i].signbits = SignbitsForPlane (&frustum[i]);
}
}
#endif
/*
===============
R_SetupFrame
@ -1179,15 +1197,18 @@ void GLR_SetupFrame (void)
if (!cls.allow_watervis)
r_wateralphaval = 1;
GLR_AnimateLight ();
if (!mirror)
{
GLR_AnimateLight ();
r_framecount++;
// build the transformation matrix for the given view angles
// build the transformation matrix for the given view angles
AngleVectors (r_refdef.viewangles, vpn, vright, vup);
r_framecount++;
}
VectorCopy (r_refdef.vieworg, r_origin);
AngleVectors (r_refdef.viewangles, vpn, vright, vup);
// current viewleaf
if (r_refdef.flags & 1)
{
@ -1284,10 +1305,6 @@ void GLR_SetupFrame (void)
void MYgluPerspective( GLdouble fovy, GLdouble aspect,
GLdouble zNear, GLdouble zFar )
{
#if 1 //for the sake of the d3d...
#else
GLfloat matrix[16];
#endif
GLdouble xmin, xmax, ymin, ymax;
ymax = zNear * tan( fovy * M_PI / 360.0 );
@ -1296,39 +1313,30 @@ void MYgluPerspective( GLdouble fovy, GLdouble aspect,
xmin = ymin * aspect;
xmax = ymax * aspect;
#if 1 //for the sake of the d3d...
qglFrustum( xmin, xmax, ymin, ymax, zNear, zFar );
#else
r_projection_matrix[0] = (2*zNear) / (xmax - xmin);
r_projection_matrix[4] = 0;
r_projection_matrix[8] = (xmax + xmin) / (xmax - xmin);
r_projection_matrix[12] = 0;
matrix[0] = (2*zNear) / (xmax - xmin);
matrix[4] = 0;
matrix[8] = (xmax + xmin) / (xmax - xmin);
matrix[12] = 0;
r_projection_matrix[1] = 0;
r_projection_matrix[5] = (2*zNear) / (ymax - ymin);
r_projection_matrix[9] = (ymax + ymin) / (ymax - ymin);
r_projection_matrix[13] = 0;
matrix[1] = 0;
matrix[5] = (2*zNear) / (ymax - ymin);
matrix[9] = (ymax + ymin) / (ymax - ymin);
matrix[13] = 0;
matrix[2] = 0;
matrix[6] = 0;
matrix[10] = - (zFar+zNear)/(zFar-zNear);
matrix[14] = - (2.0f*zFar*zNear)/(zFar-zNear);
r_projection_matrix[2] = 0;
r_projection_matrix[6] = 0;
r_projection_matrix[10] = - (zFar+zNear)/(zFar-zNear);
r_projection_matrix[14] = - (2.0f*zFar*zNear)/(zFar-zNear);
matrix[3] = 0;
matrix[7] = 0;
matrix[11] = -1;
matrix[15] = 0;
qglMultMatrixf(matrix);
#endif
r_projection_matrix[3] = 0;
r_projection_matrix[7] = 0;
r_projection_matrix[11] = -1;
r_projection_matrix[15] = 0;
}
void GL_InfinatePerspective( GLdouble fovy, GLdouble aspect,
GLdouble zNear)
{
GLfloat matrix[16];
// nudge infinity in just slightly for lsb slop
GLfloat nudge = 1;// - 1.0 / (1<<23);
@ -1340,27 +1348,25 @@ void GL_InfinatePerspective( GLdouble fovy, GLdouble aspect,
xmin = ymin * aspect;
xmax = ymax * aspect;
matrix[0] = (2*zNear) / (xmax - xmin);
matrix[4] = 0;
matrix[8] = (xmax + xmin) / (xmax - xmin);
matrix[12] = 0;
r_projection_matrix[0] = (2*zNear) / (xmax - xmin);
r_projection_matrix[4] = 0;
r_projection_matrix[8] = (xmax + xmin) / (xmax - xmin);
r_projection_matrix[12] = 0;
matrix[1] = 0;
matrix[5] = (2*zNear) / (ymax - ymin);
matrix[9] = (ymax + ymin) / (ymax - ymin);
matrix[13] = 0;
r_projection_matrix[1] = 0;
r_projection_matrix[5] = (2*zNear) / (ymax - ymin);
r_projection_matrix[9] = (ymax + ymin) / (ymax - ymin);
r_projection_matrix[13] = 0;
matrix[2] = 0;
matrix[6] = 0;
matrix[10] = -1 * nudge;
matrix[14] = -2*zNear * nudge;
r_projection_matrix[2] = 0;
r_projection_matrix[6] = 0;
r_projection_matrix[10] = -1 * nudge;
r_projection_matrix[14] = -2*zNear * nudge;
matrix[3] = 0;
matrix[7] = 0;
matrix[11] = -1;
matrix[15] = 0;
qglMultMatrixf(matrix);
r_projection_matrix[3] = 0;
r_projection_matrix[7] = 0;
r_projection_matrix[11] = -1;
r_projection_matrix[15] = 0;
}
@ -1404,10 +1410,9 @@ void R_SetupGL (void)
qglViewport (glx + x, gly + y2, w, h);
qglMatrixMode(GL_PROJECTION);
qglLoadIdentity ();
screenaspect = (float)r_refdef.vrect.width/r_refdef.vrect.height;
if ((!r_shadows.value || !gl_canstencil) && gl_maxdist.value>0)//gl_nv_range_clamp)
if ((!r_shadows.value || !gl_canstencil) && gl_maxdist.value>256)//gl_nv_range_clamp)
{
// yfov = 2*atan((float)r_refdef.vrect.height/r_refdef.vrect.width)*180/M_PI;
// yfov = (2.0 * tan (scr_fov.value/360*M_PI)) / screenaspect;
@ -1419,13 +1424,14 @@ void R_SetupGL (void)
{
GL_InfinatePerspective(r_refdef.fov_y, screenaspect, 4);
}
qglLoadMatrixf(r_projection_matrix);
if (mirror)
{
if (mirror_plane->normal[2])
qglScalef (1, -1, 1);
else
qglScalef (-1, 1, 1);
// if (mirror_plane->normal[2])
// qglScalef (1, -1, 1);
// else
// qglScalef (-1, 1, 1);
qglCullFace(GL_BACK);
}
else
@ -1444,8 +1450,8 @@ void R_SetupGL (void)
qglMatrixMode(GL_MODELVIEW);
ML_ModelViewMatrixFromAxis(r_world_matrix, vpn, vright, vup, r_refdef.vieworg);
qglLoadMatrixf(r_world_matrix);
ML_ModelViewMatrixFromAxis(r_view_matrix, vpn, vright, vup, r_refdef.vieworg);
qglLoadMatrixf(r_view_matrix);
//
@ -1505,15 +1511,14 @@ void R_RenderScene (void)
if (!cl.worldmodel)
r_refdef.flags |= Q2RDF_NOWORLDMODEL;
if (!mirror)
GLR_SetupFrame ();
TRACE(("dbg: calling R_SetFrustrum\n"));
R_SetFrustum ();
TRACE(("dbg: calling R_SetupGL\n"));
R_SetupGL ();
TRACE(("dbg: calling R_SetFrustrum\n"));
R_SetFrustum ();
if (!(r_refdef.flags & 1))
{
#ifdef DOOMWADS
@ -1732,6 +1737,7 @@ void R_Mirror (void)
mplane_t *mirror_plane;
vec3_t oldangles, oldorg, oldvpn, oldvright, oldvup; //cache - for rear view mirror and stuff.
float base_view_matrix[16];
if (!mirror)
{
@ -1746,92 +1752,181 @@ void R_Mirror (void)
memcpy(oldvpn, vpn, sizeof(vec3_t));
memcpy(oldvright, vright, sizeof(vec3_t));
memcpy(oldvup, vup, sizeof(vec3_t));
memcpy (r_base_world_matrix, r_world_matrix, sizeof(r_base_world_matrix));
memcpy (base_view_matrix, r_view_matrix, sizeof(base_view_matrix));
s = r_mirror_chain;
while(s) //okay, so this is a hack
{
s->nextalphasurface = s->texturechain;
s = s->nextalphasurface;
}
cl.worldmodel->textures[mirrortexturenum]->texturechain = NULL;
while(r_mirror_chain)
{
s = r_mirror_chain;
r_mirror_chain = r_mirror_chain->texturechain;
r_mirror_chain = r_mirror_chain->nextalphasurface;
#if 0
s->nextalphasurface = NULL;
#else
//this loop figures out all surfaces with the same plane.
//yes, this can mean that the list is reversed a few times, but we do have depth testing to solve that anyway.
for(prevs = s,prevr=NULL,rejects=NULL;r_mirror_chain;r_mirror_chain=r_mirror_chain->texturechain)
for(prevs = s,prevr=NULL,rejects=NULL;r_mirror_chain;r_mirror_chain=r_mirror_chain->nextalphasurface)
{
if (s->plane->dist != r_mirror_chain->plane->dist || s->plane->signbits != r_mirror_chain->plane->signbits
|| s->plane->normal[0] != r_mirror_chain->plane->normal[0] || s->plane->normal[1] != r_mirror_chain->plane->normal[1] || s->plane->normal[2] != r_mirror_chain->plane->normal[2])
{ //reject
if (prevr)
prevr->texturechain = r_mirror_chain;
prevr->nextalphasurface = r_mirror_chain;
else
rejects = r_mirror_chain;
prevr = r_mirror_chain;
}
else
{ //matches
prevs->texturechain = r_mirror_chain;
prevs->nextalphasurface = r_mirror_chain;
prevs = r_mirror_chain;
}
}
prevs->texturechain = NULL;
prevs->nextalphasurface = NULL;
if (prevr)
prevr->texturechain = NULL;
prevr->nextalphasurface = NULL;
r_mirror_chain = rejects;
#endif
mirror_plane = s->plane;
//enable stencil writing
qglClearStencil(0);
qglClear(GL_STENCIL_BUFFER_BIT);
qglDisable(GL_ALPHA_TEST);
qglDisable(GL_STENCIL_TEST);
qglEnable(GL_STENCIL_TEST);
qglStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); //replace where it passes
qglStencilFunc( GL_ALWAYS, 1, ~0 ); //always pass (where z passes set to 1)
qglColorMask( GL_FALSE, GL_TRUE, GL_FALSE, GL_FALSE );
qglDisable(GL_TEXTURE_2D);
qglColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE );
qglDepthMask( GL_FALSE );
qglEnableClientState( GL_VERTEX_ARRAY );
for (prevs = s; s; s=s->texturechain) //write the polys to the stencil buffer.
for (prevs = s; s; s=s->nextalphasurface) //write the polys to the stencil buffer.
{
qglVertexPointer(3, GL_FLOAT, 0, s->mesh->xyz_array);
qglDrawElements(GL_TRIANGLES, s->mesh->numindexes, GL_UNSIGNED_INT, s->mesh->indexes);
}
qglColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
qglDepthMask( GL_TRUE );
qglStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
qglStencilFunc( GL_EQUAL, 1, ~0 ); //pass if equal to 1
//now clear the depth buffer where the stencil passed
//we achieve this by changing the projection matrix underneath.
//the stencil only shows where the final surface will appear, and only where not obscured
//we rewrite the depth with the blending pass after.
qglEnable(GL_DEPTH_TEST); //use only the stencil test
qglDepthRange(1, 1);
qglDepthFunc (GL_ALWAYS);
qglDepthMask( GL_TRUE );
qglColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE );
// oldvisents = cl_numvisedicts;
// R_MirrorAddPlayerModels(); //we need to add the player model. Invisible in mirror otherwise.
qglMatrixMode(GL_PROJECTION);
qglLoadIdentity();
qglOrtho (0, 1, 1, 0, -99999, 99999);
qglMatrixMode(GL_MODELVIEW);
qglLoadIdentity ();
d = DotProduct (oldorg, mirror_plane->normal) - mirror_plane->dist;
VectorMA (oldorg, -2*d, mirror_plane->normal, r_refdef.vieworg);
memcpy(r_origin, r_refdef.vieworg, sizeof(vec3_t));
qglBegin(GL_QUADS);
qglVertex3f(0, 0, -99999);
qglVertex3f(1, 0, -99999);
qglVertex3f(1, 1, -99999);
qglVertex3f(0, 1, -99999);
qglEnd();
d = DotProduct (oldvpn, mirror_plane->normal);
VectorMA (oldvpn, -2*d, mirror_plane->normal, vpn);
d = DotProduct (oldvright, mirror_plane->normal);
VectorMA (oldvright, -2*d, mirror_plane->normal, vright);
d = DotProduct (oldvup, mirror_plane->normal);
VectorMA (oldvup, -2*d, mirror_plane->normal, vup);
r_refdef.viewangles[0] = -asin (vpn[2])/M_PI*180;
r_refdef.viewangles[1] = atan2 (vpn[1], vpn[0])/M_PI*180;
r_refdef.viewangles[2] = -oldangles[2];
vpn[0]*=0.001;
vpn[1]*=0.001;
vpn[2]*=0.001;
qglEnable(GL_DEPTH_TEST); //use only the stencil test
qglColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
/*
r_refdef.vieworg[0] = 400;
r_refdef.vieworg[1] = 575;
r_refdef.vieworg[2] = 64;
Thus the final mirror matrix for any given plane p*<nx,ny,nz>+k=0 is:
| 1-2*nx*nx -2*nx*ny -2*nx*nz -2*nx*k |
| -2*ny*nx 1-2*ny*ny -2*ny*nz -2*ny*k |
| -2*nz*nx -2*nz*ny 1-2*nz*nz -2*nz*k |
| 0 0 0 1 |
*/
AngleVectors (r_refdef.viewangles, vpn, vright, vup);
{
float mirror[16];
float view[16];
float result[16];
float nx = mirror_plane->normal[0];
float ny = mirror_plane->normal[1];
float nz = mirror_plane->normal[2];
float k = -mirror_plane->dist;
mirror[0] = 1-2*nx*nx;
mirror[1] = -2*nx*ny;
mirror[2] = -2*nx*nz;
mirror[3] = 0;
mirror[4] = -2*ny*nx;
mirror[5] = 1-2*ny*ny;
mirror[6] = -2*ny*nz;
mirror[7] = 0;
mirror[8] = -2*nz*nx;
mirror[9] = -2*nz*ny;
mirror[10] = 1-2*nz*nz;
mirror[11] = 0;
mirror[12] = -2*nx*k;
mirror[13] = -2*ny*k;
mirror[14] = -2*nz*k;
mirror[15] = 1;
view[0] = oldvpn[0];
view[1] = oldvpn[1];
view[2] = oldvpn[2];
view[3] = 0;
view[4] = -oldvright[0];
view[5] = -oldvright[1];
view[6] = -oldvright[2];
view[7] = 0;
view[8] = oldvup[0];
view[9] = oldvup[1];
view[10] = oldvup[2];
view[11] = 0;
view[12] = oldorg[0];
view[13] = oldorg[1];
view[14] = oldorg[2];
view[15] = 1;
Matrix4_Multiply(mirror, view, result);
vpn[0] = result[0];
vpn[1] = result[1];
vpn[2] = result[2];
vright[0] = -result[4];
vright[1] = -result[5];
vright[2] = -result[6];
vup[0] = result[8];
vup[1] = result[9];
vup[2] = result[10];
r_refdef.vieworg[0] = result[12];
r_refdef.vieworg[1] = result[13];
r_refdef.vieworg[2] = result[14];
}
r_refdef.viewangles[0] = 0;
r_refdef.viewangles[1] = 0;
r_refdef.viewangles[2] = 0;
gldepthmin = 0.5;
@ -1841,7 +1936,7 @@ void R_Mirror (void)
R_RenderScene ();
GLR_DrawWaterSurfaces ();
// GLR_DrawWaterSurfaces ();
gldepthmin = 0;
@ -1853,36 +1948,32 @@ void R_Mirror (void)
memcpy(r_refdef.viewangles, oldangles, sizeof(vec3_t));
memcpy(r_refdef.vieworg, oldorg, sizeof(vec3_t));
qglMatrixMode(GL_PROJECTION);
if (mirror_plane->normal[2])
qglScalef (1,-1,1);
else
qglScalef (-1,1,1);
qglCullFace(GL_FRONT);
qglMatrixMode(GL_MODELVIEW);
qglLoadMatrixf (r_base_world_matrix);
qglLoadMatrixf (base_view_matrix);
qglDisable(GL_STENCIL_TEST);
// blend on top
qglDisable(GL_ALPHA_TEST);
qglEnable (GL_BLEND);
qglEnable(GL_TEXTURE_2D);
qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
qglColor4f (1,1,1,r_mirroralpha.value);
for ( ; s ; s=s->texturechain)
qglDisable(GL_STENCIL_TEST);
qglPolygonOffset(1, 0);
qglEnable(GL_POLYGON_OFFSET_FILL);
for (s=prevs ; s ; s=s->nextalphasurface)
{
qglEnable (GL_BLEND);
R_RenderBrushPoly (s);
}
cl.worldmodel->textures[mirrortexturenum]->texturechain = NULL;
qglDisable(GL_POLYGON_OFFSET_FILL);
qglPolygonOffset(0, 0);
qglEnable(GL_TEXTURE_2D);
qglDisable (GL_BLEND);
qglColor4f (1,1,1,1);
//put things back for rear views
qglCullFace(GL_BACK);
// cl_numvisedicts = oldvisents;
}
qglDisable(GL_STENCIL_TEST);
@ -2016,8 +2107,8 @@ void GLR_RenderView (void)
// render normal view
R_RenderScene ();
GLR_DrawViewModel ();
GLR_DrawWaterSurfaces ();
GLR_DrawAlphaSurfaces ();
// GLR_DrawWaterSurfaces ();
// GLR_DrawAlphaSurfaces ();
// render mirror view
R_Mirror ();

View file

@ -1746,40 +1746,6 @@ void GL_EnableMultitexture(void)
}
}
/*
================
DrawGLWaterPoly
Warp the vertex coordinates
================
*/
static void DrawGLWaterPoly (mesh_t *p)
{
Sys_Error("DrawGLWaterPoly needs work");
/*
int i;
float *v;
vec3_t nv;
GL_DisableMultitexture();
qglBegin (GL_TRIANGLE_FAN);
v = p->verts[0];
for (i=0 ; i<p->numverts ; i++, v+= VERTEXSIZE)
{
qglTexCoord2f (v[3], v[4]);
nv[0] = v[0] + 8*sin(v[1]*0.05+realtime)*sin(v[2]*0.05+realtime);
nv[1] = v[1] + 8*sin(v[0]*0.05+realtime)*sin(v[2]*0.05+realtime);
nv[2] = v[2];
qglVertex3fv (nv);
}
qglEnd ();
*/
}
/*
================
DrawGLPoly
@ -1788,8 +1754,14 @@ DrawGLPoly
static void DrawGLPoly (mesh_t *mesh)
{
// GL_DrawAliasMesh
#ifdef Q3SHADERS
R_UnlockArrays();
#endif
qglVertexPointer(3, GL_FLOAT, 0, mesh->xyz_array);
qglEnableClientState( GL_VERTEX_ARRAY );
qglEnableClientState( GL_TEXTURE_COORD_ARRAY );
qglTexCoordPointer(2, GL_FLOAT, 0, mesh->st_array);
qglDrawElements(GL_TRIANGLES, mesh->numindexes, GL_UNSIGNED_INT, mesh->indexes);
R_IBrokeTheArrays();
@ -1938,13 +1910,7 @@ void R_RenderBrushPoly (msurface_t *fa)
return;
}
//moved so lightmap is made first.
if (((r_viewleaf->contents==Q1CONTENTS_EMPTY && (fa->flags & SURF_UNDERWATER)) ||
(r_viewleaf->contents!=Q1CONTENTS_EMPTY && !(fa->flags & SURF_UNDERWATER)))
&& !(fa->flags & SURF_DONTWARP))
DrawGLWaterPoly (fa->mesh);
else
DrawGLPoly (fa->mesh);
DrawGLPoly (fa->mesh);
}
/*
@ -2090,7 +2056,7 @@ void GLR_DrawWaterSurfaces (void)
// go back to the world matrix
//
qglLoadMatrixf (r_world_matrix);
qglLoadMatrixf (r_view_matrix);
if (r_wateralphaval < 1.0) {
qglEnable (GL_BLEND);
@ -2232,7 +2198,7 @@ void GLR_DrawAlphaSurfaces (void)
// go back to the world matrix
//
qglLoadMatrixf (r_world_matrix);
qglLoadMatrixf (r_view_matrix);
GL_TexEnv(GL_MODULATE);
qglEnable(GL_ALPHA_TEST);
@ -2932,14 +2898,14 @@ start:
R_RenderDynamicLightmaps (surf);
// if sorting by texture, just store it out
if (surf->flags & SURF_DRAWALPHA)
/* if (surf->flags & SURF_DRAWALPHA)
{ // add to the translucent chain
surf->nextalphasurface = r_alpha_surfaces;
r_alpha_surfaces = surf;
surf->ownerent = &r_worldentity;
}
else
{
*/ {
surf->texturechain = surf->texinfo->texture->texturechain;
surf->texinfo->texture->texturechain = surf;
}

View file

@ -207,7 +207,8 @@ extern int mirrortexturenum; // quake texturenum, not gltexturenum
extern qboolean mirror;
extern mplane_t *mirror_plane;
extern float r_world_matrix[16];
extern float r_projection_matrix[16];
extern float r_view_matrix[16];
extern const char *gl_vendor;
extern const char *gl_renderer;

View file

@ -229,7 +229,7 @@ void IWeb_GenerateIndexFile (char *parms, char *content, int contentlength)
IWeb_Generate(hostname.string);
IWeb_Generate("</H1>");
IWeb_Generate("<A HREF=\"http://fte.quakesrc.org\">Server website</A><P>");
IWeb_Generate("<A HREF=\""ENGINEWEBSITE"\">Engine website</A><P>");
if (Rank_OpenRankings())
IWeb_Generate("<A HREF=\"allplayers.html\">Click here to see ranked players.</A><P>");

View file

@ -573,7 +573,7 @@ char *PR_UglyValueString (progfuncs_t *progfuncs, etype_t type, eval_t *val)
static char line[256];
fdef_t *fielddef;
dfunction_t *f;
int i;
int i, j;
#ifdef DEF_SAVEGLOBAL
type &= ~DEF_SAVEGLOBAL;
@ -591,19 +591,28 @@ char *PR_UglyValueString (progfuncs_t *progfuncs, etype_t type, eval_t *val)
sprintf (line, "unions cannot yet be saved");
break;
case ev_string:
_snprintf (line, sizeof(line), "%s", val->string+progfuncs->stringtable);
if ((unsigned)val->_int > (unsigned)addressableused)
_snprintf (line, sizeof(line), "CORRUPT STRING");
else
_snprintf (line, sizeof(line), "%s", val->string+progfuncs->stringtable);
break;
case ev_entity:
sprintf (line, "%i", val->_int);
break;
case ev_function:
i = (val->function & 0xff000000)>>24;
if (i > maxprogs)
i = (val->function & 0xff000000)>>24; //progs number
if (i > maxprogs || !pr_progstate[i].progs)
sprintf (line, "BAD FUNCTION INDEX: %i", val->function);
else
{
f = pr_progstate[(val->function & 0xff000000)>>24].functions + (val->function & ~0xff000000);
sprintf (line, "%i:%s", (val->function & 0xff000000)>>24, f->s_name+progfuncs->stringtable);
j = (val->function & ~0xff000000); //function number
if ((unsigned)j > pr_progstate[i].progs->numfunctions)
sprintf(line, "%i:%s", i, "CORRUPT FUNCTION POINTER");
else
{
f = pr_progstate[i].functions + j;
sprintf (line, "%i:%s", i, f->s_name+progfuncs->stringtable);
}
}
break;
case ev_field:

View file

@ -111,7 +111,7 @@ void PR_StackTrace (progfuncs_t *progfuncs)
printf ("<%s>\n", pr_progstate[progs].filename);
}
if (!f->s_file)
printf ("stripped : %s\n", f->s_name);
printf ("stripped : %s\n", f->s_name+progfuncs->stringtable);
else
printf ("%12s : %s\n", f->s_file+progfuncs->stringtable, f->s_name+progfuncs->stringtable);

View file

@ -6044,13 +6044,13 @@ void QCC_Marshal_Locals(int first, int laststatement)
QCC_def_t *local;
unsigned int newofs;
if (!opt_overlaptemps) //clear these after each function. we arn't overlapping them so why do we need to keep track of them?
{
temp_t *t;
for (t = functemps; t; t = t->next)
QCC_FreeOffset(t->ofs, t->size);
functemps = NULL;
}
// if (!opt_overlaptemps) //clear these after each function. we arn't overlapping them so why do we need to keep track of them?
// {
// temp_t *t;
// for (t = functemps; t; t = t->next)
// QCC_FreeOffset(t->ofs, t->size);
// functemps = NULL;
// }
if (!pr.localvars) //nothing to marshal
{

View file

@ -421,7 +421,7 @@ void NPP_NQWriteByte(int dest, qbyte data) //replacement write func (nq to qw)
multicasttype=MULTICAST_PVS;
break;
case 76:
case DPTE_TEI_G3:
protocollen = sizeofcoord*9+sizeof(qbyte)*2;
multicastpos = 2;
multicasttype=MULTICAST_PHS;
@ -433,7 +433,7 @@ void NPP_NQWriteByte(int dest, qbyte data) //replacement write func (nq to qw)
multicasttype=MULTICAST_PHS;
break;
case 79:
case DPTE_TEI_PLASMAHIT:
protocollen = sizeofcoord*6+sizeof(qbyte)*3;
multicastpos = 2;
multicasttype=MULTICAST_PHS;

View file

@ -1333,9 +1333,9 @@ void PR_ClientUserInfoChanged(char *name, char *oldivalue, char *newvalue)
pr_global_struct->time = sv.time;
pr_global_struct->self = EDICT_TO_PROG(svprogfuncs, sv_player);
G_INT(OFS_PARM0) = (int)PR_SetString(svprogfuncs, name);
G_INT(OFS_PARM1) = (int)PR_SetString(svprogfuncs, oldivalue);
G_INT(OFS_PARM2) = (int)PR_SetString(svprogfuncs, newvalue);
G_INT(OFS_PARM0) = PR_TempString(svprogfuncs, name);
G_INT(OFS_PARM1) = PR_TempString(svprogfuncs, oldivalue);
G_INT(OFS_PARM2) = PR_TempString(svprogfuncs, newvalue);
PR_ExecuteProgram (svprogfuncs, UserInfo_Changed);
}
@ -1351,9 +1351,9 @@ void PR_LocalInfoChanged(char *name, char *oldivalue, char *newvalue)
pr_global_struct->time = sv.time;
pr_global_struct->self = EDICT_TO_PROG(svprogfuncs, sv.edicts);
G_INT(OFS_PARM0) = (int)PR_SetString(svprogfuncs, name);
G_INT(OFS_PARM1) = (int)PR_SetString(svprogfuncs, oldivalue);
G_INT(OFS_PARM2) = (int)PR_SetString(svprogfuncs, newvalue);
G_INT(OFS_PARM0) = PR_TempString(svprogfuncs, name);
G_INT(OFS_PARM1) = PR_TempString(svprogfuncs, oldivalue);
G_INT(OFS_PARM2) = PR_TempString(svprogfuncs, newvalue);
PR_ExecuteProgram (svprogfuncs, localinfoChanged);
}
@ -2233,7 +2233,7 @@ PF_particle
particle(origin, color, count)
=================
*/
void PF_particle (progfuncs_t *prinst, globalvars_t *pr_globals) //I said it was for compatability only.
static void PF_particle (progfuncs_t *prinst, globalvars_t *pr_globals) //I said it was for compatability only.
{
float *org, *dir;
float color;
@ -2359,7 +2359,7 @@ PF_particle2 - hexen2
particle(origin, dmin, dmax, color, effect, count)
=================
*/
void PF_particle2 (progfuncs_t *prinst, globalvars_t *pr_globals)
static void PF_particle2 (progfuncs_t *prinst, globalvars_t *pr_globals)
{
float *org, *dmin, *dmax;
float color;
@ -2399,7 +2399,7 @@ PF_particle3 - hexen2
particle(origin, box, color, effect, count)
=================
*/
void PF_particle3 (progfuncs_t *prinst, globalvars_t *pr_globals)
static void PF_particle3 (progfuncs_t *prinst, globalvars_t *pr_globals)
{
float *org, *box;
float color;
@ -2434,7 +2434,7 @@ PF_particle4 - hexen2
particle(origin, radius, color, effect, count)
=================
*/
void PF_particle4 (progfuncs_t *prinst, globalvars_t *pr_globals)
static void PF_particle4 (progfuncs_t *prinst, globalvars_t *pr_globals)
{
float *org;
float radius;
@ -3283,6 +3283,13 @@ char *PF_TempStr(progfuncs_t *prinst)
return prinst->tempstringbase + (prinst->tempstringnum++)*MAXTEMPBUFFERLEN;
}
string_t PR_TempString(progfuncs_t *prinst, char *str)
{
char *tmp = PF_TempStr(prinst);
Q_strncpyz(tmp, str, MAXTEMPBUFFERLEN);
return tmp - prinst->tempstringbase;
}
void PF_InitTempStrings(progfuncs_t *prinst)
{
prinst->tempstringbase = prinst->AddString(prinst, "", MAXTEMPBUFFERLEN*MAX_TEMPSTRS);
@ -3920,7 +3927,8 @@ void PF_pointcontents (progfuncs_t *prinst, struct globalvars_s *pr_globals)
v = G_VECTOR(OFS_PARM0);
cont = SV_PointContents (v);
cont = SV_Move(v, vec3_origin, vec3_origin, v, MOVE_NOMONSTERS, NULL).contents;
// cont = SV_PointContents (v);
if (cont & FTECONTENTS_SOLID)
G_FLOAT(OFS_RETURN) = Q1CONTENTS_SOLID;
else if (cont & FTECONTENTS_SKY)
@ -4110,7 +4118,7 @@ void PF_changeyaw (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
//void() changepitch = #63;
void PF_changepitch (progfuncs_t *prinst, struct globalvars_s *pr_globals)
static void PF_changepitch (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
edict_t *ent;
float ideal, current, move, speed;
@ -4851,11 +4859,13 @@ void PF_makestatic (progfuncs_t *prinst, struct globalvars_s *pr_globals)
state->effects = ent->v->effects;
state->hexen2flags = ent->v->drawflags;
state->abslight = (int)(ent->v->abslight*255) & 255;
state->trans = ent->v->alpha;
if (!state->trans)
state->trans = 1;
state->trans = ent->v->alpha*255;
if (!ent->v->alpha)
state->trans = 255;
state->fatness = ent->v->fatness;
state->scale = ent->v->scale;
state->scale = ent->v->scale*16.0;
if (!ent->v->scale)
state->scale = 1*16;
if (progstype != PROG_QW) //don't send extra nq effects to a qw client.
state->effects &= EF_BRIGHTLIGHT | EF_DIMLIGHT;
@ -6974,7 +6984,7 @@ void PF_randomvec (progfuncs_t *prinst, struct globalvars_s *pr_globals)
//void(vector dir) vectorvectors = #432
//Writes new values for v_forward, v_up, and v_right based on the given forward vector
void PF_vectorvectors (progfuncs_t *prinst, struct globalvars_s *pr_globals)
static void PF_vectorvectors (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
VectorCopy(G_VECTOR(OFS_PARM0), P_VEC(v_forward));
VectorNormalize(P_VEC(v_forward));
@ -7953,7 +7963,7 @@ void PF_te_bloodshower(progfuncs_t *prinst, struct globalvars_s *pr_globals)
//DP_SV_EFFECT
//void(vector org, string modelname, float startframe, float endframe, float framerate) effect = #404;
void PF_effect(progfuncs_t *prinst, struct globalvars_s *pr_globals)
static void PF_effect(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
float *org = G_VECTOR(OFS_PARM0);
char *name = PR_GetStringOfs(prinst, OFS_PARM1);
@ -8413,24 +8423,19 @@ void PF_setattachment(progfuncs_t *prinst, struct globalvars_s *pr_globals)
edict_t *tagentity = G_EDICT(prinst, OFS_PARM1);
char *tagname = PR_GetStringOfs(prinst, OFS_PARM2);
eval_t *te;
eval_t *ti;
int modelindex;
te = prinst->GetEdictFieldValue(prinst, e, "tag_entity", NULL);
ti = prinst->GetEdictFieldValue(prinst, e, "tag_index", NULL);
int tagidx;
e->tagent = tagentity->entnum;
e->tagindex = 0;
tagidx = 0;
if (tagentity != sv.edicts && tagname && tagname[0])
{
modelindex = (int)tagentity->v->modelindex;
if (modelindex > 0 && modelindex < MAX_MODELS && sv.model_precache[modelindex])
{
e->tagindex = SV_TagForName(modelindex, tagname);
if (e->tagindex == 0)
tagidx = SV_TagForName(modelindex, tagname);
if (tagidx == 0)
Con_DPrintf("setattachment(edict %i, edict %i, string \"%s\"): tried to find tag named \"%s\" on entity %i (model \"%s\") but could not find it\n", NUM_FOR_EDICT(prinst, e), NUM_FOR_EDICT(prinst, tagentity), tagname, tagname, NUM_FOR_EDICT(prinst, tagentity), sv.models[modelindex]->name);
}
else
@ -8438,18 +8443,8 @@ void PF_setattachment(progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
//fix me, move to somewhere nicer.
MSG_WriteByte(&sv.multicast, svc_setattachment);
MSG_WriteShort(&sv.multicast, e->entnum);
MSG_WriteShort(&sv.multicast, e->tagent);
MSG_WriteShort(&sv.multicast, e->tagindex);
SV_MulticastProtExt(vec3_origin, MULTICAST_ALL_R, 0xffffffff, PEXT_SETATTACHMENT, 0);
if (te)
te->edict = EDICT_TO_PROG(prinst,EDICT_NUM(prinst, e->tagent));
if (ti)
te->_float = e->tagindex;
e->v->tag_entity = EDICT_TO_PROG(prinst,tagentity);
e->v->tag_index = tagidx;
}
void PF_clientstat(progfuncs_t *prinst, struct globalvars_s *pr_globals)
@ -9166,6 +9161,9 @@ void PR_RegisterFields(void) //it's just easier to do it this way.
fieldentity(viewmodelforclient);
fieldentity(exteriormodeltoclient);
fieldentity(tag_entity);
fieldfloat(tag_index);
fieldfloat(glow_size);
fieldfloat(glow_color);
fieldfloat(glow_trail);

View file

@ -185,6 +185,9 @@ typedef struct entvars_s
int viewmodelforclient;
int exteriormodeltoclient;
int tag_entity;
float tag_index;
float glow_size;
float glow_color;
float glow_trail;

View file

@ -84,10 +84,6 @@ typedef struct edict_s
entity_state_t baseline;
qbyte solidtype; //relinks entities if thier solidity changed
unsigned short tagent;
unsigned short tagindex;
// other fields from progs come immediately after
} edict_t;

View file

@ -902,7 +902,13 @@ void SV_Status_f (void)
pak = (float)svs.stats.latched_packets/ STATFRAMES;
if (net_local_sv_ipadr.type != NA_LOOPBACK)
Con_Printf ("ip address : %s\n",NET_AdrToString (net_local_sv_ipadr));
{
extern cvar_t pr_imitatemvdsv;
if (pr_imitatemvdsv.value)
Con_Printf ("net address : %s\n",NET_AdrToString (net_local_sv_ipadr));
else
Con_Printf ("ip address : %s\n",NET_AdrToString (net_local_sv_ipadr));
}
Con_Printf ("cpu utilization : %3i%%\n",(int)cpu);
Con_Printf ("avg response time: %i ms\n",(int)avg);
Con_Printf ("packets/frame : %5.2f\n", pak); //not relevent as a limit.
@ -1187,6 +1193,8 @@ void SV_Localinfo_f (void)
Info_SetValueForKey (localinfo, Cmd_Argv(1), Cmd_Argv(2), MAX_LOCALINFO_STRING);
PR_LocalInfoChanged(Cmd_Argv(1), old, Cmd_Argv(2));
Con_DPrintf("Localinfo %s changed (%s -> %s)\n", Cmd_Argv(1), old, Cmd_Argv(2));
}
void SV_SaveInfo(FILE *f, char *info, char *commandname)
@ -1399,6 +1407,11 @@ void SV_Snap (int uid)
Con_TPrintf (STL_USERDOESNTEXIST);
return;
}
if (!ISQWCLIENT(cl))
{
Con_Printf("Can only snap QW clients\n");
return;
}
sprintf(pcxname, "%d-00.pcx", uid);
@ -1428,7 +1441,7 @@ void SV_Snap (int uid)
cl->remote_snap = false;
ClientReliableWrite_Begin (cl, svc_stufftext, 24);
ClientReliableWrite_String (cl, "cmd snap");
ClientReliableWrite_String (cl, "cmd snap\n");
Con_TPrintf (STL_SNAPREQUEST, uid);
}

View file

@ -524,12 +524,15 @@ void SV_WriteDelta (entity_state_t *from, entity_state_t *to, sizebuf_t *msg, qb
if ( to->abslight != from->abslight && protext & PEXT_HEXEN2)
evenmorebits |= U_ABSLIGHT;
if (to->glowsize)
if (to->glowsize != from->glowsize)
to->dpflags |= 4;
if (to->dpflags)
if (to->dpflags != from->dpflags)
evenmorebits |= U_DPFLAGS;
if (to->tagentity != from->tagentity || to->tagindex != from->tagindex)
evenmorebits |= U_TAGINFO;
if (evenmorebits&0xff00)
evenmorebits |= U_YETMORE;
if (evenmorebits&0x00ff)
@ -594,15 +597,15 @@ void SV_WriteDelta (entity_state_t *from, entity_state_t *to, sizebuf_t *msg, qb
#ifdef U_SCALE
if (evenmorebits & U_SCALE)
MSG_WriteByte (msg, (qbyte)(to->scale*100.0));
MSG_WriteByte (msg, (qbyte)(to->scale));
#endif
#ifdef U_TRANS
if (evenmorebits & U_TRANS)
MSG_WriteByte (msg, (qbyte)(to->trans*255));
MSG_WriteByte (msg, (qbyte)(to->trans));
#endif
#ifdef U_FATNESS
if (evenmorebits & U_FATNESS)
MSG_WriteChar (msg, to->fatness*2);
MSG_WriteChar (msg, to->fatness);
#endif
if (evenmorebits & U_DRAWFLAGS)
@ -612,6 +615,13 @@ void SV_WriteDelta (entity_state_t *from, entity_state_t *to, sizebuf_t *msg, qb
if (evenmorebits & U_DPFLAGS)
MSG_WriteByte (msg, to->dpflags);
if (evenmorebits & U_TAGINFO)
{
MSG_WriteShort (msg, to->tagentity);
MSG_WriteShort (msg, to->tagindex);
}
}
/*
@ -781,12 +791,18 @@ void SV_EmitPacketEntities (client_t *client, packet_entities_t *to, sizebuf_t *
void SVDP_EmitEntity(entity_state_t *from, entity_state_t *to, sizebuf_t *msg, qboolean isnew)
{
int bits;
if (!memcmp(from, to, sizeof(entity_state_t)))
if (!isnew && !memcmp(from, to, sizeof(entity_state_t)))
{
to->bitmask = 0;
return; //didn't change
}
bits = 0;
if (isnew)
{
bits |= E5_FULLUPDATE;
to->bitmask = 0; //no point...
}
if (!VectorCompare(from->origin, to->origin))
bits |= E5_ORIGIN;
@ -800,20 +816,20 @@ void SVDP_EmitEntity(entity_state_t *from, entity_state_t *to, sizebuf_t *msg, q
bits |= E5_SKIN;
if (from->effects != to->effects)
bits |= E5_EFFECTS;
if (from->flags != to->flags)
if (from->dpflags != to->dpflags)
bits |= E5_FLAGS;
if (from->trans != to->trans)
bits |= E5_ALPHA;
// if (from->scale != to->scale)
// bits |= E5_SCALE;
if (from->scale != to->scale)
bits |= E5_SCALE;
if (from->colormap != to->colormap)
bits |= E5_COLORMAP;
// if (from->tagentity != to->tagentity || o->tagindex != to->tagindex)
// bits |= E5_ATTACHMENT;
if (from->tagentity != to->tagentity || from->tagindex != to->tagindex)
bits |= E5_ATTACHMENT;
// if (from->light[0] != to->light[0] || o->light[1] != to->light[1] || o->light[2] != to->light[2] || o->light[3] != to->light[3] || o->lightstyle != to->lightstyle || o->lightpflags != to->lightpflags)
// bits |= E5_LIGHT;
// if (from->glowsize != to->glowsize || o->glowcolor != to->glowcolor)
// bits |= E5_GLOW;
if (from->glowsize != to->glowsize || from->glowcolour != to->glowcolour)
bits |= E5_GLOW;
// if (from->colormod[0] != to->colormod[0] || o->colormod[1] != to->colormod[1] || o->colormod[2] != to->colormod[2])
// bits |= E5_COLORMOD;
@ -839,7 +855,8 @@ void SVDP_EmitEntity(entity_state_t *from, entity_state_t *to, sizebuf_t *msg, q
if (bits >= 16777216)
bits |= E5_EXTEND3;
to->bitmask |= bits;
bits |= to->bitmask;
to->bitmask = bits;
if (!bits)
return;
@ -853,7 +870,7 @@ void SVDP_EmitEntity(entity_state_t *from, entity_state_t *to, sizebuf_t *msg, q
if (bits & E5_EXTEND3)
MSG_WriteByte(msg, (bits >> 24) & 0xFF);
if (bits & E5_FLAGS)
MSG_WriteByte(msg, to->flags);
MSG_WriteByte(msg, to->dpflags);
if (bits & E5_ORIGIN)
{
if (bits & E5_ORIGIN32)
@ -910,16 +927,16 @@ void SVDP_EmitEntity(entity_state_t *from, entity_state_t *to, sizebuf_t *msg, q
MSG_WriteByte(msg, to->effects);
}
if (bits & E5_ALPHA)
MSG_WriteByte(msg, to->trans*255);
MSG_WriteByte(msg, to->trans);
if (bits & E5_SCALE)
MSG_WriteByte(msg, to->scale);
if (bits & E5_COLORMAP)
MSG_WriteByte(msg, to->colormap);
// if (bits & E5_ATTACHMENT)
// {
// MSG_WriteShort(msg, to->tagentity);
// MSG_WriteByte(msg, to->tagindex);
// }
if (bits & E5_ATTACHMENT)
{
MSG_WriteShort(msg, to->tagentity);
MSG_WriteByte(msg, to->tagindex);
}
// if (bits & E5_LIGHT)
// {
// MSG_WriteShort(msg, to->light[0]);
@ -929,11 +946,11 @@ void SVDP_EmitEntity(entity_state_t *from, entity_state_t *to, sizebuf_t *msg, q
// MSG_WriteByte(msg, to->lightstyle);
// MSG_WriteByte(msg, to->lightpflags);
// }
// if (bits & E5_GLOW)
// {
// MSG_WriteByte(msg, to->glowsize);
// MSG_WriteByte(msg, to->glowcolor);
// }
if (bits & E5_GLOW)
{
MSG_WriteByte(msg, to->glowsize);
MSG_WriteByte(msg, to->glowcolour);
}
// if (bits & E5_COLORMOD)
// {
// MSG_WriteByte(msg, to->colormod[0]);
@ -942,6 +959,7 @@ void SVDP_EmitEntity(entity_state_t *from, entity_state_t *to, sizebuf_t *msg, q
// }
}
entity_state_t defaultstate;
void SVDP_EmitEntitiesUpdate (client_t *client, packet_entities_t *to, sizebuf_t *msg)
{
edict_t *ent;
@ -951,19 +969,14 @@ void SVDP_EmitEntitiesUpdate (client_t *client, packet_entities_t *to, sizebuf_t
int oldnum, newnum;
int oldmax;
client->netchan.incoming_sequence++;
// this is the frame that we are going to delta update from
if (client->delta_sequence != -1)
{
fromframe = &client->frames[client->delta_sequence & UPDATE_MASK];
from = &fromframe->entities;
oldmax = from->num_entities;
}
else
{
oldmax = 0; // no delta update
from = NULL;
}
client->delta_sequence++;
fromframe = &client->frames[(client->netchan.incoming_sequence-2) & UPDATE_MASK];
from = &fromframe->entities;
oldmax = from->num_entities;
// Con_Printf ("frame %i\n", client->netchan.incoming_sequence);
MSG_WriteByte(msg, svcdp_entities);
MSG_WriteLong(msg, 0);
@ -972,6 +985,7 @@ void SVDP_EmitEntitiesUpdate (client_t *client, packet_entities_t *to, sizebuf_t
for (newindex = 0; newindex < to->num_entities; newindex++)
to->entities[newindex].bitmask = 0;
//add in the bitmasks of dropped packets.
newindex = 0;
oldindex = 0;
@ -992,10 +1006,10 @@ void SVDP_EmitEntitiesUpdate (client_t *client, packet_entities_t *to, sizebuf_t
}
if (newnum < oldnum)
{ // this is a new entity, send it from the baseline
{ // this is a new entity, send it from the baseline... as far as dp understands it...
ent = EDICT_NUM(svprogfuncs, newnum);
//Con_Printf ("baseline %i\n", newnum);
SVDP_EmitEntity (&ent->baseline, &to->entities[newindex], msg, true);
SVDP_EmitEntity (&defaultstate, &to->entities[newindex], msg, true);
newindex++;
continue;
}
@ -1140,19 +1154,19 @@ void SV_WritePlayerToClient(sizebuf_t *msg, clstate_t *ent)
#ifdef PEXT_SCALE //this is graphics, not physics
if (ent->fteext & PEXT_SCALE)
{
if (ent->scale) pflags |= (zext&Z_EXT_PM_TYPE)?PF_SCALE_Z:PF_SCALE_NOZ;
if (ent->scale) pflags |= PF_SCALE_Z;
}
#endif
#ifdef PEXT_TRANS
if (ent->fteext & PEXT_TRANS)
{
if (ent->transparency) pflags |= (zext&Z_EXT_PM_TYPE)?PF_TRANS_Z:PF_TRANS_NOZ;
if (ent->transparency) pflags |= PF_TRANS_Z;
}
#endif
#ifdef PEXT_FATNESS
if (ent->fteext & PEXT_FATNESS)
{
if (ent->fatness) pflags |= (zext&Z_EXT_PM_TYPE)?PF_FATNESS_Z:PF_FATNESS_NOZ;
if (ent->fatness) pflags |= PF_FATNESS_Z;
}
#endif
}
@ -1161,7 +1175,7 @@ void SV_WritePlayerToClient(sizebuf_t *msg, clstate_t *ent)
{
hullnumber = SV_HullNumForPlayer(ent->hull, ent->mins, ent->maxs);
if (hullnumber != 1)
pflags |= (zext&Z_EXT_PM_TYPE)?PF_HULLSIZE_Z:PF_HULLSIZE_NOZ;
pflags |= PF_HULLSIZE_Z;
}
else
hullnumber=1;
@ -1288,44 +1302,22 @@ void SV_WritePlayerToClient(sizebuf_t *msg, clstate_t *ent)
if (pflags & PF_WEAPONFRAME)
MSG_WriteByte (msg, ent->weaponframe);
if (zext&Z_EXT_PM_TYPE)
{
#ifdef PEXT_SCALE
if (pflags & PF_SCALE_Z)
MSG_WriteByte (msg, ent->scale*100);
if (pflags & PF_SCALE_Z)
MSG_WriteByte (msg, ent->scale*50);
#endif
#ifdef PEXT_TRANS
if (pflags & PF_TRANS_Z)
MSG_WriteByte (msg, (qbyte)(ent->transparency*255));
if (pflags & PF_TRANS_Z)
MSG_WriteByte (msg, (qbyte)(ent->transparency*255));
#endif
#ifdef PEXT_FATNESS
if (pflags & PF_FATNESS_Z)
MSG_WriteChar (msg, ent->fatness*2);
if (pflags & PF_FATNESS_Z)
MSG_WriteChar (msg, ent->fatness*2);
#endif
#ifdef PEXT_HULLSIZE //shrunken or crouching in halflife levels. (possibly enlarged)
if (pflags & PF_HULLSIZE_Z)
MSG_WriteChar (msg, hullnumber + (ent->onladder?128:0)); //physics.
if (pflags & PF_HULLSIZE_Z)
MSG_WriteChar (msg, hullnumber + (ent->onladder?128:0)); //physics.
#endif
}
else
{
#ifdef PEXT_SCALE
if (pflags & PF_SCALE_NOZ)
MSG_WriteByte (msg, ent->scale*100);
#endif
#ifdef PEXT_TRANS
if (pflags & PF_TRANS_NOZ)
MSG_WriteByte (msg, (qbyte)(ent->transparency*255));
#endif
#ifdef PEXT_FATNESS
if (pflags & PF_FATNESS_NOZ)
MSG_WriteChar (msg, ent->fatness*2);
#endif
#ifdef PEXT_HULLSIZE //shrunken or crouching in halflife levels. (possibly enlarged)
if (pflags & PF_HULLSIZE_NOZ)
MSG_WriteChar (msg, hullnumber + (ent->onladder?128:0)); //physics.
#endif
}
}
#endif
@ -2412,15 +2404,17 @@ void SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg, qboolean ignore
state->abslight = clent->v->abslight;
#ifdef PEXT_SCALE
state->scale = clent->v->scale;
state->scale = clent->v->scale*16;
if (!clent->v->scale)
clent->v->scale = 1*16;
#endif
#ifdef PEXT_TRANS
state->trans = clent->v->alpha;
if (!state->trans)
state->trans = 1;
state->trans = clent->v->alpha*255;
if (!clent->v->alpha)
clent->v->alpha = 255;
#endif
#ifdef PEXT_FATNESS
state->fatness = clent->v->fatness;
state->fatness = clent->v->fatness*2;
#endif
if (state->effects & QWEF_FLAG1)
@ -2478,13 +2472,13 @@ void SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg, qboolean ignore
{
//unconditional
}
else if (ent->tagent)
else if (ent->v->tag_entity)
{
edict_t *p = ent;
int c = 10;
while(p->tagent&&c-->0)
while(p->v->tag_entity&&c-->0)
{
p = EDICT_NUM(svprogfuncs, p->tagent);
p = EDICT_NUM(svprogfuncs, p->v->tag_entity);
}
if (!sv.worldmodel->funcs.EdictInFatPVS(p))
continue;
@ -2635,7 +2629,7 @@ void SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg, qboolean ignore
if (ent->v->exteriormodeltoclient)
{
if (ent->v->exteriormodeltoclient == EDICT_TO_PROG(svprogfuncs, client->edict))
state->dpflags |= RENDER_VIEWMODEL;
state->dpflags |= RENDER_EXTERIORMODEL;
//everyone else sees it normally.
}
@ -2650,6 +2644,8 @@ void SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg, qboolean ignore
state->effects = ent->v->effects;
state->hexen2flags = ent->v->drawflags;
state->abslight = (int)(ent->v->abslight*255) & 255;
state->tagentity = ent->v->tag_entity;
state->tagindex = ent->v->tag_index;
if ((int)ent->v->flags & FL_CLASS_DEPENDENT && client->playerclass)
{
char modname[MAX_QPATH];
@ -2667,7 +2663,7 @@ void SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg, qboolean ignore
{
state->hexen2flags |= MLS_FULLBRIGHT;
}
if (progstype != PROG_QW && state->effects) //don't send extra nq effects to a qw client.
if (progstype != PROG_QW && state->effects && ISQWCLIENT(client)) //don't send extra nq effects to a qw client.
{
//EF_NODRAW doesn't draw the model.
//The client still needs to know about it though, as it might have other effects on it.
@ -2685,16 +2681,21 @@ void SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg, qboolean ignore
state->effects &= EF_BRIGHTLIGHT | EF_DIMLIGHT | NQEF_ADDATIVE | EF_RED | EF_BLUE;
}
#ifdef PEXT_SCALE
state->scale = ent->v->scale;
#endif
#ifdef PEXT_TRANS
state->trans = ent->v->alpha;
if (!ent->v->alpha)
state->trans = 1;
state->glowsize = ent->v->glow_size*0.25;
state->glowcolour = ent->v->glow_color;
if (ent->v->glow_trail)
state->dpflags |= RENDER_GLOWTRAIL;
#ifdef PEXT_SCALE
state->scale = ent->v->scale*16;
if (!ent->v->scale)
state->scale = 1*16;
#endif
#ifdef PEXT_TRANS
state->trans = ent->v->alpha*255;
if (!ent->v->alpha)
state->trans = 255;
//QSG_DIMENSION_PLANES - if the only shared dimensions are ghost dimensions, Set half alpha.
if (client->edict)
@ -2708,18 +2709,23 @@ void SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg, qboolean ignore
}
#endif
#ifdef PEXT_FATNESS
state->fatness = ent->v->fatness;
state->fatness = ent->v->fatness*2;
#endif
}
#ifdef NQPROT
if (client->protocol == SCP_NETQUAKE)
return;
if (client->protocol == SCP_DARKPLACES6 || client->protocol == SCP_DARKPLACES7)
if (ISNQCLIENT(client))
{
SVDP_EmitEntitiesUpdate(client, pack, msg);
SV_EmitCSQCUpdate(client, msg);
return;
if (client->protocol == SCP_DARKPLACES6 || client->protocol == SCP_DARKPLACES7)
{
SVDP_EmitEntitiesUpdate(client, pack, msg);
SV_EmitCSQCUpdate(client, msg);
return;
}
else
{
client->netchan.incoming_sequence++;
return;
}
}
#endif

View file

@ -210,10 +210,10 @@ void SVNQ_CreateBaseline (void)
svent->baseline.number = entnum;
#ifdef PEXT_SCALE
svent->baseline.scale = 1;
svent->baseline.scale = 1*16;
#endif
#ifdef PEXT_TRANS
svent->baseline.trans = 1;
svent->baseline.trans = 255;
#endif
if (svent->isfree)

View file

@ -376,7 +376,8 @@ void SV_DropClient (client_t *drop)
if (pr_nqglobal_struct->SetChangeParms)
PR_ExecuteProgram (svprogfuncs, pr_global_struct->SetChangeParms);
for (j=0 ; j<NUM_SPAWN_PARMS ; j++)
rs.parm[j] = *spawnparamglobals[j];
if (spawnparamglobals[j])
rs.parm[j] = *spawnparamglobals[j];
Rank_SetPlayerStats(drop->rankid, &rs);
}
}
@ -2066,6 +2067,8 @@ void SVNQ_ConnectionlessPacket(void)
if (sv_listen.value < 2)
return;
if (sv_bigcoords.value)
return; //no, start using dp7 instead.
MSG_BeginReading();
header = BigLong(MSG_ReadLong());
@ -2677,6 +2680,7 @@ SV_Frame
*/
void SV_Frame (float time)
{
extern cvar_t pr_imitatemvdsv;
static double start, end;
start = Sys_DoubleTime ();
@ -2744,6 +2748,13 @@ void SV_MVDStream_Poll(void);
// get packets
SV_ReadPackets ();
if (pr_imitatemvdsv.value)
{
Cbuf_Execute ();
if (sv.state < ss_active) //whoops...
return;
}
if (sv.multicast.cursize)
{
Con_Printf("Unterminated multicast\n");
@ -2771,8 +2782,10 @@ void SV_MVDStream_Poll(void);
SV_GetConsoleCommands ();
// process console commands
if (!pr_imitatemvdsv.value)
Cbuf_Execute ();
}
if (sv.state < ss_active) //whoops...
return;
@ -3588,6 +3601,14 @@ void SV_Init (quakeparms_t *parms)
// if a map wasn't specified on the command line, spawn start.map
if (sv.state == ss_dead)
Cmd_ExecuteString ("map start", RESTRICT_LOCAL);
if (sv.state == ss_dead)
{
cvar_t *ml;
ml = Cvar_Get("g_maplist", "dm1 dm2 dm3 dm4 dm5 dm6", 0, "");
Cmd_TokenizeString(ml->string, false, false);
if (Cmd_Argc())
Cmd_ExecuteString(va("map %s", Cmd_Argv(rand()%Cmd_Argc())), RESTRICT_LOCAL);
}
if (sv.state == ss_dead)
SV_Error ("Couldn't spawn a server");

View file

@ -1367,7 +1367,7 @@ static qboolean SV_MVD_Record (mvddest_t *dest)
n = 0;
s = sv.model_precache[n+1];
while (*s)
while (s)
{
MSG_WriteString (&buf, s);
if (buf.cursize > MAX_QWMSGLEN/2)

View file

@ -1680,7 +1680,8 @@ void SV_RunEntity (edict_t *ent)
//
pr_global_struct->time = sv.time;
pr_global_struct->self = EDICT_TO_PROG(svprogfuncs, ent);
PR_ExecuteProgram (svprogfuncs, pr_global_struct->PlayerPreThink);
if (pr_global_struct->PlayerPreThink)
PR_ExecuteProgram (svprogfuncs, pr_global_struct->PlayerPreThink);
if (readyforjump) //qw progs can't jump for themselves...
{
@ -1780,7 +1781,8 @@ void SV_RunEntity (edict_t *ent)
pr_global_struct->time = sv.time;
pr_global_struct->self = EDICT_TO_PROG(svprogfuncs, ent);
PR_ExecuteProgram (svprogfuncs, pr_global_struct->PlayerPostThink);
if (pr_global_struct->PlayerPostThink)
PR_ExecuteProgram (svprogfuncs, pr_global_struct->PlayerPostThink);
}
}

View file

@ -967,7 +967,7 @@ void SV_WriteClientdataToMessage (client_t *client, sizebuf_t *msg)
MSG_WriteByte (msg, svc_time);
MSG_WriteFloat(msg, sv.physicstime);
client->nextservertimeupdate = sv.physicstime;
Con_Printf("%f\n", sv.physicstime);
// Con_Printf("%f\n", sv.physicstime);
bits = 0;

View file

@ -929,14 +929,6 @@ void SV_PreSpawn_f (void)
ent = EDICT_NUM(svprogfuncs, buf - bufs - sv.numextrastatics);
if (ent->tagent)
{
MSG_WriteByte(&host_client->netchan.message, svc_setattachment);
MSG_WriteShort(&host_client->netchan.message, ent->entnum);
MSG_WriteShort(&host_client->netchan.message, ent->tagent);
MSG_WriteShort(&host_client->netchan.message, ent->tagindex);
}
state = &ent->baseline;
if (!state->number || !state->modelindex)
{ //ent doesn't have a baseline
@ -2267,16 +2259,16 @@ void SV_SetInfo_f (void)
sv_player->v->team = atoi(Cmd_Argv(2))+1;
}
PR_ClientUserInfoChanged(Cmd_Argv(1), oldval, Cmd_Argv(2));
if (*Cmd_Argv(1) != '_')
{
i = host_client - svs.clients;
MSG_WriteByte (&sv.reliable_datagram, svc_setinfo);
MSG_WriteByte (&sv.reliable_datagram, i);
MSG_WriteString (&sv.reliable_datagram, Cmd_Argv(1));
MSG_WriteString (&sv.reliable_datagram, Info_ValueForKey(host_client->userinfo, Cmd_Argv(1)));
}
if (*Cmd_Argv(1) == '_')
return;
i = host_client - svs.clients;
MSG_WriteByte (&sv.reliable_datagram, svc_setinfo);
MSG_WriteByte (&sv.reliable_datagram, i);
MSG_WriteString (&sv.reliable_datagram, Cmd_Argv(1));
MSG_WriteString (&sv.reliable_datagram, Info_ValueForKey(host_client->userinfo, Cmd_Argv(1)));
PR_ClientUserInfoChanged(Cmd_Argv(1), oldval, Info_ValueForKey(host_client->userinfo, Cmd_Argv(1)));
}
/*
@ -2611,7 +2603,7 @@ void Cmd_Fly_f (void)
/*
====================
Host_SetPos_f UDC
By Alex Shadowalker
By Alex Shadowalker (and added to fte because he kept winging)
====================
*/
void Cmd_SetPos_f(void)
@ -2652,7 +2644,7 @@ void SetUpClientEdict (client_t *cl, edict_t *ent)
ent->v->netname = PR_SetString(svprogfuncs, cl->name);
if (pr_teamfield)
((string_t *)&ent->v)[pr_teamfield] = (string_t)PR_SetString(svprogfuncs, cl->team);
((string_t *)ent->v)[pr_teamfield] = (string_t)PR_SetString(svprogfuncs, cl->team);
ent->v->gravity = cl->entgravity = 1.0;
@ -3424,7 +3416,7 @@ ucmd_t nqucmds[] =
{"playermodel", NULL},
{"playerskin", NULL},
{"rate", NULL},
{"rate", SV_Rate_f},
#ifdef SVRANKING
{"topten", Rank_ListTop10_f},

View file

@ -1429,7 +1429,7 @@ void SV_ClipMoveToEntities ( moveclip_t *clip )
int headnode;
float *angles;
int passed = EDICT_TO_PROG(svprogfuncs, clip->passedict);
int passed = clip->passedict?EDICT_TO_PROG(svprogfuncs, clip->passedict):NULL;
num = SV_AreaEdicts (clip->boxmins, clip->boxmaxs, touchlist
, MAX_EDICTS, AREA_SOLID);
@ -1600,12 +1600,18 @@ void SV_ClipToLinks ( areanode_t *node, moveclip_t *clip )
if (clip->type & MOVE_NOMONSTERS && touch->v->solid != SOLID_BSP)
continue;
// don't clip corpse against character
if (clip->passedict->v->solid == SOLID_CORPSE && (touch->v->solid == SOLID_SLIDEBOX || touch->v->solid == SOLID_CORPSE))
continue;
// don't clip character against corpse
if (clip->passedict->v->solid == SOLID_SLIDEBOX && touch->v->solid == SOLID_CORPSE)
continue;
if (clip->passedict)
{
// don't clip corpse against character
if (clip->passedict->v->solid == SOLID_CORPSE && (touch->v->solid == SOLID_SLIDEBOX || touch->v->solid == SOLID_CORPSE))
continue;
// don't clip character against corpse
if (clip->passedict->v->solid == SOLID_SLIDEBOX && touch->v->solid == SOLID_CORPSE)
continue;
if (!((int)clip->passedict->v->dimension_hit & (int)touch->v->dimension_solid))
continue;
}
if (clip->boxmins[0] > touch->v->absmax[0]
|| clip->boxmins[1] > touch->v->absmax[1]
@ -1618,9 +1624,6 @@ void SV_ClipToLinks ( areanode_t *node, moveclip_t *clip )
if (clip->passedict && clip->passedict->v->size[0] && !touch->v->size[0])
continue; // points never interact
if (!((int)clip->passedict->v->dimension_hit & (int)touch->v->dimension_solid))
continue;
// might intersect, so do an exact clip
if (clip->trace.allsolid)
return;
@ -1778,7 +1781,7 @@ trace_t SV_Move (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int type, e
memset ( &clip, 0, sizeof ( moveclip_t ) );
if (passedict->v->hull)
if (passedict && passedict->v->hull)
hullnum = passedict->v->hull;
else if (sv_compatablehulls.value)
hullnum = 0;

View file

@ -657,7 +657,7 @@ void R_AliasSetupSkin (void)
numskins = paliasskingroup->numskins;
fullskininterval = pskinintervals[numskins-1];
skintime = cl.time + currententity->syncbase;
skintime = cl.time;// + currententity->syncbase;
// when loading in Mod_LoadAliasSkinGroup, we guaranteed all interval
// values are positive, so we don't have to worry about division by 0
@ -809,7 +809,7 @@ void R_AliasSetupFrame (void)
numframes = paliasgroup->numframes;
fullinterval = pintervals[numframes-1];
time = cl.time + currententity->syncbase;
time = currententity->frame1time;
//
// when loading in Mod_LoadAliasGroup, we guaranteed all interval values
@ -840,7 +840,7 @@ void R_AliasSetupFrame (void)
numframes = paliasgroup->numframes;
fullinterval = pintervals[numframes-1];
time = cl.time + currententity->syncbase;
time = currententity->frame1time;
//
// when loading in Mod_LoadAliasGroup, we guaranteed all interval values

View file

@ -681,18 +681,10 @@ void SWR_DrawEntitiesOnList (void)
currententity = &cl_visedicts[i];
{
j = currententity->keynum;
while(j)
{
if (j == (cl.viewentity[r_refdef.currentplayernum]?cl.viewentity[r_refdef.currentplayernum]:(cl.playernum[r_refdef.currentplayernum]+1)))
break;
j = cl.lerpents[j].tagent;
}
if (j)
continue;
if (cl.viewentity[r_refdef.currentplayernum] && currententity->keynum == cl.viewentity[r_refdef.currentplayernum])
if (currententity->keynum == (cl.viewentity[r_refdef.currentplayernum]?cl.viewentity[r_refdef.currentplayernum]:(cl.playernum[r_refdef.currentplayernum]+1)))
continue;
// if (cl.viewentity[r_refdef.currentplayernum] && currententity->keynum == cl.viewentity[r_refdef.currentplayernum])
// continue;
if (!Cam_DrawPlayer(0, currententity->keynum-1))
continue;
}

View file

@ -259,7 +259,7 @@ mspriteframe_t *R_GetSpriteframe (msprite_t *psprite)
numframes = pspritegroup->numframes;
fullinterval = pintervals[numframes-1];
time = cl.time + currententity->syncbase;
time = currententity->frame1time;
// when loading in Mod_LoadSpriteGroup, we guaranteed all interval values
// are positive, so we don't have to worry about division by 0