From f241e418e8848a5779b84bb8f58fd2b7351ea102 Mon Sep 17 00:00:00 2001 From: div0 Date: Wed, 25 Apr 2007 18:24:50 +0000 Subject: [PATCH] use play2() function (as preparation for sound packs) do spawn point management only in info_player_deathmatch (Dresk) git-svn-id: svn://svn.icculus.org/nexuiz/trunk@2398 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/qcsrc/server/builtins.qh | 2 +- data/qcsrc/server/cl_client.qc | 6 +++--- data/qcsrc/server/ctf.qc | 12 ++++-------- data/qcsrc/server/defs.qh | 1 - data/qcsrc/server/g_damage.qc | 20 ++++++++++---------- data/qcsrc/server/g_world.qc | 16 +++++++++++++--- data/qcsrc/server/miscfunctions.qc | 29 +++++++++++++++++++++++++++++ data/qcsrc/server/t_items.qc | 12 ++++++------ data/qcsrc/server/w_nex.qc | 22 +++++++++++----------- 9 files changed, 77 insertions(+), 43 deletions(-) diff --git a/data/qcsrc/server/builtins.qh b/data/qcsrc/server/builtins.qh index 984994ec1..28f367a6d 100644 --- a/data/qcsrc/server/builtins.qh +++ b/data/qcsrc/server/builtins.qh @@ -17,7 +17,7 @@ void remove (entity e) = #15; void traceline (vector v1, vector v2, float nomonst, entity forent) = #16; entity checkclient (void) = #17; entity find (entity start, .string fld, string match) = #18; -string precache_sound (string s) = #19; +//string precache_sound (string s) = #19; string precache_model (string s) = #20; //void(entity client, string s)stuffcmd = #21; entity findradius (vector org, float rad) = #22; diff --git a/data/qcsrc/server/cl_client.qc b/data/qcsrc/server/cl_client.qc index 0d95b91f7..f9e6b4655 100644 --- a/data/qcsrc/server/cl_client.qc +++ b/data/qcsrc/server/cl_client.qc @@ -1,11 +1,11 @@ void info_player_start (void) { - self.classname = "info_player_deathmatch"; - relocate_spawnpoint(); + info_player_deathmatch(); } void info_player_deathmatch (void) { + self.classname = "info_player_deathmatch"; relocate_spawnpoint(); } @@ -1239,7 +1239,7 @@ void ShowRespawnCountdown() { self.respawn_countdown = number - 1; if(ceil(self.death_time - (time + 0.5)) == number) // only say it if it is the same number even in 0.5s; to prevent overlapping sounds - stuffcmd(self, strcat("play2 announcer/robotic/", ftos(number), ".ogg\n")); + play2(self, strcat("announcer/robotic/", ftos(number), ".ogg")); } } } diff --git a/data/qcsrc/server/ctf.qc b/data/qcsrc/server/ctf.qc index 38f5bb81d..02a453702 100644 --- a/data/qcsrc/server/ctf.qc +++ b/data/qcsrc/server/ctf.qc @@ -315,9 +315,8 @@ Keys: */ void() info_player_team1 = { - self.classname = "info_player_deathmatch"; self.team = 5; // red - relocate_spawnpoint(); + info_player_deathmatch(); }; //self.team = 4;self.classname = "info_player_start";info_player_start();}; @@ -331,9 +330,8 @@ Keys: */ void() info_player_team2 = { - self.classname = "info_player_deathmatch"; self.team = 14; // blue - relocate_spawnpoint(); + info_player_deathmatch(); }; //self.team = 13;self.classname = "info_player_start";info_player_start();}; @@ -347,9 +345,8 @@ Keys: */ void() info_player_team3 = { - self.classname = "info_player_deathmatch"; self.team = 10; // purple - relocate_spawnpoint(); + info_player_deathmatch(); }; @@ -363,9 +360,8 @@ Keys: */ void() info_player_team4 = { - self.classname = "info_player_deathmatch"; self.team = 13; // yellow - relocate_spawnpoint(); + info_player_deathmatch(); }; diff --git a/data/qcsrc/server/defs.qh b/data/qcsrc/server/defs.qh index a6ef81c52..9b868c4e6 100644 --- a/data/qcsrc/server/defs.qh +++ b/data/qcsrc/server/defs.qh @@ -152,7 +152,6 @@ float WEP_ROCKET_LAUNCHER = 9; // float IT_ROCKET_LAUNCHER = 128; float WEP_FIRST = 1; float WEP_LAST = 9; -void(entity e, float chan, string samp, float vol, float atten) sound = #8; void(entity client, string s) stuffcmd = #21; void(entity client, string s) sprint = #24; vector(entity e, float sped) aim = #44; diff --git a/data/qcsrc/server/g_damage.qc b/data/qcsrc/server/g_damage.qc index f0977a3ee..4767ec162 100644 --- a/data/qcsrc/server/g_damage.qc +++ b/data/qcsrc/server/g_damage.qc @@ -249,37 +249,37 @@ void Obituary (entity attacker, entity targ, float deathtype) if (attacker.killcount == 3) { bprint (a,"^7 made a ^1TRIPLE FRAG\n"); - stuffcmd(attacker, "play2 announcer/male/03kills.ogg\n"); + play2(attacker, "announcer/male/03kills.ogg"); } else if (attacker.killcount == 5) { bprint (a,"^7 made a ^1FIVE FRAG COMBO\n"); - stuffcmd(attacker, "play2 announcer/male/05kills.ogg\n"); + play2(attacker, "announcer/male/05kills.ogg"); } else if (attacker.killcount == 10) { bprint (a,"^7 is on a ^1RAGE\n"); - stuffcmd(attacker, "play2 announcer/male/10kills.ogg\n"); + play2(attacker, "announcer/male/10kills.ogg"); } else if (attacker.killcount == 15) { bprint (a,"^7 has done a ^1MASSACRE!\n"); - stuffcmd(attacker, "play2 announcer/male/15kills.ogg\n"); + play2(attacker, "announcer/male/15kills.ogg"); } else if (attacker.killcount == 20) { bprint (a,"^7 is ^1UNHUMAN!\n"); - stuffcmd(attacker, "play2 announcer/male/20kills.ogg\n"); + play2(attacker, "announcer/male/20kills.ogg"); } else if (attacker.killcount == 25) { bprint (a,"^7 is a ^1DEATH INCARNATION!\n"); - stuffcmd(attacker, "play2 announcer/male/25kills.ogg\n"); + play2(attacker, "announcer/male/25kills.ogg"); } else if (attacker.killcount == 30) { bprint (a,"^7 is maybe a ^1AIMBOTTER?!\n"); - stuffcmd(attacker, "play2 announcer/male/30kills.ogg\n"); + play2(attacker, "announcer/male/30kills.ogg"); } } } @@ -304,7 +304,7 @@ void Obituary (entity attacker, entity targ, float deathtype) bprint ("^1",s, "^1 died\n"); GiveFrags(targ, targ, -1); if(targ.frags == -5) { - stuffcmd(targ, "play2 announcer/male/botlike.ogg\n"); + play2(targ, "announcer/male/botlike.ogg"); } if (targ.killcount > 2) @@ -414,7 +414,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float } else if (deathtype == IT_NEX && targ.items & IT_STRENGTH) { - if(clienttype(attacker) == CLIENTTYPE_REAL) stuffcmd(attacker, "play2 announcer/male/yoda.ogg\n"); + if(clienttype(attacker) == CLIENTTYPE_REAL) play2(attacker, "announcer/male/yoda.ogg"); } if (deathtype == IT_LASER) { @@ -433,7 +433,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float } else { if (deathtype == IT_NEX && !targ.deadflag && !(attacker.flags & FL_ONGROUND) && !(targ.flags & FL_ONGROUND) && attacker.waterlevel < 2 && targ.waterlevel < 2 && attacker.killcount != 3 && attacker.killcount != 5 && attacker.killcount != 10 && attacker.killcount != 15 && attacker.killcount != 20 && attacker.killcount != 25 && attacker.killcount != 30) { - if(clienttype(attacker) == CLIENTTYPE_REAL) stuffcmd(attacker, "play2 announcer/male/yoda.ogg\n"); + if(clienttype(attacker) == CLIENTTYPE_REAL) play2(attacker, "announcer/male/yoda.ogg"); } } diff --git a/data/qcsrc/server/g_world.qc b/data/qcsrc/server/g_world.qc index 2b4b43a2c..52d732c23 100644 --- a/data/qcsrc/server/g_world.qc +++ b/data/qcsrc/server/g_world.qc @@ -76,6 +76,16 @@ void worldspawn (void) if(world_already_spawned) error("world already spawned - you may have EXACTLY ONE worldspawn!"); world_already_spawned = TRUE; + + /* + TODO sound pack system + // initialize sound pack system + soundpack = cvar_string("g_soundpack"); + if(soundpack != "") + soundpack = strcat(soundpack, "/"); + soundpack = strzone(soundpack); + */ + // Precache all player models // Workaround for "invisible players" precache_model("models/player/carni.zym"); @@ -1845,7 +1855,7 @@ void MapVote_Tick() // notify about keep-two if(keeptwo != 0 && mapvote_keeptwotime == 0) - stuffcmd(other, "\nplay2 misc/invshot.wav\n"); + play2(other, "misc/invshot.wav"); // clear possibly invalid votes if(mapvote_maps[other.mapvote - 1] == "") @@ -1932,12 +1942,12 @@ void EndFrame() if(self.classname == "spectator") { if(self.enemy.hitsound) - stuffcmd(self, "play2 misc/hit.wav\n"); + play2(self, "misc/hit.wav"); } else { if(self.hitsound) - stuffcmd(self, "play2 misc/hit.wav\n"); + play2(self, "misc/hit.wav"); } } FOR_EACH_CLIENT(self) diff --git a/data/qcsrc/server/miscfunctions.qc b/data/qcsrc/server/miscfunctions.qc index 78395308f..78ee88bd6 100644 --- a/data/qcsrc/server/miscfunctions.qc +++ b/data/qcsrc/server/miscfunctions.qc @@ -1,3 +1,5 @@ +void() info_player_deathmatch; // needed for the other spawnpoints + void move_out_of_solid_expand(entity e, vector by) { float eps = 0.0625; @@ -703,3 +705,30 @@ void readlevelcvars(void) g_pickup_healthmega = cvar("g_pickup_healthmega"); g_pickup_healthmega_max = cvar("g_pickup_healthmega_max"); } + +/* +// TODO sound pack system +string soundpack; + +string precache_sound_builtin (string s) = #19; +void(entity e, float chan, string samp, float vol, float atten) sound_builtin = #8; +string precache_sound(string s) +{ + return precache_sound_builtin(strcat(soundpack, s)); +} +void play2(entity e, string filename) +{ + stuffcmd(e, strcat("play2 ", soundpack, filename, "\n")); +} +void sound(entity e, float chan, string samp, float vol, float atten) +{ + sound_builtin(e, chan, strcat(soundpack, samp), vol, atten); +} +*/ + +string precache_sound (string s) = #19; +void(entity e, float chan, string samp, float vol, float atten) sound = #8; +void play2(entity e, string filename) +{ + stuffcmd(e, strcat("play2 ", filename, "\n")); +} diff --git a/data/qcsrc/server/t_items.qc b/data/qcsrc/server/t_items.qc index f11787a8e..ff71fe532 100644 --- a/data/qcsrc/server/t_items.qc +++ b/data/qcsrc/server/t_items.qc @@ -54,12 +54,12 @@ void Item_Touch (void) // play some cool sounds ;) centerprint(other, "\n"); if(other.health <= 5) - stuffcmd(other, "play2 announcer/robotic/lastsecond.ogg\n"); + play2(other, "announcer/robotic/lastsecond.ogg"); else if(other.health < 50) - stuffcmd(other, "play2 announcer/robotic/narrowly.ogg\n"); + play2(other, "announcer/robotic/narrowly.ogg"); // sound not available // else if(self.items == IT_CELLS) - // stuffcmd(other, "play2 announce/robotic/ammo.ogg\n"); + // play2(other, "announce/robotic/ammo.ogg"); if (self.items & IT_NEX) W_GiveWeapon (other, IT_NEX, "Nex"); @@ -73,7 +73,7 @@ void Item_Touch (void) { pickedup = TRUE; // sound not available - // stuffcmd(other, "play2 announce/robotic/extra.ogg\nplay2 announce/robotic/_lives.ogg\n"); + // play2(other, "announce/robotic/extra.ogg\nplay2 announce/robotic/_lives.ogg"); other.armorvalue = other.armorvalue + cvar("g_minstagib_extralives"); sprint(other, "^3You picked up some extra lives\n"); } @@ -83,7 +83,7 @@ void Item_Touch (void) { pickedup = TRUE; // sound not available - // stuffcmd(other, "play2 announce/robotic/invisible.ogg\n"); + // play2(other, "announce/robotic/invisible.ogg"); other.strength_finished = max(other.strength_finished, time) + cvar("g_balance_powerup_strength_time"); } @@ -92,7 +92,7 @@ void Item_Touch (void) { pickedup = TRUE; // sound not available - // stuffcmd(other, "play2 announce/robotic/speed.ogg\n"); + // play2(other, "announce/robotic/speed.ogg"); other.invincible_finished = max(other.invincible_finished, time) + cvar("g_balance_powerup_strength_time"); } } diff --git a/data/qcsrc/server/w_nex.qc b/data/qcsrc/server/w_nex.qc index 966c84f61..0e5d74717 100644 --- a/data/qcsrc/server/w_nex.qc +++ b/data/qcsrc/server/w_nex.qc @@ -69,67 +69,67 @@ void minstagib_ammocheck (void) { centerprint(self, "you're dead now...\n"); Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0'); - stuffcmd(self, "play2 announcer/robotic/terminated.ogg\n"); + play2(self, "announcer/robotic/terminated.ogg"); } if (self.health == 10) { centerprint(self, "^11^7 second left to find some ammo\n"); Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0'); - stuffcmd(self, "play2 announcer/robotic/1.ogg\n"); + play2(self, "announcer/robotic/1.ogg"); } if (self.health == 20) { centerprint(self, "^12^7 seconds left to find some ammo\n"); Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0'); - stuffcmd(self, "play2 announcer/robotic/2.ogg\n"); + play2(self, "announcer/robotic/2.ogg"); } if (self.health == 30) { centerprint(self, "^13^7 seconds left to find some ammo\n"); Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0'); - stuffcmd(self, "play2 announcer/robotic/3.ogg\n"); + play2(self, "announcer/robotic/3.ogg"); } if (self.health == 40) { centerprint(self, "^14^7 seconds left to find some ammo\n"); Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0'); - stuffcmd(self, "play2 announcer/robotic/4.ogg\n"); + play2(self, "announcer/robotic/4.ogg"); } if (self.health == 50) { centerprint(self, "^15^7 seconds left to find some ammo\n"); Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0'); - stuffcmd(self, "play2 announcer/robotic/5.ogg\n"); + play2(self, "announcer/robotic/5.ogg"); } if (self.health == 60) { centerprint(self, "^36^7 seconds left to find some ammo\n"); Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0'); - stuffcmd(self, "play2 announcer/robotic/6.ogg\n"); + play2(self, "announcer/robotic/6.ogg"); } if (self.health == 70) { centerprint(self, "^37^7 seconds left to find some ammo\n"); Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0'); - stuffcmd(self, "play2 announcer/robotic/7.ogg\n"); + play2(self, "announcer/robotic/7.ogg"); } if (self.health == 80) { centerprint(self, "^38^7 seconds left to find some ammo\n"); Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0'); - stuffcmd(self, "play2 announcer/robotic/8.ogg\n"); + play2(self, "announcer/robotic/8.ogg"); } if (self.health == 90) { centerprint(self, "^39^7 seconds left to find some ammo\n"); Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0'); - stuffcmd(self, "play2 announcer/robotic/9.ogg\n"); + play2(self, "announcer/robotic/9.ogg"); } if (self.health == 100) { centerprint(self, "get some ammo or\nyou'll be dead in ^310^7 seconds..."); Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0'); - stuffcmd(self, "play2 announcer/robotic/10.ogg\n"); + play2(self, "announcer/robotic/10.ogg"); } } self.minstagib_nextthink = time + 1; -- 2.39.2