]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Attempt a minor cleanup, make it actually play
authorMario <zacjardine@y7mail.com>
Tue, 10 Feb 2015 19:52:28 +0000 (06:52 +1100)
committerMario <zacjardine@y7mail.com>
Tue, 10 Feb 2015 19:52:28 +0000 (06:52 +1100)
qcsrc/common/notifications.qh
qcsrc/server/autocvars.qh
qcsrc/server/mutators/gamemode_ctf.qc

index 9580f56929cdad22ecd42347f7ad9d4dafe09ff6..d582a560fba6c93b233c4976657953c1a5307194 100644 (file)
@@ -1346,7 +1346,7 @@ float NOTIF_CHOICE_COUNT;
 // notification limits -- INCREASE AS NECESSARY
 const float NOTIF_ANNCE_MAX   = 100;
 const float NOTIF_INFO_MAX    = 300;
-const float NOTIF_CENTER_MAX  = 200;
+const float NOTIF_CENTER_MAX  = 250;
 const float NOTIF_MULTI_MAX   = 200;
 const float NOTIF_CHOICE_MAX  = 30;
 
index 89f7caf780c94f2f99e7898ed94abbbd5783ea34..fcefe27d10fc6f863fe498857aa40c116760eb3c 100644 (file)
@@ -252,20 +252,12 @@ float autocvar_g_ctf_pass_turnrate;
 float autocvar_g_ctf_pass_timelimit;
 float autocvar_g_ctf_pass_velocity;
 bool autocvar_g_ctf_dynamiclights;
-string autocvar_g_ctf_flag_blue_model;
-int autocvar_g_ctf_flag_blue_skin;
 float autocvar_g_ctf_flag_collect_delay;
 float autocvar_g_ctf_flag_damageforcescale;
 bool autocvar_g_ctf_flag_dropped_waypoint;
 bool autocvar_g_ctf_flag_dropped_floatinwater;
 bool autocvar_g_ctf_flag_glowtrails;
 int autocvar_g_ctf_flag_health;
-string autocvar_g_ctf_flag_neutral_model;
-int autocvar_g_ctf_flag_neutral_skin;
-string autocvar_g_ctf_flag_pink_model;
-int autocvar_g_ctf_flag_pink_skin;
-string autocvar_g_ctf_flag_red_model;
-int autocvar_g_ctf_flag_red_skin;
 bool autocvar_g_ctf_flag_return;
 float autocvar_g_ctf_flag_return_carried_radius;
 float autocvar_g_ctf_flag_return_time;
@@ -273,8 +265,6 @@ float autocvar_g_ctf_flag_return_when_unreachable;
 float autocvar_g_ctf_flag_return_damage;
 float autocvar_g_ctf_flag_return_damage_delay;
 float autocvar_g_ctf_flag_return_dropped;
-string autocvar_g_ctf_flag_yellow_model;
-int autocvar_g_ctf_flag_yellow_skin;
 float autocvar_g_ctf_flagcarrier_auto_helpme_damage;
 float autocvar_g_ctf_flagcarrier_auto_helpme_time;
 float autocvar_g_ctf_flagcarrier_selfdamagefactor;
index 4b0f0546e5ef488b01fe2fd9dd0c50bb312f4a30..dea4a2c288769e329bf909ac44b2c2280bed1bbf 100644 (file)
@@ -1076,9 +1076,16 @@ void ctf_DelayedFlagSetup(void) // called after a flag is placed on a map by ctf
        ctf_CaptureShield_Spawn(self);
 }
 
