]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
CSQC: track client-side entities for sounds issued for the server-side matching entity
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 14 Nov 2011 09:31:55 +0000 (09:31 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 14 Nov 2011 09:31:55 +0000 (09:31 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11555 d7cf8633-e32d-0410-b094-e92efae38249

snd_main.c

index 23f1bca77213635bb98057989ba9f59cfb193a50..71f8b4d73e80c6612f7c3c32677ba22a440bf4b0 100644 (file)
@@ -1324,6 +1324,13 @@ static void SND_Spatialize_WithSfx(channel_t *ch, qboolean isstatic, sfx_t *sfx)
                        else
                                Matrix4x4_OriginFromMatrix(&cl.entities[ch->entnum].render.matrix, ch->origin);
                }
+               else if (cl.csqc_server2csqcentitynumber[ch->entnum])
+               {
+                       //Con_Printf("-- entnum %i (client %i) origin %f %f %f neworigin %f %f %f\n", ch->entnum, cl.csqc_server2csqcentitynumber[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]);
+
+                       if (!CL_VM_GetEntitySoundOrigin(cl.csqc_server2csqcentitynumber[ch->entnum] + MAX_EDICTS, ch->origin))
+                               ch->entnum = MAX_EDICTS; // entity was removed, disown sound
+               }
        }
 
        mastervol = ch->basevolume;