properly let sounds come out of attached entities (currently for svqc only)
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 27 Mar 2009 11:57:59 +0000 (11:57 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 27 Mar 2009 11:57:59 +0000 (11:57 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8829 d7cf8633-e32d-0410-b094-e92efae38249

csprogs.c
snd_main.c

index f9d5e7d..67a7aee 100644 (file)
--- a/csprogs.c
+++ b/csprogs.c
@@ -953,6 +953,8 @@ qboolean CL_VM_GetEntitySoundOrigin(int entnum, vec3_t out)
 
        CSQC_BEGIN;
 
+       // FIXME consider attachments here!
+
        ed = PRVM_EDICT_NUM(entnum - 32768);
 
        if(!ed->priv.required->free)
index c4218af..1675b86 100644 (file)
@@ -1245,9 +1245,10 @@ void SND_Spatialize(channel_t *ch, qboolean isstatic)
                else if (cl.entities[ch->entnum].state_current.active)
                {
                        //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);
+                               VectorMAM(0.5f, cl.entities[ch->entnum].render.mins, 0.5f, cl.entities[ch->entnum].render.maxs, ch->origin);
+                       else
+                               Matrix4x4_OriginFromMatrix(&cl.entities[ch->entnum].render.matrix, ch->origin);
                }
        }