+void set_flag_string(entity flag, .string field, string value, string teamname)
+{
+       if(flag.field == "")
+               flag.field = strzone(sprintf(value,teamname));
+}
+
 void ctf_FlagSetup(int teamnumber, entity flag) // called when spawning a flag entity on the map as a spawnfunc
 {
        // declarations
+       string teamname = Static_Team_ColorName_Lower(teamnumber);
        self = flag; // for later usage with droptofloor()
 
        // main setup
@@ -1112,21 +1119,21 @@ void ctf_FlagSetup(int teamnumber, entity flag) // called when spawning a flag e
        flag.ctf_status = FLAG_BASE;
 
        // appearence
-       if(flag.model == "")       { flag.model = ((teamnumber == NUM_TEAM_1) ? autocvar_g_ctf_flag_red_model : ((teamnumber == NUM_TEAM_2) ? autocvar_g_ctf_flag_blue_model : ((teamnumber == NUM_TEAM_3) ? autocvar_g_ctf_flag_yellow_model : ((teamnumber == NUM_TEAM_4) ? autocvar_g_ctf_flag_pink_model : autocvar_g_ctf_flag_neutral_model)))); }
-       if(!flag.scale)            { flag.scale = FLAG_SCALE; }
-       if(!flag.skin)             { flag.skin = ((teamnumber == NUM_TEAM_1) ? autocvar_g_ctf_flag_red_skin : ((teamnumber == NUM_TEAM_2) ? autocvar_g_ctf_flag_blue_skin : ((teamnumber == NUM_TEAM_3) ? autocvar_g_ctf_flag_yellow_skin : ((teamnumber == NUM_TEAM_4) ? autocvar_g_ctf_flag_pink_skin : autocvar_g_ctf_flag_neutral_skin)))); }
-       if(flag.toucheffect == "") { flag.toucheffect = ((teamnumber == NUM_TEAM_1) ? "redflag_touch" : ((teamnumber == NUM_TEAM_2) ? "blueflag_touch" : ((teamnumber == NUM_TEAM_3) ? "yellowflag_touch" : ((teamnumber == NUM_TEAM_4) ? "pinkflag_touch" : "neutralflag_touch")))); }
-       if(flag.passeffect == "")  { flag.passeffect = ((teamnumber == NUM_TEAM_1) ? "red_pass" : ((teamnumber == NUM_TEAM_2) ? "blue_pass" : ((teamnumber == NUM_TEAM_3) ? "yellow_pass" : ((teamnumber == NUM_TEAM_4) ? "pink_pass" : "neutral_pass")))); }
-       if(flag.capeffect == "")   { flag.capeffect = ((teamnumber == NUM_TEAM_1) ? "red_cap" : ((teamnumber == NUM_TEAM_2) ? "blue_cap" : ((teamnumber == NUM_TEAM_3) ? "yellow_cap" : ((teamnumber == NUM_TEAM_4) ? "pink_cap" : "")))); } // neutral flag cant be capped itself
-
-       // sound
-       if(flag.snd_flag_taken == "")    { flag.snd_flag_taken = ((teamnumber == NUM_TEAM_1) ? "ctf/red_taken.wav" : ((teamnumber == NUM_TEAM_2) ? "ctf/blue_taken.wav" : ((teamnumber == NUM_TEAM_3) ? "ctf/yellow_taken.wav" : ((teamnumber == NUM_TEAM_4) ? "ctf/pink_taken.wav" : "ctf/neutral_taken.wav")))); }
-       if(flag.snd_flag_returned == "") { flag.snd_flag_returned = ((teamnumber == NUM_TEAM_1) ? "ctf/red_returned.wav" : ((teamnumber == NUM_TEAM_2) ? "ctf/blue_returned.wav" : ((teamnumber == NUM_TEAM_3) ? "ctf/yellow_returned.wav" : ((teamnumber == NUM_TEAM_4) ? "ctf/pink_returned.wav" : "")))); } // neutral flag can't be returned by players
-       if(flag.snd_flag_capture == "")  { flag.snd_flag_capture = ((teamnumber == NUM_TEAM_1) ? "ctf/red_capture.wav" : ((teamnumber == NUM_TEAM_2) ? "ctf/blue_capture.wav" : ((teamnumber == NUM_TEAM_3) ? "ctf/yellow_capture.wav" : ((teamnumber == NUM_TEAM_4) ? "ctf/pink_capture.wav" : "")))); } // again can't be captured
-       if(flag.snd_flag_respawn == "")  { flag.snd_flag_respawn = "ctf/flag_respawn.wav"; } // if there is ever a team-based sound for this, update the code to match.
-       if(flag.snd_flag_dropped == "")  { flag.snd_flag_dropped = ((teamnumber == NUM_TEAM_1) ? "ctf/red_dropped.wav" : ((teamnumber == NUM_TEAM_2) ? "ctf/blue_dropped.wav" : ((teamnumber == NUM_TEAM_3) ? "ctf/yellow_dropped.wav" : ((teamnumber == NUM_TEAM_4) ? "ctf/pink_dropped.wav" : "ctf/neutral_dropped.wav")))); }
-       if(flag.snd_flag_touch == "")    { flag.snd_flag_touch = "ctf/touch.wav"; } // again has no team-based sound
-       if(flag.snd_flag_pass == "")     { flag.snd_flag_pass = "ctf/pass.wav"; } // same story here
+       if(!flag.scale)                         { flag.scale = FLAG_SCALE; }
+       if(flag.skin == 0)                      { flag.skin = cvar(sprintf("g_ctf_flag_%s_skin", teamname)); }
+       if(flag.model == "")            { flag.model = cvar_string(sprintf("g_ctf_flag_%s_model", teamname)); }
+       set_flag_string(flag, toucheffect,      "%sflag_touch", teamname);
+       set_flag_string(flag, passeffect,       "%sflag_pass",  teamname);
+       set_flag_string(flag, capeffect,        "%sflag_cap",   teamname);
+
+       // sounds
+       set_flag_string(flag, snd_flag_taken,           "ctf/%s_taken.wav",     teamname);
+       set_flag_string(flag, snd_flag_returned,        "ctf/%s_returned.wav",  teamname);
+       set_flag_string(flag, snd_flag_capture,         "ctf/%s_capture.wav",   teamname);
+       set_flag_string(flag, snd_flag_dropped,         "ctf/%s_dropped.wav",   teamname);
+       if(flag.snd_flag_respawn == "")         { flag.snd_flag_respawn = "ctf/flag_respawn.wav"; } // if there is ever a team-based sound for this, update the code to match.
+       if(flag.snd_flag_touch == "")           { flag.snd_flag_touch = "ctf/touch.wav"; } // again has no team-based sound
+       if(flag.snd_flag_pass == "")            { flag.snd_flag_pass = "ctf/pass.wav"; } // same story here
 
        // precache
        precache_sound(flag.snd_flag_taken);
@@ -1147,7 +1154,14 @@ void ctf_FlagSetup(int teamnumber, entity flag) // called when spawning a flag e
 
        if(autocvar_g_ctf_flag_glowtrails)
        {
-               flag.glow_color = ((teamnumber == NUM_TEAM_1) ? 251 : ((teamnumber == NUM_TEAM_2) ? 210 : ((teamnumber == NUM_TEAM_3) ? 110 : ((teamnumber == NUM_TEAM_4) ? 145 : 254))));
+               switch(teamnumber)
+               {
+                       case NUM_TEAM_1: flag.glow_color = 251; break;
+                       case NUM_TEAM_2: flag.glow_color = 210; break;
+                       case NUM_TEAM_3: flag.glow_color = 110; break;
+                       case NUM_TEAM_4: flag.glow_color = 145; break;
+                       default:                 flag.glow_color = 254; break;
+               }
                flag.glow_size = 25;
                flag.glow_trail = 1;
        }
@@ -1162,7 +1176,7 @@ void ctf_FlagSetup(int teamnumber, entity flag) // called when spawning a flag e
                        case NUM_TEAM_2: flag.effects |= EF_BLUE; break;
                        case NUM_TEAM_3: flag.effects |= EF_DIMLIGHT; break;
                        case NUM_TEAM_4: flag.effects |= EF_RED; break;
-                       default: flag.effects |= EF_DIMLIGHT; break;
+                       default:                 flag.effects |= EF_DIMLIGHT; break;
                }
        }