X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Feffects%2Fqc%2Fglobalsound.qh;h=44925cd510cf81c71fe4018b792de9a2f46bda22;hp=892d3d078b3dfb523f41c6bb59ea44d4eb8c0ec6;hb=3220cab5a7b69ced4a641504a6a5f4eccf2d3bfc;hpb=2bb4c42f723576432bb2c80e0afe0a09ec7350f3 diff --git a/qcsrc/common/effects/qc/globalsound.qh b/qcsrc/common/effects/qc/globalsound.qh index 892d3d078..44925cd51 100644 --- a/qcsrc/common/effects/qc/globalsound.qh +++ b/qcsrc/common/effects/qc/globalsound.qh @@ -1,6 +1,11 @@ #ifndef GLOBALSOUND_H #define GLOBALSOUND_H +#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 .string m_playersoundstr; @@ -10,9 +15,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; \ } @@ -20,12 +24,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) @@ -41,9 +43,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,22 +87,21 @@ 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) 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") @@ -111,35 +111,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); #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(thise, def, chan, voicetype) _GlobalSound(this, NULL, def, string_null, chan, voicetype, false) + #define PlayerSound(this, def, chan, voicetype) _GlobalSound(this, NULL, def, string_null, chan, voicetype, false) #define VoiceMessage(this, def, msg) \ - do \ + 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); \ - } \ - while (0) + } MACRO_END #endif +string allvoicesamples; +STATIC_INIT(allvoicesamples) +{ + FOREACH(PlayerSounds, it.instanceOfVoiceMessage, allvoicesamples = strcat(allvoicesamples, " ", it.m_playersoundstr)); + allvoicesamples = strzone(substring(allvoicesamples, 1, -1)); +} + #endif