r4992 - trunk/data/qcsrc/server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Wed Nov 5 15:19:42 EST 2008
Author: div0
Date: 2008-11-05 15:19:42 -0500 (Wed, 05 Nov 2008)
New Revision: 4992
Modified:
trunk/data/qcsrc/server/cl_player.qc
trunk/data/qcsrc/server/defs.qh
Log:
clean up voice message stuff a bit
Modified: trunk/data/qcsrc/server/cl_player.qc
===================================================================
--- trunk/data/qcsrc/server/cl_player.qc 2008-11-05 20:03:07 UTC (rev 4991)
+++ trunk/data/qcsrc/server/cl_player.qc 2008-11-05 20:19:42 UTC (rev 4992)
@@ -773,18 +773,11 @@
GetPlayerSoundSampleField_fixed = 0;
switch(type)
{
- case "attack": return playersound_attack;
- case "attackinfive": return playersound_attackinfive;
- case "coverme": return playersound_coverme;
- case "defend": return playersound_defend;
- case "freelance": return playersound_freelance;
- case "incoming": return playersound_incoming;
- case "meet": return playersound_meet;
- case "needhelp": return playersound_needhelp;
- case "seenflag": return playersound_seenflag;
- case "taunt": return playersound_taunt;
- case "teamshoot": return playersound_teamshoot;
- case "teamshoot_auto": return playersound_teamshoot;
+#define _VOICEMSG(m) case #m: return playersound_##m;
+ ALLVOICEMSGS
+#undef _VOICEMSG
+ // exception:
+ case "teamshoot_auto": return playersound_teamshoot;
}
GetPlayerSoundSampleField_notFound = 1;
return playersound_taunt;
@@ -796,15 +789,9 @@
GetPlayerSoundSampleField_fixed = 0;
switch(type)
{
- case "death": return playersound_death;
- case "drown": return playersound_drown;
- case "falling": return playersound_falling;
- case "gasp": return playersound_gasp;
- case "jump": return playersound_jump;
- case "pain25": return playersound_pain25;
- case "pain50": return playersound_pain50;
- case "pain75": return playersound_pain75;
- case "pain100": return playersound_pain100;
+#define _VOICEMSG(m) case #m: return playersound_##m;
+ ALLPLAYERSOUNDS
+#undef _VOICEMSG
}
GetPlayerSoundSampleField_notFound = 1;
return playersound_taunt;
@@ -847,26 +834,10 @@
void ClearPlayerSounds()
{
- if(self.playersound_attack ) { strunzone(self.playersound_attack ); self.playersound_attack = string_null; }
- if(self.playersound_attackinfive) { strunzone(self.playersound_attackinfive); self.playersound_attackinfive = string_null; }
- if(self.playersound_coverme ) { strunzone(self.playersound_coverme ); self.playersound_coverme = string_null; }
- if(self.playersound_defend ) { strunzone(self.playersound_defend ); self.playersound_defend = string_null; }
- if(self.playersound_freelance ) { strunzone(self.playersound_freelance ); self.playersound_freelance = string_null; }
- if(self.playersound_incoming ) { strunzone(self.playersound_incoming ); self.playersound_incoming = string_null; }
- if(self.playersound_meet ) { strunzone(self.playersound_meet ); self.playersound_meet = string_null; }
- if(self.playersound_needhelp ) { strunzone(self.playersound_needhelp ); self.playersound_needhelp = string_null; }
- if(self.playersound_seenflag ) { strunzone(self.playersound_seenflag ); self.playersound_seenflag = string_null; }
- if(self.playersound_taunt ) { strunzone(self.playersound_taunt ); self.playersound_taunt = string_null; }
- if(self.playersound_teamshoot ) { strunzone(self.playersound_teamshoot ); self.playersound_teamshoot = string_null; }
- if(self.playersound_death ) { strunzone(self.playersound_death ); self.playersound_death = string_null; }
- if(self.playersound_drown ) { strunzone(self.playersound_drown ); self.playersound_drown = string_null; }
- if(self.playersound_falling ) { strunzone(self.playersound_falling ); self.playersound_falling = string_null; }
- if(self.playersound_gasp ) { strunzone(self.playersound_gasp ); self.playersound_gasp = string_null; }
- if(self.playersound_jump ) { strunzone(self.playersound_jump ); self.playersound_jump = string_null; }
- if(self.playersound_pain25 ) { strunzone(self.playersound_pain25 ); self.playersound_pain25 = string_null; }
- if(self.playersound_pain50 ) { strunzone(self.playersound_pain50 ); self.playersound_pain50 = string_null; }
- if(self.playersound_pain75 ) { strunzone(self.playersound_pain75 ); self.playersound_pain75 = string_null; }
- if(self.playersound_pain100 ) { strunzone(self.playersound_pain100 ); self.playersound_pain100 = string_null; }
+#define _VOICEMSG(m) if(self.playersound_##m) { strunzone(self.playersound_##m); self.playersound_##m = string_null; }
+ ALLPLAYERSOUNDS
+ ALLVOICEMSGS
+#undef _VOICEMSG
}
void LoadPlayerSounds(string f, float first)
Modified: trunk/data/qcsrc/server/defs.qh
===================================================================
--- trunk/data/qcsrc/server/defs.qh 2008-11-05 20:03:07 UTC (rev 4991)
+++ trunk/data/qcsrc/server/defs.qh 2008-11-05 20:19:42 UTC (rev 4992)
@@ -437,26 +437,45 @@
.float(entity to, float sendflags) SendEntity;
// player sounds, voice messages
-.string playersound_attack;
-.string playersound_attackinfive;
-.string playersound_coverme;
-.string playersound_defend;
-.string playersound_freelance;
-.string playersound_incoming;
-.string playersound_meet;
-.string playersound_needhelp;
-.string playersound_seenflag;
-.string playersound_taunt;
-.string playersound_teamshoot;
-.string playersound_death;
-.string playersound_drown;
-.string playersound_falling; // not yet implemented, FIXME
-.string playersound_gasp;
-.string playersound_jump;
-.string playersound_pain25;
-.string playersound_pain50;
-.string playersound_pain75;
-.string playersound_pain100;
+// TODO implemented fall and falling
+#define ALLPLAYERSOUNDS \
+ _VOICEMSG(death) \
+ _VOICEMSG(drown) \
+ _VOICEMSG(fall) \
+ _VOICEMSG(falling) \
+ _VOICEMSG(gasp) \
+ _VOICEMSG(jump) \
+ _VOICEMSG(pain25) \
+ _VOICEMSG(pain50) \
+ _VOICEMSG(pain75) \
+ _VOICEMSG(pain100)
+#define ALLVOICEMSGS \
+ _VOICEMSG(attack) \
+ _VOICEMSG(attackinfive) \
+ _VOICEMSG(coverme) \
+ _VOICEMSG(defend) \
+ _VOICEMSG(freelance) \
+ _VOICEMSG(incoming) \
+ _VOICEMSG(meet) \
+ _VOICEMSG(needhelp) \
+ _VOICEMSG(seenflag) \
+ _VOICEMSG(taunt) \
+ _VOICEMSG(teamshoot) \
+ _VOICEMSG(attacking) \
+ _VOICEMSG(defending) \
+ _VOICEMSG(roaming) \
+ _VOICEMSG(positive) \
+ _VOICEMSG(negative) \
+ _VOICEMSG(onmyway) \
+ _VOICEMSG(seenenemy) \
+ _VOICEMSG(getflag) \
+ _VOICEMSG(droppedflag) \
+ _VOICEMSG(getourflagback) \
+ _VOICEMSG(flagcarriertakingdamage)
+#define _VOICEMSG(m) .string playersound_##m;
+ALLPLAYERSOUNDS
+ALLVOICEMSGS
+#undef _VOICEMSG
string globalsound_fall;
string globalsound_metalfall;
string globalsound_step;
More information about the nexuiz-commits
mailing list