From: havoc Date: Mon, 30 May 2005 08:38:51 +0000 (+0000) Subject: made bmodel trails (if anyone ever dares to try them) come from the center of the... X-Git-Tag: xonotic-v0.1.0preview~4824 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ab2cfe0b43fb9f80cff4d8807e40d6524ee1bae5;p=xonotic%2Fdarkplaces.git made bmodel trails (if anyone ever dares to try them) come from the center of the bmodel, this also cleaned up the sound code (and fixed a weird bug with a sound played in the same frame as an entity is removed) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5358 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/cl_main.c b/cl_main.c index dfca0cf7..736fea16 100644 --- a/cl_main.c +++ b/cl_main.c @@ -333,7 +333,7 @@ static void CL_PrintEntities_f(void) 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); } } @@ -718,9 +718,19 @@ void CL_LinkNetworkEntity(entity_t *e) 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; diff --git a/snd_main.c b/snd_main.c index cf82a6d7..a4717f43 100644 --- a/snd_main.c +++ b/snd_main.c @@ -497,12 +497,10 @@ void SND_Spatialize(channel_t *ch, qboolean isstatic) 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