X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;ds=sidebyside;f=qcsrc%2Fcommon%2Feffects%2Fqc%2Fglobalsound.qh;h=8c6dd86ddcd717571f32c53295f2e344083e5fb2;hb=88e815808cb794930e7a0d6257cfdb8b3456a9a1;hp=1c2aa64612a089652596da6014814890d752de1f;hpb=2489e43ce71c67339a9eb359a20074083d0760d7;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/effects/qc/globalsound.qh b/qcsrc/common/effects/qc/globalsound.qh index 1c2aa6461..8c6dd86dd 100644 --- a/qcsrc/common/effects/qc/globalsound.qh +++ b/qcsrc/common/effects/qc/globalsound.qh @@ -1,5 +1,9 @@ -#ifndef GLOBALSOUND_H -#define GLOBALSOUND_H +#pragma once + +#ifdef SVQC + /** Use new sound handling. TODO: use when sounds play correctly on clients */ + bool autocvar_g_debug_globalsounds = false; +#endif // player sounds, voice messages @@ -19,12 +23,10 @@ REGISTER_REGISTRY(PlayerSounds) REGISTRY_SORT(PlayerSounds) STATIC_INIT(PlayerSounds_renumber) { - FOREACH(PlayerSounds, true, LAMBDA(it.m_id = i)); + FOREACH(PlayerSounds, true, it.m_id = i); } REGISTRY_CHECK(PlayerSounds) -// TODO implement fall and falling - REGISTER_PLAYERSOUND(death) REGISTER_PLAYERSOUND(drown) REGISTER_PLAYERSOUND(fall) @@ -92,13 +94,13 @@ REGISTER_REGISTRY(GlobalSounds) REGISTRY_SORT(GlobalSounds) STATIC_INIT(GlobalSounds_renumber) { - FOREACH(GlobalSounds, true, LAMBDA(it.m_id = i)); + FOREACH(GlobalSounds, true, it.m_id = i); } REGISTRY_CHECK(GlobalSounds) void PrecacheGlobalSound(string samplestring); PRECACHE(GlobalSounds) { - FOREACH(GlobalSounds, true, LAMBDA(PrecacheGlobalSound(it.m_globalsoundstr))); + FOREACH(GlobalSounds, true, PrecacheGlobalSound(it.m_globalsoundstr)); } REGISTER_GLOBALSOUND(STEP, "misc/footstep0 6") @@ -108,34 +110,42 @@ 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 +entity GetVoiceMessage(string type); + +string GlobalSound_sample(string pair, float r); #ifdef SVQC - 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) + void _GlobalSound(entity this, entity gs, entity ps, string sample, float chan, float vol, float voicetype, bool fake); + #define GlobalSound(this, def, chan, vol, voicetype) _GlobalSound(this, def, NULL, string_null, chan, vol, voicetype, false) + #define GlobalSound_string(this, def, chan, vol, voicetype) _GlobalSound(this, NULL, NULL, def, chan, vol, voicetype, false) + #define PlayerSound(this, def, chan, vol, voicetype) _GlobalSound(this, NULL, def, string_null, chan, vol, voicetype, false) #define VoiceMessage(this, def, msg) \ MACRO_BEGIN \ { \ entity VM = def; \ int voicetype = VM.m_playersoundvt; \ bool ownteam = (voicetype == VOICETYPE_TEAMRADIO); \ - int flood = Say(this, ownteam, world, msg, true); \ + int flood = Say(this, ownteam, NULL, msg, true); \ bool fake; \ if (IS_SPEC(this) || IS_OBSERVER(this) || flood < 0) fake = true; \ else if (flood > 0) fake = false; \ else break; \ - _GlobalSound(this, NULL, VM, string_null, CH_VOICE, voicetype, fake); \ + _GlobalSound(this, NULL, VM, string_null, CH_VOICE, VOL_BASEVOICE, voicetype, fake); \ } MACRO_END #endif -#endif +string allvoicesamples; +STATIC_INIT(allvoicesamples) +{ + FOREACH(PlayerSounds, it.instanceOfVoiceMessage, allvoicesamples = strcat(allvoicesamples, " ", it.m_playersoundstr)); + allvoicesamples = strzone(substring(allvoicesamples, 1, -1)); +}