}
else
hours = 0;
- print ("#%-2u %-16.16s %3i %2i:%02i:%02i\n", j+1, client->name, (int)client->edict->v.frags, hours, minutes, seconds);
+ print ("#%-2u %-16.16s %3i %2i:%02i:%02i\n", j+1, client->name, (int)client->edict->v->frags, hours, minutes, seconds);
print (" %s\n", client->netconnection->address);
}
}
if (pr_global_struct->deathmatch)
return;
- sv_player->v.flags = (int)sv_player->v.flags ^ FL_GODMODE;
- if (!((int)sv_player->v.flags & FL_GODMODE) )
+ sv_player->v->flags = (int)sv_player->v->flags ^ FL_GODMODE;
+ if (!((int)sv_player->v->flags & FL_GODMODE) )
SV_ClientPrintf ("godmode OFF\n");
else
SV_ClientPrintf ("godmode ON\n");
if (pr_global_struct->deathmatch)
return;
- sv_player->v.flags = (int)sv_player->v.flags ^ FL_NOTARGET;
- if (!((int)sv_player->v.flags & FL_NOTARGET) )
+ sv_player->v->flags = (int)sv_player->v->flags ^ FL_NOTARGET;
+ if (!((int)sv_player->v->flags & FL_NOTARGET) )
SV_ClientPrintf ("notarget OFF\n");
else
SV_ClientPrintf ("notarget ON\n");
if (pr_global_struct->deathmatch)
return;
- if (sv_player->v.movetype != MOVETYPE_NOCLIP)
+ if (sv_player->v->movetype != MOVETYPE_NOCLIP)
{
noclip_anglehack = true;
- sv_player->v.movetype = MOVETYPE_NOCLIP;
+ sv_player->v->movetype = MOVETYPE_NOCLIP;
SV_ClientPrintf ("noclip ON\n");
}
else
{
noclip_anglehack = false;
- sv_player->v.movetype = MOVETYPE_WALK;
+ sv_player->v->movetype = MOVETYPE_WALK;
SV_ClientPrintf ("noclip OFF\n");
}
}
if (pr_global_struct->deathmatch)
return;
- if (sv_player->v.movetype != MOVETYPE_FLY)
+ if (sv_player->v->movetype != MOVETYPE_FLY)
{
- sv_player->v.movetype = MOVETYPE_FLY;
+ sv_player->v->movetype = MOVETYPE_FLY;
SV_ClientPrintf ("flymode ON\n");
}
else
{
- sv_player->v.movetype = MOVETYPE_WALK;
+ sv_player->v->movetype = MOVETYPE_WALK;
SV_ClientPrintf ("flymode OFF\n");
}
}
int i, j;
float total;
client_t *client;
-
+
if (cmd_source == src_command)
{
Cmd_ForwardToServer ();
for (i=0 ; i<svs.maxclients ; i++)
{
- if (svs.clients[i].active && (svs.clients[i].edict->v.health <= 0) )
+ if (svs.clients[i].active && (svs.clients[i].edict->v->health <= 0) )
{
Con_Printf ("Can't savegame with a dead player\n");
return;
{
// parse an edict
ent = EDICT_NUM(entnum);
- memset (&ent->v, 0, progs->entityfields * 4);
+ memset (ent->v, 0, progs->entityfields * 4);
ent->free = false;
ED_ParseEdict (start, ent);
if (strcmp(host_client->name, newName) != 0)
Con_Printf ("%s renamed to %s\n", host_client->name, newName);
strcpy (host_client->name, newName);
- host_client->edict->v.netname = host_client->name - pr_strings;
+ host_client->edict->v->netname = host_client->name - pr_strings;
// send notification to all clients
{
if (!client || !client->active || !client->spawned)
continue;
- if (teamplay.integer && teamonly && client->edict->v.team != save->edict->v.team)
+ if (teamplay.integer && teamonly && client->edict->v->team != save->edict->v->team)
continue;
host_client = client;
SV_ClientPrintf("%s", text);
else
{
host_client->colors = playercolor;
- host_client->edict->v.team = bottom + 1;
+ host_client->edict->v->team = bottom + 1;
// send notification to all clients
MSG_WriteByte (&sv.reliable_datagram, svc_updatecolors);
return;
}
- if (sv_player->v.health <= 0)
+ if (sv_player->v->health <= 0)
{
SV_ClientPrintf ("Can't suicide -- already dead!\n");
return;
*/
void Host_Pause_f (void)
{
-
+
if (cmd_source == src_command)
{
Cmd_ForwardToServer ();
if (sv.paused)
{
- SV_BroadcastPrintf ("%s paused the game\n", pr_strings + sv_player->v.netname);
+ SV_BroadcastPrintf ("%s paused the game\n", pr_strings + sv_player->v->netname);
}
else
{
- SV_BroadcastPrintf ("%s unpaused the game\n",pr_strings + sv_player->v.netname);
+ SV_BroadcastPrintf ("%s unpaused the game\n",pr_strings + sv_player->v->netname);
}
// send notification to all clients
Con_Printf ("prespawn not valid -- already spawned\n");
return;
}
-
+
SZ_Write (&host_client->message, sv.signon.data, sv.signon.cursize);
MSG_WriteByte (&host_client->message, svc_signonnum);
MSG_WriteByte (&host_client->message, 2);
// set up the edict
ent = host_client->edict;
- memset (&ent->v, 0, progs->entityfields * 4);
- ent->v.colormap = NUM_FOR_EDICT(ent);
- ent->v.team = (host_client->colors & 15) + 1;
- ent->v.netname = host_client->name - pr_strings;
+ memset (ent->v, 0, progs->entityfields * 4);
+ ent->v->colormap = NUM_FOR_EDICT(ent);
+ ent->v->team = (host_client->colors & 15) + 1;
+ ent->v->netname = host_client->name - pr_strings;
if ((val = GETEDICTFIELDVALUE(host_client->edict, eval_pmodel)))
val->_float = host_client->pmodel;
ent = EDICT_NUM( 1 + (host_client - svs.clients) );
MSG_WriteByte (&host_client->message, svc_setangle);
for (i=0 ; i < 2 ; i++)
- MSG_WriteAngle (&host_client->message, ent->v.angles[i] );
+ MSG_WriteAngle (&host_client->message, ent->v->angles[i] );
MSG_WriteAngle (&host_client->message, 0 );
SV_WriteClientdataToMessage (sv_player, &host_client->message);
if (t[0] == '6')
{
if (t[1] == 'a')
- sv_player->v.items = (int)sv_player->v.items | HIT_PROXIMITY_GUN;
+ sv_player->v->items = (int)sv_player->v->items | HIT_PROXIMITY_GUN;
else
- sv_player->v.items = (int)sv_player->v.items | IT_GRENADE_LAUNCHER;
+ sv_player->v->items = (int)sv_player->v->items | IT_GRENADE_LAUNCHER;
}
else if (t[0] == '9')
- sv_player->v.items = (int)sv_player->v.items | HIT_LASER_CANNON;
+ sv_player->v->items = (int)sv_player->v->items | HIT_LASER_CANNON;
else if (t[0] == '0')
- sv_player->v.items = (int)sv_player->v.items | HIT_MJOLNIR;
+ sv_player->v->items = (int)sv_player->v->items | HIT_MJOLNIR;
else if (t[0] >= '2')
- sv_player->v.items = (int)sv_player->v.items | (IT_SHOTGUN << (t[0] - '2'));
+ sv_player->v->items = (int)sv_player->v->items | (IT_SHOTGUN << (t[0] - '2'));
}
else
{
if (t[0] >= '2')
- sv_player->v.items = (int)sv_player->v.items | (IT_SHOTGUN << (t[0] - '2'));
+ sv_player->v->items = (int)sv_player->v->items | (IT_SHOTGUN << (t[0] - '2'));
}
break;
val->_float = v;
}
- sv_player->v.ammo_shells = v;
+ sv_player->v->ammo_shells = v;
break;
case 'n':
if (gamemode == GAME_ROGUE)
if ((val = GETEDICTFIELDVALUE(sv_player, eval_ammo_nails1)))
{
val->_float = v;
- if (sv_player->v.weapon <= IT_LIGHTNING)
- sv_player->v.ammo_nails = v;
+ if (sv_player->v->weapon <= IT_LIGHTNING)
+ sv_player->v->ammo_nails = v;
}
}
else
{
- sv_player->v.ammo_nails = v;
+ sv_player->v->ammo_nails = v;
}
break;
case 'l':
if (val)
{
val->_float = v;
- if (sv_player->v.weapon > IT_LIGHTNING)
- sv_player->v.ammo_nails = v;
+ if (sv_player->v->weapon > IT_LIGHTNING)
+ sv_player->v->ammo_nails = v;
}
}
break;
if (val)
{
val->_float = v;
- if (sv_player->v.weapon <= IT_LIGHTNING)
- sv_player->v.ammo_rockets = v;
+ if (sv_player->v->weapon <= IT_LIGHTNING)
+ sv_player->v->ammo_rockets = v;
}
}
else
{
- sv_player->v.ammo_rockets = v;
+ sv_player->v->ammo_rockets = v;
}
break;
case 'm':
if (val)
{
val->_float = v;
- if (sv_player->v.weapon > IT_LIGHTNING)
- sv_player->v.ammo_rockets = v;
+ if (sv_player->v->weapon > IT_LIGHTNING)
+ sv_player->v->ammo_rockets = v;
}
}
break;
case 'h':
- sv_player->v.health = v;
+ sv_player->v->health = v;
break;
case 'c':
if (gamemode == GAME_ROGUE)
if (val)
{
val->_float = v;
- if (sv_player->v.weapon <= IT_LIGHTNING)
- sv_player->v.ammo_cells = v;
+ if (sv_player->v->weapon <= IT_LIGHTNING)
+ sv_player->v->ammo_cells = v;
}
}
else
{
- sv_player->v.ammo_cells = v;
+ sv_player->v->ammo_cells = v;
}
break;
case 'p':
if (val)
{
val->_float = v;
- if (sv_player->v.weapon > IT_LIGHTNING)
- sv_player->v.ammo_cells = v;
+ if (sv_player->v->weapon > IT_LIGHTNING)
+ sv_player->v->ammo_cells = v;
}
}
break;
for (i=0 ; i<sv.num_edicts ; i++)
{
e = EDICT_NUM(i);
- if ( !strcmp (pr_strings + e->v.classname, "viewthing") )
+ if ( !strcmp (pr_strings + e->v->classname, "viewthing") )
return e;
}
Con_Printf ("No viewthing on map\n");
Con_Printf ("Can't load %s\n", Cmd_Argv(1));
return;
}
-
- e->v.frame = 0;
- cl.model_precache[(int)e->v.modelindex] = m;
+
+ e->v->frame = 0;
+ cl.model_precache[(int)e->v->modelindex] = m;
}
/*
e = FindViewthing ();
if (!e)
return;
- m = cl.model_precache[(int)e->v.modelindex];
+ m = cl.model_precache[(int)e->v->modelindex];
f = atoi(Cmd_Argv(1));
if (f >= m->numframes)
f = m->numframes-1;
- e->v.frame = f;
+ e->v->frame = f;
}
{
edict_t *e;
model_t *m;
-
+
e = FindViewthing ();
if (!e)
return;
- m = cl.model_precache[(int)e->v.modelindex];
+ m = cl.model_precache[(int)e->v->modelindex];
- e->v.frame = e->v.frame + 1;
- if (e->v.frame >= m->numframes)
- e->v.frame = m->numframes - 1;
+ e->v->frame = e->v->frame + 1;
+ if (e->v->frame >= m->numframes)
+ e->v->frame = m->numframes - 1;
- PrintFrameName (m, e->v.frame);
+ PrintFrameName (m, e->v->frame);
}
/*
if (!e)
return;
- m = cl.model_precache[(int)e->v.modelindex];
+ m = cl.model_precache[(int)e->v->modelindex];
- e->v.frame = e->v.frame - 1;
- if (e->v.frame < 0)
- e->v.frame = 0;
+ e->v->frame = e->v->frame - 1;
+ if (e->v->frame < 0)
+ e->v->frame = 0;
- PrintFrameName (m, e->v.frame);
+ PrintFrameName (m, e->v->frame);
}
/*
##### Variables that you may want to modify #####
#choose the compiler you want to use
-CC=gcc
+CC=gcc-3.1
#recommended for: anyone not using ALSA 0.5
OBJ_SND=snd_oss.o snd_dma.o snd_mix.o snd_mem.o
MSG_WriteByte(&net_message, playerNumber);
MSG_WriteString(&net_message, client->name);
MSG_WriteLong(&net_message, client->colors);
- MSG_WriteLong(&net_message, (int)client->edict->v.frags);
+ MSG_WriteLong(&net_message, (int)client->edict->v->frags);
MSG_WriteLong(&net_message, (int)(net_time - client->netconnection->connecttime));
MSG_WriteString(&net_message, client->netconnection->address);
*((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
{
edict_t *e;
float *org;
-
+
e = G_EDICT(OFS_PARM0);
org = G_VECTOR(OFS_PARM1);
- VectorCopy (org, e->v.origin);
+ VectorCopy (org, e->v->origin);
SV_LinkEdict (e, false);
}
Host_Error ("backwards mins/maxs");
// set derived values
- VectorCopy (min, e->v.mins);
- VectorCopy (max, e->v.maxs);
- VectorSubtract (max, min, e->v.size);
+ VectorCopy (min, e->v->mins);
+ VectorCopy (max, e->v->maxs);
+ VectorSubtract (max, min, e->v->size);
SV_LinkEdict (e, false);
}
Host_Error ("no precache: %s\n", m);
- e->v.model = m - pr_strings;
- e->v.modelindex = i;
+ e->v->model = m - pr_strings;
+ e->v->modelindex = i;
- mod = sv.models[ (int)e->v.modelindex];
+ mod = sv.models[ (int)e->v->modelindex];
if (mod)
SetMinMaxSize (e, mod->normalmins, mod->normalmaxs, true);
newvalue[2] = value1[2] * new;
}
- VectorCopy (newvalue, G_VECTOR(OFS_RETURN));
+ VectorCopy (newvalue, G_VECTOR(OFS_RETURN));
}
/*
if (ent->free)
continue;
- if (ent->v.health <= 0)
+ if (ent->v->health <= 0)
continue;
- if ((int)ent->v.flags & FL_NOTARGET)
+ if ((int)ent->v->flags & FL_NOTARGET)
continue;
// anything that is a client, or has a client as an enemy
}
// get the PVS for the entity
- VectorAdd (ent->v.origin, ent->v.view_ofs, org);
+ VectorAdd (ent->v->origin, ent->v->view_ofs, org);
leaf = Mod_PointInLeaf (org, sv.worldmodel);
pvs = Mod_LeafPVS (leaf, sv.worldmodel);
memcpy (checkpvs, pvs, (sv.worldmodel->numleafs+7)>>3 );
// return check if it might be visible
ent = EDICT_NUM(sv.lastcheck);
- if (ent->free || ent->v.health <= 0)
+ if (ent->free || ent->v->health <= 0)
{
RETURN_EDICT(sv.edicts);
return;
// if current entity can't possibly see the check entity, return 0
self = PROG_TO_EDICT(pr_global_struct->self);
- VectorAdd (self->v.origin, self->v.view_ofs, view);
+ VectorAdd (self->v->origin, self->v->view_ofs, view);
leaf = Mod_PointInLeaf (view, sv.worldmodel);
if (leaf)
{
int i;
chain = (edict_t *)sv.edicts;
-
+
org = G_VECTOR(OFS_PARM0);
radius = G_FLOAT(OFS_PARM1);
radius2 = radius * radius;
{
if (ent->free)
continue;
- if (ent->v.solid == SOLID_NOT)
+ if (ent->v->solid == SOLID_NOT)
continue;
// LordHavoc: compare against bounding box rather than center,
// and use DotProduct instead of Length, major speedup
- eorg[0] = (org[0] - ent->v.origin[0]) - bound(ent->v.mins[0], (org[0] - ent->v.origin[0]), ent->v.maxs[0]);
- eorg[1] = (org[1] - ent->v.origin[1]) - bound(ent->v.mins[1], (org[1] - ent->v.origin[1]), ent->v.maxs[1]);
- eorg[2] = (org[2] - ent->v.origin[2]) - bound(ent->v.mins[2], (org[2] - ent->v.origin[2]), ent->v.maxs[2]);
+ eorg[0] = (org[0] - ent->v->origin[0]) - bound(ent->v->mins[0], (org[0] - ent->v->origin[0]), ent->v->maxs[0]);
+ eorg[1] = (org[1] - ent->v->origin[1]) - bound(ent->v->mins[1], (org[1] - ent->v->origin[1]), ent->v->maxs[1]);
+ eorg[2] = (org[2] - ent->v->origin[2]) - bound(ent->v->mins[2], (org[2] - ent->v->origin[2]), ent->v->maxs[2]);
if (DotProduct(eorg, eorg) > radius2)
continue;
-
- ent->v.chain = EDICT_TO_PROG(chain);
+
+ ent->v->chain = EDICT_TO_PROG(chain);
chain = ent;
}
// LordHavoc: added this for searching float, int, and entity reference fields
void PF_FindFloat (void)
{
- int e;
+ int e;
int f;
float s;
edict_t *ed;
e = G_EDICTNUM(OFS_PARM0);
f = G_INT(OFS_PARM1);
s = G_FLOAT(OFS_PARM2);
-
+
for (e++ ; e < sv.num_edicts ; e++)
{
ed = EDICT_NUM(e);
// entity(.string field, string match) findchain = #402;
void PF_findchain (void)
{
- int i;
+ int i;
int f;
char *s, *t;
edict_t *ent, *chain;
RETURN_EDICT(sv.edicts);
return;
}
-
+
ent = NEXT_EDICT(sv.edicts);
for (i = 1;i < sv.num_edicts;i++, ent = NEXT_EDICT(ent))
{
if (strcmp(t,s))
continue;
- ent->v.chain = EDICT_TO_PROG(chain);
+ ent->v->chain = EDICT_TO_PROG(chain);
chain = ent;
}
// entity(.string field, float match) findchainfloat = #403;
void PF_findchainfloat (void)
{
- int i;
+ int i;
int f;
float s;
edict_t *ent, *chain;
f = G_INT(OFS_PARM0);
s = G_FLOAT(OFS_PARM1);
-
+
ent = NEXT_EDICT(sv.edicts);
for (i = 1;i < sv.num_edicts;i++, ent = NEXT_EDICT(ent))
{
if (E_FLOAT(ent,f) != s)
continue;
- ent->v.chain = EDICT_TO_PROG(chain);
+ ent->v->chain = EDICT_TO_PROG(chain);
chain = ent;
}
s = G_STRING(OFS_PARM0);
G_INT(OFS_RETURN) = G_INT(OFS_PARM0);
PR_CheckEmptyString (s);
-
+
for (i=0 ; i<MAX_SOUNDS ; i++)
{
if (!sv.sound_precache[i])
{
char *s;
int i;
-
+
if (sv.state != ss_loading)
Host_Error ("PF_Precache_*: Precache can only be done in spawn functions");
vec3_t move;
dfunction_t *oldf;
int oldself;
-
+
ent = PROG_TO_EDICT(pr_global_struct->self);
yaw = G_FLOAT(OFS_PARM0);
dist = G_FLOAT(OFS_PARM1);
-
- if ( !( (int)ent->v.flags & (FL_ONGROUND|FL_FLY|FL_SWIM) ) )
+
+ if ( !( (int)ent->v->flags & (FL_ONGROUND|FL_FLY|FL_SWIM) ) )
{
G_FLOAT(OFS_RETURN) = 0;
return;
}
yaw = yaw*M_PI*2 / 360;
-
+
move[0] = cos(yaw)*dist;
move[1] = sin(yaw)*dist;
move[2] = 0;
// save program state, because SV_movestep may call other progs
oldf = pr_xfunction;
oldself = pr_global_struct->self;
-
+
G_FLOAT(OFS_RETURN) = SV_movestep(ent, move, true);
-
-
+
+
// restore program state
pr_xfunction = oldf;
pr_global_struct->self = oldself;
ent = PROG_TO_EDICT(pr_global_struct->self);
- VectorCopy (ent->v.origin, end);
+ VectorCopy (ent->v->origin, end);
end[2] -= 256;
- trace = SV_Move (ent->v.origin, ent->v.mins, ent->v.maxs, end, MOVE_NORMAL, ent);
+ trace = SV_Move (ent->v->origin, ent->v->mins, ent->v->maxs, end, MOVE_NORMAL, ent);
if (trace.fraction == 1 || trace.allsolid)
G_FLOAT(OFS_RETURN) = 0;
else
{
- VectorCopy (trace.endpos, ent->v.origin);
+ VectorCopy (trace.endpos, ent->v->origin);
SV_LinkEdict (ent, false);
- ent->v.flags = (int)ent->v.flags | FL_ONGROUND;
- ent->v.groundentity = EDICT_TO_PROG(trace.ent);
+ ent->v->flags = (int)ent->v->flags | FL_ONGROUND;
+ ent->v->groundentity = EDICT_TO_PROG(trace.ent);
G_FLOAT(OFS_RETURN) = 1;
// if support is destroyed, keep suspended (gross hack for floating items in various maps)
ent->suspendedinairflag = true;
ent = G_EDICT(OFS_PARM0);
speed = G_FLOAT(OFS_PARM1);
- VectorCopy (ent->v.origin, start);
+ VectorCopy (ent->v->origin, start);
start[2] += 20;
// try sending a trace straight
VectorCopy (pr_global_struct->v_forward, dir);
VectorMA (start, 2048, dir, end);
tr = SV_Move (start, vec3_origin, vec3_origin, end, MOVE_NORMAL, ent);
- if (tr.ent && ((edict_t *)tr.ent)->v.takedamage == DAMAGE_AIM
- && (!teamplay.integer || ent->v.team <=0 || ent->v.team != ((edict_t *)tr.ent)->v.team) )
+ if (tr.ent && ((edict_t *)tr.ent)->v->takedamage == DAMAGE_AIM
+ && (!teamplay.integer || ent->v->team <=0 || ent->v->team != ((edict_t *)tr.ent)->v->team) )
{
VectorCopy (pr_global_struct->v_forward, G_VECTOR(OFS_RETURN));
return;
check = NEXT_EDICT(sv.edicts);
for (i=1 ; i<sv.num_edicts ; i++, check = NEXT_EDICT(check) )
{
- if (check->v.takedamage != DAMAGE_AIM)
+ if (check->v->takedamage != DAMAGE_AIM)
continue;
if (check == ent)
continue;
- if (teamplay.integer && ent->v.team > 0 && ent->v.team == check->v.team)
+ if (teamplay.integer && ent->v->team > 0 && ent->v->team == check->v->team)
continue; // don't aim at teammate
for (j=0 ; j<3 ; j++)
- end[j] = check->v.origin[j]
- + 0.5*(check->v.mins[j] + check->v.maxs[j]);
+ end[j] = check->v->origin[j]
+ + 0.5*(check->v->mins[j] + check->v->maxs[j]);
VectorSubtract (end, start, dir);
VectorNormalize (dir);
dist = DotProduct (dir, pr_global_struct->v_forward);
if (bestent)
{
- VectorSubtract (bestent->v.origin, ent->v.origin, dir);
+ VectorSubtract (bestent->v->origin, ent->v->origin, dir);
dist = DotProduct (dir, pr_global_struct->v_forward);
VectorScale (pr_global_struct->v_forward, dist, end);
end[2] = dir[2];
float ideal, current, move, speed;
ent = PROG_TO_EDICT(pr_global_struct->self);
- current = ANGLEMOD(ent->v.angles[1]);
- ideal = ent->v.ideal_yaw;
- speed = ent->v.yaw_speed;
+ current = ANGLEMOD(ent->v->angles[1]);
+ ideal = ent->v->ideal_yaw;
+ speed = ent->v->yaw_speed;
if (current == ideal)
return;
move = -speed;
}
- ent->v.angles[1] = ANGLEMOD (current + move);
+ ent->v->angles[1] = ANGLEMOD (current + move);
}
/*
eval_t *val;
ent = G_EDICT(OFS_PARM0);
- current = ANGLEMOD( ent->v.angles[0] );
+ current = ANGLEMOD( ent->v->angles[0] );
if ((val = GETEDICTFIELDVALUE(ent, eval_idealpitch)))
ideal = val->_float;
else
move = -speed;
}
- ent->v.angles[0] = ANGLEMOD (current + move);
+ ent->v->angles[0] = ANGLEMOD (current + move);
}
/*
ent = G_EDICT(OFS_PARM0);
large = false;
- if (ent->v.modelindex >= 256 || ent->v.frame >= 256)
+ if (ent->v->modelindex >= 256 || ent->v->frame >= 256)
large = true;
if (large)
{
MSG_WriteByte (&sv.signon,svc_spawnstatic2);
- MSG_WriteShort (&sv.signon, ent->v.modelindex);
- MSG_WriteShort (&sv.signon, ent->v.frame);
+ MSG_WriteShort (&sv.signon, ent->v->modelindex);
+ MSG_WriteShort (&sv.signon, ent->v->frame);
}
else
{
MSG_WriteByte (&sv.signon,svc_spawnstatic);
- MSG_WriteByte (&sv.signon, ent->v.modelindex);
- MSG_WriteByte (&sv.signon, ent->v.frame);
+ MSG_WriteByte (&sv.signon, ent->v->modelindex);
+ MSG_WriteByte (&sv.signon, ent->v->frame);
}
- MSG_WriteByte (&sv.signon, ent->v.colormap);
- MSG_WriteByte (&sv.signon, ent->v.skin);
+ MSG_WriteByte (&sv.signon, ent->v->colormap);
+ MSG_WriteByte (&sv.signon, ent->v->skin);
for (i=0 ; i<3 ; i++)
{
- MSG_WriteDPCoord(&sv.signon, ent->v.origin[i]);
- MSG_WriteAngle(&sv.signon, ent->v.angles[i]);
+ MSG_WriteDPCoord(&sv.signon, ent->v->origin[i]);
+ MSG_WriteAngle(&sv.signon, ent->v->angles[i]);
}
// throw the entity away now
edict_t *in, *out;
in = G_EDICT(OFS_PARM0);
out = G_EDICT(OFS_PARM1);
- memcpy(&out->v, &in->v, progs->entityfields * 4);
+ memcpy(out->v, in->v, progs->entityfields * 4);
}
/*
client = &svs.clients[entnum-1];
client->colors = i;
- client->edict->v.team = (i & 15) + 1;
+ client->edict->v->team = (i & 15) + 1;
MSG_WriteByte (&sv.reliable_datagram, svc_updatecolors);
MSG_WriteByte (&sv.reliable_datagram, entnum - 1);
model_t *model;
if (!ed || ed->free)
return NULL;
- modelindex = ed->v.modelindex;
+ modelindex = ed->v->modelindex;
if (modelindex < 1 || modelindex >= MAX_MODELS)
return NULL;
model = sv.models[modelindex];
if (pointnum < 0 || pointnum >= surf->poly_numverts)
return;
// FIXME: implement rotation/scaling
- VectorAdd(&surf->poly_verts[pointnum * 3], ed->v.origin, G_VECTOR(OFS_RETURN));
+ VectorAdd(&surf->poly_verts[pointnum * 3], ed->v->origin, G_VECTOR(OFS_RETURN));
}
//PF_getsurfacenormal, // #436 vector(entity e, float s) getsurfacenormal = #436;
void PF_getsurfacenormal(void)
if (!ed || ed->free)
return;
- modelindex = ed->v.modelindex;
+ modelindex = ed->v->modelindex;
if (modelindex < 1 || modelindex >= MAX_MODELS)
return;
model = sv.models[modelindex];
return;
// FIXME: implement rotation/scaling
- VectorSubtract(point, ed->v.origin, p);
+ VectorSubtract(point, ed->v->origin, p);
best = -1;
bestdist = 1000000000;
for (surfnum = 0;surfnum < model->nummodelsurfaces;surfnum++)
if (!(surf = getsurface(ed, G_FLOAT(OFS_PARM1))))
return;
// FIXME: implement rotation/scaling
- VectorSubtract(G_VECTOR(OFS_PARM2), ed->v.origin, p);
+ VectorSubtract(G_VECTOR(OFS_PARM2), ed->v->origin, p);
clippointtosurface(surf, p, out);
// FIXME: implement rotation/scaling
- VectorAdd(out, ed->v.origin, G_VECTOR(OFS_RETURN));
+ VectorAdd(out, ed->v->origin, G_VECTOR(OFS_RETURN));
}
void PF_Fixme (void)
*/
void ED_ClearEdict (edict_t *e)
{
- memset (&e->v, 0, progs->entityfields * 4);
+ memset (e->v, 0, progs->entityfields * 4);
e->free = false;
}
SV_UnlinkEdict (ed); // unlink from world bsp
ed->free = true;
- ed->v.model = 0;
- ed->v.takedamage = 0;
- ed->v.modelindex = 0;
- ed->v.colormap = 0;
- ed->v.skin = 0;
- ed->v.frame = 0;
- VectorClear(ed->v.origin);
- VectorClear(ed->v.angles);
- ed->v.nextthink = -1;
- ed->v.solid = 0;
+ ed->v->model = 0;
+ ed->v->takedamage = 0;
+ ed->v->modelindex = 0;
+ ed->v->colormap = 0;
+ ed->v->skin = 0;
+ ed->v->frame = 0;
+ VectorClear(ed->v->origin);
+ VectorClear(ed->v->angles);
+ ed->v->nextthink = -1;
+ ed->v->solid = 0;
ed->freetime = sv.time;
}
if (name[strlen(name)-2] == '_')
continue; // skip _x, _y, _z vars
- v = (int *)((char *)&ed->v + d->ofs*4);
+ v = (int *)((char *)ed->v + d->ofs*4);
// if the value is still all 0, skip the field
type = d->type & ~DEF_SAVEGLOBAL;
if (name[strlen(name)-2] == '_')
continue; // skip _x, _y, _z vars
- v = (int *)((char *)&ed->v + d->ofs*4);
+ v = (int *)((char *)ed->v + d->ofs*4);
// if the value is still all 0, skip the field
type = d->type & ~DEF_SAVEGLOBAL;
if (ent->free)
continue;
active++;
- if (ent->v.solid)
+ if (ent->v->solid)
solid++;
- if (ent->v.model)
+ if (ent->v->model)
models++;
- if (ent->v.movetype == MOVETYPE_STEP)
+ if (ent->v->movetype == MOVETYPE_STEP)
step++;
}
// clear it
if (ent != sv.edicts) // hack
- memset (&ent->v, 0, progs->entityfields * 4);
+ memset (ent->v, 0, progs->entityfields * 4);
// go through all the dictionary pairs
while (1)
sprintf (com_token, "0 %s 0", temp);
}
- if (!ED_ParseEpair ((void *)&ent->v, key, com_token))
+ if (!ED_ParseEpair ((void *)ent->v, key, com_token))
Host_Error ("ED_ParseEdict: parse error");
}
// remove things from different skill levels or deathmatch
if (deathmatch.integer)
{
- if (((int)ent->v.spawnflags & SPAWNFLAG_NOT_DEATHMATCH))
+ if (((int)ent->v->spawnflags & SPAWNFLAG_NOT_DEATHMATCH))
{
ED_Free (ent);
inhibit++;
continue;
}
}
- else if ((current_skill == 0 && ((int)ent->v.spawnflags & SPAWNFLAG_NOT_EASY ))
- || (current_skill == 1 && ((int)ent->v.spawnflags & SPAWNFLAG_NOT_MEDIUM))
- || (current_skill >= 2 && ((int)ent->v.spawnflags & SPAWNFLAG_NOT_HARD )))
+ else if ((current_skill == 0 && ((int)ent->v->spawnflags & SPAWNFLAG_NOT_EASY ))
+ || (current_skill == 1 && ((int)ent->v->spawnflags & SPAWNFLAG_NOT_MEDIUM))
+ || (current_skill >= 2 && ((int)ent->v->spawnflags & SPAWNFLAG_NOT_HARD )))
{
- ED_Free (ent);
+ ED_Free (ent);
inhibit++;
continue;
}
//
// immediately call spawn function
//
- if (!ent->v.classname)
+ if (!ent->v->classname)
{
Con_Printf ("No classname for:\n");
ED_Print (ent);
}
// look for the spawn function
- func = ED_FindFunction ( pr_strings + ent->v.classname );
+ func = ED_FindFunction ( pr_strings + ent->v->classname );
if (!func)
{
((int *)pr_globals)[i] = LittleLong (((int *)pr_globals)[i]);
// moved edict_size calculation down here, below field adding code
- pr_edict_size = progs->entityfields * 4 + sizeof (edict_t) - sizeof(entvars_t);
-
+ // LordHavoc: this no longer includes the edict_t header
+ pr_edict_size = progs->entityfields * 4;
pr_edictareasize = pr_edict_size * MAX_EDICTS;
// LordHavoc: bounds check anything static
name = pr_strings + d->s_name;
if (name[strlen(name)-2] == '_')
continue; // skip _x, _y, _z vars
- v = (int *)((char *)&ed->v + d->ofs*4);
+ v = (int *)((char *)ed->v + d->ofs*4);
// if the value is still all 0, skip the field
for (j = 0;j < type_size[d->type & ~DEF_SAVEGLOBAL];j++)
{
int NUM_FOR_EDICT(edict_t *e)
{
- if ((qbyte *)e < (qbyte *)sv.edicts || (qbyte *)e > (qbyte *)sv.edicts + pr_edictareasize)
+ int n;
+ n = e - sv.edicts;
+ if ((unsigned int)n >= MAX_EDICTS)
Host_Error ("NUM_FOR_EDICT: bad pointer");
- return e->number;
+ return n;
}
int NoCrash_NUM_FOR_EDICT(edict_t *e)
{
- return e->number;
+ return e - sv.edicts;
+}
+
+//#define EDICT_TO_PROG(e) ((qbyte *)(((edict_t *)e)->v) - (qbyte *)(sv.edictsfields))
+//#define PROG_TO_EDICT(e) (sv.edictstable[(e) / (progs->entityfields * 4)])
+int EDICT_TO_PROG(edict_t *e)
+{
+ int n;
+ n = e - sv.edicts;
+ if ((unsigned int)n >= sv.max_edicts)
+ Host_Error("EDICT_TO_PROG: invalid edict %8p (number %i compared to world at %8p)\n", e, n, sv.edicts);
+ return n;// EXPERIMENTAL
+ //return (qbyte *)e->v - (qbyte *)sv.edictsfields;
+}
+edict_t *PROG_TO_EDICT(int n)
+{
+ if ((unsigned int)n >= sv.max_edicts)
+ Host_Error("PROG_TO_EDICT: invalid edict number %i\n", n);
+ return sv.edictstable[n]; // EXPERIMENTAL
+ //return sv.edictstable[(n) / (progs->entityfields * 4)];
}
void PR_PrintStatement (dstatement_t *s)
{
int i;
-
+
if ( (unsigned)s->op < sizeof(pr_opnames)/sizeof(pr_opnames[0]))
{
Con_Printf ("%s ", pr_opnames[s->op]);
for ( ; i<10 ; i++)
Con_Printf (" ");
}
-
+
if (s->op == OP_IF || s->op == OP_IFNOT)
Con_Printf ("%sbranch %i",PR_GlobalString((unsigned short) s->a),s->b);
else if (s->op == OP_GOTO)
}
else if ( (unsigned)(s->op - OP_STORE_F) < 6)
{
- Con_Printf ("%s",PR_GlobalString((unsigned short) s->a));
+ Con_Printf ("%s", PR_GlobalString((unsigned short) s->a));
Con_Printf ("%s", PR_GlobalStringNoContents((unsigned short) s->b));
}
else
{
if (s->a)
- Con_Printf ("%s",PR_GlobalString((unsigned short) s->a));
+ Con_Printf ("%s", PR_GlobalString((unsigned short) s->a));
if (s->b)
- Con_Printf ("%s",PR_GlobalString((unsigned short) s->b));
+ Con_Printf ("%s", PR_GlobalString((unsigned short) s->b));
if (s->c)
Con_Printf ("%s", PR_GlobalStringNoContents((unsigned short) s->c));
}
OPC->_float = !OPA->function;
break;
case OP_NOT_ENT:
- OPC->_float = (PROG_TO_EDICT(OPA->edict) == sv.edicts);
+ OPC->_float = (OPA->edict == 0);
break;
case OP_EQ_F:
OPC->_float = OPA->_float == OPB->_float;
if (OPB->_int < 0 || OPB->_int + 4 > pr_edictareasize)
{
pr_xstatement = st - pr_statements;
- Host_Error("Progs attempted to write to an out of bounds edict\n");
- return;
- }
- if (OPB->_int % pr_edict_size < ((qbyte *)&sv.edicts->v - (qbyte *)sv.edicts))
- {
- pr_xstatement = st - pr_statements;
- Host_Error("Progs attempted to write to an engine edict field\n");
+ Host_Error("Progs attempted to write to an out of bounds edict (%i)\n", OPB->_int);
return;
}
#endif
- ptr = (eval_t *)((qbyte *)sv.edicts + OPB->_int);
+ ptr = (eval_t *)((qbyte *)sv.edictsfields + OPB->_int);
ptr->_int = OPA->_int;
break;
case OP_STOREP_V:
if (OPB->_int < 0 || OPB->_int + 12 > pr_edictareasize)
{
pr_xstatement = st - pr_statements;
- Host_Error("Progs attempted to write to an out of bounds edict\n");
+ Host_Error("Progs attempted to write to an out of bounds edict (%i)\n", OPB->_int);
return;
}
#endif
- ptr = (eval_t *)((qbyte *)sv.edicts + OPB->_int);
+ ptr = (eval_t *)((qbyte *)sv.edictsfields + OPB->_int);
ptr->vector[0] = OPA->vector[0];
ptr->vector[1] = OPA->vector[1];
ptr->vector[2] = OPA->vector[2];
break;
case OP_ADDRESS:
+ pr_xstatement = st - pr_statements;
#if PRBOUNDSCHECK
- if (OPA->edict <= 0)
- {
- if (OPA->edict == 0 && sv.state == ss_active)
- {
- pr_xstatement = st - pr_statements;
- Host_Error ("assignment to world entity");
- return;
- }
- else
- {
- pr_xstatement = st - pr_statements;
- Host_Error("Progs attempted to address an out of bounds edict\n");
- return;
- }
- }
- else if (OPA->edict >= pr_edictareasize)
+ if ((unsigned int)OPB->_int >= progs->entityfields)
{
- pr_xstatement = st - pr_statements;
- Host_Error("Progs attempted to address an out of bounds edict\n");
+ Host_Error("Progs attempted to address an invalid field (%i) in an edict\n", OPB->_int);
return;
}
- if (OPB->_int < 0 || OPB->_int >= progs->entityfields)
- {
- pr_xstatement = st - pr_statements;
- Host_Error("Progs attempted to address an invalid field in an edict\n");
- return;
- }
-#else
+#endif
if (OPA->edict == 0 && sv.state == ss_active)
{
- pr_xstatement = st - pr_statements;
Host_Error ("assignment to world entity");
return;
}
-#endif
ed = PROG_TO_EDICT(OPA->edict);
- OPC->_int = (qbyte *)((int *)&ed->v + OPB->_int) - (qbyte *)sv.edicts;
+ OPC->_int = (qbyte *)((int *)ed->v + OPB->_int) - (qbyte *)sv.edictsfields;
break;
case OP_LOAD_F:
case OP_LOAD_ENT:
case OP_LOAD_S:
case OP_LOAD_FNC:
+ pr_xstatement = st - pr_statements;
#if PRBOUNDSCHECK
- if (OPA->edict < 0 || OPA->edict >= pr_edictareasize)
+ if ((unsigned int)OPB->_int >= progs->entityfields)
{
- pr_xstatement = st - pr_statements;
- Host_Error("Progs attempted to read an out of bounds edict number\n");
- return;
- }
- if (OPB->_int < 0 || OPB->_int >= progs->entityfields)
- {
- pr_xstatement = st - pr_statements;
- Host_Error("Progs attempted to read an invalid field in an edict\n");
+ Host_Error("Progs attempted to read an invalid field in an edict (%i)\n", OPB->_int);
return;
}
#endif
ed = PROG_TO_EDICT(OPA->edict);
- OPC->_int = ((eval_t *)((int *)&ed->v + OPB->_int))->_int;
+ OPC->_int = ((eval_t *)((int *)ed->v + OPB->_int))->_int;
break;
case OP_LOAD_V:
+ pr_xstatement = st - pr_statements;
#if PRBOUNDSCHECK
- if (OPA->edict < 0 || OPA->edict >= pr_edictareasize)
- {
- pr_xstatement = st - pr_statements;
- Host_Error("Progs attempted to read an out of bounds edict number\n");
- return;
- }
if (OPB->_int < 0 || OPB->_int + 2 >= progs->entityfields)
{
- pr_xstatement = st - pr_statements;
- Host_Error("Progs attempted to read an invalid field in an edict\n");
+ Host_Error("Progs attempted to read an invalid field in an edict (%i)\n", OPB->_int);
return;
}
#endif
ed = PROG_TO_EDICT(OPA->edict);
- OPC->vector[0] = ((eval_t *)((int *)&ed->v + OPB->_int))->vector[0];
- OPC->vector[1] = ((eval_t *)((int *)&ed->v + OPB->_int))->vector[1];
- OPC->vector[2] = ((eval_t *)((int *)&ed->v + OPB->_int))->vector[2];
+ OPC->vector[0] = ((eval_t *)((int *)ed->v + OPB->_int))->vector[0];
+ OPC->vector[1] = ((eval_t *)((int *)ed->v + OPB->_int))->vector[1];
+ OPC->vector[2] = ((eval_t *)((int *)ed->v + OPB->_int))->vector[2];
break;
//==================
case OP_STATE:
ed = PROG_TO_EDICT(pr_global_struct->self);
- ed->v.nextthink = pr_global_struct->time + 0.1;
- ed->v.frame = OPA->_float;
- ed->v.think = OPB->function;
+ ed->v->nextthink = pr_global_struct->time + 0.1;
+ ed->v->frame = OPA->_float;
+ ed->v->think = OPB->function;
break;
// LordHavoc: to be enabled when Progs version 7 (or whatever it will be numbered) is finalized
Host_Error("Progs attempted to write to an out of bounds edict\n");
return;
}
- if (OPB->_int % pr_edict_size < ((qbyte *)&sv.edicts->v - (qbyte *)sv.edicts))
- {
- pr_xstatement = st - pr_statements;
- Host_Error("Progs attempted to write to an engine edict field\n");
- return;
- }
#endif
- ptr = (eval_t *)((qbyte *)sv.edicts + OPB->_int);
+ ptr = (eval_t *)((qbyte *)sv.edictsfields + OPB->_int);
ptr->_int = OPA->_int;
break;
case OP_LOAD_I:
}
#endif
ed = PROG_TO_EDICT(OPA->edict);
- OPC->_int = ((eval_t *)((int *)&ed->v + OPB->_int))->_int;
+ OPC->_int = ((eval_t *)((int *)ed->v + OPB->_int))->_int;
break;
case OP_GSTOREP_I:
{
qboolean free; // true if this edict is unused
link_t area; // physics area this edict is linked into
- int number; // number of this edict
#ifdef QUAKEENTITIES
entity_state_t baseline; // baseline values
int suspendedinairflag; // LordHavoc: gross hack to make floating items still work
float freetime; // sv.time when the object was freed
- entvars_t v; // C exported fields from progs
-// other fields from progs come immediately after
+ entvars_t *v; // edict fields
} edict_t;
// LordHavoc: in an effort to eliminate time wasted on GetEdictFieldValue... see pr_edict.c for the functions which use these.
extern int eval_punchvector;
extern int eval_viewzoom;
-#define GETEDICTFIELDVALUE(ed, fieldoffset) (fieldoffset ? (eval_t*)((char*)&ed->v + fieldoffset) : NULL)
+#define GETEDICTFIELDVALUE(ed, fieldoffset) (fieldoffset ? (eval_t *)((qbyte *)ed->v + fieldoffset) : NULL)
extern dfunction_t *SV_PlayerPhysicsQC;
int NUM_FOR_EDICT(edict_t *e);
-#define NEXT_EDICT(e) ((edict_t *)( (qbyte *)e + pr_edict_size))
+#define NEXT_EDICT(e) ((e) + 1)
-#define EDICT_TO_PROG(e) ((qbyte *)e - (qbyte *)sv.edicts)
-#define PROG_TO_EDICT(e) ((edict_t *)((qbyte *)sv.edicts + e))
+int EDICT_TO_PROG(edict_t *e);
+edict_t *PROG_TO_EDICT(int n);
//============================================================================
#define G_FLOAT(o) (pr_globals[o])
#define G_INT(o) (*(int *)&pr_globals[o])
-#define G_EDICT(o) ((edict_t *)((qbyte *)sv.edicts+ *(int *)&pr_globals[o]))
+#define G_EDICT(o) (PROG_TO_EDICT(*(int *)&pr_globals[o]))
#define G_EDICTNUM(o) NUM_FOR_EDICT(G_EDICT(o))
#define G_VECTOR(o) (&pr_globals[o])
#define G_STRING(o) (pr_strings + *(string_t *)&pr_globals[o])
-#define G_FUNCTION(o) (*(func_t *)&pr_globals[o])
+//#define G_FUNCTION(o) (*(func_t *)&pr_globals[o])
-#define E_FLOAT(e,o) (((float*)&e->v)[o])
-#define E_INT(e,o) (*(int *)&((float*)&e->v)[o])
-#define E_VECTOR(e,o) (&((float*)&e->v)[o])
-#define E_STRING(e,o) (pr_strings + *(string_t *)&((float*)&e->v)[o])
+// FIXME: make these go away?
+#define E_FLOAT(e,o) (((float*)e->v)[o])
+//#define E_INT(e,o) (((int*)e->v)[o])
+//#define E_VECTOR(e,o) (&((float*)e->v)[o])
+#define E_STRING(e,o) (pr_strings + *(string_t *)&((float*)e->v)[o])
extern int type_size[8];
edict_t *edicts;
// can be array indexed
edict_t **edictstable;
+ // array of QC edict field variables
+ void *edictsfields;
// some actions are only valid during load
server_state_t state;
else
MSG_WriteByte (&sv.datagram, sound_num);
for (i=0 ; i<3 ; i++)
- MSG_WriteDPCoord (&sv.datagram, entity->v.origin[i]+0.5*(entity->v.mins[i]+entity->v.maxs[i]));
+ MSG_WriteDPCoord (&sv.datagram, entity->v->origin[i]+0.5*(entity->v->mins[i]+entity->v->maxs[i]));
}
/*
else
MSG_WriteByte (&client->message, GAME_COOP);
- sprintf (message, pr_strings+sv.edicts->v.message);
+ sprintf (message, pr_strings+sv.edicts->v->message);
MSG_WriteString (&client->message,message);
// send music
MSG_WriteByte (&client->message, svc_cdtrack);
- MSG_WriteByte (&client->message, sv.edicts->v.sounds);
- MSG_WriteByte (&client->message, sv.edicts->v.sounds);
+ MSG_WriteByte (&client->message, sv.edicts->v->sounds);
+ MSG_WriteByte (&client->message, sv.edicts->v->sounds);
// set view
MSG_WriteByte (&client->message, svc_setview);
Mod_CheckLoaded(sv.worldmodel);
// find the client's PVS
- VectorAdd (clent->v.origin, clent->v.view_ofs, testeye);
+ VectorAdd (clent->v->origin, clent->v->view_ofs, testeye);
pvs = SV_FatPVS (testeye);
culled_pvs = 0;
if (val->_float != 0)
bits |= U_GLOWTRAIL;
- if (ent->v.modelindex >= 0 && ent->v.modelindex < MAX_MODELS && pr_strings[ent->v.model])
+ if (ent->v->modelindex >= 0 && ent->v->modelindex < MAX_MODELS && pr_strings[ent->v->model])
{
- model = sv.models[(int)ent->v.modelindex];
+ model = sv.models[(int)ent->v->modelindex];
Mod_CheckLoaded(model);
}
else
continue;
}
- VectorCopy(ent->v.angles, angles);
- if (DotProduct(ent->v.velocity, ent->v.velocity) >= 1.0f)
+ VectorCopy(ent->v->angles, angles);
+ if (DotProduct(ent->v->velocity, ent->v->velocity) >= 1.0f)
{
- VectorMA(ent->v.origin, host_client->latency, ent->v.velocity, origin);
+ VectorMA(ent->v->origin, host_client->latency, ent->v->velocity, origin);
// LordHavoc: trace predicted movement to avoid putting things in walls
- trace = SV_Move (ent->v.origin, ent->v.mins, ent->v.maxs, origin, MOVE_NORMAL, ent);
+ trace = SV_Move (ent->v->origin, ent->v->mins, ent->v->maxs, origin, MOVE_NORMAL, ent);
VectorCopy(trace.endpos, origin);
}
else
{
- VectorCopy(ent->v.origin, origin);
+ VectorCopy(ent->v->origin, origin);
}
// ent has survived every check so far, check if it is visible
// using the model's bounding box to ensure things are visible regardless of their physics box
if (model)
{
- if (ent->v.angles[0] || ent->v.angles[2]) // pitch and roll
+ if (ent->v->angles[0] || ent->v->angles[2]) // pitch and roll
{
VectorAdd(entmins, model->rotatedmins, entmins);
VectorAdd(entmaxs, model->rotatedmaxs, entmaxs);
}
- else if (ent->v.angles[1])
+ else if (ent->v->angles[1])
{
VectorAdd(entmins, model->yawmins, entmins);
VectorAdd(entmaxs, model->yawmaxs, entmaxs);
alphaf = 255.0f;
scale = 16;
glowcolor = 254;
- effects = ent->v.effects;
+ effects = ent->v->effects;
if ((val = GETEDICTFIELDVALUE(ent, eval_alpha)))
if (val->_float != 0)
// send an update
baseline = &ent->baseline;
- if (((int)ent->v.effects & EF_DELTA) && sv_deltacompress.integer)
+ if (((int)ent->v->effects & EF_DELTA) && sv_deltacompress.integer)
{
// every half second a full update is forced
if (realtime < client->nextfullupdate[e])
if (e >= 256)
bits |= U_LONGENTITY;
- if (ent->v.movetype == MOVETYPE_STEP)
+ if (ent->v->movetype == MOVETYPE_STEP)
bits |= U_STEP;
// LordHavoc: old stuff, but rewritten to have more exact tolerances
if (((int)(angles[0]*(256.0/360.0)) & 255) != ((int)(baseline->angles[0]*(256.0/360.0)) & 255)) bits |= U_ANGLE1;
if (((int)(angles[1]*(256.0/360.0)) & 255) != ((int)(baseline->angles[1]*(256.0/360.0)) & 255)) bits |= U_ANGLE2;
if (((int)(angles[2]*(256.0/360.0)) & 255) != ((int)(baseline->angles[2]*(256.0/360.0)) & 255)) bits |= U_ANGLE3;
- if (baseline->colormap != (qbyte) ent->v.colormap) bits |= U_COLORMAP;
- if (baseline->skin != (qbyte) ent->v.skin) bits |= U_SKIN;
- if ((baseline->frame & 0x00FF) != ((int) ent->v.frame & 0x00FF)) bits |= U_FRAME;
- if ((baseline->effects & 0x00FF) != ((int) ent->v.effects & 0x00FF)) bits |= U_EFFECTS;
- if ((baseline->modelindex & 0x00FF) != ((int) ent->v.modelindex & 0x00FF)) bits |= U_MODEL;
+ if (baseline->colormap != (qbyte) ent->v->colormap) bits |= U_COLORMAP;
+ if (baseline->skin != (qbyte) ent->v->skin) bits |= U_SKIN;
+ if ((baseline->frame & 0x00FF) != ((int) ent->v->frame & 0x00FF)) bits |= U_FRAME;
+ if ((baseline->effects & 0x00FF) != ((int) ent->v->effects & 0x00FF)) bits |= U_EFFECTS;
+ if ((baseline->modelindex & 0x00FF) != ((int) ent->v->modelindex & 0x00FF)) bits |= U_MODEL;
// LordHavoc: new stuff
if (baseline->alpha != alpha) bits |= U_ALPHA;
if (baseline->scale != scale) bits |= U_SCALE;
- if (((int) baseline->effects & 0xFF00) != ((int) ent->v.effects & 0xFF00)) bits |= U_EFFECTS2;
+ if (((int) baseline->effects & 0xFF00) != ((int) ent->v->effects & 0xFF00)) bits |= U_EFFECTS2;
if (baseline->glowsize != glowsize) bits |= U_GLOWSIZE;
if (baseline->glowcolor != glowcolor) bits |= U_GLOWCOLOR;
- if (((int) baseline->frame & 0xFF00) != ((int) ent->v.frame & 0xFF00)) bits |= U_FRAME2;
- if (((int) baseline->frame & 0xFF00) != ((int) ent->v.modelindex & 0xFF00)) bits |= U_MODEL2;
+ if (((int) baseline->frame & 0xFF00) != ((int) ent->v->frame & 0xFF00)) bits |= U_FRAME2;
+ if (((int) baseline->frame & 0xFF00) != ((int) ent->v->modelindex & 0xFF00)) bits |= U_MODEL2;
// update delta baseline
- VectorCopy(ent->v.origin, ent->deltabaseline.origin);
- VectorCopy(ent->v.angles, ent->deltabaseline.angles);
- ent->deltabaseline.colormap = ent->v.colormap;
- ent->deltabaseline.skin = ent->v.skin;
- ent->deltabaseline.frame = ent->v.frame;
- ent->deltabaseline.effects = ent->v.effects;
- ent->deltabaseline.modelindex = ent->v.modelindex;
+ VectorCopy(ent->v->origin, ent->deltabaseline.origin);
+ VectorCopy(ent->v->angles, ent->deltabaseline.angles);
+ ent->deltabaseline.colormap = ent->v->colormap;
+ ent->deltabaseline.skin = ent->v->skin;
+ ent->deltabaseline.frame = ent->v->frame;
+ ent->deltabaseline.effects = ent->v->effects;
+ ent->deltabaseline.modelindex = ent->v->modelindex;
ent->deltabaseline.alpha = alpha;
ent->deltabaseline.scale = scale;
ent->deltabaseline.glowsize = glowsize;
MSG_WriteShort (msg,e);
else
MSG_WriteByte (msg,e);
- if (bits & U_MODEL) MSG_WriteByte (msg, ent->v.modelindex);
- if (bits & U_FRAME) MSG_WriteByte (msg, ent->v.frame);
- if (bits & U_COLORMAP) MSG_WriteByte (msg, ent->v.colormap);
- if (bits & U_SKIN) MSG_WriteByte (msg, ent->v.skin);
- if (bits & U_EFFECTS) MSG_WriteByte (msg, ent->v.effects);
+ if (bits & U_MODEL) MSG_WriteByte (msg, ent->v->modelindex);
+ if (bits & U_FRAME) MSG_WriteByte (msg, ent->v->frame);
+ if (bits & U_COLORMAP) MSG_WriteByte (msg, ent->v->colormap);
+ if (bits & U_SKIN) MSG_WriteByte (msg, ent->v->skin);
+ if (bits & U_EFFECTS) MSG_WriteByte (msg, ent->v->effects);
if (bits & U_ORIGIN1) MSG_WriteDPCoord (msg, origin[0]);
if (bits & U_ANGLE1) MSG_WriteAngle(msg, angles[0]);
if (bits & U_ORIGIN2) MSG_WriteDPCoord (msg, origin[1]);
// LordHavoc: new stuff
if (bits & U_ALPHA) MSG_WriteByte(msg, alpha);
if (bits & U_SCALE) MSG_WriteByte(msg, scale);
- if (bits & U_EFFECTS2) MSG_WriteByte(msg, (int)ent->v.effects >> 8);
+ if (bits & U_EFFECTS2) MSG_WriteByte(msg, (int)ent->v->effects >> 8);
if (bits & U_GLOWSIZE) MSG_WriteByte(msg, glowsize);
if (bits & U_GLOWCOLOR) MSG_WriteByte(msg, glowcolor);
- if (bits & U_FRAME2) MSG_WriteByte(msg, (int)ent->v.frame >> 8);
- if (bits & U_MODEL2) MSG_WriteByte(msg, (int)ent->v.modelindex >> 8);
+ if (bits & U_FRAME2) MSG_WriteByte(msg, (int)ent->v->frame >> 8);
+ if (bits & U_MODEL2) MSG_WriteByte(msg, (int)ent->v->modelindex >> 8);
}
if (sv_cullentities_stats.integer)
// find the client's PVS
// the real place being tested from
- VectorAdd (clent->v.origin, clent->v.view_ofs, testeye);
+ VectorAdd (clent->v->origin, clent->v->view_ofs, testeye);
pvs = SV_FatPVS (testeye);
// the place being reported (to consider the fact the client still
// applies the view_ofs[2], so we have to only send the fractional part
// of view_ofs[2], undoing what the client will redo)
VectorCopy (testeye, testorigin);
- e = (int) clent->v.view_ofs[2] & 255;
+ e = (int) clent->v->view_ofs[2] & 255;
if (e >= 128)
e -= 256;
testorigin[2] -= (float) e;
}
glowsize = 0;
- effects = ent->v.effects;
+ effects = ent->v->effects;
if ((val = GETEDICTFIELDVALUE(ent, eval_glow_size)))
glowsize = (int) val->_float >> 2;
glowsize = bound(0, glowsize, 255);
}
modelindex = 0;
- if (ent->v.modelindex >= 0 && ent->v.modelindex < MAX_MODELS && pr_strings[ent->v.model])
+ if (ent->v->modelindex >= 0 && ent->v->modelindex < MAX_MODELS && pr_strings[ent->v->model])
{
- modelindex = ent->v.modelindex;
- model = sv.models[(int)ent->v.modelindex];
+ modelindex = ent->v->modelindex;
+ model = sv.models[(int)ent->v->modelindex];
Mod_CheckLoaded(model);
}
else
continue;
}
- VectorCopy(ent->v.angles, angles);
- if (DotProduct(ent->v.velocity, ent->v.velocity) >= 1.0f && host_client->latency >= 0.01f)
+ VectorCopy(ent->v->angles, angles);
+ if (DotProduct(ent->v->velocity, ent->v->velocity) >= 1.0f && host_client->latency >= 0.01f)
{
- VectorMA(ent->v.origin, host_client->latency, ent->v.velocity, origin);
+ VectorMA(ent->v->origin, host_client->latency, ent->v->velocity, origin);
// LordHavoc: trace predicted movement to avoid putting things in walls
- trace = SV_Move (ent->v.origin, ent->v.mins, ent->v.maxs, origin, MOVE_NORMAL, ent);
+ trace = SV_Move (ent->v->origin, ent->v->mins, ent->v->maxs, origin, MOVE_NORMAL, ent);
VectorCopy(trace.endpos, origin);
}
else
{
- VectorCopy(ent->v.origin, origin);
+ VectorCopy(ent->v->origin, origin);
}
// ent has survived every check so far, check if it is visible
// using the model's bounding box to ensure things are visible regardless of their physics box
if (model)
{
- if (ent->v.angles[0] || ent->v.angles[2]) // pitch and roll
+ if (ent->v->angles[0] || ent->v->angles[2]) // pitch and roll
{
VectorAdd(entmins, model->rotatedmins, entmins);
VectorAdd(entmaxs, model->rotatedmaxs, entmaxs);
}
- else if (ent->v.angles[1])
+ else if (ent->v->angles[1])
{
VectorAdd(entmins, model->yawmins, entmins);
VectorAdd(entmaxs, model->yawmaxs, entmaxs);
alphaf = 255.0f;
scale = 16;
glowcolor = 254;
- effects = ent->v.effects;
+ effects = ent->v->effects;
if ((val = GETEDICTFIELDVALUE(ent, eval_alpha)))
if (val->_float != 0)
if ((val = GETEDICTFIELDVALUE(ent, eval_exteriormodeltoclient)) && val->edict == clentnum)
flags |= RENDER_EXTERIORMODEL;
- if (ent->v.movetype == MOVETYPE_STEP)
+ if (ent->v->movetype == MOVETYPE_STEP)
flags |= RENDER_STEP;
// don't send an entity if it's coordinates would wrap around
if ((effects & EF_LOWPRECISION) && origin[0] >= -32768 && origin[1] >= -32768 && origin[2] >= -32768 && origin[0] <= 32767 && origin[1] <= 32767 && origin[2] <= 32767)
break;
VectorCopy(origin, s->origin);
VectorCopy(angles, s->angles);
- if (ent->v.colormap >= 1024)
+ if (ent->v->colormap >= 1024)
flags |= RENDER_COLORMAPPED;
- s->colormap = ent->v.colormap;
- s->skin = ent->v.skin;
- s->frame = ent->v.frame;
+ s->colormap = ent->v->colormap;
+ s->skin = ent->v->skin;
+ s->frame = ent->v->frame;
s->modelindex = modelindex;
s->effects = effects;
s->alpha = alpha;
ent = NEXT_EDICT(sv.edicts);
for (e=1 ; e<sv.num_edicts ; e++, ent = NEXT_EDICT(ent))
- ent->v.effects = (int)ent->v.effects & ~EF_MUZZLEFLASH;
+ ent->v->effects = (int)ent->v->effects & ~EF_MUZZLEFLASH;
}
/*
//
// send a damage message
//
- if (ent->v.dmg_take || ent->v.dmg_save)
+ if (ent->v->dmg_take || ent->v->dmg_save)
{
- other = PROG_TO_EDICT(ent->v.dmg_inflictor);
+ other = PROG_TO_EDICT(ent->v->dmg_inflictor);
MSG_WriteByte (msg, svc_damage);
- MSG_WriteByte (msg, ent->v.dmg_save);
- MSG_WriteByte (msg, ent->v.dmg_take);
+ MSG_WriteByte (msg, ent->v->dmg_save);
+ MSG_WriteByte (msg, ent->v->dmg_take);
for (i=0 ; i<3 ; i++)
- MSG_WriteDPCoord (msg, other->v.origin[i] + 0.5*(other->v.mins[i] + other->v.maxs[i]));
+ MSG_WriteDPCoord (msg, other->v->origin[i] + 0.5*(other->v->mins[i] + other->v->maxs[i]));
- ent->v.dmg_take = 0;
- ent->v.dmg_save = 0;
+ ent->v->dmg_take = 0;
+ ent->v->dmg_save = 0;
}
//
SV_SetIdealPitch (); // how much to look up / down ideally
// a fixangle might get lost in a dropped packet. Oh well.
- if ( ent->v.fixangle )
+ if ( ent->v->fixangle )
{
MSG_WriteByte (msg, svc_setangle);
for (i=0 ; i < 3 ; i++)
- MSG_WriteAngle (msg, ent->v.angles[i] );
- ent->v.fixangle = 0;
+ MSG_WriteAngle (msg, ent->v->angles[i] );
+ ent->v->fixangle = 0;
}
bits = 0;
- if (ent->v.view_ofs[2] != DEFAULT_VIEWHEIGHT)
+ if (ent->v->view_ofs[2] != DEFAULT_VIEWHEIGHT)
bits |= SU_VIEWHEIGHT;
- if (ent->v.idealpitch)
+ if (ent->v->idealpitch)
bits |= SU_IDEALPITCH;
// stuff the sigil bits into the high bits of items for sbar, or else
val = GETEDICTFIELDVALUE(ent, eval_items2);
if (val)
- items = (int)ent->v.items | ((int)val->_float << 23);
+ items = (int)ent->v->items | ((int)val->_float << 23);
else
- items = (int)ent->v.items | ((int)pr_global_struct->serverflags << 28);
+ items = (int)ent->v->items | ((int)pr_global_struct->serverflags << 28);
bits |= SU_ITEMS;
- if ( (int)ent->v.flags & FL_ONGROUND)
+ if ( (int)ent->v->flags & FL_ONGROUND)
bits |= SU_ONGROUND;
- if ( ent->v.waterlevel >= 2)
+ if ( ent->v->waterlevel >= 2)
bits |= SU_INWATER;
// dpprotocol
for (i=0 ; i<3 ; i++)
{
- if (ent->v.punchangle[i])
+ if (ent->v->punchangle[i])
bits |= (SU_PUNCH1<<i);
if (punchvector[i]) // dpprotocol
bits |= (SU_PUNCHVEC1<<i); // dpprotocol
- if (ent->v.velocity[i])
+ if (ent->v->velocity[i])
bits |= (SU_VELOCITY1<<i);
}
- if (ent->v.weaponframe)
+ if (ent->v->weaponframe)
bits |= SU_WEAPONFRAME;
- if (ent->v.armorvalue)
+ if (ent->v->armorvalue)
bits |= SU_ARMOR;
bits |= SU_WEAPON;
MSG_WriteByte(msg, bits >> 24);
if (bits & SU_VIEWHEIGHT)
- MSG_WriteChar (msg, ent->v.view_ofs[2]);
+ MSG_WriteChar (msg, ent->v->view_ofs[2]);
if (bits & SU_IDEALPITCH)
- MSG_WriteChar (msg, ent->v.idealpitch);
+ MSG_WriteChar (msg, ent->v->idealpitch);
for (i=0 ; i<3 ; i++)
{
if (bits & (SU_PUNCH1<<i))
- MSG_WritePreciseAngle(msg, ent->v.punchangle[i]); // dpprotocol
+ MSG_WritePreciseAngle(msg, ent->v->punchangle[i]); // dpprotocol
if (bits & (SU_PUNCHVEC1<<i)) // dpprotocol
MSG_WriteDPCoord(msg, punchvector[i]); // dpprotocol
if (bits & (SU_VELOCITY1<<i))
- MSG_WriteChar (msg, ent->v.velocity[i]/16);
+ MSG_WriteChar (msg, ent->v->velocity[i]/16);
}
// [always sent] if (bits & SU_ITEMS)
MSG_WriteLong (msg, items);
if (bits & SU_WEAPONFRAME)
- MSG_WriteByte (msg, ent->v.weaponframe);
+ MSG_WriteByte (msg, ent->v->weaponframe);
if (bits & SU_ARMOR)
- MSG_WriteByte (msg, ent->v.armorvalue);
+ MSG_WriteByte (msg, ent->v->armorvalue);
if (bits & SU_WEAPON)
- MSG_WriteByte (msg, SV_ModelIndex(pr_strings+ent->v.weaponmodel));
+ MSG_WriteByte (msg, SV_ModelIndex(pr_strings+ent->v->weaponmodel));
- MSG_WriteShort (msg, ent->v.health);
- MSG_WriteByte (msg, ent->v.currentammo);
- MSG_WriteByte (msg, ent->v.ammo_shells);
- MSG_WriteByte (msg, ent->v.ammo_nails);
- MSG_WriteByte (msg, ent->v.ammo_rockets);
- MSG_WriteByte (msg, ent->v.ammo_cells);
+ MSG_WriteShort (msg, ent->v->health);
+ MSG_WriteByte (msg, ent->v->currentammo);
+ MSG_WriteByte (msg, ent->v->ammo_shells);
+ MSG_WriteByte (msg, ent->v->ammo_nails);
+ MSG_WriteByte (msg, ent->v->ammo_rockets);
+ MSG_WriteByte (msg, ent->v->ammo_cells);
if (gamemode == GAME_HIPNOTIC || gamemode == GAME_ROGUE)
{
for(i=0;i<32;i++)
{
- if ( ((int)ent->v.weapon) & (1<<i) )
+ if ( ((int)ent->v->weapon) & (1<<i) )
{
MSG_WriteByte (msg, i);
break;
}
else
{
- MSG_WriteByte (msg, ent->v.weapon);
+ MSG_WriteByte (msg, ent->v->weapon);
}
if (bits & SU_VIEWZOOM)
// check for changes to be sent over the reliable streams
for (i=0, host_client = svs.clients ; i<svs.maxclients ; i++, host_client++)
{
- if (host_client->old_frags != host_client->edict->v.frags)
+ if (host_client->old_frags != host_client->edict->v->frags)
{
for (j=0, client = svs.clients ; j<svs.maxclients ; j++, client++)
{
continue;
MSG_WriteByte (&client->message, svc_updatefrags);
MSG_WriteByte (&client->message, i);
- MSG_WriteShort (&client->message, host_client->edict->v.frags);
+ MSG_WriteShort (&client->message, host_client->edict->v->frags);
}
- host_client->old_frags = host_client->edict->v.frags;
+ host_client->old_frags = host_client->edict->v->frags;
}
}
if (svent->free)
continue;
- if (entnum > svs.maxclients && !svent->v.modelindex)
+ if (entnum > svs.maxclients && !svent->v->modelindex)
continue;
// create entity baseline
- VectorCopy (svent->v.origin, svent->baseline.origin);
- VectorCopy (svent->v.angles, svent->baseline.angles);
- svent->baseline.frame = svent->v.frame;
- svent->baseline.skin = svent->v.skin;
+ VectorCopy (svent->v->origin, svent->baseline.origin);
+ VectorCopy (svent->v->angles, svent->baseline.angles);
+ svent->baseline.frame = svent->v->frame;
+ svent->baseline.skin = svent->v->skin;
if (entnum > 0 && entnum <= svs.maxclients)
{
svent->baseline.colormap = entnum;
else
{
svent->baseline.colormap = 0;
- svent->baseline.modelindex = svent->v.modelindex;
+ svent->baseline.modelindex = svent->v->modelindex;
}
large = false;
MSG_WriteChar (&msg, svc_stufftext);
MSG_WriteString (&msg, "reconnect\n");
NET_SendToAll (&msg, 5);
-
+
if (cls.state != ca_dedicated)
Cmd_ExecuteString ("reconnect\n", src_command);
}
// clear the edict memory pool
Mem_EmptyPool(sv_edicts_mempool);
- sv.edicts = Mem_Alloc(sv_edicts_mempool, sv.max_edicts * pr_edict_size);
+ sv.edicts = Mem_Alloc(sv_edicts_mempool, sv.max_edicts * sizeof(edict_t));
+ sv.edictsfields = Mem_Alloc(sv_edicts_mempool, sv.max_edicts * pr_edict_size);
sv.edictstable = Mem_Alloc(sv_edicts_mempool, sv.max_edicts * sizeof(edict_t *));
for (i = 0;i < MAX_EDICTS;i++)
{
- ent = (edict_t *)((qbyte *)sv.edicts + (i * pr_edict_size));
- ent->number = i;
+ ent = sv.edicts + i;
+ ent->v = (void *)((qbyte *)sv.edictsfields + i * pr_edict_size);
sv.edictstable[i] = ent;
}
// load the rest of the entities
//
ent = EDICT_NUM(0);
- memset (&ent->v, 0, progs->entityfields * 4);
+ memset (ent->v, 0, progs->entityfields * 4);
ent->free = false;
- ent->v.model = sv.worldmodel->name - pr_strings;
- ent->v.modelindex = 1; // world model
- ent->v.solid = SOLID_BSP;
- ent->v.movetype = MOVETYPE_PUSH;
+ ent->v->model = sv.worldmodel->name - pr_strings;
+ ent->v->modelindex = 1; // world model
+ ent->v->solid = SOLID_BSP;
+ ent->v->movetype = MOVETYPE_PUSH;
if (coop.integer)
pr_global_struct->coop = coop.integer;
ED_LoadFromFile (sv.worldmodel->entities);
// LordHavoc: clear world angles (to fix e3m3.bsp)
- VectorClear(sv.edicts->v.angles);
+ VectorClear(sv.edicts->v->angles);
sv.active = true;
int x, y;
float mid, bottom;
- VectorAdd (ent->v.origin, ent->v.mins, mins);
- VectorAdd (ent->v.origin, ent->v.maxs, maxs);
+ VectorAdd (ent->v->origin, ent->v->mins, mins);
+ VectorAdd (ent->v->origin, ent->v->maxs, maxs);
// if all of the points under the corners are solid world, don't bother
// with the tougher checks
edict_t *enemy;
// try the move
- VectorCopy (ent->v.origin, oldorg);
- VectorAdd (ent->v.origin, move, neworg);
+ VectorCopy (ent->v->origin, oldorg);
+ VectorAdd (ent->v->origin, move, neworg);
// flying monsters don't step up
- if ( (int)ent->v.flags & (FL_SWIM | FL_FLY) )
+ if ( (int)ent->v->flags & (FL_SWIM | FL_FLY) )
{
// try one move with vertical motion, then one without
for (i=0 ; i<2 ; i++)
{
- VectorAdd (ent->v.origin, move, neworg);
- enemy = PROG_TO_EDICT(ent->v.enemy);
+ VectorAdd (ent->v->origin, move, neworg);
+ enemy = PROG_TO_EDICT(ent->v->enemy);
if (i == 0 && enemy != sv.edicts)
{
- dz = ent->v.origin[2] - PROG_TO_EDICT(ent->v.enemy)->v.origin[2];
+ dz = ent->v->origin[2] - PROG_TO_EDICT(ent->v->enemy)->v->origin[2];
if (dz > 40)
neworg[2] -= 8;
if (dz < 30)
neworg[2] += 8;
}
- trace = SV_Move (ent->v.origin, ent->v.mins, ent->v.maxs, neworg, MOVE_NORMAL, ent);
+ trace = SV_Move (ent->v->origin, ent->v->mins, ent->v->maxs, neworg, MOVE_NORMAL, ent);
if (trace.fraction == 1)
{
VectorCopy(trace.endpos, traceendpos);
- if ( ((int)ent->v.flags & FL_SWIM) && Mod_PointContents(traceendpos, sv.worldmodel) == CONTENTS_EMPTY )
+ if ( ((int)ent->v->flags & FL_SWIM) && Mod_PointContents(traceendpos, sv.worldmodel) == CONTENTS_EMPTY )
return false; // swim monster left water
- VectorCopy (traceendpos, ent->v.origin);
+ VectorCopy (traceendpos, ent->v->origin);
if (relink)
SV_LinkEdict (ent, true);
return true;
VectorCopy (neworg, end);
end[2] -= sv_stepheight.value*2;
- trace = SV_Move (neworg, ent->v.mins, ent->v.maxs, end, MOVE_NORMAL, ent);
+ trace = SV_Move (neworg, ent->v->mins, ent->v->maxs, end, MOVE_NORMAL, ent);
if (trace.allsolid)
return false;
if (trace.startsolid)
{
neworg[2] -= sv_stepheight.value;
- trace = SV_Move (neworg, ent->v.mins, ent->v.maxs, end, MOVE_NORMAL, ent);
+ trace = SV_Move (neworg, ent->v->mins, ent->v->maxs, end, MOVE_NORMAL, ent);
if (trace.allsolid || trace.startsolid)
return false;
}
if (trace.fraction == 1)
{
// if monster had the ground pulled out, go ahead and fall
- if ( (int)ent->v.flags & FL_PARTIALGROUND )
+ if ( (int)ent->v->flags & FL_PARTIALGROUND )
{
- VectorAdd (ent->v.origin, move, ent->v.origin);
+ VectorAdd (ent->v->origin, move, ent->v->origin);
if (relink)
SV_LinkEdict (ent, true);
- ent->v.flags = (int)ent->v.flags & ~FL_ONGROUND;
+ ent->v->flags = (int)ent->v->flags & ~FL_ONGROUND;
return true;
}
}
// check point traces down for dangling corners
- VectorCopy (trace.endpos, ent->v.origin);
-
+ VectorCopy (trace.endpos, ent->v->origin);
+
if (!SV_CheckBottom (ent))
{
- if ( (int)ent->v.flags & FL_PARTIALGROUND )
+ if ( (int)ent->v->flags & FL_PARTIALGROUND )
{ // entity had floor mostly pulled out from underneath it
// and is trying to correct
if (relink)
SV_LinkEdict (ent, true);
return true;
}
- VectorCopy (oldorg, ent->v.origin);
+ VectorCopy (oldorg, ent->v->origin);
return false;
}
- if ( (int)ent->v.flags & FL_PARTIALGROUND )
- ent->v.flags = (int)ent->v.flags & ~FL_PARTIALGROUND;
+ if ( (int)ent->v->flags & FL_PARTIALGROUND )
+ ent->v->flags = (int)ent->v->flags & ~FL_PARTIALGROUND;
- ent->v.groundentity = EDICT_TO_PROG(trace.ent);
+ ent->v->groundentity = EDICT_TO_PROG(trace.ent);
// the move is ok
if (relink)
{
vec3_t move, oldorigin;
float delta;
-
- ent->v.ideal_yaw = yaw;
+
+ ent->v->ideal_yaw = yaw;
PF_changeyaw();
-
+
yaw = yaw*M_PI*2 / 360;
move[0] = cos(yaw)*dist;
move[1] = sin(yaw)*dist;
move[2] = 0;
- VectorCopy (ent->v.origin, oldorigin);
+ VectorCopy (ent->v->origin, oldorigin);
if (SV_movestep (ent, move, false))
{
- delta = ent->v.angles[YAW] - ent->v.ideal_yaw;
+ delta = ent->v->angles[YAW] - ent->v->ideal_yaw;
if (delta > 45 && delta < 315)
{ // not turned far enough, so don't take the step
- VectorCopy (oldorigin, ent->v.origin);
+ VectorCopy (oldorigin, ent->v->origin);
}
SV_LinkEdict (ent, true);
return true;
}
SV_LinkEdict (ent, true);
-
+
return false;
}
*/
void SV_FixCheckBottom (edict_t *ent)
{
- ent->v.flags = (int)ent->v.flags | FL_PARTIALGROUND;
+ ent->v->flags = (int)ent->v->flags | FL_PARTIALGROUND;
}
float d[3];
float tdir, olddir, turnaround;
- olddir = ANGLEMOD((int)(actor->v.ideal_yaw/45)*45);
+ olddir = ANGLEMOD((int)(actor->v->ideal_yaw/45)*45);
turnaround = ANGLEMOD(olddir - 180);
- deltax = enemy->v.origin[0] - actor->v.origin[0];
- deltay = enemy->v.origin[1] - actor->v.origin[1];
+ deltax = enemy->v->origin[0] - actor->v->origin[0];
+ deltay = enemy->v->origin[1] - actor->v->origin[1];
if (deltax>10)
d[1]= 0;
else if (deltax<-10)
tdir = d[2] == 90 ? 45 : 315;
else
tdir = d[2] == 90 ? 135 : 215;
-
+
if (tdir != turnaround && SV_StepDirection(actor, tdir, dist))
return;
}
if (turnaround != DI_NODIR && SV_StepDirection(actor, turnaround, dist) )
return;
- actor->v.ideal_yaw = olddir; // can't move
+ actor->v->ideal_yaw = olddir; // can't move
// if a bridge was pulled out from underneath a monster, it may not have
// a valid standing position at all
for (i=0 ; i<3 ; i++)
{
- if (goal->v.absmin[i] > ent->v.absmax[i] + dist)
+ if (goal->v->absmin[i] > ent->v->absmax[i] + dist)
return false;
- if (goal->v.absmax[i] < ent->v.absmin[i] - dist)
+ if (goal->v->absmax[i] < ent->v->absmin[i] - dist)
return false;
}
return true;
float dist;
ent = PROG_TO_EDICT(pr_global_struct->self);
- goal = PROG_TO_EDICT(ent->v.goalentity);
+ goal = PROG_TO_EDICT(ent->v->goalentity);
dist = G_FLOAT(OFS_PARM0);
- if ( !( (int)ent->v.flags & (FL_ONGROUND|FL_FLY|FL_SWIM) ) )
+ if ( !( (int)ent->v->flags & (FL_ONGROUND|FL_FLY|FL_SWIM) ) )
{
G_FLOAT(OFS_RETURN) = 0;
return;
}
// if the next step hits the enemy, return immediately
- if ( PROG_TO_EDICT(ent->v.enemy) != sv.edicts && SV_CloseEnough (ent, goal, dist) )
+ if ( PROG_TO_EDICT(ent->v->enemy) != sv.edicts && SV_CloseEnough (ent, goal, dist) )
return;
// bump around...
if ( (rand()&3)==1 ||
- !SV_StepDirection (ent, ent->v.ideal_yaw, dist))
+ !SV_StepDirection (ent, ent->v->ideal_yaw, dist))
{
SV_NewChaseDir (ent, goal, dist);
}
{
if (check->free)
continue;
- if (check->v.movetype == MOVETYPE_PUSH
- || check->v.movetype == MOVETYPE_NONE
- || check->v.movetype == MOVETYPE_FOLLOW
- || check->v.movetype == MOVETYPE_NOCLIP)
+ if (check->v->movetype == MOVETYPE_PUSH
+ || check->v->movetype == MOVETYPE_NONE
+ || check->v->movetype == MOVETYPE_FOLLOW
+ || check->v->movetype == MOVETYPE_NOCLIP)
continue;
if (SV_TestEntityPosition (check))
//
for (i=0 ; i<3 ; i++)
{
- if (IS_NAN(ent->v.velocity[i]))
+ if (IS_NAN(ent->v->velocity[i]))
{
- Con_Printf ("Got a NaN velocity on %s\n", pr_strings + ent->v.classname);
- ent->v.velocity[i] = 0;
+ Con_Printf ("Got a NaN velocity on %s\n", pr_strings + ent->v->classname);
+ ent->v->velocity[i] = 0;
}
- if (IS_NAN(ent->v.origin[i]))
+ if (IS_NAN(ent->v->origin[i]))
{
- Con_Printf ("Got a NaN origin on %s\n", pr_strings + ent->v.classname);
- ent->v.origin[i] = 0;
+ Con_Printf ("Got a NaN origin on %s\n", pr_strings + ent->v->classname);
+ ent->v->origin[i] = 0;
}
}
// LordHavoc: max velocity fix, inspired by Maddes's source fixes, but this is faster
- wishspeed = DotProduct(ent->v.velocity, ent->v.velocity);
+ wishspeed = DotProduct(ent->v->velocity, ent->v->velocity);
if (wishspeed > sv_maxvelocity.value * sv_maxvelocity.value)
{
wishspeed = sv_maxvelocity.value / sqrt(wishspeed);
- ent->v.velocity[0] *= wishspeed;
- ent->v.velocity[1] *= wishspeed;
- ent->v.velocity[2] *= wishspeed;
+ ent->v->velocity[0] *= wishspeed;
+ ent->v->velocity[1] *= wishspeed;
+ ent->v->velocity[2] *= wishspeed;
}
}
{
float thinktime;
- thinktime = ent->v.nextthink;
+ thinktime = ent->v->nextthink;
if (thinktime <= 0 || thinktime > sv.time + sv.frametime)
return true;
if (thinktime < sv.time)
thinktime = sv.time;
- ent->v.nextthink = 0;
+ ent->v->nextthink = 0;
pr_global_struct->time = thinktime;
pr_global_struct->self = EDICT_TO_PROG(ent);
pr_global_struct->other = EDICT_TO_PROG(sv.edicts);
- PR_ExecuteProgram (ent->v.think, "NULL think function");
+ PR_ExecuteProgram (ent->v->think, "NULL think function");
return !ent->free;
}
old_other = pr_global_struct->other;
pr_global_struct->time = sv.time;
- if (e1->v.touch && e1->v.solid != SOLID_NOT)
+ if (e1->v->touch && e1->v->solid != SOLID_NOT)
{
pr_global_struct->self = EDICT_TO_PROG(e1);
pr_global_struct->other = EDICT_TO_PROG(e2);
- PR_ExecuteProgram (e1->v.touch, "");
+ PR_ExecuteProgram (e1->v->touch, "");
}
- if (e2->v.touch && e2->v.solid != SOLID_NOT)
+ if (e2->v->touch && e2->v->solid != SOLID_NOT)
{
pr_global_struct->self = EDICT_TO_PROG(e2);
pr_global_struct->other = EDICT_TO_PROG(e1);
- PR_ExecuteProgram (e2->v.touch, "");
+ PR_ExecuteProgram (e2->v->touch, "");
}
pr_global_struct->self = old_self;
numbumps = 4;
blocked = 0;
- VectorCopy (ent->v.velocity, original_velocity);
- VectorCopy (ent->v.velocity, primal_velocity);
+ VectorCopy (ent->v->velocity, original_velocity);
+ VectorCopy (ent->v->velocity, primal_velocity);
numplanes = 0;
time_left = time;
for (bumpcount=0 ; bumpcount<numbumps ; bumpcount++)
{
- if (!ent->v.velocity[0] && !ent->v.velocity[1] && !ent->v.velocity[2])
+ if (!ent->v->velocity[0] && !ent->v->velocity[1] && !ent->v->velocity[2])
break;
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];
- trace = SV_Move (ent->v.origin, ent->v.mins, ent->v.maxs, end, MOVE_NORMAL, ent);
+ trace = SV_Move (ent->v->origin, ent->v->mins, ent->v->maxs, end, MOVE_NORMAL, ent);
if (trace.allsolid)
{
// LordHavoc: note: this code is what makes entities stick in place if embedded in another object (which can be the world)
// entity is trapped in another solid
- VectorClear(ent->v.velocity);
+ VectorClear(ent->v->velocity);
return 3;
}
if (trace.fraction > 0)
{
// actually covered some distance
- VectorCopy (trace.endpos, ent->v.origin);
- VectorCopy (ent->v.velocity, original_velocity);
+ VectorCopy (trace.endpos, ent->v->origin);
+ VectorCopy (ent->v->velocity, original_velocity);
numplanes = 0;
}
if (!trace.ent)
Host_Error ("SV_FlyMove: !trace.ent");
- if ((int) ent->v.flags & FL_ONGROUND)
+ if ((int) ent->v->flags & FL_ONGROUND)
{
- if (ent->v.groundentity == EDICT_TO_PROG(trace.ent))
+ if (ent->v->groundentity == EDICT_TO_PROG(trace.ent))
impact = false;
else
{
- ent->v.flags = (int)ent->v.flags & ~FL_ONGROUND;
+ ent->v->flags = (int)ent->v->flags & ~FL_ONGROUND;
impact = true;
}
}
{
// floor
blocked |= 1;
- ent->v.flags = (int)ent->v.flags | FL_ONGROUND;
- ent->v.groundentity = EDICT_TO_PROG(trace.ent);
+ ent->v->flags = (int)ent->v->flags | FL_ONGROUND;
+ ent->v->groundentity = EDICT_TO_PROG(trace.ent);
}
if (!trace.plane.normal[2])
{
if (numplanes >= MAX_CLIP_PLANES)
{
// this shouldn't really happen
- VectorClear(ent->v.velocity);
+ VectorClear(ent->v->velocity);
return 3;
}
if (i != numplanes)
{
// go along this plane
- VectorCopy (new_velocity, ent->v.velocity);
+ VectorCopy (new_velocity, ent->v->velocity);
}
else
{
// go along the crease
if (numplanes != 2)
{
- VectorClear(ent->v.velocity);
+ VectorClear(ent->v->velocity);
return 7;
}
CrossProduct (planes[0], planes[1], dir);
// LordHavoc: thanks to taniwha of QuakeForge for pointing out this fix for slowed falling in corners
VectorNormalize(dir);
- d = DotProduct (dir, ent->v.velocity);
- VectorScale (dir, d, ent->v.velocity);
+ d = DotProduct (dir, ent->v->velocity);
+ VectorScale (dir, d, ent->v->velocity);
}
// if original velocity is against the original velocity,
// stop dead to avoid tiny occilations in sloping corners
- if (DotProduct (ent->v.velocity, primal_velocity) <= 0)
+ if (DotProduct (ent->v->velocity, primal_velocity) <= 0)
{
- VectorClear(ent->v.velocity);
+ VectorClear(ent->v->velocity);
return blocked;
}
}
ent_gravity = val->_float;
else
ent_gravity = 1.0;
- ent->v.velocity[2] -= ent_gravity * sv_gravity.value * sv.frametime;
+ ent->v->velocity[2] -= ent_gravity * sv_gravity.value * sv.frametime;
}
trace_t trace;
vec3_t end;
- VectorAdd (ent->v.origin, push, end);
+ VectorAdd (ent->v->origin, push, end);
- if (ent->v.movetype == MOVETYPE_FLYMISSILE)
- trace = SV_Move (ent->v.origin, ent->v.mins, ent->v.maxs, end, MOVE_MISSILE, ent);
- else if (ent->v.solid == SOLID_TRIGGER || ent->v.solid == SOLID_NOT)
+ if (ent->v->movetype == MOVETYPE_FLYMISSILE)
+ trace = SV_Move (ent->v->origin, ent->v->mins, ent->v->maxs, end, MOVE_MISSILE, ent);
+ else if (ent->v->solid == SOLID_TRIGGER || ent->v->solid == SOLID_NOT)
// only clip against bmodels
- trace = SV_Move (ent->v.origin, ent->v.mins, ent->v.maxs, end, MOVE_NOMONSTERS, ent);
+ trace = SV_Move (ent->v->origin, ent->v->mins, ent->v->maxs, end, MOVE_NOMONSTERS, ent);
else
- trace = SV_Move (ent->v.origin, ent->v.mins, ent->v.maxs, end, MOVE_NORMAL, ent);
+ trace = SV_Move (ent->v->origin, ent->v->mins, ent->v->maxs, end, MOVE_NORMAL, ent);
- VectorCopy (trace.endpos, ent->v.origin);
+ VectorCopy (trace.endpos, ent->v->origin);
// FIXME: turn players specially
- ent->v.angles[1] += trace.fraction * pushangles[1];
+ ent->v->angles[1] += trace.fraction * pushangles[1];
SV_LinkEdict (ent, true);
- if (trace.ent && (!((int)ent->v.flags & FL_ONGROUND) || ent->v.groundentity != EDICT_TO_PROG(trace.ent)))
+ if (trace.ent && (!((int)ent->v->flags & FL_ONGROUND) || ent->v->groundentity != EDICT_TO_PROG(trace.ent)))
SV_Impact (ent, trace.ent);
return trace;
}
model_t *pushermodel;
trace_t trace;
- switch ((int) pusher->v.solid)
+ switch ((int) pusher->v->solid)
{
// LordHavoc: valid pusher types
case SOLID_BSP:
// LordHavoc: no collisions
case SOLID_NOT:
case SOLID_TRIGGER:
- VectorMA (pusher->v.origin, movetime, pusher->v.velocity, pusher->v.origin);
- VectorMA (pusher->v.angles, movetime, pusher->v.avelocity, pusher->v.angles);
- pusher->v.ltime += movetime;
+ VectorMA (pusher->v->origin, movetime, pusher->v->velocity, pusher->v->origin);
+ VectorMA (pusher->v->angles, movetime, pusher->v->avelocity, pusher->v->angles);
+ pusher->v->ltime += movetime;
SV_LinkEdict (pusher, false);
return;
default:
- Host_Error("SV_PushMove: unrecognized solid type %f\n", pusher->v.solid);
+ Host_Error("SV_PushMove: unrecognized solid type %f\n", pusher->v->solid);
}
- if (!pusher->v.velocity[0] && !pusher->v.velocity[1] && !pusher->v.velocity[2] && !pusher->v.avelocity[0] && !pusher->v.avelocity[1] && !pusher->v.avelocity[2])
+ if (!pusher->v->velocity[0] && !pusher->v->velocity[1] && !pusher->v->velocity[2] && !pusher->v->avelocity[0] && !pusher->v->avelocity[1] && !pusher->v->avelocity[2])
{
- pusher->v.ltime += movetime;
+ pusher->v->ltime += movetime;
return;
}
- index = (int) pusher->v.modelindex;
+ index = (int) pusher->v->modelindex;
if (index < 1 || index >= MAX_MODELS)
- Host_Error("SV_PushMove: invalid modelindex %f\n", pusher->v.modelindex);
+ Host_Error("SV_PushMove: invalid modelindex %f\n", pusher->v->modelindex);
pushermodel = sv.models[index];
movetime2 = movetime;
- VectorScale(pusher->v.velocity, movetime2, move1);
- VectorScale(pusher->v.avelocity, movetime2, moveangle);
+ VectorScale(pusher->v->velocity, movetime2, move1);
+ VectorScale(pusher->v->avelocity, movetime2, moveangle);
if (moveangle[0] || moveangle[2])
{
for (i = 0;i < 3;i++)
{
if (move1[i] > 0)
{
- mins[i] = pushermodel->rotatedmins[i] + pusher->v.origin[i] - 1;
- maxs[i] = pushermodel->rotatedmaxs[i] + move1[i] + pusher->v.origin[i] + 1;
+ mins[i] = pushermodel->rotatedmins[i] + pusher->v->origin[i] - 1;
+ maxs[i] = pushermodel->rotatedmaxs[i] + move1[i] + pusher->v->origin[i] + 1;
}
else
{
- mins[i] = pushermodel->rotatedmins[i] + move1[i] + pusher->v.origin[i] - 1;
- maxs[i] = pushermodel->rotatedmaxs[i] + pusher->v.origin[i] + 1;
+ mins[i] = pushermodel->rotatedmins[i] + move1[i] + pusher->v->origin[i] - 1;
+ maxs[i] = pushermodel->rotatedmaxs[i] + pusher->v->origin[i] + 1;
}
}
}
{
if (move1[i] > 0)
{
- mins[i] = pushermodel->yawmins[i] + pusher->v.origin[i] - 1;
- maxs[i] = pushermodel->yawmaxs[i] + move1[i] + pusher->v.origin[i] + 1;
+ mins[i] = pushermodel->yawmins[i] + pusher->v->origin[i] - 1;
+ maxs[i] = pushermodel->yawmaxs[i] + move1[i] + pusher->v->origin[i] + 1;
}
else
{
- mins[i] = pushermodel->yawmins[i] + move1[i] + pusher->v.origin[i] - 1;
- maxs[i] = pushermodel->yawmaxs[i] + pusher->v.origin[i] + 1;
+ mins[i] = pushermodel->yawmins[i] + move1[i] + pusher->v->origin[i] - 1;
+ maxs[i] = pushermodel->yawmaxs[i] + pusher->v->origin[i] + 1;
}
}
}
{
if (move1[i] > 0)
{
- mins[i] = pushermodel->normalmins[i] + pusher->v.origin[i] - 1;
- maxs[i] = pushermodel->normalmaxs[i] + move1[i] + pusher->v.origin[i] + 1;
+ mins[i] = pushermodel->normalmins[i] + pusher->v->origin[i] - 1;
+ maxs[i] = pushermodel->normalmaxs[i] + move1[i] + pusher->v->origin[i] + 1;
}
else
{
- mins[i] = pushermodel->normalmins[i] + move1[i] + pusher->v.origin[i] - 1;
- maxs[i] = pushermodel->normalmaxs[i] + pusher->v.origin[i] + 1;
+ mins[i] = pushermodel->normalmins[i] + move1[i] + pusher->v->origin[i] - 1;
+ maxs[i] = pushermodel->normalmaxs[i] + pusher->v->origin[i] + 1;
}
}
}
VectorNegate (moveangle, a);
AngleVectorsFLU (a, forward, left, up);
- VectorCopy (pusher->v.origin, pushorig);
- VectorCopy (pusher->v.angles, pushang);
- pushltime = pusher->v.ltime;
+ VectorCopy (pusher->v->origin, pushorig);
+ VectorCopy (pusher->v->angles, pushang);
+ pushltime = pusher->v->ltime;
// move the pusher to it's final position
- VectorMA (pusher->v.origin, movetime, pusher->v.velocity, pusher->v.origin);
- VectorMA (pusher->v.angles, movetime, pusher->v.avelocity, pusher->v.angles);
- pusher->v.ltime += movetime;
+ VectorMA (pusher->v->origin, movetime, pusher->v->velocity, pusher->v->origin);
+ VectorMA (pusher->v->angles, movetime, pusher->v->avelocity, pusher->v->angles);
+ pusher->v->ltime += movetime;
SV_LinkEdict (pusher, false);
- savesolid = pusher->v.solid;
+ savesolid = pusher->v->solid;
// see if any solid entities are inside the final position
num_moved = 0;
{
if (check->free)
continue;
- if (check->v.movetype == MOVETYPE_PUSH
- || check->v.movetype == MOVETYPE_NONE
- || check->v.movetype == MOVETYPE_FOLLOW
- || check->v.movetype == MOVETYPE_NOCLIP)
+ if (check->v->movetype == MOVETYPE_PUSH
+ || check->v->movetype == MOVETYPE_NONE
+ || check->v->movetype == MOVETYPE_FOLLOW
+ || check->v->movetype == MOVETYPE_NOCLIP)
continue;
// if the entity is standing on the pusher, it will definitely be moved
- if (!(((int)check->v.flags & FL_ONGROUND) && PROG_TO_EDICT(check->v.groundentity) == pusher))
+ if (!(((int)check->v->flags & FL_ONGROUND) && PROG_TO_EDICT(check->v->groundentity) == pusher))
{
- if (check->v.absmin[0] >= maxs[0]
- || check->v.absmax[0] <= mins[0]
- || check->v.absmin[1] >= maxs[1]
- || check->v.absmax[1] <= mins[1]
- || check->v.absmin[2] >= maxs[2]
- || check->v.absmax[2] <= mins[2])
+ if (check->v->absmin[0] >= maxs[0]
+ || check->v->absmax[0] <= mins[0]
+ || check->v->absmin[1] >= maxs[1]
+ || check->v->absmax[1] <= mins[1]
+ || check->v->absmin[2] >= maxs[2]
+ || check->v->absmax[2] <= mins[2])
continue;
- trace = SV_ClipMoveToEntity (pusher, check->v.origin, check->v.mins, check->v.maxs, check->v.origin);
+ trace = SV_ClipMoveToEntity (pusher, check->v->origin, check->v->mins, check->v->maxs, check->v->origin);
if (!trace.startsolid)
continue;
}
if (forward[0] < 0.999f) // quick way to check if any rotation is used
{
- VectorSubtract (check->v.origin, pusher->v.origin, org);
+ VectorSubtract (check->v->origin, pusher->v->origin, org);
org2[0] = DotProduct (org, forward);
org2[1] = DotProduct (org, left);
org2[2] = DotProduct (org, up);
VectorCopy (move1, move);
// remove the onground flag for non-players
- if (check->v.movetype != MOVETYPE_WALK)
- check->v.flags = (int)check->v.flags & ~FL_ONGROUND;
+ if (check->v->movetype != MOVETYPE_WALK)
+ check->v->flags = (int)check->v->flags & ~FL_ONGROUND;
- VectorCopy (check->v.origin, moved_from[num_moved]);
- VectorCopy (check->v.angles, moved_fromangles[num_moved]);
+ VectorCopy (check->v->origin, moved_from[num_moved]);
+ VectorCopy (check->v->angles, moved_fromangles[num_moved]);
moved_edict[num_moved++] = check;
// try moving the contacted entity
- pusher->v.solid = SOLID_NOT;
+ pusher->v->solid = SOLID_NOT;
trace = SV_PushEntity (check, move, moveangle);
- pusher->v.solid = savesolid; // was SOLID_BSP
+ pusher->v->solid = savesolid; // was SOLID_BSP
// if it is still inside the pusher, block
if (SV_TestEntityPosition (check))
{
// try moving the contacted entity a tiny bit further to account for precision errors
- pusher->v.solid = SOLID_NOT;
+ pusher->v->solid = SOLID_NOT;
VectorScale(move, 0.1, move);
trace = SV_PushEntity (check, move, vec3_origin);
- pusher->v.solid = savesolid;
+ pusher->v->solid = savesolid;
if (SV_TestEntityPosition (check))
{
// still inside pusher, so it's really blocked
// fail the move
- if (check->v.mins[0] == check->v.maxs[0])
+ if (check->v->mins[0] == check->v->maxs[0])
continue;
- if (check->v.solid == SOLID_NOT || check->v.solid == SOLID_TRIGGER)
+ if (check->v->solid == SOLID_NOT || check->v->solid == SOLID_TRIGGER)
{
// corpse
- check->v.mins[0] = check->v.mins[1] = 0;
- VectorCopy (check->v.mins, check->v.maxs);
+ check->v->mins[0] = check->v->mins[1] = 0;
+ VectorCopy (check->v->mins, check->v->maxs);
continue;
}
- VectorCopy (pushorig, pusher->v.origin);
- VectorCopy (pushang, pusher->v.angles);
- pusher->v.ltime = pushltime;
+ VectorCopy (pushorig, pusher->v->origin);
+ VectorCopy (pushang, pusher->v->angles);
+ pusher->v->ltime = pushltime;
SV_LinkEdict (pusher, false);
// move back any entities we already moved
for (i=0 ; i<num_moved ; i++)
{
- VectorCopy (moved_from[i], moved_edict[i]->v.origin);
- VectorCopy (moved_fromangles[i], moved_edict[i]->v.angles);
+ VectorCopy (moved_from[i], moved_edict[i]->v->origin);
+ VectorCopy (moved_fromangles[i], moved_edict[i]->v->angles);
SV_LinkEdict (moved_edict[i], false);
}
// if the pusher has a "blocked" function, call it, otherwise just stay in place until the obstacle is gone
- if (pusher->v.blocked)
+ if (pusher->v->blocked)
{
pr_global_struct->self = EDICT_TO_PROG(pusher);
pr_global_struct->other = EDICT_TO_PROG(check);
- PR_ExecuteProgram (pusher->v.blocked, "");
+ PR_ExecuteProgram (pusher->v->blocked, "");
}
return;
}
{
float thinktime, oldltime, movetime;
- oldltime = ent->v.ltime;
+ oldltime = ent->v->ltime;
- thinktime = ent->v.nextthink;
- if (thinktime < ent->v.ltime + sv.frametime)
+ thinktime = ent->v->nextthink;
+ if (thinktime < ent->v->ltime + sv.frametime)
{
- movetime = thinktime - ent->v.ltime;
+ movetime = thinktime - ent->v->ltime;
if (movetime < 0)
movetime = 0;
}
movetime = sv.frametime;
if (movetime)
- // advances ent->v.ltime if not blocked
+ // advances ent->v->ltime if not blocked
SV_PushMove (ent, movetime);
- if (thinktime > oldltime && thinktime <= ent->v.ltime)
+ if (thinktime > oldltime && thinktime <= ent->v->ltime)
{
- ent->v.nextthink = 0;
+ ent->v->nextthink = 0;
pr_global_struct->time = sv.time;
pr_global_struct->self = EDICT_TO_PROG(ent);
pr_global_struct->other = EDICT_TO_PROG(sv.edicts);
- PR_ExecuteProgram (ent->v.think, "NULL think function");
+ PR_ExecuteProgram (ent->v->think, "NULL think function");
if (ent->free)
return;
}
if (!SV_TestEntityPosition(ent))
{
- VectorCopy (ent->v.origin, ent->v.oldorigin);
+ VectorCopy (ent->v->origin, ent->v->oldorigin);
return;
}
- VectorCopy (ent->v.origin, org);
- VectorCopy (ent->v.oldorigin, ent->v.origin);
+ VectorCopy (ent->v->origin, org);
+ VectorCopy (ent->v->oldorigin, ent->v->origin);
if (!SV_TestEntityPosition(ent))
{
Con_DPrintf ("Unstuck.\n");
for (i=-1 ; i <= 1 ; i++)
for (j=-1 ; j <= 1 ; j++)
{
- ent->v.origin[0] = org[0] + i;
- ent->v.origin[1] = org[1] + j;
- ent->v.origin[2] = org[2] + z;
+ ent->v->origin[0] = org[0] + i;
+ ent->v->origin[1] = org[1] + j;
+ ent->v->origin[2] = org[2] + z;
if (!SV_TestEntityPosition(ent))
{
Con_DPrintf ("Unstuck.\n");
}
}
- VectorCopy (org, ent->v.origin);
+ VectorCopy (org, ent->v->origin);
Con_DPrintf ("player is stuck.\n");
}
int cont;
vec3_t point;
- point[0] = ent->v.origin[0];
- point[1] = ent->v.origin[1];
- point[2] = ent->v.origin[2] + ent->v.mins[2] + 1;
+ point[0] = ent->v->origin[0];
+ point[1] = ent->v->origin[1];
+ point[2] = ent->v->origin[2] + ent->v->mins[2] + 1;
- ent->v.waterlevel = 0;
- ent->v.watertype = CONTENTS_EMPTY;
+ ent->v->waterlevel = 0;
+ ent->v->watertype = CONTENTS_EMPTY;
cont = Mod_PointContents(point, sv.worldmodel);
if (cont <= CONTENTS_WATER)
{
- ent->v.watertype = cont;
- ent->v.waterlevel = 1;
- point[2] = ent->v.origin[2] + (ent->v.mins[2] + ent->v.maxs[2])*0.5;
+ ent->v->watertype = cont;
+ ent->v->waterlevel = 1;
+ point[2] = ent->v->origin[2] + (ent->v->mins[2] + ent->v->maxs[2])*0.5;
cont = Mod_PointContents(point, sv.worldmodel);
if (cont <= CONTENTS_WATER)
{
- ent->v.waterlevel = 2;
- point[2] = ent->v.origin[2] + ent->v.view_ofs[2];
+ ent->v->waterlevel = 2;
+ point[2] = ent->v->origin[2] + ent->v->view_ofs[2];
cont = Mod_PointContents(point, sv.worldmodel);
if (cont <= CONTENTS_WATER)
- ent->v.waterlevel = 3;
+ ent->v->waterlevel = 3;
}
}
- return ent->v.waterlevel > 1;
+ return ent->v->waterlevel > 1;
}
/*
float d, i;
vec3_t forward, into, side;
- AngleVectors (ent->v.v_angle, forward, NULL, NULL);
+ AngleVectors (ent->v->v_angle, forward, NULL, NULL);
d = DotProduct (trace->plane.normal, forward);
d += 0.5;
return;
// cut the tangential velocity
- i = DotProduct (trace->plane.normal, ent->v.velocity);
+ i = DotProduct (trace->plane.normal, ent->v->velocity);
VectorScale (trace->plane.normal, i, into);
- VectorSubtract (ent->v.velocity, into, side);
+ VectorSubtract (ent->v->velocity, into, side);
- ent->v.velocity[0] = side[0] * (1 + d);
- ent->v.velocity[1] = side[1] * (1 + d);
+ ent->v->velocity[0] = side[0] * (1 + d);
+ ent->v->velocity[1] = side[1] * (1 + d);
}
/*
vec3_t oldorg, dir;
trace_t steptrace;
- VectorCopy (ent->v.origin, oldorg);
+ VectorCopy (ent->v->origin, oldorg);
VectorClear (dir);
for (i=0 ; i<8 ; i++)
SV_PushEntity (ent, dir, vec3_origin);
// retry the original move
- ent->v.velocity[0] = oldvel[0];
- ent->v.velocity[1] = oldvel[1];
- ent->v.velocity[2] = 0;
+ ent->v->velocity[0] = oldvel[0];
+ ent->v->velocity[1] = oldvel[1];
+ ent->v->velocity[2] = 0;
clip = SV_FlyMove (ent, 0.1, &steptrace);
- if (fabs(oldorg[1] - ent->v.origin[1]) > 4
- || fabs(oldorg[0] - ent->v.origin[0]) > 4)
+ if (fabs(oldorg[1] - ent->v->origin[1]) > 4
+ || fabs(oldorg[0] - ent->v->origin[0]) > 4)
return clip;
// go back to the original pos and try again
- VectorCopy (oldorg, ent->v.origin);
+ VectorCopy (oldorg, ent->v->origin);
}
// still not moving
- VectorClear (ent->v.velocity);
+ VectorClear (ent->v->velocity);
return 7;
}
trace_t steptrace, downtrace;
// do a regular slide move unless it looks like you ran into a step
- oldonground = (int)ent->v.flags & FL_ONGROUND;
- ent->v.flags = (int)ent->v.flags & ~FL_ONGROUND;
+ oldonground = (int)ent->v->flags & FL_ONGROUND;
+ ent->v->flags = (int)ent->v->flags & ~FL_ONGROUND;
- VectorCopy (ent->v.origin, oldorg);
- VectorCopy (ent->v.velocity, oldvel);
+ VectorCopy (ent->v->origin, oldorg);
+ VectorCopy (ent->v->velocity, oldvel);
clip = SV_FlyMove (ent, sv.frametime, &steptrace);
if ( !(clip & 2) )
return;
- if (ent->v.movetype != MOVETYPE_FLY)
+ if (ent->v->movetype != MOVETYPE_FLY)
{
- if (!oldonground && ent->v.waterlevel == 0 && !sv_jumpstep.integer)
+ if (!oldonground && ent->v->waterlevel == 0 && !sv_jumpstep.integer)
// don't stair up while jumping
return;
- if (ent->v.movetype != MOVETYPE_WALK)
+ if (ent->v->movetype != MOVETYPE_WALK)
// gibbed by a trigger
return;
}
if (sv_nostep.integer)
return;
- if ( (int)sv_player->v.flags & FL_WATERJUMP )
+ if ( (int)sv_player->v->flags & FL_WATERJUMP )
return;
- VectorCopy (ent->v.origin, nosteporg);
- VectorCopy (ent->v.velocity, nostepvel);
+ VectorCopy (ent->v->origin, nosteporg);
+ VectorCopy (ent->v->velocity, nostepvel);
// try moving up and forward to go up a step
// back to start pos
- VectorCopy (oldorg, ent->v.origin);
+ VectorCopy (oldorg, ent->v->origin);
VectorClear (upmove);
VectorClear (downmove);
SV_PushEntity (ent, upmove, vec3_origin);
// move forward
- ent->v.velocity[0] = oldvel[0];
- ent->v.velocity[1] = oldvel[1];
- ent->v.velocity[2] = 0;
+ ent->v->velocity[0] = oldvel[0];
+ ent->v->velocity[1] = oldvel[1];
+ ent->v->velocity[2] = 0;
clip = SV_FlyMove (ent, sv.frametime, &steptrace);
- ent->v.velocity[2] += oldvel[2];
+ ent->v->velocity[2] += oldvel[2];
// check for stuckness, possibly due to the limited precision of floats
// in the clipping hulls
if (clip
- && fabs(oldorg[1] - ent->v.origin[1]) < 0.03125
- && fabs(oldorg[0] - ent->v.origin[0]) < 0.03125)
+ && fabs(oldorg[1] - ent->v->origin[1]) < 0.03125
+ && fabs(oldorg[0] - ent->v->origin[0]) < 0.03125)
// stepping up didn't make any progress
clip = SV_TryUnstick (ent, oldvel);
if (downtrace.plane.normal[2] > 0.7)
{
// LordHavoc: disabled this so you can walk on monsters/players
- //if (ent->v.solid == SOLID_BSP)
+ //if (ent->v->solid == SOLID_BSP)
{
- ent->v.flags = (int)ent->v.flags | FL_ONGROUND;
- ent->v.groundentity = EDICT_TO_PROG(downtrace.ent);
+ ent->v->flags = (int)ent->v->flags | FL_ONGROUND;
+ ent->v->groundentity = EDICT_TO_PROG(downtrace.ent);
}
}
else
// if the push down didn't end up on good ground, use the move without
// the step up. This happens near wall / slope combinations, and can
// cause the player to hop up higher on a slope too steep to climb
- VectorCopy (nosteporg, ent->v.origin);
- VectorCopy (nostepvel, ent->v.velocity);
+ VectorCopy (nosteporg, ent->v->origin);
+ VectorCopy (nostepvel, ent->v->velocity);
}
}
SV_CheckVelocity (ent);
// decide which move function to call
- switch ((int)ent->v.movetype)
+ switch ((int)ent->v->movetype)
{
case MOVETYPE_NONE:
if (!SV_RunThink (ent))
case MOVETYPE_WALK:
if (!SV_RunThink (ent))
return;
- if (!SV_CheckWater (ent) && ! ((int)ent->v.flags & FL_WATERJUMP) )
+ if (!SV_CheckWater (ent) && ! ((int)ent->v->flags & FL_WATERJUMP) )
SV_AddGravity (ent);
SV_CheckStuck (ent);
SV_WalkMove (ent);
if (!SV_RunThink (ent))
return;
SV_CheckWater (ent);
- VectorMA (ent->v.origin, sv.frametime, ent->v.velocity, ent->v.origin);
- VectorMA (ent->v.angles, sv.frametime, ent->v.avelocity, ent->v.angles);
+ VectorMA (ent->v->origin, sv.frametime, ent->v->velocity, ent->v->origin);
+ VectorMA (ent->v->angles, sv.frametime, ent->v->avelocity, ent->v->angles);
break;
default:
- Host_Error ("SV_Physics_client: bad movetype %i", (int)ent->v.movetype);
+ Host_Error ("SV_Physics_client: bad movetype %i", (int)ent->v->movetype);
}
// call standard player post-think
return;
// LordHavoc: implemented rotation on MOVETYPE_FOLLOW objects
- e = PROG_TO_EDICT(ent->v.aiment);
- if (e->v.angles[0] == ent->v.punchangle[0] && e->v.angles[1] == ent->v.punchangle[1] && e->v.angles[2] == ent->v.punchangle[2])
+ e = PROG_TO_EDICT(ent->v->aiment);
+ if (e->v->angles[0] == ent->v->punchangle[0] && e->v->angles[1] == ent->v->punchangle[1] && e->v->angles[2] == ent->v->punchangle[2])
{
// quick case for no rotation
- VectorAdd(e->v.origin, ent->v.view_ofs, ent->v.origin);
+ VectorAdd(e->v->origin, ent->v->view_ofs, ent->v->origin);
}
else
{
- angles[0] = -ent->v.punchangle[0];
- angles[1] = ent->v.punchangle[1];
- angles[2] = ent->v.punchangle[2];
+ angles[0] = -ent->v->punchangle[0];
+ angles[1] = ent->v->punchangle[1];
+ angles[2] = ent->v->punchangle[2];
AngleVectors (angles, vf, vr, vu);
- v[0] = ent->v.view_ofs[0] * vf[0] + ent->v.view_ofs[1] * vr[0] + ent->v.view_ofs[2] * vu[0];
- v[1] = ent->v.view_ofs[0] * vf[1] + ent->v.view_ofs[1] * vr[1] + ent->v.view_ofs[2] * vu[1];
- v[2] = ent->v.view_ofs[0] * vf[2] + ent->v.view_ofs[1] * vr[2] + ent->v.view_ofs[2] * vu[2];
- angles[0] = -e->v.angles[0];
- angles[1] = e->v.angles[1];
- angles[2] = e->v.angles[2];
+ v[0] = ent->v->view_ofs[0] * vf[0] + ent->v->view_ofs[1] * vr[0] + ent->v->view_ofs[2] * vu[0];
+ v[1] = ent->v->view_ofs[0] * vf[1] + ent->v->view_ofs[1] * vr[1] + ent->v->view_ofs[2] * vu[1];
+ v[2] = ent->v->view_ofs[0] * vf[2] + ent->v->view_ofs[1] * vr[2] + ent->v->view_ofs[2] * vu[2];
+ angles[0] = -e->v->angles[0];
+ angles[1] = e->v->angles[1];
+ angles[2] = e->v->angles[2];
AngleVectors (angles, vf, vr, vu);
- ent->v.origin[0] = v[0] * vf[0] + v[1] * vf[1] + v[2] * vf[2] + e->v.origin[0];
- ent->v.origin[1] = v[0] * vr[0] + v[1] * vr[1] + v[2] * vr[2] + e->v.origin[1];
- ent->v.origin[2] = v[0] * vu[0] + v[1] * vu[1] + v[2] * vu[2] + e->v.origin[2];
+ ent->v->origin[0] = v[0] * vf[0] + v[1] * vf[1] + v[2] * vf[2] + e->v->origin[0];
+ ent->v->origin[1] = v[0] * vr[0] + v[1] * vr[1] + v[2] * vr[2] + e->v->origin[1];
+ ent->v->origin[2] = v[0] * vu[0] + v[1] * vu[1] + v[2] * vu[2] + e->v->origin[2];
}
- VectorAdd (e->v.angles, ent->v.v_angle, ent->v.angles);
+ VectorAdd (e->v->angles, ent->v->v_angle, ent->v->angles);
SV_LinkEdict (ent, true);
}
if (!SV_RunThink (ent))
return;
- VectorMA (ent->v.angles, sv.frametime, ent->v.avelocity, ent->v.angles);
- VectorMA (ent->v.origin, sv.frametime, ent->v.velocity, ent->v.origin);
+ VectorMA (ent->v->angles, sv.frametime, ent->v->avelocity, ent->v->angles);
+ VectorMA (ent->v->origin, sv.frametime, ent->v->velocity, ent->v->origin);
SV_LinkEdict (ent, false);
}
void SV_CheckWaterTransition (edict_t *ent)
{
int cont;
- cont = Mod_PointContents(ent->v.origin, sv.worldmodel);
- if (!ent->v.watertype)
+ cont = Mod_PointContents(ent->v->origin, sv.worldmodel);
+ if (!ent->v->watertype)
{
// just spawned here
- ent->v.watertype = cont;
- ent->v.waterlevel = 1;
+ ent->v->watertype = cont;
+ ent->v->waterlevel = 1;
return;
}
if (cont <= CONTENTS_WATER)
{
- if (ent->v.watertype == CONTENTS_EMPTY && cont != CONTENTS_LAVA)
+ if (ent->v->watertype == CONTENTS_EMPTY && cont != CONTENTS_LAVA)
// just crossed into water
SV_StartSound (ent, 0, "misc/h2ohit1.wav", 255, 1);
- ent->v.watertype = cont;
- ent->v.waterlevel = 1;
+ ent->v->watertype = cont;
+ ent->v->waterlevel = 1;
}
else
{
- if (ent->v.watertype != CONTENTS_EMPTY && ent->v.watertype != CONTENTS_LAVA)
+ if (ent->v->watertype != CONTENTS_EMPTY && ent->v->watertype != CONTENTS_LAVA)
// just crossed into water
SV_StartSound (ent, 0, "misc/h2ohit1.wav", 255, 1);
- ent->v.watertype = CONTENTS_EMPTY;
- ent->v.waterlevel = cont;
+ ent->v->watertype = CONTENTS_EMPTY;
+ ent->v->waterlevel = cont;
}
}
return;
// if onground, return without moving
- if ((int)ent->v.flags & FL_ONGROUND)
+ if ((int)ent->v->flags & FL_ONGROUND)
{
- VectorClear(ent->v.velocity);
- if (ent->v.groundentity == 0)
+ VectorClear(ent->v->velocity);
+ if (ent->v->groundentity == 0)
return;
// if ent was supported by a brush model on previous frame,
// and groundentity is now freed, set groundentity to 0 (floating)
- groundentity = PROG_TO_EDICT(ent->v.groundentity);
- if (groundentity->v.solid == SOLID_BSP)
+ groundentity = PROG_TO_EDICT(ent->v->groundentity);
+ if (groundentity->v->solid == SOLID_BSP)
{
ent->suspendedinairflag = true;
return;
else if (ent->suspendedinairflag && groundentity->free)
{
// leave it suspended in the air
- ent->v.groundentity = 0;
+ ent->v->groundentity = 0;
ent->suspendedinairflag = false;
return;
}
SV_CheckVelocity (ent);
// add gravity
- if (ent->v.movetype == MOVETYPE_TOSS || ent->v.movetype == MOVETYPE_BOUNCE)
+ if (ent->v->movetype == MOVETYPE_TOSS || ent->v->movetype == MOVETYPE_BOUNCE)
SV_AddGravity (ent);
// move angles
- VectorMA (ent->v.angles, sv.frametime, ent->v.avelocity, ent->v.angles);
+ VectorMA (ent->v->angles, sv.frametime, ent->v->avelocity, ent->v->angles);
// move origin
- VectorScale (ent->v.velocity, sv.frametime, move);
+ VectorScale (ent->v->velocity, sv.frametime, move);
trace = SV_PushEntity (ent, move, vec3_origin);
if (ent->free)
return;
if (trace.fraction < 1)
{
- if (ent->v.movetype == MOVETYPE_BOUNCEMISSILE)
+ if (ent->v->movetype == MOVETYPE_BOUNCEMISSILE)
{
- ClipVelocity (ent->v.velocity, trace.plane.normal, ent->v.velocity, 2.0);
- ent->v.flags = (int)ent->v.flags & ~FL_ONGROUND;
+ ClipVelocity (ent->v->velocity, trace.plane.normal, ent->v->velocity, 2.0);
+ ent->v->flags = (int)ent->v->flags & ~FL_ONGROUND;
}
- else if (ent->v.movetype == MOVETYPE_BOUNCE)
+ else if (ent->v->movetype == MOVETYPE_BOUNCE)
{
- ClipVelocity (ent->v.velocity, trace.plane.normal, ent->v.velocity, 1.5);
+ ClipVelocity (ent->v->velocity, trace.plane.normal, ent->v->velocity, 1.5);
// LordHavoc: fixed grenades not bouncing when fired down a slope
- if (trace.plane.normal[2] > 0.7 && DotProduct(trace.plane.normal, ent->v.velocity) < 60)
+ if (trace.plane.normal[2] > 0.7 && DotProduct(trace.plane.normal, ent->v->velocity) < 60)
{
- ent->v.flags = (int)ent->v.flags | FL_ONGROUND;
- ent->v.groundentity = EDICT_TO_PROG(trace.ent);
- VectorClear (ent->v.velocity);
- VectorClear (ent->v.avelocity);
+ ent->v->flags = (int)ent->v->flags | FL_ONGROUND;
+ ent->v->groundentity = EDICT_TO_PROG(trace.ent);
+ VectorClear (ent->v->velocity);
+ VectorClear (ent->v->avelocity);
}
else
- ent->v.flags = (int)ent->v.flags & ~FL_ONGROUND;
+ ent->v->flags = (int)ent->v->flags & ~FL_ONGROUND;
}
else
{
- ClipVelocity (ent->v.velocity, trace.plane.normal, ent->v.velocity, 1.0);
+ ClipVelocity (ent->v->velocity, trace.plane.normal, ent->v->velocity, 1.0);
if (trace.plane.normal[2] > 0.7)
{
- ent->v.flags = (int)ent->v.flags | FL_ONGROUND;
- ent->v.groundentity = EDICT_TO_PROG(trace.ent);
- VectorClear (ent->v.velocity);
- VectorClear (ent->v.avelocity);
+ ent->v->flags = (int)ent->v->flags | FL_ONGROUND;
+ ent->v->groundentity = EDICT_TO_PROG(trace.ent);
+ VectorClear (ent->v->velocity);
+ VectorClear (ent->v->avelocity);
}
else
- ent->v.flags = (int)ent->v.flags & ~FL_ONGROUND;
+ ent->v->flags = (int)ent->v->flags & ~FL_ONGROUND;
}
}
// freefall if not fly/swim
fall = true;
- flags = (int)ent->v.flags;
+ flags = (int)ent->v->flags;
if (flags & (FL_FLY | FL_SWIM))
{
if (flags & FL_FLY)
fall = false;
- else if ((flags & FL_SWIM) && Mod_PointContents(ent->v.origin, sv.worldmodel) != CONTENTS_EMPTY)
+ else if ((flags & FL_SWIM) && Mod_PointContents(ent->v->origin, sv.worldmodel) != CONTENTS_EMPTY)
fall = false;
}
- if (fall && (flags & FL_ONGROUND) && ent->v.groundentity == 0)
+ if (fall && (flags & FL_ONGROUND) && ent->v->groundentity == 0)
fall = false;
if (fall)
{
- if (ent->v.velocity[2] < sv_gravity.value*-0.1)
+ if (ent->v->velocity[2] < sv_gravity.value*-0.1)
{
hitsound = true;
if (flags & FL_ONGROUND)
SV_LinkEdict (ent, false);
// just hit ground
- if ((int)ent->v.flags & FL_ONGROUND)
+ if ((int)ent->v->flags & FL_ONGROUND)
{
- VectorClear(ent->v.velocity);
+ VectorClear(ent->v->velocity);
if (hitsound)
SV_StartSound (ent, 0, "demon/dland2.wav", 255, 1);
}
continue;
}
- switch ((int) ent->v.movetype)
+ switch ((int) ent->v->movetype)
{
case MOVETYPE_PUSH:
SV_Physics_Pusher (ent);
break;
case MOVETYPE_NONE:
// LordHavoc: manually inlined the thinktime check here because MOVETYPE_NONE is used on so many objects
- if (ent->v.nextthink > 0 && ent->v.nextthink <= sv.time + sv.frametime)
+ if (ent->v->nextthink > 0 && ent->v->nextthink <= sv.time + sv.frametime)
SV_RunThink (ent);
break;
case MOVETYPE_FOLLOW:
case MOVETYPE_WALK:
if (SV_RunThink (ent))
{
- if (!SV_CheckWater (ent) && ! ((int)ent->v.flags & FL_WATERJUMP) )
+ if (!SV_CheckWater (ent) && ! ((int)ent->v->flags & FL_WATERJUMP) )
SV_AddGravity (ent);
SV_CheckStuck (ent);
SV_WalkMove (ent);
SV_Physics_Toss (ent);
break;
default:
- Host_Error ("SV_Physics: bad movetype %i", (int)ent->v.movetype);
+ Host_Error ("SV_Physics: bad movetype %i", (int)ent->v->movetype);
break;
}
}
memcpy(&tempent, tossent, sizeof(edict_t));
tent = &tempent;
- savesolid = tossent->v.solid;
- tossent->v.solid = SOLID_NOT;
+ savesolid = tossent->v->solid;
+ tossent->v->solid = SOLID_NOT;
// this has to fetch the field from the original edict, since our copy is truncated
val = GETEDICTFIELDVALUE(tossent, eval_gravity);
for (i = 0;i < 200;i++) // LordHavoc: sanity check; never trace more than 10 seconds
{
SV_CheckVelocity (tent);
- tent->v.velocity[2] -= gravity;
- VectorMA (tent->v.angles, 0.05, tent->v.avelocity, tent->v.angles);
- VectorScale (tent->v.velocity, 0.05, move);
- VectorAdd (tent->v.origin, move, end);
- trace = SV_Move (tent->v.origin, tent->v.mins, tent->v.maxs, end, MOVE_NORMAL, tent);
- VectorCopy (trace.endpos, tent->v.origin);
+ tent->v->velocity[2] -= gravity;
+ VectorMA (tent->v->angles, 0.05, tent->v->avelocity, tent->v->angles);
+ VectorScale (tent->v->velocity, 0.05, move);
+ VectorAdd (tent->v->origin, move, end);
+ trace = SV_Move (tent->v->origin, tent->v->mins, tent->v->maxs, end, MOVE_NORMAL, tent);
+ VectorCopy (trace.endpos, tent->v->origin);
if (trace.fraction < 1 && trace.ent)
if (trace.ent != ignore)
break;
}
- tossent->v.solid = savesolid;
+ tossent->v->solid = savesolid;
trace.fraction = 0; // not relevant
return trace;
}
int i, j;
int step, dir, steps;
- if (!((int)sv_player->v.flags & FL_ONGROUND))
+ if (!((int)sv_player->v->flags & FL_ONGROUND))
return;
- angleval = sv_player->v.angles[YAW] * M_PI*2 / 360;
+ angleval = sv_player->v->angles[YAW] * M_PI*2 / 360;
sinval = sin(angleval);
cosval = cos(angleval);
for (i=0 ; i<MAX_FORWARD ; i++)
{
- top[0] = sv_player->v.origin[0] + cosval*(i+3)*12;
- top[1] = sv_player->v.origin[1] + sinval*(i+3)*12;
- top[2] = sv_player->v.origin[2] + sv_player->v.view_ofs[2];
+ top[0] = sv_player->v->origin[0] + cosval*(i+3)*12;
+ top[1] = sv_player->v->origin[1] + sinval*(i+3)*12;
+ top[2] = sv_player->v->origin[2] + sv_player->v->view_ofs[2];
bottom[0] = top[0];
bottom[1] = top[1];
if (!dir)
{
- sv_player->v.idealpitch = 0;
+ sv_player->v->idealpitch = 0;
return;
}
if (steps < 2)
return;
- sv_player->v.idealpitch = -dir * sv_idealpitchscale.value;
+ sv_player->v->idealpitch = -dir * sv_idealpitchscale.value;
}
// if the leading edge is over a dropoff, increase friction
start[0] = stop[0] = origin[0] + vel[0]/speed*16;
start[1] = stop[1] = origin[1] + vel[1]/speed*16;
- start[2] = origin[2] + sv_player->v.mins[2];
+ start[2] = origin[2] + sv_player->v->mins[2];
stop[2] = start[2] - 34;
trace = SV_Move (start, vec3_origin, vec3_origin, stop, MOVE_NOMONSTERS, sv_player);
float len;
eval_t *val;
- len = VectorNormalizeLength (sv_player->v.punchangle);
+ len = VectorNormalizeLength (sv_player->v->punchangle);
len -= 10*sv.frametime;
if (len < 0)
len = 0;
- VectorScale (sv_player->v.punchangle, len, sv_player->v.punchangle);
+ VectorScale (sv_player->v->punchangle, len, sv_player->v->punchangle);
if ((val = GETEDICTFIELDVALUE(sv_player, eval_punchvector)))
{
int i;
float wishspeed;
- AngleVectors (sv_player->v.v_angle, forward, right, up);
+ AngleVectors (sv_player->v->v_angle, forward, right, up);
for (i = 0; i < 3; i++)
velocity[i] = forward[i] * cmd.forwardmove + right[i] * cmd.sidemove;
float speed, newspeed, wishspeed, addspeed, accelspeed, temp;
// user intentions
- AngleVectors (sv_player->v.v_angle, forward, right, up);
+ AngleVectors (sv_player->v->v_angle, forward, right, up);
for (i=0 ; i<3 ; i++)
wishvel[i] = forward[i]*cmd.forwardmove + right[i]*cmd.sidemove;
void SV_WaterJump (void)
{
- if (sv.time > sv_player->v.teleport_time || !sv_player->v.waterlevel)
+ if (sv.time > sv_player->v->teleport_time || !sv_player->v->waterlevel)
{
- sv_player->v.flags = (int)sv_player->v.flags & ~FL_WATERJUMP;
- sv_player->v.teleport_time = 0;
+ sv_player->v->flags = (int)sv_player->v->flags & ~FL_WATERJUMP;
+ sv_player->v->teleport_time = 0;
}
- sv_player->v.velocity[0] = sv_player->v.movedir[0];
- sv_player->v.velocity[1] = sv_player->v.movedir[1];
+ sv_player->v->velocity[0] = sv_player->v->movedir[0];
+ sv_player->v->velocity[1] = sv_player->v->movedir[1];
}
// LordHavoc: correct quake movement speed bug when looking up/down
wishvel[0] = wishvel[2] = 0;
- wishvel[1] = sv_player->v.angles[1];
+ wishvel[1] = sv_player->v->angles[1];
AngleVectors (wishvel, forward, right, up);
fmove = cmd.forwardmove;
smove = cmd.sidemove;
// hack to not let you back into teleporter
- if (sv.time < sv_player->v.teleport_time && fmove < 0)
+ if (sv.time < sv_player->v->teleport_time && fmove < 0)
fmove = 0;
for (i=0 ; i<3 ; i++)
wishvel[i] = forward[i]*fmove + right[i]*smove;
- if ((int)sv_player->v.movetype != MOVETYPE_WALK)
+ if ((int)sv_player->v->movetype != MOVETYPE_WALK)
wishvel[2] += cmd.upmove;
VectorCopy (wishvel, wishdir);
wishspeed = sv_maxspeed.value;
}
- if (sv_player->v.movetype == MOVETYPE_NOCLIP)
+ if (sv_player->v->movetype == MOVETYPE_NOCLIP)
{
// noclip
VectorCopy (wishvel, velocity);
{
vec3_t v_angle;
- if (sv_player->v.movetype == MOVETYPE_NONE)
+ if (sv_player->v->movetype == MOVETYPE_NONE)
return;
- onground = (int)sv_player->v.flags & FL_ONGROUND;
+ onground = (int)sv_player->v->flags & FL_ONGROUND;
- origin = sv_player->v.origin;
- velocity = sv_player->v.velocity;
+ origin = sv_player->v->origin;
+ velocity = sv_player->v->velocity;
DropPunchAngle ();
// if dead, behave differently
- if (sv_player->v.health <= 0)
+ if (sv_player->v->health <= 0)
return;
// angles
// show 1/3 the pitch angle and all the roll angle
cmd = host_client->cmd;
- angles = sv_player->v.angles;
+ angles = sv_player->v->angles;
- VectorAdd (sv_player->v.v_angle, sv_player->v.punchangle, v_angle);
- angles[ROLL] = V_CalcRoll (sv_player->v.angles, sv_player->v.velocity)*4;
- if (!sv_player->v.fixangle)
+ VectorAdd (sv_player->v->v_angle, sv_player->v->punchangle, v_angle);
+ angles[ROLL] = V_CalcRoll (sv_player->v->angles, sv_player->v->velocity)*4;
+ if (!sv_player->v->fixangle)
{
// LordHavoc: pitch was ugly to begin with... removed except in water
- if (sv_player->v.waterlevel >= 2)
+ if (sv_player->v->waterlevel >= 2)
angles[PITCH] = -v_angle[PITCH]/3;
else
angles[PITCH] = 0;
angles[YAW] = v_angle[YAW];
}
- if ( (int)sv_player->v.flags & FL_WATERJUMP )
+ if ( (int)sv_player->v->flags & FL_WATERJUMP )
{
SV_WaterJump ();
return;
// Player is (somehow) outside of the map, or flying, or noclipping
if (SV_TestEntityPosition (sv_player)
- || sv_player->v.movetype == MOVETYPE_FLY
- || sv_player->v.movetype == MOVETYPE_NOCLIP)
+ || sv_player->v->movetype == MOVETYPE_FLY
+ || sv_player->v->movetype == MOVETYPE_NOCLIP)
{
SV_FreeMove ();
return;
}
// walk
- if ((sv_player->v.waterlevel >= 2) && (sv_player->v.movetype != MOVETYPE_NOCLIP))
+ if ((sv_player->v->waterlevel >= 2) && (sv_player->v->movetype != MOVETYPE_NOCLIP))
{
SV_WaterMove ();
return;
for (i = 0;i < 3;i++)
angle[i] = MSG_ReadFloat ();
- VectorCopy (angle, host_client->edict->v.v_angle);
+ VectorCopy (angle, host_client->edict->v->v_angle);
// read movement
move->forwardmove = MSG_ReadShort ();
// read buttons
bits = MSG_ReadByte ();
- host_client->edict->v.button0 = bits & 1;
- host_client->edict->v.button2 = (bits & 2)>>1;
+ host_client->edict->v->button0 = bits & 1;
+ host_client->edict->v->button2 = (bits & 2)>>1;
// LordHavoc: added 6 new buttons
if ((val = GETEDICTFIELDVALUE(host_client->edict, eval_button3))) val->_float = ((bits >> 2) & 1);
if ((val = GETEDICTFIELDVALUE(host_client->edict, eval_button4))) val->_float = ((bits >> 3) & 1);
i = MSG_ReadByte ();
if (i)
- host_client->edict->v.impulse = i;
+ host_client->edict->v->impulse = i;
}
/*
touch = EDICT_FROM_AREA(l);
if (touch == ent)
continue;
- if (!touch->v.touch || touch->v.solid != SOLID_TRIGGER)
+ if (!touch->v->touch || touch->v->solid != SOLID_TRIGGER)
continue;
- if (ent->v.absmin[0] > touch->v.absmax[0]
- || ent->v.absmin[1] > touch->v.absmax[1]
- || ent->v.absmin[2] > touch->v.absmax[2]
- || ent->v.absmax[0] < touch->v.absmin[0]
- || ent->v.absmax[1] < touch->v.absmin[1]
- || ent->v.absmax[2] < touch->v.absmin[2])
+ if (ent->v->absmin[0] > touch->v->absmax[0]
+ || ent->v->absmin[1] > touch->v->absmax[1]
+ || ent->v->absmin[2] > touch->v->absmax[2]
+ || ent->v->absmax[0] < touch->v->absmin[0]
+ || ent->v->absmax[1] < touch->v->absmin[1]
+ || ent->v->absmax[2] < touch->v->absmin[2])
continue;
old_self = pr_global_struct->self;
old_other = pr_global_struct->other;
pr_global_struct->self = EDICT_TO_PROG(touch);
pr_global_struct->other = EDICT_TO_PROG(ent);
pr_global_struct->time = sv.time;
- PR_ExecuteProgram (touch->v.touch, "");
+ PR_ExecuteProgram (touch->v->touch, "");
pr_global_struct->self = old_self;
pr_global_struct->other = old_other;
if (node->axis == -1)
return;
- if (ent->v.absmax[node->axis] > node->dist)
+ if (ent->v->absmax[node->axis] > node->dist)
{
- if (ent->v.absmin[node->axis] < node->dist)
+ if (ent->v->absmin[node->axis] < node->dist)
SV_TouchLinks(ent, node->children[1]); // order reversed to reduce code
node = node->children[0];
goto loc0;
}
else
{
- if (ent->v.absmin[node->axis] < node->dist)
+ if (ent->v->absmin[node->axis] < node->dist)
{
node = node->children[1];
goto loc0;
// set the abs box
- if (ent->v.solid == SOLID_BSP)
+ if (ent->v->solid == SOLID_BSP)
{
- if (ent->v.modelindex < 0 || ent->v.modelindex > MAX_MODELS)
+ if (ent->v->modelindex < 0 || ent->v->modelindex > MAX_MODELS)
Host_Error("SOLID_BSP with invalid modelindex!\n");
- model = sv.models[(int) ent->v.modelindex];
+ model = sv.models[(int) ent->v->modelindex];
if (model != NULL)
{
if (model->type != mod_brush)
Host_Error("SOLID_BSP with non-BSP model\n");
- if (ent->v.angles[0] || ent->v.angles[2] || ent->v.avelocity[0] || ent->v.avelocity[2])
+ if (ent->v->angles[0] || ent->v->angles[2] || ent->v->avelocity[0] || ent->v->avelocity[2])
{
- VectorAdd(ent->v.origin, model->rotatedmins, ent->v.absmin);
- VectorAdd(ent->v.origin, model->rotatedmaxs, ent->v.absmax);
+ VectorAdd(ent->v->origin, model->rotatedmins, ent->v->absmin);
+ VectorAdd(ent->v->origin, model->rotatedmaxs, ent->v->absmax);
}
- else if (ent->v.angles[1] || ent->v.avelocity[1])
+ else if (ent->v->angles[1] || ent->v->avelocity[1])
{
- VectorAdd(ent->v.origin, model->yawmins, ent->v.absmin);
- VectorAdd(ent->v.origin, model->yawmaxs, ent->v.absmax);
+ VectorAdd(ent->v->origin, model->yawmins, ent->v->absmin);
+ VectorAdd(ent->v->origin, model->yawmaxs, ent->v->absmax);
}
else
{
- VectorAdd(ent->v.origin, model->normalmins, ent->v.absmin);
- VectorAdd(ent->v.origin, model->normalmaxs, ent->v.absmax);
+ VectorAdd(ent->v->origin, model->normalmins, ent->v->absmin);
+ VectorAdd(ent->v->origin, model->normalmaxs, ent->v->absmax);
}
}
else
{
// SOLID_BSP with no model is valid, mainly because some QC setup code does so temporarily
- VectorAdd (ent->v.origin, ent->v.mins, ent->v.absmin);
- VectorAdd (ent->v.origin, ent->v.maxs, ent->v.absmax);
+ VectorAdd (ent->v->origin, ent->v->mins, ent->v->absmin);
+ VectorAdd (ent->v->origin, ent->v->maxs, ent->v->absmax);
}
}
else
{
- VectorAdd (ent->v.origin, ent->v.mins, ent->v.absmin);
- VectorAdd (ent->v.origin, ent->v.maxs, ent->v.absmax);
+ VectorAdd (ent->v->origin, ent->v->mins, ent->v->absmin);
+ VectorAdd (ent->v->origin, ent->v->maxs, ent->v->absmax);
}
//
// to make items easier to pick up and allow them to be grabbed off
// of shelves, the abs sizes are expanded
//
- if ((int)ent->v.flags & FL_ITEM)
+ if ((int)ent->v->flags & FL_ITEM)
{
- ent->v.absmin[0] -= 15;
- ent->v.absmin[1] -= 15;
- ent->v.absmin[2] -= 1;
- ent->v.absmax[0] += 15;
- ent->v.absmax[1] += 15;
- ent->v.absmax[2] += 1;
+ ent->v->absmin[0] -= 15;
+ ent->v->absmin[1] -= 15;
+ ent->v->absmin[2] -= 1;
+ ent->v->absmax[0] += 15;
+ ent->v->absmax[1] += 15;
+ ent->v->absmax[2] += 1;
}
else
{
// because movement is clipped an epsilon away from an actual edge,
// we must fully check even when bounding boxes don't quite touch
- ent->v.absmin[0] -= 1;
- ent->v.absmin[1] -= 1;
- ent->v.absmin[2] -= 1;
- ent->v.absmax[0] += 1;
- ent->v.absmax[1] += 1;
- ent->v.absmax[2] += 1;
+ ent->v->absmin[0] -= 1;
+ ent->v->absmin[1] -= 1;
+ ent->v->absmin[2] -= 1;
+ ent->v->absmax[0] += 1;
+ ent->v->absmax[1] += 1;
+ ent->v->absmax[2] += 1;
}
- if (ent->v.solid == SOLID_NOT)
+ if (ent->v->solid == SOLID_NOT)
return;
// find the first node that the ent's box crosses
{
if (node->axis == -1)
break;
- if (ent->v.absmin[node->axis] > node->dist)
+ if (ent->v->absmin[node->axis] > node->dist)
node = node->children[0];
- else if (ent->v.absmax[node->axis] < node->dist)
+ else if (ent->v->absmax[node->axis] < node->dist)
node = node->children[1];
else
break; // crosses the node
// link it in
- if (ent->v.solid == SOLID_TRIGGER)
+ if (ent->v->solid == SOLID_TRIGGER)
InsertLinkBefore (&ent->area, &node->trigger_edicts);
else
InsertLinkBefore (&ent->area, &node->solid_edicts);
*/
int SV_TestEntityPosition (edict_t *ent)
{
- return SV_Move (ent->v.origin, ent->v.mins, ent->v.maxs, ent->v.origin, MOVE_NORMAL, ent).startsolid;
+ return SV_Move (ent->v->origin, ent->v->mins, ent->v->maxs, ent->v->origin, MOVE_NORMAL, ent).startsolid;
}
trace_t trace;
model_t *model;
- i = ent->v.modelindex;
+ i = ent->v->modelindex;
if ((unsigned int) i >= MAX_MODELS)
Host_Error("SV_ClipMoveToEntity: invalid modelindex\n");
model = sv.models[i];
if (i != 0 && model == NULL)
Host_Error("SV_ClipMoveToEntity: invalid modelindex\n");
- if ((int) ent->v.solid == SOLID_BSP)
+ if ((int) ent->v->solid == SOLID_BSP)
{
Mod_CheckLoaded(model);
if (model->type != mod_brush)
ED_Print (ent);
Host_Error ("SV_ClipMoveToEntity: SOLID_BSP with a non bsp model\n");
}
- if (ent->v.movetype != MOVETYPE_PUSH)
+ if (ent->v->movetype != MOVETYPE_PUSH)
Host_Error ("SV_ClipMoveToEntity: SOLID_BSP without MOVETYPE_PUSH");
}
- Collision_ClipTrace(&trace, ent, model, ent->v.origin, ent->v.angles, ent->v.mins, ent->v.maxs, start, mins, maxs, end);
+ Collision_ClipTrace(&trace, ent, model, ent->v->origin, ent->v->angles, ent->v->mins, ent->v->maxs, start, mins, maxs, end);
return trace;
}
{
next = l->next;
touch = EDICT_FROM_AREA(l);
- if (touch->v.solid == SOLID_NOT)
+ if (touch->v->solid == SOLID_NOT)
continue;
if (touch == clip->passedict)
continue;
- if (touch->v.solid == SOLID_TRIGGER)
+ if (touch->v->solid == SOLID_TRIGGER)
{
ED_Print(touch);
Host_Error ("Trigger in clipping list");
}
- if (clip->type == MOVE_NOMONSTERS && touch->v.solid != SOLID_BSP)
+ if (clip->type == MOVE_NOMONSTERS && touch->v->solid != SOLID_BSP)
continue;
- if (clip->boxmins[0] > touch->v.absmax[0]
- || clip->boxmaxs[0] < touch->v.absmin[0]
- || clip->boxmins[1] > touch->v.absmax[1]
- || clip->boxmaxs[1] < touch->v.absmin[1]
- || clip->boxmins[2] > touch->v.absmax[2]
- || clip->boxmaxs[2] < touch->v.absmin[2])
+ if (clip->boxmins[0] > touch->v->absmax[0]
+ || clip->boxmaxs[0] < touch->v->absmin[0]
+ || clip->boxmins[1] > touch->v->absmax[1]
+ || clip->boxmaxs[1] < touch->v->absmin[1]
+ || clip->boxmins[2] > touch->v->absmax[2]
+ || clip->boxmaxs[2] < touch->v->absmin[2])
continue;
if (clip->passedict)
{
- if (clip->passedict->v.size[0] && !touch->v.size[0])
+ if (clip->passedict->v->size[0] && !touch->v->size[0])
continue; // points never interact
- if (PROG_TO_EDICT(touch->v.owner) == clip->passedict)
+ if (PROG_TO_EDICT(touch->v->owner) == clip->passedict)
continue; // don't clip against own missiles
- if (PROG_TO_EDICT(clip->passedict->v.owner) == touch)
+ if (PROG_TO_EDICT(clip->passedict->v->owner) == touch)
continue; // don't clip against owner
// LordHavoc: corpse code
- if (clip->passedict->v.solid == SOLID_CORPSE && (touch->v.solid == SOLID_SLIDEBOX || touch->v.solid == SOLID_CORPSE))
+ if (clip->passedict->v->solid == SOLID_CORPSE && (touch->v->solid == SOLID_SLIDEBOX || touch->v->solid == SOLID_CORPSE))
continue;
- if (clip->passedict->v.solid == SOLID_SLIDEBOX && touch->v.solid == SOLID_CORPSE)
+ if (clip->passedict->v->solid == SOLID_SLIDEBOX && touch->v->solid == SOLID_CORPSE)
continue;
}
// might interact, so do an exact clip
- if (touch->v.solid == SOLID_BSP)
+ if (touch->v->solid == SOLID_BSP)
trace = SV_ClipMoveToEntity (touch, clip->start, clip->hullmins, clip->hullmaxs, clip->end);
- else if ((int)touch->v.flags & FL_MONSTER)
+ else if ((int)touch->v->flags & FL_MONSTER)
trace = SV_ClipMoveToEntity (touch, clip->start, clip->mins2, clip->maxs2, clip->end);
else
trace = SV_ClipMoveToEntity (touch, clip->start, clip->mins, clip->maxs, clip->end);