oldmaxentities = cl.max_csqcentities;
oldentities = cl.csqcentities;
cl.max_csqcentities = (num & ~255) + 256;
- cl.csqcentities = Mem_Alloc(cls.levelmempool, cl.max_csqcentities * sizeof(entity_t));
+ cl.csqcentities = (entity_t *)Mem_Alloc(cls.levelmempool, cl.max_csqcentities * sizeof(entity_t));
memcpy(cl.csqcentities, oldentities, oldmaxentities * sizeof(entity_t));
Mem_Free(oldentities);
for (i = oldmaxentities;i < cl.max_csqcentities;i++)
//static const vec3_t nomodelmaxs = {16, 16, 16};
void CL_BoundingBoxForEntity(entity_render_t *ent)
{
- if (ent->model)
+ model_t *model = ent->model;
+ if (model)
{
//if (ent->angles[0] || ent->angles[2])
if (ent->matrix.m[2][0] != 0 || ent->matrix.m[2][1] != 0)
{
// pitch or roll
- ent->mins[0] = ent->matrix.m[0][3] + ent->model->rotatedmins[0];
- ent->mins[1] = ent->matrix.m[1][3] + ent->model->rotatedmins[1];
- ent->mins[2] = ent->matrix.m[2][3] + ent->model->rotatedmins[2];
- ent->maxs[0] = ent->matrix.m[0][3] + ent->model->rotatedmaxs[0];
- ent->maxs[1] = ent->matrix.m[1][3] + ent->model->rotatedmaxs[1];
- ent->maxs[2] = ent->matrix.m[2][3] + ent->model->rotatedmaxs[2];
- //VectorAdd(ent->origin, ent->model->rotatedmins, ent->mins);
- //VectorAdd(ent->origin, ent->model->rotatedmaxs, ent->maxs);
+ ent->mins[0] = ent->matrix.m[0][3] + model->rotatedmins[0];
+ ent->mins[1] = ent->matrix.m[1][3] + model->rotatedmins[1];
+ ent->mins[2] = ent->matrix.m[2][3] + model->rotatedmins[2];
+ ent->maxs[0] = ent->matrix.m[0][3] + model->rotatedmaxs[0];
+ ent->maxs[1] = ent->matrix.m[1][3] + model->rotatedmaxs[1];
+ ent->maxs[2] = ent->matrix.m[2][3] + model->rotatedmaxs[2];
+ //VectorAdd(ent->origin, model->rotatedmins, ent->mins);
+ //VectorAdd(ent->origin, model->rotatedmaxs, ent->maxs);
}
//else if (ent->angles[1])
else if (ent->matrix.m[0][1] != 0 || ent->matrix.m[1][0] != 0)
{
// yaw
- ent->mins[0] = ent->matrix.m[0][3] + ent->model->yawmins[0];
- ent->mins[1] = ent->matrix.m[1][3] + ent->model->yawmins[1];
- ent->mins[2] = ent->matrix.m[2][3] + ent->model->yawmins[2];
- ent->maxs[0] = ent->matrix.m[0][3] + ent->model->yawmaxs[0];
- ent->maxs[1] = ent->matrix.m[1][3] + ent->model->yawmaxs[1];
- ent->maxs[2] = ent->matrix.m[2][3] + ent->model->yawmaxs[2];
- //VectorAdd(ent->origin, ent->model->yawmins, ent->mins);
- //VectorAdd(ent->origin, ent->model->yawmaxs, ent->maxs);
+ ent->mins[0] = ent->matrix.m[0][3] + model->yawmins[0];
+ ent->mins[1] = ent->matrix.m[1][3] + model->yawmins[1];
+ ent->mins[2] = ent->matrix.m[2][3] + model->yawmins[2];
+ ent->maxs[0] = ent->matrix.m[0][3] + model->yawmaxs[0];
+ ent->maxs[1] = ent->matrix.m[1][3] + model->yawmaxs[1];
+ ent->maxs[2] = ent->matrix.m[2][3] + model->yawmaxs[2];
+ //VectorAdd(ent->origin, model->yawmins, ent->mins);
+ //VectorAdd(ent->origin, model->yawmaxs, ent->maxs);
}
else
{
- ent->mins[0] = ent->matrix.m[0][3] + ent->model->normalmins[0];
- ent->mins[1] = ent->matrix.m[1][3] + ent->model->normalmins[1];
- ent->mins[2] = ent->matrix.m[2][3] + ent->model->normalmins[2];
- ent->maxs[0] = ent->matrix.m[0][3] + ent->model->normalmaxs[0];
- ent->maxs[1] = ent->matrix.m[1][3] + ent->model->normalmaxs[1];
- ent->maxs[2] = ent->matrix.m[2][3] + ent->model->normalmaxs[2];
- //VectorAdd(ent->origin, ent->model->normalmins, ent->mins);
- //VectorAdd(ent->origin, ent->model->normalmaxs, ent->maxs);
+ ent->mins[0] = ent->matrix.m[0][3] + model->normalmins[0];
+ ent->mins[1] = ent->matrix.m[1][3] + model->normalmins[1];
+ ent->mins[2] = ent->matrix.m[2][3] + model->normalmins[2];
+ ent->maxs[0] = ent->matrix.m[0][3] + model->normalmaxs[0];
+ ent->maxs[1] = ent->matrix.m[1][3] + model->normalmaxs[1];
+ ent->maxs[2] = ent->matrix.m[2][3] + model->normalmaxs[2];
+ //VectorAdd(ent->origin, model->normalmins, ent->mins);
+ //VectorAdd(ent->origin, model->normalmaxs, ent->maxs);
}
}
else
l = (i-1) % cl.lightstyle[j].length;
k = cl.lightstyle[j].map[k] - 'a';
l = cl.lightstyle[j].map[l] - 'a';
- r_refdef.lightstylevalue[j] = ((k*frac)+(l*(1-frac)))*22;
+ r_refdef.lightstylevalue[j] = (unsigned short)(((k*frac)+(l*(1-frac)))*22);
}
}
{
matrix4x4_t *matrix, blendmatrix, tempmatrix, matrix2;
//matrix4x4_t dlightmatrix;
- int j, k, l, trailtype, temp;
- float origin[3], angles[3], delta[3], lerp, dlightcolor[3], dlightradius, mins[3], maxs[3], v2[3], d;
+ int j, k, l;
+ effectnameindex_t trailtype;
+ float origin[3], angles[3], delta[3], lerp, dlightcolor[3], dlightradius, v2[3], d;
entity_t *t;
model_t *model;
trace_t trace;
origin[1] = e->render.matrix.m[1][3];
origin[2] = e->render.matrix.m[2][3];
}
- trailtype = -1;
+ trailtype = EFFECT_NONE;
dlightradius = 0;
dlightcolor[0] = 0;
dlightcolor[1] = 0;
if (e->render.effects & EF_BRIGHTFIELD)
{
if (gamemode == GAME_NEXUIZ)
- {
- dlightradius = max(dlightradius, 200);
- dlightcolor[0] += 0.75f;
- dlightcolor[1] += 1.50f;
- dlightcolor[2] += 3.00f;
- trailtype = 8;
- }
+ trailtype = EFFECT_TR_NEXUIZPLASMA;
else
CL_EntityParticles(e);
}
dlightcolor[2] += 1.50f;
}
if (e->render.effects & EF_FLAME)
- {
- mins[0] = origin[0] - 16.0f;
- mins[1] = origin[1] - 16.0f;
- mins[2] = origin[2] - 16.0f;
- maxs[0] = origin[0] + 16.0f;
- maxs[1] = origin[1] + 16.0f;
- maxs[2] = origin[2] + 16.0f;
- // how many flames to make
- temp = (int) (cl.time * 300) - (int) (cl.oldtime * 300);
- CL_FlameCube(mins, maxs, temp);
- d = lhrandom(0.75f, 1);
- dlightradius = max(dlightradius, 200);
- dlightcolor[0] += d * 2.0f;
- dlightcolor[1] += d * 1.5f;
- dlightcolor[2] += d * 0.5f;
- }
+ CL_ParticleEffect(EFFECT_EF_FLAME, cl.time - cl.oldtime, origin, origin, vec3_origin, vec3_origin, NULL, 0);
if (e->render.effects & EF_STARDUST)
- {
- mins[0] = origin[0] - 16.0f;
- mins[1] = origin[1] - 16.0f;
- mins[2] = origin[2] - 16.0f;
- maxs[0] = origin[0] + 16.0f;
- maxs[1] = origin[1] + 16.0f;
- maxs[2] = origin[2] + 16.0f;
- // how many particles to make
- temp = (int) (cl.time * 200) - (int) (cl.oldtime * 200);
- CL_Stardust(mins, maxs, temp);
- dlightradius = max(dlightradius, 200);
- dlightcolor[0] += 1.0f;
- dlightcolor[1] += 0.7f;
- dlightcolor[2] += 0.3f;
- }
+ CL_ParticleEffect(EFFECT_EF_STARDUST, cl.time - cl.oldtime, origin, origin, vec3_origin, vec3_origin, NULL, 0);
if (e->render.effects & (EF_FLAG1QW | EF_FLAG2QW))
{
// these are only set on player entities
tempmatrix.m[1][3] = trace.endpos[1];
tempmatrix.m[2][3] = trace.endpos[2];
CL_AllocDlight(NULL, &tempmatrix, 100, e->persistent.muzzleflash, e->persistent.muzzleflash, e->persistent.muzzleflash, 0, 0, 0, -1, true, 0, 0.25, 0.25, 1, 1, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
- e->persistent.muzzleflash -= cl.frametime * 10;
+ e->persistent.muzzleflash -= (cl.time - cl.oldtime) * 10;
}
// LordHavoc: if the model has no flags, don't check each
if (e->render.model && e->render.model->flags && (!e->state_current.tagentity && !(e->render.flags & RENDER_VIEWMODEL)))
{
if (e->render.model->flags & EF_GIB)
- trailtype = 2;
+ trailtype = EFFECT_TR_BLOOD;
else if (e->render.model->flags & EF_ZOMGIB)
- trailtype = 4;
+ trailtype = EFFECT_TR_SLIGHTBLOOD;
else if (e->render.model->flags & EF_TRACER)
- {
- trailtype = 3;
- //dlightradius = max(dlightradius, 100);
- //dlightcolor[0] += 0.25f;
- //dlightcolor[1] += 1.00f;
- //dlightcolor[2] += 0.25f;
- }
+ trailtype = EFFECT_TR_WIZSPIKE;
else if (e->render.model->flags & EF_TRACER2)
- {
- trailtype = 5;
- //dlightradius = max(dlightradius, 100);
- //dlightcolor[0] += 1.00f;
- //dlightcolor[1] += 0.60f;
- //dlightcolor[2] += 0.20f;
- }
+ trailtype = EFFECT_TR_KNIGHTSPIKE;
else if (e->render.model->flags & EF_ROCKET)
- {
- trailtype = 0;
- dlightradius = max(dlightradius, 200);
- dlightcolor[0] += 3.00f;
- dlightcolor[1] += 1.50f;
- dlightcolor[2] += 0.50f;
- }
+ trailtype = EFFECT_TR_ROCKET;
else if (e->render.model->flags & EF_GRENADE)
{
// LordHavoc: e->render.alpha == -1 is for Nehahra dem compatibility (cigar smoke)
- trailtype = e->render.alpha == -1 ? 7 : 1;
+ trailtype = e->render.alpha == -1 ? EFFECT_TR_NEHAHRASMOKE : EFFECT_TR_GRENADE;
}
else if (e->render.model->flags & EF_TRACER3)
- {
- trailtype = 6;
- if (gamemode == GAME_PRYDON)
- {
- dlightradius = max(dlightradius, 100);
- dlightcolor[0] += 0.30f;
- dlightcolor[1] += 0.60f;
- dlightcolor[2] += 1.20f;
- }
- else
- {
- dlightradius = max(dlightradius, 200);
- dlightcolor[0] += 1.20f;
- dlightcolor[1] += 0.50f;
- dlightcolor[2] += 1.00f;
- }
- }
+ trailtype = EFFECT_TR_VORESPIKE;
}
// LordHavoc: customizable glow
if (e->state_current.glowsize)
}
// do trails
if (e->render.flags & RENDER_GLOWTRAIL)
- trailtype = 9;
- if (trailtype >= 0)
- CL_RocketTrail(e->persistent.trail_origin, origin, trailtype, e->state_current.glowcolor, e);
+ trailtype = EFFECT_TR_GLOWTRAIL;
+ if (trailtype)
+ {
+ float len;
+ vec3_t vel;
+ VectorSubtract(e->state_current.origin, e->state_previous.origin, vel);
+ len = e->state_current.time - e->state_previous.time;
+ if (len > 0)
+ len = 1.0f / len;
+ VectorScale(vel, len, vel);
+ CL_ParticleEffect(trailtype, 1, e->persistent.trail_origin, origin, vel, vel, e, e->state_current.glowcolor);
+ }
VectorCopy(origin, e->persistent.trail_origin);
// tenebrae's sprites are all additive mode (weird)
if (gamemode == GAME_TENEBRAE && e->render.model && e->render.model->type == mod_sprite)
if (e->active)
{
frame = (cl.time - e->starttime) * e->framerate + e->startframe;
- intframe = frame;
+ intframe = (int)frame;
if (intframe < 0 || intframe >= e->endframe)
{
memset(e, 0, sizeof(*e));
void CSQC_RelinkAllEntities (int drawmask)
{
+ cl.num_brushmodel_entities = 0;
CL_RelinkNetworkEntities(drawmask);
if(drawmask & ENTMASK_ENGINE)
{
r_refdef.extraupdate = !r_speeds.integer;
r_refdef.numentities = 0;
r_refdef.viewentitymatrix = identitymatrix;
- cl.num_brushmodel_entities = 0;
if (cls.state == ca_connected && cls.signon == SIGNONS)
{
CL_ClientMovement_Replay();
if(!csqc_loaded) //[515]: csqc
{
+ cl.num_brushmodel_entities = 0;
CL_RelinkNetworkEntities(65535);
// move particles
// update view blend
V_CalcViewBlend();
+
+ // update the r_refdef time again because cl.time may have changed
+ r_refdef.time = cl.time;
}
return 0;