strcpy(name, "--no model--");
for (j = strlen(name);j < 25;j++)
name[j] = ' ';
- Con_Printf("%3i: %s:%04i (%5i %5i %5i) [%3i %3i %3i] %4.2f %5.3f\n", i, name, ent->render.frame, (int) ent->render.origin[0], (int) ent->render.origin[1], (int) ent->render.origin[2], (int) ent->render.angles[0] % 360, (int) ent->render.angles[1] % 360, (int) ent->render.angles[2] % 360, ent->render.scale, ent->render.alpha);
+ Con_Printf("%3i: %s:%4i (%5i %5i %5i) [%3i %3i %3i] %4.2f %5.3f\n", i, name, ent->render.frame, (int) ent->render.origin[0], (int) ent->render.origin[1], (int) ent->render.origin[2], (int) ent->render.angles[0] % 360, (int) ent->render.angles[1] % 360, (int) ent->render.angles[2] % 360, ent->render.scale, ent->render.alpha);
}
}
CL_BoundingBoxForEntity(&e->render);
// handle effects now that we know where this entity is in the world...
- origin[0] = e->render.matrix.m[0][3];
- origin[1] = e->render.matrix.m[1][3];
- origin[2] = e->render.matrix.m[2][3];
+ if (e->render.model && e->render.model->soundfromcenter)
+ {
+ // bmodels are treated specially since their origin is usually '0 0 0'
+ vec3_t o;
+ VectorMAM(0.5f, e->render.model->normalmins, 0.5f, e->render.model->normalmaxs, o);
+ Matrix4x4_Transform(&e->render.matrix, o, origin);
+ }
+ else
+ {
+ origin[0] = e->render.matrix.m[0][3];
+ origin[1] = e->render.matrix.m[1][3];
+ origin[2] = e->render.matrix.m[2][3];
+ }
trailtype = -1;
dlightradius = 0;
dlightcolor[0] = 0;
else
{
// update sound origin if we know about the entity
- if (ch->entnum > 0 && cls.state == ca_connected && cl_entities[ch->entnum].state_current.active)
+ if (ch->entnum > 0 && cls.state == ca_connected && cl_entities[ch->entnum].render.model)
{
- //Con_Printf("-- entnum %i origin %f %f %f neworigin %f %f %f\n", ch->entnum, ch->origin[0], ch->origin[1], ch->origin[2], cl_entities[ch->entnum].state_current.origin[0], cl_entities[ch->entnum].state_current.origin[1], cl_entities[ch->entnum].state_current.origin[2]);
- VectorCopy(cl_entities[ch->entnum].state_current.origin, ch->origin);
- if (cl_entities[ch->entnum].state_current.modelindex && cl.model_precache[cl_entities[ch->entnum].state_current.modelindex] && cl.model_precache[cl_entities[ch->entnum].state_current.modelindex]->soundfromcenter)
- VectorMAMAM(1.0f, ch->origin, 0.5f, cl.model_precache[cl_entities[ch->entnum].state_current.modelindex]->normalmins, 0.5f, cl.model_precache[cl_entities[ch->entnum].state_current.modelindex]->normalmaxs, ch->origin);
+ //Con_Printf("-- entnum %i origin %f %f %f neworigin %f %f %f\n", ch->entnum, ch->origin[0], ch->origin[1], ch->origin[2], cl_entities[ch->entnum].persistent.trail_origin[0], cl_entities[ch->entnum].persistent.trail_origin[1], cl_entities[ch->entnum].persistent.trail_origin[2]);
+ VectorCopy(cl_entities[ch->entnum].persistent.trail_origin, ch->origin);
}
// calculate stereo seperation and distance attenuation