return buf;
}
+/*
+=================
+PRVM_ED_CanAlloc
+
+Returns if this particular edict could get allocated by PRVM_ED_Alloc
+=================
+*/
+qboolean PRVM_ED_CanAlloc(prvm_edict_t *e)
+{
+ if(!e->priv.required->free)
+ return false;
+ if(e->priv.required->freetime < prog->starttime + 2)
+ return true;
+ if(realtime > e->priv.required->freetime + 1)
+ return true;
+ return false; // entity slot still blocked because the entity was freed less than one second ago
+}
+
/*
=================
PRVM_ED_Alloc
for (i = prog->reserved_edicts + 1;i < prog->num_edicts;i++)
{
e = PRVM_EDICT_NUM(i);
- // the first couple seconds of server time can involve a lot of
- // freeing and allocating, so relax the replacement policy
- if (e->priv.required->free && ( e->priv.required->freetime < 2 || prog->globaloffsets.time < 0 || (PRVM_GLOBALFIELDVALUE(prog->globaloffsets.time)->_float - e->priv.required->freetime) > 0.5 ) )
+ if(PRVM_ED_CanAlloc(e))
{
PRVM_ED_ClearEdict (e);
e->priv.required->allocation_origin = PRVM_AllocationOrigin();
PRVM_GCALL(free_edict)(ed);
ed->priv.required->free = true;
- ed->priv.required->freetime = prog->globaloffsets.time >= 0 ? PRVM_GLOBALFIELDVALUE(prog->globaloffsets.time)->_float : 0;
+ ed->priv.required->freetime = realtime;
if(ed->priv.required->allocation_origin)
{
PRVM_Free((char *)ed->priv.required->allocation_origin);
prog->fieldoffsets.viewmodelforclient = PRVM_ED_FindFieldOffset("viewmodelforclient");
prog->fieldoffsets.viewzoom = PRVM_ED_FindFieldOffset("viewzoom");
prog->fieldoffsets.yaw_speed = PRVM_ED_FindFieldOffset("yaw_speed");
+ prog->fieldoffsets.bouncefactor = PRVM_ED_FindFieldOffset("bouncefactor");
+ prog->fieldoffsets.bouncestop = PRVM_ED_FindFieldOffset("bouncestop");
prog->funcoffsets.CSQC_ConsoleCommand = PRVM_ED_FindFunctionOffset("CSQC_ConsoleCommand");
prog->funcoffsets.CSQC_Ent_Remove = PRVM_ED_FindFunctionOffset("CSQC_Ent_Remove");
prog->funcoffsets.CSQC_Ent_Spawn = PRVM_ED_FindFunctionOffset("CSQC_Ent_Spawn");