]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/cl_player.qh
Merge branch 'terencehill/quickmenu_file_example' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / cl_player.qh
index 83ca3282f6fbac9979ed8d7154142a53a4c8e2f1..b74b6f01c5ca89e71c9b76d9265aa32bd7cd2f9b 100644 (file)
@@ -93,9 +93,32 @@ void PrecachePlayerSounds(string f);
 void ClearPlayerSounds(entity this);
 float LoadPlayerSounds(string f, bool strict);
 void UpdatePlayerSounds(entity this);
-void FakeGlobalSound(string sample, float chan, float voicetype);
-void GlobalSound(string sample, float chan, float voicetype);
+#define FakeGlobalSound(sample, chan, voicetype) _GlobalSound(sample, chan, voicetype, true)
+void _GlobalSound(string sample, float chan, float voicetype, bool fake);
+#define GlobalSound(def, chan, voicetype) _GlobalSound((def).m_globalsoundstr, chan, voicetype, false)
 void PlayerSound(.string samplefield, float chan, float voicetype);
 void VoiceMessage(string type, string msg);
 
+.string m_globalsoundstr;
+REGISTRY(GlobalSounds, BITS(8) - 1)
+#define GlobalSounds_from(i) _GlobalSounds_from(i, NULL)
+#define REGISTER_GLOBALSOUND(id, str) \
+       REGISTER(RegisterGlobalSounds, GS, GlobalSounds, id, m_id, new(GlobalSound)) \
+       { \
+               make_pure(this); \
+               this.m_globalsoundstr = str; \
+       }
+REGISTER_REGISTRY(RegisterGlobalSounds)
+REGISTRY_SORT(GlobalSounds, 0)
+REGISTRY_CHECK(GlobalSounds)
+PRECACHE(GlobalSounds)
+{
+       FOREACH(GlobalSounds, true, LAMBDA(PrecacheGlobalSound(it.m_globalsoundstr)));
+}
+
+REGISTER_GLOBALSOUND(STEP, "misc/footstep0 6")
+REGISTER_GLOBALSOUND(STEP_METAL, "misc/metalfootstep0 6")
+REGISTER_GLOBALSOUND(FALL, "misc/hitground 4")
+REGISTER_GLOBALSOUND(FALL_METAL, "misc/metalhitground 4")
+
 #endif