]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/effects/qc/globalsound.qh
Sounds: revert to engine networking
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / effects / qc / globalsound.qh
index 4b86da5c8f6fda1cb51c139cf76ef1e7ad08bbd3..22e04e94a7f6d77a0b5324968cd027de24fe1909 100644 (file)
@@ -10,9 +10,8 @@ REGISTRY(PlayerSounds, BITS(8) - 1)
 #define PlayerSounds_from(i) _PlayerSounds_from(i, NULL)
 #define REGISTER_PLAYERSOUND(id) \
        .string _playersound_##id; \
-       REGISTER(PlayerSounds, playersound, id, m_id, new(PlayerSound)) \
+       REGISTER(PlayerSounds, playersound, id, m_id, new_pure(PlayerSound)) \
        { \
-               make_pure(this); \
                this.m_playersoundstr = #id; \
                this.m_playersoundfld = _playersound_##id; \
        }
@@ -41,9 +40,8 @@ REGISTER_PLAYERSOUND(pain75)
 .int m_playersoundvt;
 #define REGISTER_VOICEMSG(id, vt) \
        .string _playersound_##id; \
-       REGISTER(PlayerSounds, playersound, id, m_id, new(VoiceMessage)) \
+       REGISTER(PlayerSounds, playersound, id, m_id, new_pure(VoiceMessage)) \
        { \
-               make_pure(this); \
                this.instanceOfVoiceMessage = true; \
                this.m_playersoundstr = #id; \
                this.m_playersoundfld = _playersound_##id; \
@@ -86,9 +84,8 @@ REGISTER_VOICEMSG(teamshoot, VOICETYPE_LASTATTACKER)
 REGISTRY(GlobalSounds, BITS(8) - 1)
 #define GlobalSounds_from(i) _GlobalSounds_from(i, NULL)
 #define REGISTER_GLOBALSOUND(id, str) \
-       REGISTER(GlobalSounds, GS, id, m_id, new(GlobalSound)) \
+       REGISTER(GlobalSounds, GS, id, m_id, new_pure(GlobalSound)) \
        { \
-               make_pure(this); \
                this.m_globalsoundstr = str; \
        }
 REGISTER_REGISTRY(GlobalSounds)
@@ -111,22 +108,22 @@ REGISTER_GLOBALSOUND(FALL_METAL, "misc/metalhitground 4")
 
 bool GetPlayerSoundSampleField_notFound;
 void PrecachePlayerSounds(string f);
-#ifdef CSQC
+//#ifdef CSQC
        .string GetVoiceMessageSampleField(string type);
        .string GetPlayerSoundSampleField(string type);
        void ClearPlayerSounds(entity this);
        float LoadPlayerSounds(entity this, string f, bool strict);
        void UpdatePlayerSounds(entity this);
-#endif
+//#endif
 
 #ifdef SVQC
 
-       void _GlobalSound(entity gs, entity ps, string sample, float chan, float voicetype, bool fake);
-       #define GlobalSound(def, chan, voicetype) _GlobalSound(def, NULL, string_null, chan, voicetype, false)
-       #define GlobalSound_string(def, chan, voicetype) _GlobalSound(NULL, NULL, def, chan, voicetype, false)
-       #define PlayerSound(def, chan, voicetype) _GlobalSound(NULL, def, string_null, chan, voicetype, false)
-       #define VoiceMessage(def, msg) \
-               do \
+       void _GlobalSound(entity this, entity gs, entity ps, string sample, float chan, float voicetype, bool fake);
+       #define GlobalSound(this, def, chan, voicetype) _GlobalSound(this, def, NULL, string_null, chan, voicetype, false)
+       #define GlobalSound_string(this, def, chan, voicetype) _GlobalSound(this, NULL, NULL, def, chan, voicetype, false)
+       #define PlayerSound(this, def, chan, voicetype) _GlobalSound(this, NULL, def, string_null, chan, voicetype, false)
+       #define VoiceMessage(this, def, msg) \
+               MACRO_BEGIN \
                { \
                        entity VM = def; \
                        int voicetype = VM.m_playersoundvt; \
@@ -136,9 +133,8 @@ void PrecachePlayerSounds(string f);
                        if (IS_SPEC(this) || IS_OBSERVER(this) || flood < 0) fake = true; \
                        else if (flood > 0) fake = false; \
                        else break; \
-                       _GlobalSound(NULL, VM, string_null, CH_VOICE, voicetype, fake); \
-               } \
-               while (0)
+                       _GlobalSound(this, NULL, VM, string_null, CH_VOICE, voicetype, fake); \
+               } MACRO_END
 
 #endif