model_t *CL_GetModelFromEdict(prvm_edict_t *ed)
{
prvm_prog_t *prog = CLVM_prog;
- if (!ed || ed->priv.server->free)
+ if (!ed || ed->free)
return NULL;
return CL_GetModelByIndex((int)PRVM_clientedictfloat(ed, modelindex));
}
if (ent == prog->edicts)
return; // don't add the world
- if (ent->priv.server->free)
+ if (ent->free)
return;
// set the abs box
VM_Warning(prog, "setorigin: can not modify world entity\n");
return;
}
- if (e->priv.required->free)
+ if (e->free)
{
VM_Warning(prog, "setorigin: can not modify free entity\n");
return;
VM_Warning(prog, "setsize: can not modify world entity\n");
return;
}
- if (e->priv.server->free)
+ if (e->free)
{
VM_Warning(prog, "setsize: can not modify free entity\n");
return;
VM_Warning(prog, "droptofloor: can not modify world entity\n");
return;
}
- if (ent->priv.server->free)
+ if (ent->free)
{
VM_Warning(prog, "droptofloor: can not modify free entity\n");
return;
// so we can easily check if CSQC entity #edictnum is currently drawn
cl.csqcrenderentities[i].entitynumber = 0;
ed = &prog->edicts[i];
- if(ed->priv.required->free)
+ if(ed->free)
continue;
CSQC_Think(ed);
- if(ed->priv.required->free)
+ if(ed->free)
continue;
// note that for RF_USEAXIS entities, Predraw sets v_forward/v_right/v_up globals that are read by CSQC_AddRenderEdict
CSQC_Predraw(ed);
- if(ed->priv.required->free)
+ if(ed->free)
continue;
if(!((int)PRVM_clientedictfloat(ed, drawmask) & drawmask))
continue;
VM_Warning(prog, "makestatic: can not modify world entity\n");
return;
}
- if (ent->priv.server->free)
+ if (ent->free)
{
VM_Warning(prog, "makestatic: can not modify free entity\n");
return;
VM_Warning(prog, "copyentity: can not read world entity\n");
return;
}
- if (in->priv.server->free)
+ if (in->free)
{
VM_Warning(prog, "copyentity: can not read free entity\n");
return;
VM_Warning(prog, "copyentity: can not modify world entity\n");
return;
}
- if (out->priv.server->free)
+ if (out->free)
{
VM_Warning(prog, "copyentity: can not modify free entity\n");
return;
VM_Warning(prog, "setattachment: can not modify world entity\n");
return;
}
- if (e->priv.server->free)
+ if (e->free)
{
VM_Warning(prog, "setattachment: can not modify free entity\n");
return;
if (ent == prog->edicts)
return 1;
- if (ent->priv.server->free)
+ if (ent->free)
return 2;
model = CL_GetModelFromEdict(ent);
VM_Warning(prog, "VM_CL_gettagindex(entity #%i): can't affect world entity\n", PRVM_NUM_FOR_EDICT(ent));
return;
}
- if (ent->priv.server->free)
+ if (ent->free)
{
VM_Warning(prog, "VM_CL_gettagindex(entity #%i): can't affect free entity\n", PRVM_NUM_FOR_EDICT(ent));
return;
VM_Warning(prog, "walkmove: can not modify world entity\n");
return;
}
- if (ent->priv.server->free)
+ if (ent->free)
{
VM_Warning(prog, "walkmove: can not modify free entity\n");
return;
VectorCopy(PRVM_G_VECTOR(OFS_PARM0), viewpos);
viewee = PRVM_G_EDICT(OFS_PARM1);
- if(viewee->priv.required->free)
+ if(viewee->free)
{
VM_Warning(prog, "checkpvs: can not check free entity\n");
PRVM_G_FLOAT(OFS_RETURN) = 4;
// link every entity except world
for (i = 1, ent = prog->edicts;i < prog->num_edicts;i++, ent++)
- if (!ent->priv.server->free && !VectorCompare(PRVM_clientedictvector(ent, absmin), PRVM_clientedictvector(ent, absmax)))
+ if (!ent->free && !VectorCompare(PRVM_clientedictvector(ent, absmin), PRVM_clientedictvector(ent, absmax)))
CL_LinkEdict(ent);
}
for (i=0 ; i<prog->num_edicts ; i++)
{
ent = PRVM_EDICT_NUM(i);
- if (ent->priv.server->free)
+ if (ent->free)
continue;
active++;
if (PRVM_clientedictfloat(ent, solid))
ed = PRVM_EDICT_NUM(entnum - MAX_EDICTS);
- if(!ed->priv.required->free)
+ if(!ed->free)
{
mod = CL_GetModelFromEdict(ed);
VectorCopy(PRVM_clientedictvector(ed, origin), out);
for (i = 0; i < prog->num_edicts; i++)
{
edict = PRVM_EDICT_NUM(i);
- if (edict->priv.server->free)
+ if (edict->free)
continue;
// exclude the following for now, as they don't live in world coordinate space and can't be solid:
if (PRVM_gameedictedict(edict, tag_entity) != 0)
for (i=0 ; i<prog->num_edicts ; i++)
{
ent = PRVM_EDICT_NUM(i);
- if (ent->priv.required->free)
+ if (ent->free)
continue;
active++;
}
typedef struct edict_engineprivate_s
{
- // true if this edict is unused
- qbool free;
- // sv.time when the object was freed (to prevent early reuse which could
- // mess up client interpolation or obscure severe QuakeC bugs)
- double freetime;
// mark for the leak detector
int mark;
// place in the code where it was allocated (for the leak detector)
const char *allocation_origin;
+
// initially false to prevent projectiles from moving on their first frame
// (even if they were spawned by an synchronous client think)
qbool move;
const char *name;
} prvm_required_field_t;
-
+#define PRVM_EDICT_MARK_WAIT_FOR_SETORIGIN -1
+#define PRVM_EDICT_MARK_SETORIGIN_CAUGHT -2
// AK: I dont call it engine private cause it doesnt really belongs to the engine
// it belongs to prvm.
typedef struct prvm_edict_private_s
{
- qbool free;
- double freetime; // realtime of last change to "free" (i.e. also set on allocation)
- int mark; // used during leaktest (0 = unref, >0 = referenced); special values during server physics:
-#define PRVM_EDICT_MARK_WAIT_FOR_SETORIGIN -1
-#define PRVM_EDICT_MARK_SETORIGIN_CAUGHT -2
+ // mark for the leak detector
+ int mark;
+ // place in the code where it was allocated (for the leak detector)
const char *allocation_origin;
} prvm_edict_private_t;
typedef struct prvm_edict_s
{
+ // true if this edict is unused
+ qbool free;
+ // sv.time when the object was freed (to prevent early reuse which could
+ // mess up client interpolation or obscure severe QuakeC bugs)
+ double freetime;
+
// engine-private fields (stored in dynamically resized array)
- //edict_engineprivate_t *e;
union
{
prvm_edict_private_t *required;
VM_SAFEPARMCOUNT(1, VM_ftoe);
ent = (prvm_int_t)PRVM_G_FLOAT(OFS_PARM0);
- if (ent < 0 || ent >= prog->max_edicts || PRVM_PROG_TO_EDICT(ent)->priv.required->free)
+ if (ent < 0 || ent >= prog->max_edicts || PRVM_PROG_TO_EDICT(ent)->free)
ent = 0; // return world instead of a free or invalid entity
PRVM_G_INT(OFS_RETURN) = ent;
if (developer.integer > 0)
VM_Warning(prog, "VM_remove: tried to remove the null entity or a reserved entity!\n" );
}
- else if( ed->priv.required->free )
+ else if( ed->free )
{
if (developer.integer > 0)
VM_Warning(prog, "VM_remove: tried to remove an already freed entity!\n" );
{
prog->xfunction->builtinsprofile++;
ed = PRVM_EDICT_NUM(e);
- if (ed->priv.required->free)
+ if (ed->free)
continue;
t = PRVM_E_STRING(ed,f);
if (!t)
{
prog->xfunction->builtinsprofile++;
ed = PRVM_EDICT_NUM(e);
- if (ed->priv.required->free)
+ if (ed->free)
continue;
if (PRVM_E_FLOAT(ed,f) == s)
{
for (i = 1;i < prog->num_edicts;i++, ent = PRVM_NEXT_EDICT(ent))
{
prog->xfunction->builtinsprofile++;
- if (ent->priv.required->free)
+ if (ent->free)
continue;
t = PRVM_E_STRING(ent,f);
if (!t)
for (i = 1;i < prog->num_edicts;i++, ent = PRVM_NEXT_EDICT(ent))
{
prog->xfunction->builtinsprofile++;
- if (ent->priv.required->free)
+ if (ent->free)
continue;
if (PRVM_E_FLOAT(ent,f) != s)
continue;
{
prog->xfunction->builtinsprofile++;
ed = PRVM_EDICT_NUM(e);
- if (ed->priv.required->free)
+ if (ed->free)
continue;
if (!PRVM_E_FLOAT(ed,f))
continue;
for (i = 1;i < prog->num_edicts;i++, ent = PRVM_NEXT_EDICT(ent))
{
prog->xfunction->builtinsprofile++;
- if (ent->priv.required->free)
+ if (ent->free)
continue;
if (!PRVM_E_FLOAT(ent,f))
continue;
return;
}
ent = PRVM_EDICT_NUM(i);
- if (!ent->priv.required->free)
+ if (!ent->free)
{
VM_RETURN_EDICT(ent);
return;
}
ent = PRVM_G_EDICT(OFS_PARM1);
- if(ent->priv.required->free)
+ if(ent->free)
{
VM_Warning(prog, "VM_writetofile: %s: entity %i is free !\n", prog->name, PRVM_NUM_FOR_EDICT(ent));
return;
// get the entity
ent = PRVM_G_EDICT(OFS_PARM1);
- if(ent->priv.required->free)
+ if(ent->free)
{
PRVM_G_INT(OFS_RETURN) = PRVM_SetTempString(prog, "");
VM_Warning(prog, "VM_entityfielddata: %s: entity %i is free !\n", prog->name, PRVM_NUM_FOR_EDICT(ent));
// get the entity
ent = PRVM_G_EDICT(OFS_PARM1);
- if(ent->priv.required->free)
+ if(ent->free)
{
VM_Warning(prog, "VM_entityfielddata: %s: entity %i is free !\n", prog->name, PRVM_NUM_FOR_EDICT(ent));
PRVM_G_FLOAT(OFS_RETURN) = 0.0f;
// get edict and test it
ent = PRVM_G_EDICT(OFS_PARM0);
- if (ent->priv.required->free)
+ if (ent->free)
prog->error_cmd("VM_parseentitydata: %s: Can only set already spawned entities (entity %i is free)!", prog->name, PRVM_NUM_FOR_EDICT(ent));
data = PRVM_G_STRING(OFS_PARM1);
VM_Warning(prog, "changeyaw: can not modify world entity\n");
return;
}
- if (ent->priv.server->free)
+ if (ent->free)
{
VM_Warning(prog, "changeyaw: can not modify free entity\n");
return;
VM_Warning(prog, "changepitch: can not modify world entity\n");
return;
}
- if (ent->priv.server->free)
+ if (ent->free)
{
VM_Warning(prog, "changepitch: can not modify free entity\n");
return;
void VM_wasfreed (prvm_prog_t *prog)
{
VM_SAFEPARMCOUNT(1, VM_wasfreed);
- PRVM_G_FLOAT(OFS_RETURN) = PRVM_G_EDICT(OFS_PARM0)->priv.required->free;
+ PRVM_G_FLOAT(OFS_RETURN) = PRVM_G_EDICT(OFS_PARM0)->free;
}
void VM_SetTraceGlobals(prvm_prog_t *prog, const trace_t *trace)
ed = PRVM_G_EDICT(OFS_PARM0);
VectorCopy(PRVM_G_VECTOR(OFS_PARM1), point);
- if (!ed || ed->priv.server->free)
+ if (!ed || ed->free)
return;
model = getmodel(prog, ed);
if (!model || !model->num_surfaces)
void PRVM_ED_ClearEdict(prvm_prog_t *prog, prvm_edict_t *e)
{
memset(e->fields.fp, 0, prog->entityfields * sizeof(prvm_vec_t));
- e->priv.required->free = false;
- e->priv.required->freetime = host.realtime;
+ e->free = false;
+ e->freetime = host.realtime;
if(e->priv.required->allocation_origin)
Mem_Free((char *)e->priv.required->allocation_origin);
e->priv.required->allocation_origin = PRVM_AllocationOrigin(prog);
*/
qbool PRVM_ED_CanAlloc(prvm_prog_t *prog, prvm_edict_t *e)
{
- if(!e->priv.required->free)
+ if(!e->free)
return false;
if(prvm_reuseedicts_always_allow == host.realtime)
return true;
- if(host.realtime <= e->priv.required->freetime + 0.1 && prvm_reuseedicts_neverinsameframe.integer)
+ if(host.realtime <= e->freetime + 0.1 && prvm_reuseedicts_neverinsameframe.integer)
return false; // never allow reuse in same frame (causes networking trouble)
- if(e->priv.required->freetime < prog->starttime + prvm_reuseedicts_startuptime.value)
+ if(e->freetime < prog->starttime + prvm_reuseedicts_startuptime.value)
return true;
- if(host.realtime > e->priv.required->freetime + 1)
+ if(host.realtime > e->freetime + 1)
return true;
return false; // entity slot still blocked because the entity was freed less than one second ago
}
prog->free_edict(prog, ed);
- ed->priv.required->free = true;
- ed->priv.required->freetime = host.realtime;
+ ed->free = true;
+ ed->freetime = host.realtime;
if(ed->priv.required->allocation_origin)
{
Mem_Free((char *)ed->priv.required->allocation_origin);
char tempstring[MAX_INPUTLINE], tempstring2[260]; // temporary string buffers
char valuebuf[MAX_INPUTLINE];
- if (ed->priv.required->free)
+ if (ed->free)
{
Con_Printf("%s: FREE\n",prog->name);
return;
FS_Print(f, "{\n");
- if (ed->priv.required->free)
+ if (ed->free)
{
FS_Print(f, "}\n");
return;
}
if (!init) {
- ent->priv.required->free = true;
- ent->priv.required->freetime = host.realtime;
+ ent->free = true;
+ ent->freetime = host.realtime;
}
return data;
//
// immediately call spawn function, but only if there is a self global and a classname
//
- if (!ent->priv.required->free)
+ if (!ent->free)
{
if (!PRVM_alledictstring(ent, classname))
{
void PRVM_ED_CallPostspawnFunction (prvm_prog_t *prog, prvm_edict_t *ent)
{
- if(!ent->priv.required->free)
+ if(!ent->free)
if (PRVM_serverfunction(SV_OnEntityPostSpawnFunction))
{
// self = ent
PRVM_ED_CallPrespawnFunction(prog, ent);
- if(ent->priv.required->free)
+ if(ent->free)
{
inhibited++;
continue;
PRVM_ED_CallPostspawnFunction(prog, ent);
spawned++;
- if (ent->priv.required->free)
+ if (ent->free)
died++;
}
for (ednum = 0;ednum < prog->max_edicts;ednum++)
{
ed = PRVM_EDICT_NUM(ednum);
- if (ed->priv.required->free)
+ if (ed->free)
continue;
for (i = 1;i < prog->numfielddefs;i++)
{
for(j = 0; j < prog->num_edicts; ++j)
{
prvm_edict_t *ed = PRVM_EDICT_NUM(j);
- if (ed->priv.required->free)
+ if (ed->free)
continue;
for (i=0; i<prog->numfielddefs; ++i)
{
char vabuf2[1024];
if(PRVM_NUM_FOR_EDICT(edict) <= prog->reserved_edicts)
return true; // world or clients
- if (edict->priv.required->freetime <= prog->inittime)
+ if (edict->freetime <= prog->inittime)
return true; // created during startup
if (prog == SVVM_prog)
{
for(j = 0; j < prog->num_edicts; ++j)
{
prvm_edict_t *ed = PRVM_EDICT_NUM(j);
- if(ed->priv.required->free)
+ if(ed->free)
continue;
ed->priv.required->mark = PRVM_IsEdictRelevant(prog, ed) ? stage : 0;
}
for(j = 0; j < prog->num_edicts; ++j)
{
prvm_edict_t *ed = PRVM_EDICT_NUM(j);
- if(ed->priv.required->free)
+ if(ed->free)
continue;
if(ed->priv.required->mark)
continue;
for(j = 0; j < prog->num_edicts; ++j)
{
prvm_edict_t *ed = PRVM_EDICT_NUM(j);
- if(ed->priv.required->free)
+ if(ed->free)
continue;
if(!ed->priv.required->mark)
if(ed->priv.required->allocation_origin)
return;
}
- if(!ed->priv.required->free)
+ if(!ed->free)
{
print("Removed a \"%s\"\n", PRVM_GetString(prog, PRVM_serveredictstring(ed, classname)));
PRVM_ED_ClearEdict(prog, ed);
for (i = 0, rmcount = 0, ed = PRVM_EDICT_NUM(i); i < prog->num_edicts; i++, ed = PRVM_NEXT_EDICT(ed))
{
- if(!ed->priv.required->free && !strcmp(PRVM_GetString(prog, PRVM_serveredictstring(ed, classname)), Cmd_Argv(cmd, 1)))
+ if(!ed->free && !strcmp(PRVM_GetString(prog, PRVM_serveredictstring(ed, classname)), Cmd_Argv(cmd, 1)))
{
if(!i)
{
{
prvm_prog_t *prog = SVVM_prog;
int modelindex;
- if (!ed || ed->priv.server->free)
+ if (!ed || ed->free)
return NULL;
modelindex = (int)PRVM_serveredictfloat(ed, modelindex);
return (modelindex > 0 && modelindex < MAX_MODELS) ? sv.models[modelindex] : NULL;
// LadyHavoc: always clear state values, whether the entity is in use or not
svent->priv.server->baseline = defaultstate;
- if (svent->priv.server->free)
+ if (svent->free)
continue;
if (entnum > svs.maxclients && !PRVM_serveredictfloat(svent, modelindex))
continue;
// AK possible hack since num_edicts is still 0
ent = PRVM_EDICT_NUM(0);
memset (ent->fields.fp, 0, prog->entityfields * sizeof(prvm_vec_t));
- ent->priv.server->free = false;
+ ent->free = false;
PRVM_serveredictstring(ent, model) = PRVM_SetEngineString(prog, sv.worldname);
PRVM_serveredictfloat(ent, modelindex) = 1; // world model
PRVM_serveredictfloat(ent, solid) = SOLID_BSP;
// link every entity except world
for (i = 1, ent = prog->edicts;i < prog->num_edicts;i++, ent++)
- if (!ent->priv.server->free && !VectorCompare(PRVM_serveredictvector(ent, absmin), PRVM_serveredictvector(ent, absmax)))
+ if (!ent->free && !VectorCompare(PRVM_serveredictvector(ent, absmin), PRVM_serveredictvector(ent, absmax)))
SV_LinkEdict(ent);
}
for (i=0 ; i<prog->num_edicts ; i++)
{
ent = PRVM_EDICT_NUM(i);
- if (ent->priv.server->free)
+ if (ent->free)
continue;
active++;
if (PRVM_serveredictfloat(ent, solid))
for (edictindex = 1;edictindex < prog->num_edicts;edictindex++)
{
ed = PRVM_EDICT_NUM(edictindex);
- if (!ed->priv.required->free && BoxesOverlap(PRVM_serveredictvector(ed, absmin), PRVM_serveredictvector(ed, absmax), paddedmins, paddedmaxs))
+ if (!ed->free && BoxesOverlap(PRVM_serveredictvector(ed, absmin), PRVM_serveredictvector(ed, absmax), paddedmins, paddedmaxs))
{
resultedicts[numresultedicts++] = ed;
if (numresultedicts == maxedicts)
if (ent == prog->edicts)
return; // don't add the world
- if (ent->priv.server->free)
+ if (ent->free)
return;
if (PRVM_serveredictfloat(ent, solid) == SOLID_NOT)
if (ent == prog->edicts)
return; // don't add the world
- if (ent->priv.server->free)
+ if (ent->free)
return;
modelindex = (int)PRVM_serveredictfloat(ent, modelindex);
if (PRVM_serveredictfloat(ent, nextthink) <= 0 || PRVM_serveredictfloat(ent, nextthink) > sv.time + sv.frametime)
return true;
- for (iterations = 0;iterations < 128 && !ent->priv.server->free;iterations++)
+ for (iterations = 0;iterations < 128 && !ent->free;iterations++)
{
PRVM_serverglobalfloat(time) = max(sv.time, PRVM_serveredictfloat(ent, nextthink));
PRVM_serveredictfloat(ent, nextthink) = 0;
if (PRVM_serveredictfloat(ent, nextthink) <= PRVM_serverglobalfloat(time) || PRVM_serveredictfloat(ent, nextthink) > sv.time + sv.frametime || !sv_gameplayfix_multiplethinksperframe.integer)
break;
}
- return !ent->priv.server->free;
+ return !ent->free;
}
/*
VM_SetTraceGlobals(prog, trace);
- if (!e1->priv.server->free && !e2->priv.server->free && PRVM_serveredictfunction(e1, touch) && PRVM_serveredictfloat(e1, solid) != SOLID_NOT)
+ if (!e1->free && !e2->free && PRVM_serveredictfunction(e1, touch) && PRVM_serveredictfloat(e1, solid) != SOLID_NOT)
{
PRVM_serverglobalfloat(time) = sv.time;
PRVM_serverglobaledict(self) = PRVM_EDICT_TO_PROG(e1);
prog->ExecuteProgram(prog, PRVM_serveredictfunction(e1, touch), "QC function self.touch is missing");
}
- if (!e1->priv.server->free && !e2->priv.server->free && PRVM_serveredictfunction(e2, touch) && PRVM_serveredictfloat(e2, solid) != SOLID_NOT)
+ if (!e1->free && !e2->free && PRVM_serveredictfunction(e2, touch) && PRVM_serveredictfloat(e2, solid) != SOLID_NOT)
{
PRVM_serverglobalfloat(time) = sv.time;
PRVM_serverglobaledict(self) = PRVM_EDICT_TO_PROG(e2);
// we can trust FL_ONGROUND if groundentity is world because it never moves
return;
}
- else if (ent->priv.server->suspendedinairflag && groundentity->priv.server->free)
+ else if (ent->priv.server->suspendedinairflag && groundentity->free)
{
// if ent was supported by a brush model on previous frame,
// and groundentity is now freed, set groundentity to 0 (world)
VectorScale(PRVM_serveredictvector(ent, velocity), movetime, move);
if(!SV_PushEntity(&trace, ent, move, true))
return; // teleported
- if (ent->priv.server->free)
+ if (ent->free)
return;
if (trace.bmodelstartsolid && sv_gameplayfix_unstickentities.integer)
{
SV_UnstickEntity(ent);
if(!SV_PushEntity(&trace, ent, move, true))
return; // teleported
- if (ent->priv.server->free)
+ if (ent->free)
return;
}
if (trace.fraction == 1)
// if force_retouch, relink all the entities
if (PRVM_serverglobalfloat(force_retouch) > 0)
for (i = 1, ent = PRVM_EDICT_NUM(i);i < prog->num_edicts;i++, ent = PRVM_NEXT_EDICT(ent))
- if (!ent->priv.server->free)
+ if (!ent->free)
SV_LinkEdict_TouchAreaGrid(ent); // force retouch even for stationary
if (sv_gameplayfix_consistentplayerprethink.integer)
{
// run physics on the client entities in 3 stages
for (i = 1, ent = PRVM_EDICT_NUM(i), host_client = svs.clients;i <= svs.maxclients;i++, ent = PRVM_NEXT_EDICT(ent), host_client++)
- if (!ent->priv.server->free)
+ if (!ent->free)
SV_Physics_ClientEntity_PreThink(ent);
for (i = 1, ent = PRVM_EDICT_NUM(i), host_client = svs.clients;i <= svs.maxclients;i++, ent = PRVM_NEXT_EDICT(ent), host_client++)
- if (!ent->priv.server->free)
+ if (!ent->free)
SV_Physics_ClientEntity(ent);
for (i = 1, ent = PRVM_EDICT_NUM(i), host_client = svs.clients;i <= svs.maxclients;i++, ent = PRVM_NEXT_EDICT(ent), host_client++)
- if (!ent->priv.server->free)
+ if (!ent->free)
SV_Physics_ClientEntity_PostThink(ent);
}
else
// run physics on the client entities
for (i = 1, ent = PRVM_EDICT_NUM(i), host_client = svs.clients;i <= svs.maxclients;i++, ent = PRVM_NEXT_EDICT(ent), host_client++)
{
- if (!ent->priv.server->free)
+ if (!ent->free)
{
SV_Physics_ClientEntity_PreThink(ent);
SV_Physics_ClientEntity(ent);
if (!sv_freezenonclients.integer)
{
for (;i < prog->num_edicts;i++, ent = PRVM_NEXT_EDICT(ent))
- if (!ent->priv.server->free)
+ if (!ent->free)
SV_Physics_Entity(ent);
// make a second pass to see if any ents spawned this frame and make
// sure they run their move/think
if (sv_gameplayfix_delayprojectiles.integer < 0)
for (i = svs.maxclients + 1, ent = PRVM_EDICT_NUM(i);i < prog->num_edicts;i++, ent = PRVM_NEXT_EDICT(ent))
- if (!ent->priv.server->move && !ent->priv.server->free)
+ if (!ent->priv.server->move && !ent->free)
SV_Physics_Entity(ent);
}
PRVM_MEM_IncreaseEdicts(prog);
ent = PRVM_EDICT_NUM(entnum);
memset(ent->fields.fp, 0, prog->entityfields * sizeof(prvm_vec_t));
- ent->priv.server->free = false;
+ ent->free = false;
if(developer_entityparsing.integer)
Con_Printf("SV_Loadgame_f: loading edict %d\n", entnum);
PRVM_ED_ParseEdict (prog, start, ent);
// link it into the bsp tree
- if (!ent->priv.server->free && !VectorCompare(PRVM_serveredictvector(ent, absmin), PRVM_serveredictvector(ent, absmax)))
+ if (!ent->free && !VectorCompare(PRVM_serveredictvector(ent, absmin), PRVM_serveredictvector(ent, absmax)))
SV_LinkEdict(ent);
}
memset(sv.sendentitiesindex, 0, prog->num_edicts * sizeof(*sv.sendentitiesindex));
for (e = 1, ent = PRVM_NEXT_EDICT(prog->edicts);e < prog->num_edicts;e++, ent = PRVM_NEXT_EDICT(ent))
{
- if (!ent->priv.server->free && SV_PrepareEntityForSending(ent, sv.sendentities + sv.numsendentities, e))
+ if (!ent->free && SV_PrepareEntityForSending(ent, sv.sendentities + sv.numsendentities, e))
{
sv.sendentitiesindex[e] = sv.sendentities + sv.numsendentities;
sv.numsendentities++;
// check line of sight to portal entities and add them to PVS
for (e = 1, ed = PRVM_NEXT_EDICT(prog->edicts);e < prog->num_edicts;e++, ed = PRVM_NEXT_EDICT(ed))
{
- if (!ed->priv.server->free)
+ if (!ed->free)
{
if(PRVM_serveredictfunction(ed, camera_transform))
{
if (clientcamera > 0)
{
int oldclientcamera = host_client->clientcamera;
- if (clientcamera >= prog->max_edicts || PRVM_EDICT_NUM(clientcamera)->priv.required->free)
+ if (clientcamera >= prog->max_edicts || PRVM_EDICT_NUM(clientcamera)->free)
clientcamera = PRVM_NUM_FOR_EDICT(host_client->edict);
host_client->clientcamera = clientcamera;
}
// as requested by FrikaC, cursor_trace_ent is reset to world if the
// entity is free at time of receipt
- if (PRVM_EDICT_NUM(move->cursor_entitynumber)->priv.server->free)
+ if (PRVM_EDICT_NUM(move->cursor_entitynumber)->free)
move->cursor_entitynumber = 0;
if (sv_message.badread) Con_Printf("SV_ReadClientMessage: badread at %s:%i\n", __FILE__, __LINE__);
}
VM_Warning(prog, "setorigin: can not modify world entity\n");
return;
}
- if (e->priv.server->free)
+ if (e->free)
{
VM_Warning(prog, "setorigin: can not modify free entity\n");
return;
VM_Warning(prog, "setsize: can not modify world entity\n");
return;
}
- if (e->priv.server->free)
+ if (e->free)
{
VM_Warning(prog, "setsize: can not modify free entity\n");
return;
VM_Warning(prog, "setmodel: can not modify world entity\n");
return;
}
- if (e->priv.server->free)
+ if (e->free)
{
VM_Warning(prog, "setmodel: can not modify free entity\n");
return;
// look up the client's edict
ent = PRVM_EDICT_NUM(i);
// check if it is to be ignored, but never ignore the one we started on (prevent infinite loop)
- if (i != check && (ent->priv.server->free || PRVM_serveredictfloat(ent, health) <= 0 || ((int)PRVM_serveredictfloat(ent, flags) & FL_NOTARGET)))
+ if (i != check && (ent->free || PRVM_serveredictfloat(ent, health) <= 0 || ((int)PRVM_serveredictfloat(ent, flags) & FL_NOTARGET)))
continue;
// found a valid client (possibly the same one again)
break;
// return check if it might be visible
ent = PRVM_EDICT_NUM(sv.lastcheck);
- if (ent->priv.server->free || PRVM_serveredictfloat(ent, health) <= 0)
+ if (ent->free || PRVM_serveredictfloat(ent, health) <= 0)
{
VM_RETURN_EDICT(prog->edicts);
return;
VectorCopy(PRVM_G_VECTOR(OFS_PARM0), viewpos);
viewee = PRVM_G_EDICT(OFS_PARM1);
- if(viewee->priv.server->free)
+ if(viewee->free)
{
VM_Warning(prog, "checkpvs: can not check free entity\n");
PRVM_G_FLOAT(OFS_RETURN) = 4;
VM_Warning(prog, "walkmove: can not modify world entity\n");
return;
}
- if (ent->priv.server->free)
+ if (ent->free)
{
VM_Warning(prog, "walkmove: can not modify free entity\n");
return;
VM_Warning(prog, "droptofloor: can not modify world entity\n");
return;
}
- if (ent->priv.server->free)
+ if (ent->free)
{
VM_Warning(prog, "droptofloor: can not modify free entity\n");
return;
VM_Warning(prog, "aim: can not use world entity\n");
return;
}
- if (ent->priv.server->free)
+ if (ent->free)
{
VM_Warning(prog, "aim: can not use free entity\n");
return;
VM_Warning(prog, "makestatic: can not modify world entity\n");
return;
}
- if (ent->priv.server->free)
+ if (ent->free)
{
VM_Warning(prog, "makestatic: can not modify free entity\n");
return;
VM_Warning(prog, "copyentity: can not read world entity\n");
return;
}
- if (in->priv.server->free)
+ if (in->free)
{
VM_Warning(prog, "copyentity: can not read free entity\n");
return;
VM_Warning(prog, "copyentity: can not modify world entity\n");
return;
}
- if (out->priv.server->free)
+ if (out->free)
{
VM_Warning(prog, "copyentity: can not modify free entity\n");
return;
VM_Warning(prog, "setattachment: can not modify world entity\n");
return;
}
- if (e->priv.server->free)
+ if (e->free)
{
VM_Warning(prog, "setattachment: can not modify free entity\n");
return;
if (ent == prog->edicts)
return 1;
- if (ent->priv.server->free)
+ if (ent->free)
return 2;
modelindex = (int)PRVM_serveredictfloat(ent, modelindex);
VM_Warning(prog, "VM_SV_gettagindex(entity #%i): can't affect world entity\n", PRVM_NUM_FOR_EDICT(ent));
return;
}
- if (ent->priv.server->free)
+ if (ent->free)
{
VM_Warning(prog, "VM_SV_gettagindex(entity #%i): can't affect free entity\n", PRVM_NUM_FOR_EDICT(ent));
return;
VM_Warning(prog, "setmodelindex: can not modify world entity\n");
return;
}
- if (e->priv.server->free)
+ if (e->free)
{
VM_Warning(prog, "setmodelindex: can not modify free entity\n");
return;
if (ent->priv.server->areagridmarknumber != world->areagrid_marknumber)
{
ent->priv.server->areagridmarknumber = world->areagrid_marknumber;
- if (!ent->priv.server->free && BoxesOverlap(paddedmins, paddedmaxs, ent->priv.server->areamins, ent->priv.server->areamaxs))
+ if (!ent->free && BoxesOverlap(paddedmins, paddedmaxs, ent->priv.server->areamins, ent->priv.server->areamaxs))
{
if (numlist < maxlist)
list[numlist] = ent;
if (ent->priv.server->areagridmarknumber != world->areagrid_marknumber)
{
ent->priv.server->areagridmarknumber = world->areagrid_marknumber;
- if (!ent->priv.server->free && BoxesOverlap(paddedmins, paddedmaxs, ent->priv.server->areamins, ent->priv.server->areamaxs))
+ if (!ent->free && BoxesOverlap(paddedmins, paddedmaxs, ent->priv.server->areamins, ent->priv.server->areamaxs))
{
if (numlist < maxlist)
list[numlist] = ent;
return;
// don't add free entities
- if (ent->priv.server->free)
+ if (ent->free)
return;
VectorCopy(mins, ent->priv.server->areamins);
if (!forcetype)
return;
enemy = PRVM_gameedictedict(ed, enemy);
- if (enemy <= 0 || enemy >= prog->num_edicts || prog->edicts[enemy].priv.required->free || prog->edicts[enemy].priv.server->ode_body == 0)
+ if (enemy <= 0 || enemy >= prog->num_edicts || prog->edicts[enemy].free || prog->edicts[enemy].priv.server->ode_body == 0)
return;
VectorCopy(PRVM_gameedictvector(ed, movedir), movedir);
VectorCopy(PRVM_gameedictvector(ed, origin), origin);
VectorCopy(PRVM_gameedictvector(ed, movedir), movedir);
if(movetype == MOVETYPE_PHYSICS)
jointtype = JOINTTYPE_NONE; // can't have both
- if(enemy <= 0 || enemy >= prog->num_edicts || prog->edicts[enemy].priv.required->free || prog->edicts[enemy].priv.server->ode_body == 0)
+ if(enemy <= 0 || enemy >= prog->num_edicts || prog->edicts[enemy].free || prog->edicts[enemy].priv.server->ode_body == 0)
enemy = 0;
- if(aiment <= 0 || aiment >= prog->num_edicts || prog->edicts[aiment].priv.required->free || prog->edicts[aiment].priv.server->ode_body == 0)
+ if(aiment <= 0 || aiment >= prog->num_edicts || prog->edicts[aiment].free || prog->edicts[aiment].priv.server->ode_body == 0)
aiment = 0;
// see http://www.ode.org/old_list_archives/2006-January/017614.html
// we want to set ERP? make it fps independent and work like a spring constant
return;
ed1 = (prvm_edict_t *) dGeomGetData(o1);
- if(ed1 && ed1->priv.server->free)
+ if(ed1 && ed1->free)
ed1 = NULL;
if(ed1)
{
}
ed2 = (prvm_edict_t *) dGeomGetData(o2);
- if(ed2 && ed2->priv.server->free)
+ if(ed2 && ed2->free)
ed2 = NULL;
if(ed2)
{
if (prog)
{
for (i = 0, ed = prog->edicts + i;i < prog->num_edicts;i++, ed++)
- if (!prog->edicts[i].priv.required->free)
+ if (!prog->edicts[i].free)
World_Physics_Frame_BodyFromEntity(world, ed);
// oh, and it must be called after all bodies were created
for (i = 0, ed = prog->edicts + i;i < prog->num_edicts;i++, ed++)
- if (!prog->edicts[i].priv.required->free)
+ if (!prog->edicts[i].free)
World_Physics_Frame_JointFromEntity(world, ed);
}
{
int j;
for (j = 0, ed = prog->edicts + j;j < prog->num_edicts;j++, ed++)
- if (!prog->edicts[j].priv.required->free)
+ if (!prog->edicts[j].free)
World_Physics_Frame_ForceFromEntity(world, ed);
}
// run physics (move objects, calculate new velocities)
if (prog)
{
for (i = 1, ed = prog->edicts + i;i < prog->num_edicts;i++, ed++)
- if (!prog->edicts[i].priv.required->free)
+ if (!prog->edicts[i].free)
World_Physics_Frame_BodyToEntity(world, ed);
// print stats
world->physics.ode_activeovjects = 0;
for (i = 1, ed = prog->edicts + i;i < prog->num_edicts;i++, ed++)
{
- if (prog->edicts[i].priv.required->free)
+ if (prog->edicts[i].free)
continue;
body = (dBodyID)prog->edicts[i].priv.server->ode_body;
if (!body)