Merge branch 'master' into divVerent/4team_ctf
authorMario <mario.mario@y7mail.com>
Thu, 15 Aug 2013 03:14:14 +0000 (13:14 +1000)
committerMario <mario.mario@y7mail.com>
Thu, 15 Aug 2013 03:14:14 +0000 (13:14 +1000)
48 files changed:
effectinfo.txt
gamemodes.cfg
gfx/hud/default/flag_pink_carrying.tga [new file with mode: 0644]
gfx/hud/default/flag_pink_lost.tga [new file with mode: 0644]
gfx/hud/default/flag_pink_shielded.tga [new file with mode: 0644]
gfx/hud/default/flag_pink_taken.tga [new file with mode: 0644]
gfx/hud/default/flag_yellow_carrying.tga [new file with mode: 0644]
gfx/hud/default/flag_yellow_lost.tga [new file with mode: 0644]
gfx/hud/default/flag_yellow_shielded.tga [new file with mode: 0644]
gfx/hud/default/flag_yellow_taken.tga [new file with mode: 0644]
models/ctf/banner_pink.tga [new file with mode: 0644]
models/ctf/banner_pink_gloss.tga [new file with mode: 0644]
models/ctf/banner_yellow.tga [new file with mode: 0644]
models/ctf/banner_yellow_gloss.tga [new file with mode: 0644]
models/ctf/flag_pink.tga [new file with mode: 0644]
models/ctf/flag_pink_gloss.tga [new file with mode: 0644]
models/ctf/flag_pink_glow.tga [new file with mode: 0644]
models/ctf/flag_pink_norm.tga [new file with mode: 0644]
models/ctf/flag_yellow.tga [new file with mode: 0644]
models/ctf/flag_yellow_gloss.tga [new file with mode: 0644]
models/ctf/flag_yellow_glow.tga [new file with mode: 0644]
models/ctf/flag_yellow_norm.tga [new file with mode: 0644]
models/ctf/flags.md3_2.skin [new file with mode: 0644]
models/ctf/flags.md3_3.skin [new file with mode: 0644]
models/ctf/glow_pink.tga [new file with mode: 0644]
models/ctf/glow_pink_glow.tga [new file with mode: 0644]
models/ctf/glow_yellow.tga [new file with mode: 0644]
models/ctf/glow_yellow_glow.tga [new file with mode: 0644]
qcsrc/client/hud.qc
qcsrc/client/waypointsprites.qc
qcsrc/common/items.qh
qcsrc/common/notifications.qh
qcsrc/server/autocvars.qh
qcsrc/server/mutators/gamemode_ca.qc
qcsrc/server/mutators/gamemode_ca.qh
qcsrc/server/mutators/gamemode_ctf.qc
qcsrc/server/mutators/gamemode_ctf.qh
qcsrc/server/mutators/gamemode_freezetag.qc
qcsrc/server/scores_rules.qc
scripts/ctf.shader
sound/ctf/pink_capture.ogg [new file with mode: 0644]
sound/ctf/pink_dropped.wav [new file with mode: 0644]
sound/ctf/pink_returned.wav [new file with mode: 0644]
sound/ctf/pink_taken.wav [new file with mode: 0644]
sound/ctf/yellow_capture.ogg [new file with mode: 0644]
sound/ctf/yellow_dropped.wav [new file with mode: 0644]
sound/ctf/yellow_returned.wav [new file with mode: 0644]
sound/ctf/yellow_taken.wav [new file with mode: 0644]

index d069d5f..a390b87 100644 (file)
@@ -7670,6 +7670,38 @@ velocityjitter 300 300 300
 velocitymultiplier 0.5
 airfriction 3
 
+// yellowflag_touch -- effects for touching the yellow flag
+// used nowhere in code
+effect yellowflag_touch
+count 35
+type spark
+tex 40 40
+color 0xFFFF0F 0xFFFF0F
+size 1 3
+alpha 0 256 556
+gravity 1
+bounce 1.5
+originjitter 1 1 1
+velocityjitter 300 300 300
+velocitymultiplier 0.5
+airfriction 3
+
+// pinkflag_touch -- effects for touching the pink flag
+// used nowhere in code
+effect pinkflag_touch
+count 35
+type spark
+tex 40 40
+color 0xFFFFFF 0xFFFFFF
+size 1 3
+alpha 0 256 556
+gravity 1
+bounce 1.5
+originjitter 1 1 1
+velocityjitter 300 300 300
+velocitymultiplier 0.5
+airfriction 3
+
 // red_pass
 // used nowhere in code
 effect red_pass
@@ -7728,6 +7760,64 @@ size 4 4
 alpha 256 256 1280
 type static
 
+// yellow_pass
+// used nowhere in code
+effect yellow_pass
+trailspacing 64
+color 0xFFFF0F 0xFFFF0F
+size 2 2
+tex 32 32
+alpha 64 128 64
+airfriction 5
+sizeincrease 2
+type static
+effect yellow_pass
+trailspacing 12
+color 0xFFFF0F 0xFFFF0F
+size 1 1
+tex 0 8
+alpha 32 64 32
+airfriction 9
+sizeincrease 8
+velocityjitter 64 64 64
+type static
+effect yellow_pass
+trailspacing 12
+color 0xFFFF0F 0xFFFF0F
+size 4 4
+//tex 48 55
+alpha 256 256 1280
+type static
+
+// pink_pass
+// used nowhere in code
+effect pink_pass
+trailspacing 64
+color 0xFFFFFF 0xFFFFFF
+size 2 2
+tex 32 32
+alpha 64 128 64
+airfriction 5
+sizeincrease 2
+type static
+effect pink_pass
+trailspacing 12
+color 0xFFFFFF 0xFFFFFF
+size 1 1
+tex 0 8
+alpha 32 64 32
+airfriction 9
+sizeincrease 8
+velocityjitter 64 64 64
+type static
+effect pink_pass
+trailspacing 12
+color 0xFFFFFF 0xFFFFFF
+size 4 4
+//tex 48 55
+alpha 256 256 1280
+type static
+
 // red_cap -- red team capture effect
 effect red_cap
 count 500
@@ -7778,6 +7868,56 @@ alpha 190 190 180
 sizeincrease -80
 color 0x0000FF 0x000097
 
+// yellow_cap -- yellow team capture effect
+effect yellow_cap
+count 500
+type spark
+tex 64 64
+color 0xFFFF0F 0xFFFF0F
+size 1 1
+alpha 0 256 100
+stretchfactor 2
+//gravity 1
+bounce 1.5
+originjitter 1 1 1
+velocityjitter 1000 1000 1500
+velocitymultiplier 0.5
+airfriction 2
+stretchfactor 0.6
+effect yellow_cap
+countabsolute 1
+type smoke
+tex 65 65
+size 150 150
+alpha 190 190 180
+sizeincrease -80
+color 0xFFFF0F 0xFFFF0F
+
+// pink_cap -- pink team capture effect
+effect pink_cap
+count 500
+type spark
+tex 64 64
+color 0xFF0FFF 0xFF0FFF
+size 1 1
+alpha 0 256 100
+stretchfactor 2
+//gravity 1
+bounce 1.5
+originjitter 1 1 1
+velocityjitter 1000 1000 1500
+velocitymultiplier 0.5
+airfriction 2
+stretchfactor 0.6
+effect pink_cap
+countabsolute 1
+type smoke
+tex 65 65
+size 150 150
+alpha 190 190 180
+sizeincrease -80
+color 0xFF0FFF 0xFF0FFF
+
 // spawn_point_red -- red team idle spawn point effect
 effect spawn_point_red
 count 37.5
index 665fa55..a7c6743 100644 (file)
@@ -227,6 +227,10 @@ set g_ctf_flag_red_model "models/ctf/flags.md3"
 set g_ctf_flag_red_skin 0
 set g_ctf_flag_blue_model "models/ctf/flags.md3"
 set g_ctf_flag_blue_skin 1
+set g_ctf_flag_yellow_model "models/ctf/flags.md3"
+set g_ctf_flag_yellow_skin 2
+set g_ctf_flag_pink_model "models/ctf/flags.md3"
+set g_ctf_flag_pink_skin 3
 set g_ctf_flag_glowtrails 1
 set g_ctf_fullbrightflags 0
 set g_ctf_dynamiclights 0
diff --git a/gfx/hud/default/flag_pink_carrying.tga b/gfx/hud/default/flag_pink_carrying.tga
new file mode 100644 (file)
index 0000000..920adfd
Binary files /dev/null and b/gfx/hud/default/flag_pink_carrying.tga differ
diff --git a/gfx/hud/default/flag_pink_lost.tga b/gfx/hud/default/flag_pink_lost.tga
new file mode 100644 (file)
index 0000000..87d1141
Binary files /dev/null and b/gfx/hud/default/flag_pink_lost.tga differ
diff --git a/gfx/hud/default/flag_pink_shielded.tga b/gfx/hud/default/flag_pink_shielded.tga
new file mode 100644 (file)
index 0000000..5f92416
Binary files /dev/null and b/gfx/hud/default/flag_pink_shielded.tga differ
diff --git a/gfx/hud/default/flag_pink_taken.tga b/gfx/hud/default/flag_pink_taken.tga
new file mode 100644 (file)
index 0000000..4f8bab3
Binary files /dev/null and b/gfx/hud/default/flag_pink_taken.tga differ
diff --git a/gfx/hud/default/flag_yellow_carrying.tga b/gfx/hud/default/flag_yellow_carrying.tga
new file mode 100644 (file)
index 0000000..48ed501
Binary files /dev/null and b/gfx/hud/default/flag_yellow_carrying.tga differ
diff --git a/gfx/hud/default/flag_yellow_lost.tga b/gfx/hud/default/flag_yellow_lost.tga
new file mode 100644 (file)
index 0000000..f930414
Binary files /dev/null and b/gfx/hud/default/flag_yellow_lost.tga differ
diff --git a/gfx/hud/default/flag_yellow_shielded.tga b/gfx/hud/default/flag_yellow_shielded.tga
new file mode 100644 (file)
index 0000000..92ee3b1
Binary files /dev/null and b/gfx/hud/default/flag_yellow_shielded.tga differ
diff --git a/gfx/hud/default/flag_yellow_taken.tga b/gfx/hud/default/flag_yellow_taken.tga
new file mode 100644 (file)
index 0000000..274e4ce
Binary files /dev/null and b/gfx/hud/default/flag_yellow_taken.tga differ
diff --git a/models/ctf/banner_pink.tga b/models/ctf/banner_pink.tga
new file mode 100644 (file)
index 0000000..68e65b6
Binary files /dev/null and b/models/ctf/banner_pink.tga differ
diff --git a/models/ctf/banner_pink_gloss.tga b/models/ctf/banner_pink_gloss.tga
new file mode 100644 (file)
index 0000000..77168a8
Binary files /dev/null and b/models/ctf/banner_pink_gloss.tga differ
diff --git a/models/ctf/banner_yellow.tga b/models/ctf/banner_yellow.tga
new file mode 100644 (file)
index 0000000..b398e88
Binary files /dev/null and b/models/ctf/banner_yellow.tga differ
diff --git a/models/ctf/banner_yellow_gloss.tga b/models/ctf/banner_yellow_gloss.tga
new file mode 100644 (file)
index 0000000..77168a8
Binary files /dev/null and b/models/ctf/banner_yellow_gloss.tga differ
diff --git a/models/ctf/flag_pink.tga b/models/ctf/flag_pink.tga
new file mode 100644 (file)
index 0000000..63feddd
Binary files /dev/null and b/models/ctf/flag_pink.tga differ
diff --git a/models/ctf/flag_pink_gloss.tga b/models/ctf/flag_pink_gloss.tga
new file mode 100644 (file)
index 0000000..3e92985
Binary files /dev/null and b/models/ctf/flag_pink_gloss.tga differ
diff --git a/models/ctf/flag_pink_glow.tga b/models/ctf/flag_pink_glow.tga
new file mode 100644 (file)
index 0000000..ba70c08
Binary files /dev/null and b/models/ctf/flag_pink_glow.tga differ
diff --git a/models/ctf/flag_pink_norm.tga b/models/ctf/flag_pink_norm.tga
new file mode 100644 (file)
index 0000000..07d5e17
Binary files /dev/null and b/models/ctf/flag_pink_norm.tga differ
diff --git a/models/ctf/flag_yellow.tga b/models/ctf/flag_yellow.tga
new file mode 100644 (file)
index 0000000..63feddd
Binary files /dev/null and b/models/ctf/flag_yellow.tga differ
diff --git a/models/ctf/flag_yellow_gloss.tga b/models/ctf/flag_yellow_gloss.tga
new file mode 100644 (file)
index 0000000..3e92985
Binary files /dev/null and b/models/ctf/flag_yellow_gloss.tga differ
diff --git a/models/ctf/flag_yellow_glow.tga b/models/ctf/flag_yellow_glow.tga
new file mode 100644 (file)
index 0000000..0af88a9
Binary files /dev/null and b/models/ctf/flag_yellow_glow.tga differ
diff --git a/models/ctf/flag_yellow_norm.tga b/models/ctf/flag_yellow_norm.tga
new file mode 100644 (file)
index 0000000..07d5e17
Binary files /dev/null and b/models/ctf/flag_yellow_norm.tga differ
diff --git a/models/ctf/flags.md3_2.skin b/models/ctf/flags.md3_2.skin
new file mode 100644 (file)
index 0000000..44fb67d
--- /dev/null
@@ -0,0 +1,3 @@
+mesh,models/ctf/flag_yellow.tga
+mesh2,models/ctf/banner_yellow.tga
+mesh3,models/ctf/glow_yellow.tga
\ No newline at end of file
diff --git a/models/ctf/flags.md3_3.skin b/models/ctf/flags.md3_3.skin
new file mode 100644 (file)
index 0000000..22d77d2
--- /dev/null
@@ -0,0 +1,3 @@
+mesh,models/ctf/flag_pink.tga
+mesh2,models/ctf/banner_pink.tga
+mesh3,models/ctf/glow_pink.tga
\ No newline at end of file
diff --git a/models/ctf/glow_pink.tga b/models/ctf/glow_pink.tga
new file mode 100644 (file)
index 0000000..6a3bb8c
Binary files /dev/null and b/models/ctf/glow_pink.tga differ
diff --git a/models/ctf/glow_pink_glow.tga b/models/ctf/glow_pink_glow.tga
new file mode 100644 (file)
index 0000000..8da95a9
Binary files /dev/null and b/models/ctf/glow_pink_glow.tga differ
diff --git a/models/ctf/glow_yellow.tga b/models/ctf/glow_yellow.tga
new file mode 100644 (file)
index 0000000..8562caa
Binary files /dev/null and b/models/ctf/glow_yellow.tga differ
diff --git a/models/ctf/glow_yellow_glow.tga b/models/ctf/glow_yellow_glow.tga
new file mode 100644 (file)
index 0000000..8562caa
Binary files /dev/null and b/models/ctf/glow_yellow_glow.tga differ
index 273f427..68d3bf8 100644 (file)
@@ -2731,30 +2731,42 @@ void HUD_Mod_CA(vector myPos, vector mySize)
 }
 
 // CTF HUD modicon section
-float redflag_prevframe, blueflag_prevframe; // status during previous frame
-float redflag_prevstatus, blueflag_prevstatus; // last remembered status
-float redflag_statuschange_time, blueflag_statuschange_time; // time when the status changed
+float redflag_prevframe, blueflag_prevframe, yellowflag_prevframe, pinkflag_prevframe; // status during previous frame
+float redflag_prevstatus, blueflag_prevstatus, yellowflag_prevstatus, pinkflag_prevstatus; // last remembered status
+float redflag_statuschange_time, blueflag_statuschange_time, yellowflag_statuschange_time, pinkflag_statuschange_time; // time when the status changed
 
 void HUD_Mod_CTF_Reset(void)
 {
-       redflag_prevstatus = blueflag_prevstatus = redflag_prevframe = blueflag_prevframe = redflag_statuschange_time = blueflag_statuschange_time = 0;
+       redflag_prevstatus = blueflag_prevstatus = yellowflag_prevstatus = pinkflag_prevstatus = 0;
+       redflag_prevframe = blueflag_prevframe = yellowflag_prevframe = pinkflag_prevframe = 0;
+       redflag_statuschange_time = blueflag_statuschange_time = yellowflag_statuschange_time = pinkflag_statuschange_time = 0;
 }
 
 void HUD_Mod_CTF(vector pos, vector mySize)
 {
-       vector redflag_pos, blueflag_pos;
+       vector redflag_pos, blueflag_pos, yellowflag_pos, pinkflag_pos;
        vector flag_size;
        float f; // every function should have that
 
-       float redflag, blueflag; // current status
-       float redflag_statuschange_elapsedtime, blueflag_statuschange_elapsedtime; // time since the status changed
+       float redflag, blueflag, yellowflag, pinkflag; // current status
+       float redflag_statuschange_elapsedtime, blueflag_statuschange_elapsedtime, yellowflag_statuschange_elapsedtime, pinkflag_statuschange_elapsedtime; // time since the status changed
        float stat_items;
+       float teams_count = 0;
+       float fs, fs2, fs3, size1, size2;
+       vector e1, e2;
+       entity tm;
+       
+       for(tm = teams.sort_next; tm; tm = tm.sort_next)
+       if(tm.team != NUM_SPECTATOR)
+               ++teams_count;
 
        stat_items = getstati(STAT_ITEMS, 0, 24);
        redflag = (stat_items/IT_RED_FLAG_TAKEN) & 3;
        blueflag = (stat_items/IT_BLUE_FLAG_TAKEN) & 3;
+       yellowflag = (stat_items/IT_YELLOW_FLAG_TAKEN) & 3;
+       pinkflag = (stat_items/IT_PINK_FLAG_TAKEN) & 3;
        
-       if(redflag || blueflag)
+       if(redflag || blueflag || yellowflag || pinkflag)
                mod_active = 1;
        else
                mod_active = 0;
@@ -2763,6 +2775,10 @@ void HUD_Mod_CTF(vector pos, vector mySize)
        {
                redflag = 1;
                blueflag = 2;
+               if(teams_count >= 3)
+                       yellowflag = 2;
+               if(teams_count >= 4)
+                       pinkflag = 3;
        }
 
        // when status CHANGES, set old status into prevstatus and current status into status
@@ -2779,9 +2795,25 @@ void HUD_Mod_CTF(vector pos, vector mySize)
                blueflag_prevstatus = blueflag_prevframe;
                blueflag_prevframe = blueflag;
        }
+       
+       if (yellowflag != yellowflag_prevframe)
+       {
+               yellowflag_statuschange_time = time;
+               yellowflag_prevstatus = yellowflag_prevframe;
+               yellowflag_prevframe = yellowflag;
+       }
+
+       if (pinkflag != pinkflag_prevframe)
+       {
+               pinkflag_statuschange_time = time;
+               pinkflag_prevstatus = pinkflag_prevframe;
+               pinkflag_prevframe = pinkflag;
+       }
 
        redflag_statuschange_elapsedtime = time - redflag_statuschange_time;
        blueflag_statuschange_elapsedtime = time - blueflag_statuschange_time;
+       yellowflag_statuschange_elapsedtime = time - yellowflag_statuschange_time;
+       pinkflag_statuschange_elapsedtime = time - pinkflag_statuschange_time;
 
        float BLINK_FACTOR = 0.15;
        float BLINK_BASE = 0.85;
@@ -2800,7 +2832,7 @@ void HUD_Mod_CTF(vector pos, vector mySize)
                case 2: red_icon = "flag_red_lost"; break;
                case 3: red_icon = "flag_red_carrying"; red_alpha = BLINK_BASE + BLINK_FACTOR * cos(time * BLINK_FREQ); break;
                default:
-                       if((stat_items & IT_CTF_SHIELDED) && (myteam == NUM_TEAM_2))
+                       if((stat_items & IT_CTF_SHIELDED) && (myteam != NUM_TEAM_1))
                                red_icon = "flag_red_shielded";
                        else
                                red_icon = string_null;
@@ -2813,7 +2845,7 @@ void HUD_Mod_CTF(vector pos, vector mySize)
                default:
                        if(redflag == 3)
                                red_icon_prevstatus = "flag_red_carrying"; // make it more visible
-                       else if((stat_items & IT_CTF_SHIELDED) && (myteam == NUM_TEAM_2))
+                       else if((stat_items & IT_CTF_SHIELDED) && (myteam != NUM_TEAM_1))
                                red_icon_prevstatus = "flag_red_shielded";
                        else
                                red_icon_prevstatus = string_null;
@@ -2828,7 +2860,7 @@ void HUD_Mod_CTF(vector pos, vector mySize)
                case 2: blue_icon = "flag_blue_lost"; break;
                case 3: blue_icon = "flag_blue_carrying"; blue_alpha = BLINK_BASE + BLINK_FACTOR * cos(time * BLINK_FREQ); break;
                default:
-                       if((stat_items & IT_CTF_SHIELDED) && (myteam == NUM_TEAM_1))
+                       if((stat_items & IT_CTF_SHIELDED) && (myteam != NUM_TEAM_2))
                                blue_icon = "flag_blue_shielded";
                        else
                                blue_icon = string_null;
@@ -2841,32 +2873,129 @@ void HUD_Mod_CTF(vector pos, vector mySize)
                default:
                        if(blueflag == 3)
                                blue_icon_prevstatus = "flag_blue_carrying"; // make it more visible
-                       else if((stat_items & IT_CTF_SHIELDED) && (myteam == NUM_TEAM_1))
+                       else if((stat_items & IT_CTF_SHIELDED) && (myteam != NUM_TEAM_2))
                                blue_icon_prevstatus = "flag_blue_shielded";
                        else
                                blue_icon_prevstatus = string_null;
                        break;
        }
-
-       if(mySize_x > mySize_y) {
-               if (myteam == NUM_TEAM_1) { // always draw own flag on left
+       
+       string yellow_icon, yellow_icon_prevstatus;
+       float yellow_alpha, yellow_alpha_prevstatus;
+       yellow_alpha = yellow_alpha_prevstatus = 1;
+       switch(yellowflag) {
+               case 1: yellow_icon = "flag_yellow_taken"; break;
+               case 2: yellow_icon = "flag_yellow_lost"; break;
+               case 3: yellow_icon = "flag_yellow_carrying"; yellow_alpha = BLINK_BASE + BLINK_FACTOR * cos(time * BLINK_FREQ); break;
+               default:
+                       if((stat_items & IT_CTF_SHIELDED) && (myteam != NUM_TEAM_3))
+                               yellow_icon = "flag_yellow_shielded";
+                       else
+                               yellow_icon = string_null;
+                       break;
+       }
+       switch(yellowflag_prevstatus) {
+               case 1: yellow_icon_prevstatus = "flag_yellow_taken"; break;
+               case 2: yellow_icon_prevstatus = "flag_yellow_lost"; break;
+               case 3: yellow_icon_prevstatus = "flag_yellow_carrying"; yellow_alpha_prevstatus = BLINK_BASE + BLINK_FACTOR * cos(time * BLINK_FREQ); break;
+               default:
+                       if(yellowflag == 3)
+                               yellow_icon_prevstatus = "flag_yellow_carrying"; // make it more visible
+                       else if((stat_items & IT_CTF_SHIELDED) && (myteam != NUM_TEAM_3))
+                               yellow_icon_prevstatus = "flag_yellow_shielded";
+                       else
+                               yellow_icon_prevstatus = string_null;
+                       break;
+       }
+       
+       string pink_icon, pink_icon_prevstatus;
+       float pink_alpha, pink_alpha_prevstatus;
+       pink_alpha = pink_alpha_prevstatus = 1;
+       switch(pinkflag) {
+               case 1: pink_icon = "flag_pink_taken"; break;
+               case 2: pink_icon = "flag_pink_lost"; break;
+               case 3: pink_icon = "flag_pink_carrying"; pink_alpha = BLINK_BASE + BLINK_FACTOR * cos(time * BLINK_FREQ); break;
+               default:
+                       if((stat_items & IT_CTF_SHIELDED) && (myteam != NUM_TEAM_4))
+                               pink_icon = "flag_pink_shielded";
+                       else
+                               pink_icon = string_null;
+                       break;
+       }
+       switch(pinkflag_prevstatus) {
+               case 1: pink_icon_prevstatus = "flag_pink_taken"; break;
+               case 2: pink_icon_prevstatus = "flag_pink_lost"; break;
+               case 3: pink_icon_prevstatus = "flag_pink_carrying"; pink_alpha_prevstatus = BLINK_BASE + BLINK_FACTOR * cos(time * BLINK_FREQ); break;
+               default:
+                       if(pinkflag == 3)
+                               pink_icon_prevstatus = "flag_pink_carrying"; // make it more visible
+                       else if((stat_items & IT_CTF_SHIELDED) && (myteam != NUM_TEAM_4))
+                               pink_icon_prevstatus = "flag_pink_shielded";
+                       else
+                               pink_icon_prevstatus = string_null;
+                       break;
+       }
+       
+       switch(teams_count)
+       {
+               default:
+               case 2: fs = 0.5; fs2 = 0.5; fs3 = 0.5; break;
+               case 3: fs = 1; fs2 = 0.35; fs3 = 0.35; break;
+               case 4: fs = 0.75; fs2 = 0.25; fs3 = 0.5; break;
+       }
+       
+       if(mySize_x > mySize_y)
+       {
+               size1 = mySize_x;
+               size2 = mySize_y;
+               e1 = eX;
+               e2 = eY;
+       }
+       else
+       {
+               size1 = mySize_y;
+               size2 = mySize_x;
+               e1 = eY;
+               e2 = eX;
+       }
+       
+       switch(myteam)
+       {
+               default:
+               case NUM_TEAM_1:
+               {
                        redflag_pos = pos;
-                       blueflag_pos = pos + eX * 0.5 * mySize_x;
-               } else {
-                       blueflag_pos = pos;
-                       redflag_pos = pos + eX * 0.5 * mySize_x;
+                       blueflag_pos = pos + eX * fs2 * size1;
+                       yellowflag_pos = pos - eX * fs2 * size1;
+                       pinkflag_pos = pos + eX * fs3 * size1;
+                       break;
                }
-               flag_size = eX * 0.5 * mySize_x + eY * mySize_y;
-       } else {
-               if (myteam == NUM_TEAM_1) { // always draw own flag on left
-                       redflag_pos = pos;
-                       blueflag_pos = pos + eY * 0.5 * mySize_y;
-               } else {
+               case NUM_TEAM_2:
+               {
+                       redflag_pos = pos + eX * fs2 * size1;
                        blueflag_pos = pos;
-                       redflag_pos = pos + eY * 0.5 * mySize_y;
+                       yellowflag_pos = pos - eX * fs2 * size1;
+                       pinkflag_pos = pos + eX * fs3 * size1;
+                       break;
+               }
+               case NUM_TEAM_3:
+               {
+                       redflag_pos = pos + eX * fs3 * size1;
+                       blueflag_pos = pos - eX * fs2 * size1;
+                       yellowflag_pos = pos;
+                       pinkflag_pos = pos + eX * fs2 * size1;
+                       break;
+               }
+               case NUM_TEAM_4:
+               {
+                       redflag_pos = pos - eX * fs2 * size1;
+                       blueflag_pos = pos + eX * fs3 * size1;
+                       yellowflag_pos = pos + eX * fs2 * size1;
+                       pinkflag_pos = pos;
+                       break;
                }
-               flag_size = eY * 0.5 * mySize_y + eX * mySize_x;
        }
+       flag_size = e1 * fs * size1 + e2 * size2;
 
        f = bound(0, redflag_statuschange_elapsedtime*2, 1);
        if(red_icon_prevstatus && f < 1)
@@ -2879,6 +3008,18 @@ void HUD_Mod_CTF(vector pos, vector mySize)
                drawpic_aspect_skin_expanding(blueflag_pos, blue_icon_prevstatus, flag_size, '1 1 1', panel_fg_alpha * blue_alpha_prevstatus, DRAWFLAG_NORMAL, f);
        if(blue_icon)
                drawpic_aspect_skin(blueflag_pos, blue_icon, flag_size, '1 1 1', panel_fg_alpha * blue_alpha * f, DRAWFLAG_NORMAL);
+               
+       f = bound(0, yellowflag_statuschange_elapsedtime*2, 1);
+       if(yellow_icon_prevstatus && f < 1)
+               drawpic_aspect_skin_expanding(yellowflag_pos, yellow_icon_prevstatus, flag_size, '1 1 1', panel_fg_alpha * yellow_alpha_prevstatus, DRAWFLAG_NORMAL, f);
+       if(yellow_icon)
+               drawpic_aspect_skin(yellowflag_pos, yellow_icon, flag_size, '1 1 1', panel_fg_alpha * yellow_alpha * f, DRAWFLAG_NORMAL);
+               
+       f = bound(0, pinkflag_statuschange_elapsedtime*2, 1);
+       if(pink_icon_prevstatus && f < 1)
+               drawpic_aspect_skin_expanding(pinkflag_pos, pink_icon_prevstatus, flag_size, '1 1 1', panel_fg_alpha * pink_alpha_prevstatus, DRAWFLAG_NORMAL, f);
+       if(pink_icon)
+               drawpic_aspect_skin(pinkflag_pos, pink_icon, flag_size, '1 1 1', panel_fg_alpha * pink_alpha * f, DRAWFLAG_NORMAL);
 }
 
 // Keyhunt HUD modicon section
index 2066aec..6daeca4 100644 (file)
@@ -269,6 +269,8 @@ string spritelookuptext(string s)
                case "keycarrier-red": return _("Key carrier");
                case "keycarrier-yellow": return _("Key carrier");
                case "redbase": return _("Red base");
+               case "yellowbase": return _("Yellow base");
+               case "pinkbase": return _("Pink base");
                case "waypoint": return _("Waypoint");
                case "ons-gen-red": return _("Generator");
                case "ons-gen-blue": return _("Generator");
index ba42d55..a936a4c 100644 (file)
@@ -41,6 +41,12 @@ float   IT_HEALTH                    = 32768;
        float   IT_BLUE_FLAG_TAKEN              = 131072;
        float   IT_BLUE_FLAG_LOST               = 262144;
        float   IT_BLUE_FLAG_CARRYING   = 393216;
+       float   IT_YELLOW_FLAG_TAKEN    = 524288;
+       float   IT_YELLOW_FLAG_LOST             = 1048576;
+       float   IT_YELLOW_FLAG_CARRYING = 1572864;
+       float   IT_PINK_FLAG_TAKEN              = 2097152;
+       float   IT_PINK_FLAG_LOST               = 4194304;
+       float   IT_PINK_FLAG_CARRYING   = 6291456;
 // end
 float   IT_5HP                       = 524288;
 float   IT_25HP                      = 1048576;
index 1ad03e5..a1255c0 100644 (file)
@@ -245,19 +245,19 @@ void Send_Notification_WOVA(
                MSG_INFO_NOTIF(default, prefix##PINK, strnum, flnum, args, hudargs, sprintf(icon, strtolower(STATIC_NAME_TEAM_4)), TCR(normal, COL_TEAM_4, strtoupper(NAME_TEAM_4)), TCR(gentle, COL_TEAM_4, strtoupper(NAME_TEAM_4))) \
        #endif
 #define MSG_INFO_NOTIFICATIONS \
-       MULTITEAM_INFO(1, INFO_CTF_CAPTURE_, 2,                1, 0, "s1", "s1",                        "notify_%s_captured",   _("^BG%s^BG captured the ^TC^TT^BG flag\n"), "") \
-       MULTITEAM_INFO(1, INFO_CTF_CAPTURE_BROKEN_, 2,         2, 2, "s1 f1p2dec s2 f2p2dec", "s1",     "notify_%s_captured",   _("^BG%s^BG captured the ^TC^TT^BG flag in ^F1%s^BG seconds, breaking ^BG%s^BG's previous record of ^F2%s^BG seconds\n"), "") \
-       MULTITEAM_INFO(1, INFO_CTF_CAPTURE_TIME_, 2,           1, 1, "s1 f1p2dec", "s1",                "notify_%s_captured",   _("^BG%s^BG captured the ^TC^TT^BG flag in ^F1%s^BG seconds\n"), "") \
-       MULTITEAM_INFO(1, INFO_CTF_CAPTURE_UNBROKEN_, 2,       2, 2, "s1 f1p2dec s2 f2p2dec", "s1",     "notify_%s_captured",   _("^BG%s^BG captured the ^TC^TT^BG flag in ^F2%s^BG seconds, failing to break ^BG%s^BG's previous record of ^F1%s^BG seconds\n"), "") \
-       MULTITEAM_INFO(1, INFO_CTF_FLAGRETURN_ABORTRUN_, 2,    0, 0, "", "",                            "",                     _("^BGThe ^TC^TT^BG flag was returned to base by its owner\n"), "") \
-       MULTITEAM_INFO(1, INFO_CTF_FLAGRETURN_DAMAGED_, 2,     0, 0, "", "",                            "",                     _("^BGThe ^TC^TT^BG flag was destroyed and returned to base\n"), "") \
-       MULTITEAM_INFO(1, INFO_CTF_FLAGRETURN_DROPPED_, 2,     0, 0, "", "",                            "",                     _("^BGThe ^TC^TT^BG flag was dropped in the base and returned itself\n"), "") \
-       MULTITEAM_INFO(1, INFO_CTF_FLAGRETURN_NEEDKILL_, 2,    0, 0, "", "",                            "",                     _("^BGThe ^TC^TT^BG flag fell somewhere it couldn't be reached and returned to base\n"), "") \
-       MULTITEAM_INFO(1, INFO_CTF_FLAGRETURN_SPEEDRUN_, 2,    0, 1, "f1p2dec", "",                     "",                     _("^BGThe ^TC^TT^BG flag became impatient after ^F1%.2f^BG seconds and returned itself\n"), "") \
-       MULTITEAM_INFO(1, INFO_CTF_FLAGRETURN_TIMEOUT_, 2,     0, 0, "", "",                            "",                     _("^BGThe ^TC^TT^BG flag has returned to the base\n"), "") \
-       MULTITEAM_INFO(1, INFO_CTF_LOST_, 2,                   1, 0, "s1", "s1",                        "notify_%s_lost",       _("^BG%s^BG lost the ^TC^TT^BG flag\n"), "") \
-       MULTITEAM_INFO(1, INFO_CTF_PICKUP_, 2,                 1, 0, "s1", "s1",                        "notify_%s_taken",      _("^BG%s^BG got the ^TC^TT^BG flag\n"), "") \
-       MULTITEAM_INFO(1, INFO_CTF_RETURN_, 2,                 1, 0, "s1", "s1",                        "notify_%s_returned",   _("^BG%s^BG returned the ^TC^TT^BG flag\n"), "") \
+       MULTITEAM_INFO(1, INFO_CTF_CAPTURE_, 4,                1, 0, "s1", "s1",                        "notify_%s_captured",   _("^BG%s^BG captured the ^TC^TT^BG flag\n"), "") \
+       MULTITEAM_INFO(1, INFO_CTF_CAPTURE_BROKEN_, 4,         2, 2, "s1 f1p2dec s2 f2p2dec", "s1",     "notify_%s_captured",   _("^BG%s^BG captured the ^TC^TT^BG flag in ^F1%s^BG seconds, breaking ^BG%s^BG's previous record of ^F2%s^BG seconds\n"), "") \
+       MULTITEAM_INFO(1, INFO_CTF_CAPTURE_TIME_, 4,           1, 1, "s1 f1p2dec", "s1",                "notify_%s_captured",   _("^BG%s^BG captured the ^TC^TT^BG flag in ^F1%s^BG seconds\n"), "") \
+       MULTITEAM_INFO(1, INFO_CTF_CAPTURE_UNBROKEN_, 4,       2, 2, "s1 f1p2dec s2 f2p2dec", "s1",     "notify_%s_captured",   _("^BG%s^BG captured the ^TC^TT^BG flag in ^F2%s^BG seconds, failing to break ^BG%s^BG's previous record of ^F1%s^BG seconds\n"), "") \
+       MULTITEAM_INFO(1, INFO_CTF_FLAGRETURN_ABORTRUN_, 4,    0, 0, "", "",                            "",                     _("^BGThe ^TC^TT^BG flag was returned to base by its owner\n"), "") \
+       MULTITEAM_INFO(1, INFO_CTF_FLAGRETURN_DAMAGED_, 4,     0, 0, "", "",                            "",                     _("^BGThe ^TC^TT^BG flag was destroyed and returned to base\n"), "") \
+       MULTITEAM_INFO(1, INFO_CTF_FLAGRETURN_DROPPED_, 4,     0, 0, "", "",                            "",                     _("^BGThe ^TC^TT^BG flag was dropped in the base and returned itself\n"), "") \
+       MULTITEAM_INFO(1, INFO_CTF_FLAGRETURN_NEEDKILL_, 4,    0, 0, "", "",                            "",                     _("^BGThe ^TC^TT^BG flag fell somewhere it couldn't be reached and returned to base\n"), "") \
+       MULTITEAM_INFO(1, INFO_CTF_FLAGRETURN_SPEEDRUN_, 4,    0, 1, "f1p2dec", "",                     "",                     _("^BGThe ^TC^TT^BG flag became impatient after ^F1%.2f^BG seconds and returned itself\n"), "") \
+       MULTITEAM_INFO(1, INFO_CTF_FLAGRETURN_TIMEOUT_, 4,     0, 0, "", "",                            "",                     _("^BGThe ^TC^TT^BG flag has returned to the base\n"), "") \
+       MULTITEAM_INFO(1, INFO_CTF_LOST_, 4,                   1, 0, "s1", "s1",                        "notify_%s_lost",       _("^BG%s^BG lost the ^TC^TT^BG flag\n"), "") \
+       MULTITEAM_INFO(1, INFO_CTF_PICKUP_, 4,                 1, 0, "s1", "s1",                        "notify_%s_taken",      _("^BG%s^BG got the ^TC^TT^BG flag\n"), "") \
+       MULTITEAM_INFO(1, INFO_CTF_RETURN_, 4,                 1, 0, "s1", "s1",                        "notify_%s_returned",   _("^BG%s^BG returned the ^TC^TT^BG flag\n"), "") \
        MSG_INFO_NOTIF(1, INFO_DEATH_MURDER_CHEAT,             3, 2, "spree_inf s1 s2 s3loc spree_end", "s2 s1",  "notify_death",         _("^BG%s%s^K1 was unfairly eliminated by ^BG%s^K1%s%s\n"), "") \
        MSG_INFO_NOTIF(1, INFO_DEATH_MURDER_DROWN,             3, 2, "spree_inf s1 s2 s3loc spree_end", "s2 s1",  "notify_water",         _("^BG%s%s^K1 was drowned by ^BG%s^K1%s%s\n"), "") \
        MSG_INFO_NOTIF(1, INFO_DEATH_MURDER_FALL,              3, 2, "spree_inf s1 s2 s3loc spree_end", "s2 s1",  "notify_fall",          _("^BG%s%s^K1 was grounded by ^BG%s^K1%s%s\n"), "") \
@@ -443,20 +443,20 @@ void Send_Notification_WOVA(
        MSG_CENTER_NOTIF(1, CENTER_ROUND_OVER,                  0, 0, "",             CPID_ROUND,          "0 0", _("^BGRound over, there's no winner"), "") \
        MSG_CENTER_NOTIF(1, CENTER_CAMPCHECK,                   0, 0, "",             CPID_CAMPCHECK,      "0 0", _("^F2Don't camp!"), "") \
        MSG_CENTER_NOTIF(1, CENTER_CTF_CAPTURESHIELD_FREE,      0, 0, "",             CPID_CTF_CAPSHIELD,  "0 0", _("^BGYou are now free.\n^BGFeel free to ^F2try to capture^BG the flag again\n^BGif you think you will succeed."), "") \
-       MSG_CENTER_NOTIF(1, CENTER_CTF_CAPTURESHIELD_SHIELDED,  0, 0, "",             CPID_CTF_CAPSHIELD,  "0 0", _("^BGYou are now ^F1shielded^BG from the flag\n^BGfor ^F2too many unsuccessful attempts^BG to capture.\n^BGMake some defensive scores before trying again."), "") \
-       MULTITEAM_CENTER(1, CENTER_CTF_CAPTURE_, 2,             0, 0, "",             CPID_CTF_LOWPRIO,    "0 0", _("^BGYou captured the ^TC^TT^BG flag!"), "") \
+       MSG_CENTER_NOTIF(1, CENTER_CTF_CAPTURESHIELD_SHIELDED,  0, 0, "",             CPID_CTF_CAPSHIELD,  "0 0", _("^BGYou are now ^F1shielded^BG from the flag(s)\n^BGfor ^F2too many unsuccessful attempts^BG to capture.\n^BGMake some defensive scores before trying again."), "") \
+       MULTITEAM_CENTER(1, CENTER_CTF_CAPTURE_, 4,             0, 0, "",             CPID_CTF_LOWPRIO,    "0 0", _("^BGYou captured the ^TC^TT^BG flag!"), "") \
        MSG_CENTER_NOTIF(1, CENTER_CTF_FLAG_THROW_PUNISH,       0, 1, "f1secs",       CPID_CTF_LOWPRIO,    "0 0", _("^BGToo many flag throws! Throwing disabled for %s."), "") \
-       MULTITEAM_CENTER(1, CENTER_CTF_PASS_OTHER_, 2,          2, 0, "s1 s2",        CPID_CTF_PASS,       "0 0", _("^BG%s^BG passed the ^TC^TT^BG flag to %s"), "") \
-       MULTITEAM_CENTER(1, CENTER_CTF_PASS_RECEIVED_, 2,       1, 0, "s1",           CPID_CTF_PASS,       "0 0", _("^BGYou received the ^TC^TT^BG flag from %s"), "") \
+       MULTITEAM_CENTER(1, CENTER_CTF_PASS_OTHER_, 4,          2, 0, "s1 s2",        CPID_CTF_PASS,       "0 0", _("^BG%s^BG passed the ^TC^TT^BG flag to %s"), "") \
+       MULTITEAM_CENTER(1, CENTER_CTF_PASS_RECEIVED_, 4,       1, 0, "s1",           CPID_CTF_PASS,       "0 0", _("^BGYou received the ^TC^TT^BG flag from %s"), "") \
        MSG_CENTER_NOTIF(1, CENTER_CTF_PASS_REQUESTED,          1, 0, "s1 pass_key",  CPID_CTF_PASS,       "0 0", _("^BG%s^BG requests you to pass the flag%s"), "") \
        MSG_CENTER_NOTIF(1, CENTER_CTF_PASS_REQUESTING,         1, 0, "s1",           CPID_CTF_PASS,       "0 0", _("^BGRequesting %s^BG to pass you the flag"), "") \
-       MULTITEAM_CENTER(1, CENTER_CTF_PASS_SENT_, 2,           1, 0, "s1",           CPID_CTF_PASS,       "0 0", _("^BGYou passed the ^TC^TT^BG flag to %s"), "") \
-       MULTITEAM_CENTER(1, CENTER_CTF_PICKUP_, 2,              0, 0, "",             CPID_CTF_LOWPRIO,    "0 0", _("^BGYou got the ^TC^TT^BG flag!"), "") \
+       MULTITEAM_CENTER(1, CENTER_CTF_PASS_SENT_, 4,           1, 0, "s1",           CPID_CTF_PASS,       "0 0", _("^BGYou passed the ^TC^TT^BG flag to %s"), "") \
+       MULTITEAM_CENTER(1, CENTER_CTF_PICKUP_, 4,              0, 0, "",             CPID_CTF_LOWPRIO,    "0 0", _("^BGYou got the ^TC^TT^BG flag!"), "") \
        MSG_CENTER_NOTIF(1, CENTER_CTF_PICKUP_ENEMY,            1, 0, "s1",           CPID_CTF_LOWPRIO,    "0 0", _("^BGThe %senemy^BG got your flag! Retrieve it!"), "") \
        MSG_CENTER_NOTIF(1, CENTER_CTF_PICKUP_ENEMY_VERBOSE,    2, 0, "s1 s2 s1",     CPID_CTF_LOWPRIO,    "0 0", _("^BGThe %senemy (^BG%s%s)^BG got your flag! Retrieve it!"), "") \
-       MSG_CENTER_NOTIF(1, CENTER_CTF_PICKUP_TEAM,             1, 0, "s1",           CPID_CTF_LOWPRIO,    "0 0", _("^BGYour %steam mate^BG got the flag! Protect them!"), "") \
-       MSG_CENTER_NOTIF(1, CENTER_CTF_PICKUP_TEAM_VERBOSE,     2, 0, "s1 s2 s1",     CPID_CTF_LOWPRIO,    "0 0", _("^BGYour %steam mate (^BG%s%s)^BG got the flag! Protect them!"), "") \
-       MULTITEAM_CENTER(1, CENTER_CTF_RETURN_, 2,              0, 0, "",             CPID_CTF_LOWPRIO,    "0 0", _("^BGYou returned the ^TC^TT^BG flag!"), "") \
+       MULTITEAM_CENTER(1, CENTER_CTF_PICKUP_TEAM_, 4,         1, 0, "s1",           CPID_CTF_LOWPRIO,    "0 0", _("^BGYour %steam mate^BG got the ^TC^TT^BG flag! Protect them!"), "") \
+       MULTITEAM_CENTER(1, CENTER_CTF_PICKUP_TEAM_VERBOSE_, 4, 2, 0, "s1 s2 s1",     CPID_CTF_LOWPRIO,    "0 0", _("^BGYour %steam mate (^BG%s%s)^BG got the ^TC^TT^BG flag! Protect them!"), "") \
+       MULTITEAM_CENTER(1, CENTER_CTF_RETURN_, 4,              0, 0, "",             CPID_CTF_LOWPRIO,    "0 0", _("^BGYou returned the ^TC^TT^BG flag!"), "") \
        MSG_CENTER_NOTIF(1, CENTER_CTF_STALEMATE_CARRIER,       0, 0, "",             CPID_STALEMATE,      "0 0", _("^BGStalemate! Enemies can now see you on radar!"), "") \
        MSG_CENTER_NOTIF(1, CENTER_CTF_STALEMATE_OTHER,         0, 0, "",             CPID_STALEMATE,      "0 0", _("^BGStalemate! Flag carriers can now be seen by enemies on radar!"), "") \
        MSG_CENTER_NOTIF(1, CENTER_DEATH_MURDER_FRAG,                 1, 1, "spree_cen s1",             NO_CPID, "0 0", _("^K3%sYou fragged ^BG%s"), _("^K3%sYou scored against ^BG%s")) \
index 3d640de..ac79189 100644 (file)
@@ -756,16 +756,12 @@ float autocvar_g_ctf_pass_turnrate;
 float autocvar_g_ctf_pass_timelimit;
 float autocvar_g_ctf_pass_velocity;
 float autocvar_g_ctf_dynamiclights;
-string autocvar_g_ctf_flag_blue_model;
-float autocvar_g_ctf_flag_blue_skin;
 float autocvar_g_ctf_flag_collect_delay;
 float autocvar_g_ctf_flag_damageforcescale;
 float autocvar_g_ctf_flag_dropped_waypoint;
 float autocvar_g_ctf_flag_dropped_floatinwater;
 float autocvar_g_ctf_flag_glowtrails;
 float autocvar_g_ctf_flag_health;
-string autocvar_g_ctf_flag_red_model;
-float autocvar_g_ctf_flag_red_skin;
 float autocvar_g_ctf_flag_return_time;
 float autocvar_g_ctf_flag_return_when_unreachable;
 float autocvar_g_ctf_flag_return_damage;
index 7c49045..d5ded0f 100644 (file)
@@ -182,12 +182,8 @@ MUTATOR_HOOKFUNCTION(ca_reset_map_global)
 
 MUTATOR_HOOKFUNCTION(ca_GetTeamCount)
 {
-       ca_teams = autocvar_g_ca_teams_override;
-       if(ca_teams < 2)
-               ca_teams = autocvar_g_ca_teams;
-       ca_teams = bound(2, ca_teams, 4);
        ret_float = ca_teams;
-       return 1;
+       return 0;
 }
 
 MUTATOR_HOOKFUNCTION(ca_PlayerDies)
@@ -289,6 +285,13 @@ void ca_Initialize()
 {
        allowed_to_spawn = TRUE;
 
+       ca_teams = autocvar_g_ca_teams_override;
+       if(ca_teams < 2)
+               ca_teams = autocvar_g_ca_teams;
+       ca_teams = bound(2, ca_teams, 4);
+       ret_float = ca_teams;
+       ScoreRules_ca(ca_teams);
+
        round_handler_Spawn(CA_CheckTeams, CA_CheckWinner, CA_RoundStart);
        round_handler_Init(5, autocvar_g_ca_warmup, autocvar_g_ca_round_timelimit);
 
@@ -296,8 +299,6 @@ void ca_Initialize()
        addstat(STAT_BLUEALIVE, AS_INT, bluealive_stat);
        addstat(STAT_YELLOWALIVE, AS_INT, yellowalive_stat);
        addstat(STAT_PINKALIVE, AS_INT, pinkalive_stat);
-
-       InitializeEntity(world, ca_DelayedInit, INITPRIO_GAMETYPE);
 }
 
 MUTATOR_DEFINITION(gamemode_ca)
index a333952..a7c1edf 100644 (file)
@@ -1,8 +1,2 @@
 // should be removed in the future, as other code should not have to care
 .float caplayer; // 0.5 if scheduled to join the next round
-
-#ifdef SVQC
-
-#define ST_CA_ROUNDS 1
-
-#endif
index 1de0566..384250c 100644 (file)
@@ -32,11 +32,11 @@ void ctf_CaptureRecord(entity flag, entity player)
        {
                if(tmp_entity.CAPTURE_VERBOSE)
                {
-                       if(!ctf_captimerecord) { Send_Notification(NOTIF_ONE_ONLY, tmp_entity, MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_CAPTURE_TIME_), player.netname, (cap_time * 100)); }
-                       else if(cap_time < cap_record) { Send_Notification(NOTIF_ONE_ONLY, tmp_entity, MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_CAPTURE_BROKEN_), player.netname, refername, (cap_time * 100), (cap_record * 100)); }
-                       else { Send_Notification(NOTIF_ONE_ONLY, tmp_entity, MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_CAPTURE_UNBROKEN_), player.netname, refername, (cap_time * 100), (cap_record * 100)); }
+                       if(!ctf_captimerecord) { Send_Notification(NOTIF_ONE_ONLY, tmp_entity, MSG_INFO, APP_TEAM_ENT_4(flag, INFO_CTF_CAPTURE_TIME_), player.netname, (cap_time * 100)); }
+                       else if(cap_time < cap_record) { Send_Notification(NOTIF_ONE_ONLY, tmp_entity, MSG_INFO, APP_TEAM_ENT_4(flag, INFO_CTF_CAPTURE_BROKEN_), player.netname, refername, (cap_time * 100), (cap_record * 100)); }
+                       else { Send_Notification(NOTIF_ONE_ONLY, tmp_entity, MSG_INFO, APP_TEAM_ENT_4(flag, INFO_CTF_CAPTURE_UNBROKEN_), player.netname, refername, (cap_time * 100), (cap_record * 100)); }
                }
-               else { Send_Notification(NOTIF_ONE_ONLY, tmp_entity, MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_CAPTURE_), player.netname); }
+               else { Send_Notification(NOTIF_ONE_ONLY, tmp_entity, MSG_INFO, APP_TEAM_ENT_4(flag, INFO_CTF_CAPTURE_), player.netname); }
        }
 
        // the previous notification broadcast is only sent to real clients, this will notify server log too
@@ -44,11 +44,11 @@ void ctf_CaptureRecord(entity flag, entity player)
        {
                if(autocvar_notification_ctf_capture_verbose)
                {
-                       if(!ctf_captimerecord) { Local_Notification(MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_CAPTURE_TIME_), player.netname, (cap_time * 100)); }
-                       else if(cap_time < cap_record) { Local_Notification(MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_CAPTURE_BROKEN_), player.netname, refername, (cap_time * 100), (cap_record * 100)); }
-                       else { Local_Notification(MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_CAPTURE_UNBROKEN_), player.netname, refername, (cap_time * 100), (cap_record * 100)); }
+                       if(!ctf_captimerecord) { Local_Notification(MSG_INFO, APP_TEAM_ENT_4(flag, INFO_CTF_CAPTURE_TIME_), player.netname, (cap_time * 100)); }
+                       else if(cap_time < cap_record) { Local_Notification(MSG_INFO, APP_TEAM_ENT_4(flag, INFO_CTF_CAPTURE_BROKEN_), player.netname, refername, (cap_time * 100), (cap_record * 100)); }
+                       else { Local_Notification(MSG_INFO, APP_TEAM_ENT_4(flag, INFO_CTF_CAPTURE_UNBROKEN_), player.netname, refername, (cap_time * 100), (cap_record * 100)); }
                }
-               else { Local_Notification(MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_CAPTURE_), player.netname); }
+               else { Local_Notification(MSG_INFO, APP_TEAM_ENT_4(flag, INFO_CTF_CAPTURE_), player.netname); }
        }
        
        // write that shit in the database
@@ -131,6 +131,25 @@ float ctf_CheckPassDirection(vector head_center, vector passer_center, vector pa
        else { return TRUE; }
 }
 
+float ctf_IsDifferentTeam(entity a, entity b)
+{
+       float f = IsDifferentTeam(a, b);
+       return (autocvar_g_ctf_reverse) ? !f : f;
+}
+
+float ctf_Stalemate_waypointsprite_visible_for_player(entity e)
+{
+       // team waypoints
+       if(ctf_IsDifferentTeam(self.owner.flagcarried, self.owner))
+       if(ctf_IsDifferentTeam(self.owner.flagcarried, e))
+       if(!IsDifferentTeam(self.owner, e))
+               return FALSE;
+       if not(IS_PLAYER(e))
+               return FALSE;
+
+       return TRUE;
+}
+
 
 // =======================
 // CaptureShield Functions 
@@ -138,15 +157,21 @@ float ctf_CheckPassDirection(vector head_center, vector passer_center, vector pa
 
 float ctf_CaptureShield_CheckStatus(entity p) 
 {
-       float s, se;
+       float s, s2, s3, s4, se, se2, se3, se4, sr, ser;
        entity e;
        float players_worseeq, players_total;
 
        if(ctf_captureshield_max_ratio <= 0)
                return FALSE;
-
-       s = PlayerScore_Add(p, SP_SCORE, 0);
-       if(s >= -ctf_captureshield_min_negscore)
+               
+       s = PlayerScore_Add(p, SP_CTF_CAPS, 0);
+       s2 = PlayerScore_Add(p, SP_CTF_PICKUPS, 0);
+       s3 = PlayerScore_Add(p, SP_CTF_RETURNS, 0);
+       s4 = PlayerScore_Add(p, SP_CTF_FCKILLS, 0);
+       
+       sr = ((s - s2) + (s3 + s4));
+       
+       if(sr >= -ctf_captureshield_min_negscore)
                return FALSE;
 
        players_total = players_worseeq = 0;
@@ -154,8 +179,14 @@ float ctf_CaptureShield_CheckStatus(entity p)
        {
                if(IsDifferentTeam(e, p))
                        continue;
-               se = PlayerScore_Add(e, SP_SCORE, 0);
-               if(se <= s)
+               se = PlayerScore_Add(e, SP_CTF_CAPS, 0);
+               se2 = PlayerScore_Add(e, SP_CTF_PICKUPS, 0);
+               se3 = PlayerScore_Add(e, SP_CTF_RETURNS, 0);
+               se4 = PlayerScore_Add(e, SP_CTF_FCKILLS, 0);
+               
+               ser = ((se - se2) + (se3 + se4));
+               
+               if(ser <= sr)
                        ++players_worseeq;
                ++players_total;
        }
@@ -182,7 +213,7 @@ void ctf_CaptureShield_Update(entity player, float wanted_status)
 float ctf_CaptureShield_Customize()
 {
        if(!other.ctf_captureshielded) { return FALSE; }
-       if(!IsDifferentTeam(self, other)) { return FALSE; }
+       if(!ctf_IsDifferentTeam(self, other)) { return FALSE; }
        
        return TRUE;
 }
@@ -190,7 +221,7 @@ float ctf_CaptureShield_Customize()
 void ctf_CaptureShield_Touch()
 {
        if(!other.ctf_captureshielded) { return; }
-       if(!IsDifferentTeam(self, other)) { return; }
+       if(!ctf_IsDifferentTeam(self, other)) { return; }
        
        vector mymid = (self.absmin + self.absmax) * 0.5;
        vector othermid = (other.absmin + other.absmax) * 0.5;
@@ -239,7 +270,7 @@ void ctf_Handle_Drop(entity flag, entity player, float droptype)
        flag.ctf_status = FLAG_DROPPED;
        
        // messages and sounds
-       Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_LOST_), player.netname);
+       Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_4(flag, INFO_CTF_LOST_), player.netname);
        sound(flag, CH_TRIGGER, flag.snd_flag_dropped, VOL_BASE, ATTN_NONE);
        ctf_EventLog("dropped", player.team, player);
 
@@ -292,11 +323,11 @@ void ctf_Handle_Retrieve(entity flag, entity player)
        FOR_EACH_REALPLAYER(tmp_player)
        {
                if(tmp_player == sender)
-                       Send_Notification(NOTIF_ONE, tmp_player, MSG_CENTER, APP_TEAM_ENT_2(flag, CENTER_CTF_PASS_SENT_), player.netname);
+                       Send_Notification(NOTIF_ONE, tmp_player, MSG_CENTER, APP_TEAM_ENT_4(flag, CENTER_CTF_PASS_SENT_), player.netname);
                else if(tmp_player == player)
-                       Send_Notification(NOTIF_ONE, tmp_player, MSG_CENTER, APP_TEAM_ENT_2(flag, CENTER_CTF_PASS_RECEIVED_), sender.netname);
+                       Send_Notification(NOTIF_ONE, tmp_player, MSG_CENTER, APP_TEAM_ENT_4(flag, CENTER_CTF_PASS_RECEIVED_), sender.netname);
                else if(!IsDifferentTeam(tmp_player, sender))
-                       Send_Notification(NOTIF_ONE, tmp_player, MSG_CENTER, APP_TEAM_ENT_2(flag, CENTER_CTF_PASS_OTHER_), sender.netname, player.netname);
+                       Send_Notification(NOTIF_ONE, tmp_player, MSG_CENTER, APP_TEAM_ENT_4(flag, CENTER_CTF_PASS_OTHER_), sender.netname, player.netname);
        }
        
        // create new waypoint
@@ -407,11 +438,12 @@ void ctf_Handle_Capture(entity flag, entity toucher, float capturetype)
        float old_time, new_time; 
        
        if not(player) { return; } // without someone to give the reward to, we can't possibly cap
+       if(ctf_IsDifferentTeam(player, flag)) { return; }
        
        // messages and sounds
-       Send_Notification(NOTIF_ONE, player, MSG_CENTER, APP_TEAM_ENT_2(enemy_flag, CENTER_CTF_CAPTURE_));
+       Send_Notification(NOTIF_ONE, player, MSG_CENTER, APP_TEAM_ENT_4(enemy_flag, CENTER_CTF_CAPTURE_));
        ctf_CaptureRecord(enemy_flag, player);
-       sound(player, CH_TRIGGER, flag.snd_flag_capture, VOL_BASE, ATTN_NONE);
+       sound(player, CH_TRIGGER, ((IsDifferentTeam(player, flag)) ? enemy_flag.snd_flag_capture : flag.snd_flag_capture), VOL_BASE, ATTN_NONE);
        
        switch(capturetype)
        {
@@ -451,8 +483,8 @@ void ctf_Handle_Capture(entity flag, entity toucher, float capturetype)
 void ctf_Handle_Return(entity flag, entity player)
 {
        // messages and sounds
-       Send_Notification(NOTIF_ONE, player, MSG_CENTER, APP_TEAM_ENT_2(flag, CENTER_CTF_RETURN_));
-       Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_RETURN_), player.netname);
+       Send_Notification(NOTIF_ONE, player, MSG_CENTER, APP_TEAM_ENT_4(flag, CENTER_CTF_RETURN_));
+       Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_4(flag, INFO_CTF_RETURN_), player.netname);
        sound(player, CH_TRIGGER, flag.snd_flag_returned, VOL_BASE, ATTN_NONE);
        ctf_EventLog("return", flag.team, player);
 
@@ -500,24 +532,24 @@ void ctf_Handle_Pickup(entity flag, entity player, float pickuptype)
        }
 
        // messages and sounds
-       Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_PICKUP_), player.netname);
+       Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_4(flag, INFO_CTF_PICKUP_), player.netname);
        sound(player, CH_TRIGGER, flag.snd_flag_taken, VOL_BASE, ATTN_NONE);
 
        FOR_EACH_REALPLAYER(tmp_player)
        {
                if(tmp_player == player)
                {
-                       Send_Notification(NOTIF_ONE, tmp_player, MSG_CENTER, APP_TEAM_ENT_2(flag, CENTER_CTF_PICKUP_));
+                       Send_Notification(NOTIF_ONE, tmp_player, MSG_CENTER, APP_TEAM_ENT_4(flag, CENTER_CTF_PICKUP_));
                        if(ctf_stalemate) { Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_CTF_STALEMATE_CARRIER); }
                }
                else if(!IsDifferentTeam(tmp_player, player) && tmp_player != player)
                {
                        if(tmp_player.PICKUP_TEAM_VERBOSE)
-                               Send_Notification(NOTIF_ONE, tmp_player, MSG_CENTER, CENTER_CTF_PICKUP_TEAM_VERBOSE, Team_ColorCode(player.team), player.netname);
+                               Send_Notification(NOTIF_ONE, tmp_player, MSG_CENTER, APP_TEAM_ENT_4(flag, CENTER_CTF_PICKUP_TEAM_VERBOSE_), Team_ColorCode(player.team), player.netname);
                        else
-                               Send_Notification(NOTIF_ONE, tmp_player, MSG_CENTER, CENTER_CTF_PICKUP_TEAM, Team_ColorCode(player.team));
+                               Send_Notification(NOTIF_ONE, tmp_player, MSG_CENTER, APP_TEAM_ENT_4(flag, CENTER_CTF_PICKUP_TEAM_), Team_ColorCode(player.team));
                }
-               else if(IsDifferentTeam(tmp_player, player))
+               else if(IsDifferentTeam(tmp_player, player) && !ctf_IsDifferentTeam(flag, tmp_player))
                {
                        if(tmp_player.PICKUP_ENEMY_VERBOSE)
                                Send_Notification(NOTIF_ONE, tmp_player, MSG_CENTER, CENTER_CTF_PICKUP_ENEMY_VERBOSE, Team_ColorCode(player.team), player.netname);
@@ -582,14 +614,14 @@ void ctf_CheckFlagReturn(entity flag, float returntype)
                {
                        switch(returntype)
                        {
-                               case RETURN_DROPPED: Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_FLAGRETURN_DROPPED_)); break;
-                               case RETURN_DAMAGE: Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_FLAGRETURN_DAMAGED_)); break;
-                               case RETURN_SPEEDRUN: Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_FLAGRETURN_SPEEDRUN_), ctf_captimerecord); break;
-                               case RETURN_NEEDKILL: Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_FLAGRETURN_NEEDKILL_)); break;
+                               case RETURN_DROPPED: Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_4(flag, INFO_CTF_FLAGRETURN_DROPPED_)); break;
+                               case RETURN_DAMAGE: Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_4(flag, INFO_CTF_FLAGRETURN_DAMAGED_)); break;
+                               case RETURN_SPEEDRUN: Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_4(flag, INFO_CTF_FLAGRETURN_SPEEDRUN_), ctf_captimerecord); break;
+                               case RETURN_NEEDKILL: Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_4(flag, INFO_CTF_FLAGRETURN_NEEDKILL_)); break;
                                
                                default:
                                case RETURN_TIMEOUT:
-                                       { Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_FLAGRETURN_TIMEOUT_)); break; }
+                                       { Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_4(flag, INFO_CTF_FLAGRETURN_TIMEOUT_)); break; }
                        }
                        sound(flag, CH_TRIGGER, flag.snd_flag_respawn, VOL_BASE, ATTN_NONE);
                        ctf_EventLog("returned", flag.team, world);
@@ -601,7 +633,7 @@ void ctf_CheckFlagReturn(entity flag, float returntype)
 void ctf_CheckStalemate(void)
 {
        // declarations
-       float stale_red_flags = 0, stale_blue_flags = 0;
+       float stale_flags = 0, stale_red_flags = 0, stale_blue_flags = 0, stale_yellow_flags = 0, stale_pink_flags = 0;
        entity tmp_entity;
 
        entity ctf_staleflaglist = world; // reset the list, we need to build the list each time this function runs
@@ -616,19 +648,20 @@ void ctf_CheckStalemate(void)
                        tmp_entity.ctf_staleflagnext = ctf_staleflaglist; // link flag into staleflaglist
                        ctf_staleflaglist = tmp_entity;
                        
-                       switch(tmp_entity.team)
-                       {
-                               case NUM_TEAM_1: ++stale_red_flags; break;
-                               case NUM_TEAM_2: ++stale_blue_flags; break;
-                       }
+                       if(tmp_entity.team == NUM_TEAM_1) { ++stale_red_flags; }
+                       if(tmp_entity.team == NUM_TEAM_2) { ++stale_blue_flags; }
+                       if(tmp_entity.team == NUM_TEAM_3) { ++stale_yellow_flags; }
+                       if(tmp_entity.team == NUM_TEAM_4) { ++stale_pink_flags; }
                }
        }
-
-       if(stale_red_flags && stale_blue_flags)
+       
+       stale_flags = (stale_red_flags > 0) + (stale_blue_flags > 0) + (stale_yellow_flags > 0) + (stale_pink_flags > 0);
+       
+       if(stale_flags >= ctf_teams)
                ctf_stalemate = TRUE;
-       else if((!stale_red_flags && !stale_blue_flags) && autocvar_g_ctf_stalemate_endcondition == 2)
+       else if(stale_flags < ctf_teams && autocvar_g_ctf_stalemate_endcondition == 2)
                { ctf_stalemate = FALSE; wpforenemy_announced = FALSE; }
-       else if((!stale_red_flags || !stale_blue_flags) && autocvar_g_ctf_stalemate_endcondition == 1)
+       else if(stale_flags > 0 && autocvar_g_ctf_stalemate_endcondition == 1)
                { ctf_stalemate = FALSE; wpforenemy_announced = FALSE; }
                
        // if sufficient stalemate, then set up the waypointsprite and announce the stalemate if necessary
@@ -637,7 +670,10 @@ void ctf_CheckStalemate(void)
                for(tmp_entity = ctf_staleflaglist; tmp_entity; tmp_entity = tmp_entity.ctf_staleflagnext)
                {
                        if((tmp_entity.owner) && (!tmp_entity.owner.wps_enemyflagcarrier))
-                               WaypointSprite_Spawn("enemyflagcarrier", 0, 0, tmp_entity.owner, FLAG_WAYPOINT_OFFSET, world, tmp_entity.team, tmp_entity.owner, wps_enemyflagcarrier, TRUE, RADARICON_FLAG, WPCOLOR_ENEMYFC(tmp_entity.owner.team));
+                       {
+                               WaypointSprite_Spawn("enemyflagcarrier", 0, 0, tmp_entity.owner, FLAG_WAYPOINT_OFFSET, world, 0, tmp_entity.owner, wps_enemyflagcarrier, TRUE, RADARICON_FLAG, WPCOLOR_ENEMYFC(tmp_entity.owner.team));
+                               tmp_entity.owner.wps_enemyflagcarrier.waypointsprite_visible_for_player = ctf_Stalemate_waypointsprite_visible_for_player;
+                       }
                }
                
                if not(wpforenemy_announced)
@@ -780,6 +816,7 @@ void ctf_FlagThink()
                        
                        if((self.pass_target == world)
                                || (self.pass_target.deadflag != DEAD_NO)
+                               || (self.pass_target.flagcarried)
                                || (vlen(self.origin - targ_origin) > autocvar_g_ctf_pass_radius)
                                || ((trace_fraction < 1) && (trace_ent != self.pass_target))
                                || (time > self.ctf_droptime + autocvar_g_ctf_pass_timelimit))
@@ -841,16 +878,16 @@ void ctf_FlagTouch()
        {       
                case FLAG_BASE:
                {
-                       if(!IsDifferentTeam(toucher, self) && (toucher.flagcarried) && IsDifferentTeam(toucher.flagcarried, self))
+                       if(!ctf_IsDifferentTeam(toucher, self) && (toucher.flagcarried) && IsDifferentTeam(toucher.flagcarried, self))
                                ctf_Handle_Capture(self, toucher, CAPTURE_NORMAL); // toucher just captured the enemies flag to his base
-                       else if(IsDifferentTeam(toucher, self) && (!toucher.flagcarried) && (!toucher.ctf_captureshielded) && (time > toucher.next_take_time))
+                       else if(ctf_IsDifferentTeam(toucher, self) && (!toucher.flagcarried) && (!toucher.ctf_captureshielded) && (time > toucher.next_take_time))
                                ctf_Handle_Pickup(self, toucher, PICKUP_BASE); // toucher just stole the enemies flag
                        break;
                }
                
                case FLAG_DROPPED:
                {
-                       if(!IsDifferentTeam(toucher, self))
+                       if(!ctf_IsDifferentTeam(toucher, self))
                                ctf_Handle_Return(self, toucher); // toucher just returned his own flag
                        else if((!toucher.flagcarried) && ((toucher != self.ctf_dropper) || (time > self.ctf_droptime + autocvar_g_ctf_flag_collect_delay)))
                                ctf_Handle_Pickup(self, toucher, PICKUP_DROPPED); // toucher just picked up a dropped enemy flag
@@ -942,7 +979,17 @@ void ctf_DelayedFlagSetup(void) // called after a flag is placed on a map by ctf
        self.bot_basewaypoint = self.nearestwaypoint;
 
        // waypointsprites
-       WaypointSprite_SpawnFixed(((self.team == NUM_TEAM_1) ? "redbase" : "bluebase"), self.origin + FLAG_WAYPOINT_OFFSET, self, wps_flagbase, RADARICON_FLAG, colormapPaletteColor(self.team - 1, FALSE));
+       string basename = "base";
+       
+       switch(self.team)
+       {
+               case NUM_TEAM_1: basename = "redbase"; break;
+               case NUM_TEAM_2: basename = "bluebase"; break;
+               case NUM_TEAM_3: basename = "yellowbase"; break;
+               case NUM_TEAM_4: basename = "pinkbase"; break;
+       }
+       
+       WaypointSprite_SpawnFixed(basename, self.origin + FLAG_WAYPOINT_OFFSET, self, wps_flagbase, RADARICON_FLAG, colormapPaletteColor(self.team - 1, FALSE));
        WaypointSprite_UpdateTeamRadar(self.wps_flagbase, RADARICON_FLAG, colormapPaletteColor(self.team - 1, FALSE));
 
        // captureshield setup
@@ -950,9 +997,8 @@ void ctf_DelayedFlagSetup(void) // called after a flag is placed on a map by ctf
 }
 
 void ctf_FlagSetup(float teamnumber, entity flag) // called when spawning a flag entity on the map as a spawnfunc 
-{      
+{
        // declarations
-       teamnumber = fabs(teamnumber - bound(0, autocvar_g_ctf_reverse, 1)); // if we were originally 1, this will become 0. If we were originally 0, this will become 1. 
        self = flag; // for later usage with droptofloor()
        
        // main setup
@@ -961,9 +1007,8 @@ void ctf_FlagSetup(float teamnumber, entity flag) // called when spawning a flag
 
        setattachment(flag, world, "");
 
-       flag.netname = ((teamnumber) ? "^1RED^7 flag" : "^4BLUE^7 flag"); // Primarily only used for debugging or when showing nearby item name
-       flag.team = ((teamnumber) ? NUM_TEAM_1 : NUM_TEAM_2); // NUM_TEAM_1: color 4 team (red) - NUM_TEAM_2: color 13 team (blue)
-       flag.items = ((teamnumber) ? IT_KEY2 : IT_KEY1); // IT_KEY2: gold key (redish enough) - IT_KEY1: silver key (bluish enough)
+       flag.netname = strcat(Static_Team_ColorName_Upper(teamnumber), "^7 flag");
+       flag.team = teamnumber;
        flag.classname = "item_flag_team";
        flag.target = "###item###"; // wut?
        flag.flags = FL_ITEM | FL_NOTARGET;
@@ -986,19 +1031,19 @@ void ctf_FlagSetup(float teamnumber, entity flag) // called when spawning a flag
        flag.ctf_status = FLAG_BASE;
 
        // appearence
-       if(flag.model == "")       { flag.model = ((teamnumber) ? autocvar_g_ctf_flag_red_model : autocvar_g_ctf_flag_blue_model); }
+       if(flag.model == "")       { flag.model = strzone(cvar_string(strcat("g_ctf_flag_", Static_Team_ColorName_Lower(teamnumber), "_model"))); }
        if(!flag.scale)            { flag.scale = FLAG_SCALE; }
-       if(!flag.skin)             { flag.skin = ((teamnumber) ? autocvar_g_ctf_flag_red_skin : autocvar_g_ctf_flag_blue_skin); }
-       if(flag.toucheffect == "") { flag.toucheffect = ((teamnumber) ? "redflag_touch" : "blueflag_touch"); }
-       if(flag.passeffect == "")  { flag.passeffect = ((teamnumber) ? "red_pass" : "blue_pass"); }
-       if(flag.capeffect == "")   { flag.capeffect = ((teamnumber) ? "red_cap" : "blue_cap"); }
+       if(!flag.skin)             { flag.skin = cvar(strcat("g_ctf_flag_", Static_Team_ColorName_Lower(teamnumber), "_skin")); }
+       if(flag.toucheffect == "") { flag.toucheffect = strzone(strcat(Static_Team_ColorName_Lower(teamnumber), "_touch")); }
+       if(flag.passeffect == "")  { flag.passeffect = strzone(strcat(Static_Team_ColorName_Lower(teamnumber), "_pass")); }
+       if(flag.capeffect == "")   { flag.capeffect = strzone(strcat(Static_Team_ColorName_Lower(teamnumber), "_cap")); }
        
        // sound 
-       if(flag.snd_flag_taken == "")    { flag.snd_flag_taken  = ((teamnumber) ? "ctf/red_taken.wav" : "ctf/blue_taken.wav"); }
-       if(flag.snd_flag_returned == "") { flag.snd_flag_returned = ((teamnumber) ? "ctf/red_returned.wav" : "ctf/blue_returned.wav"); }
-       if(flag.snd_flag_capture == "")  { flag.snd_flag_capture = ((teamnumber) ? "ctf/red_capture.wav" : "ctf/blue_capture.wav"); } // blue team scores by capturing the red flag
+       if(flag.snd_flag_taken == "")    { flag.snd_flag_taken  = strzone(strcat("ctf/", Static_Team_ColorName_Lower(teamnumber), "_taken.wav")); }
+       if(flag.snd_flag_returned == "") { flag.snd_flag_returned = strzone(strcat("ctf/", Static_Team_ColorName_Lower(teamnumber), "_returned.wav")); }
+       if(flag.snd_flag_capture == "")  { flag.snd_flag_capture = strzone(strcat("ctf/", Static_Team_ColorName_Lower(teamnumber), "_capture.wav")); } // blue team scores by capturing the red flag
        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) ? "ctf/red_dropped.wav" : "ctf/blue_dropped.wav"); }
+       if(flag.snd_flag_dropped == "")  { flag.snd_flag_dropped = strzone(strcat("ctf/", Static_Team_ColorName_Lower(teamnumber), "_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
        
@@ -1021,14 +1066,29 @@ void ctf_FlagSetup(float teamnumber, entity flag) // called when spawning a flag
        
        if(autocvar_g_ctf_flag_glowtrails)
        {
-               flag.glow_color = ((teamnumber) ? 251 : 210); // 251: red - 210: blue
+               switch(teamnumber)
+               {
+                       case NUM_TEAM_1: flag.glow_color = 251; break; // red
+                       case NUM_TEAM_2: flag.glow_color = 210; break; // blue
+                       case NUM_TEAM_3: flag.glow_color = 110; break; // yellow
+                       case NUM_TEAM_4: flag.glow_color = 145; break; // pink
+               }
                flag.glow_size = 25;
                flag.glow_trail = 1;
        }
        
        flag.effects |= EF_LOWPRECISION;
        if(autocvar_g_ctf_fullbrightflags) { flag.effects |= EF_FULLBRIGHT; }
-       if(autocvar_g_ctf_dynamiclights)   { flag.effects |= ((teamnumber) ? EF_RED : EF_BLUE); }
+       if(autocvar_g_ctf_dynamiclights)
+       {
+               switch(teamnumber)
+               {
+                       case NUM_TEAM_1: flag.effects |= EF_RED; break;
+                       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;
+               }
+       }
        
        // flag placement
        if((flag.spawnflags & 1) || flag.noalign) // don't drop to floor, just stay at fixed location
@@ -1082,7 +1142,7 @@ entity havocbot_ctf_find_flag(entity bot)
        f = ctf_worldflaglist;
        while (f)
        {
-               if (bot.team == f.team)
+               if (!ctf_IsDifferentTeam(bot, f))
                        return f;
                f = f.ctf_worldflagnext;
        }
@@ -1095,7 +1155,7 @@ entity havocbot_ctf_find_enemy_flag(entity bot)
        f = ctf_worldflaglist;
        while (f)
        {
-               if (bot.team != f.team)
+               if (ctf_IsDifferentTeam(bot, f))
                        return f;
                f = f.ctf_worldflagnext;
        }
@@ -1128,7 +1188,7 @@ void havocbot_goalrating_ctf_ourflag(float ratingscale)
        head = ctf_worldflaglist;
        while (head)
        {
-               if (self.team == head.team)
+               if (!ctf_IsDifferentTeam(self, head))
                        break;
                head = head.ctf_worldflagnext;
        }
@@ -1142,7 +1202,7 @@ void havocbot_goalrating_ctf_ourbase(float ratingscale)
        head = ctf_worldflaglist;
        while (head)
        {
-               if (self.team == head.team)
+               if (!ctf_IsDifferentTeam(self, head))
                        break;
                head = head.ctf_worldflagnext;
        }
@@ -1158,7 +1218,7 @@ void havocbot_goalrating_ctf_enemyflag(float ratingscale)
        head = ctf_worldflaglist;
        while (head)
        {
-               if (self.team != head.team)
+               if (ctf_IsDifferentTeam(self, head))
                        break;
                head = head.ctf_worldflagnext;
        }
@@ -1714,27 +1774,37 @@ MUTATOR_HOOKFUNCTION(ctf_PlayerPreThink)
 {
        entity flag;
        
+       float t = 0, t2 = 0, t3 = 0;
+       
        // initially clear items so they can be set as necessary later.
        self.items &~= (IT_RED_FLAG_CARRYING | IT_RED_FLAG_TAKEN | IT_RED_FLAG_LOST 
-               | IT_BLUE_FLAG_CARRYING | IT_BLUE_FLAG_TAKEN | IT_BLUE_FLAG_LOST | IT_CTF_SHIELDED);
+                                 | IT_BLUE_FLAG_CARRYING | IT_BLUE_FLAG_TAKEN | IT_BLUE_FLAG_LOST
+                                 | IT_YELLOW_FLAG_CARRYING | IT_YELLOW_FLAG_TAKEN | IT_YELLOW_FLAG_LOST
+                                 | IT_PINK_FLAG_CARRYING | IT_PINK_FLAG_TAKEN | IT_PINK_FLAG_LOST
+                                 | IT_CTF_SHIELDED);
 
        // scan through all the flags and notify the client about them 
        for(flag = ctf_worldflaglist; flag; flag = flag.ctf_worldflagnext)
        {
+               if(flag.team == NUM_TEAM_1) { t = IT_RED_FLAG_CARRYING; t2 = IT_RED_FLAG_TAKEN; t3 = IT_RED_FLAG_LOST; }
+               if(flag.team == NUM_TEAM_2) { t = IT_BLUE_FLAG_CARRYING; t2 = IT_BLUE_FLAG_TAKEN; t3 = IT_BLUE_FLAG_LOST; }
+               if(flag.team == NUM_TEAM_3) { t = IT_YELLOW_FLAG_CARRYING; t2 = IT_YELLOW_FLAG_TAKEN; t3 = IT_YELLOW_FLAG_LOST; }
+               if(flag.team == NUM_TEAM_4) { t = IT_PINK_FLAG_CARRYING; t2 = IT_PINK_FLAG_TAKEN; t3 = IT_PINK_FLAG_LOST; }
+       
                switch(flag.ctf_status)
                {
                        case FLAG_PASSING:
                        case FLAG_CARRY:
                        {
                                if((flag.owner == self) || (flag.pass_sender == self))
-                                       self.items |= ((flag.items & IT_KEY2) ? IT_RED_FLAG_CARRYING : IT_BLUE_FLAG_CARRYING); // carrying: self is currently carrying the flag
+                                       self.items |= t; // carrying: self is currently carrying the flag
                                else 
-                                       self.items |= ((flag.items & IT_KEY2) ? IT_RED_FLAG_TAKEN : IT_BLUE_FLAG_TAKEN); // taken: someone on self's team is carrying the flag
+                                       self.items |= t2; // taken: someone else is carrying the flag
                                break;
                        }
                        case FLAG_DROPPED:
                        {
-                               self.items |= ((flag.items & IT_KEY2) ? IT_RED_FLAG_LOST : IT_BLUE_FLAG_LOST); // lost: the flag is dropped somewhere on the map
+                               self.items |= t3; // lost: the flag is dropped somewhere on the map
                                break;
                        }
                }
@@ -1766,7 +1836,7 @@ MUTATOR_HOOKFUNCTION(ctf_PlayerDamage) // for changing damage and force values t
                        frag_force *= autocvar_g_ctf_flagcarrier_forcefactor;
                }
        }
-       else if(frag_target.flagcarried && (frag_target.deadflag == DEAD_NO) && IsDifferentTeam(frag_target, frag_attacker)) // if the target is a flagcarrier
+       else if(frag_target.flagcarried && (frag_target.deadflag == DEAD_NO) && ctf_IsDifferentTeam(frag_target, frag_attacker)) // if the target is a flagcarrier
        {
                if(autocvar_g_ctf_flagcarrier_auto_helpme_damage > ('1 0 0' * healtharmor_maxdamage(frag_target.health, frag_target.armorvalue, autocvar_g_balance_armor_blockpercent)))
                if(time > frag_target.wps_helpme_time + autocvar_g_ctf_flagcarrier_auto_helpme_time)
@@ -1973,7 +2043,7 @@ MUTATOR_HOOKFUNCTION(ctf_AbortSpeedrun)
 {
        if(self.flagcarried)
        {
-               Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_2(self.flagcarried, INFO_CTF_FLAGRETURN_ABORTRUN_));
+               Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_4(self.flagcarried, INFO_CTF_FLAGRETURN_ABORTRUN_));
                ctf_RespawnFlag(self.flagcarried);
                return TRUE;
        }
@@ -2029,6 +2099,12 @@ MUTATOR_HOOKFUNCTION(ctf_GetCvars)
        return TRUE;
 }
 
+MUTATOR_HOOKFUNCTION(ctf_GetTeamCount)
+{
+       ret_float = ctf_teams;
+       return 0;
+}
+
 
 // ==========
 // Spawnfuncs
@@ -2095,7 +2171,7 @@ void spawnfunc_item_flag_team1()
 {
        if(!g_ctf) { remove(self); return; }
 
-       ctf_FlagSetup(1, self); // 1 = red
+       ctf_FlagSetup(NUM_TEAM_1, self);
 }
 
 /*QUAKED spawnfunc_item_flag_team2 (0 0.5 0.8) (-48 -48 -37) (48 48 37)
@@ -2113,7 +2189,43 @@ void spawnfunc_item_flag_team2()
 {
        if(!g_ctf) { remove(self); return; }
 
-       ctf_FlagSetup(0, self); // the 0 is misleading, but -- 0 = blue.
+       ctf_FlagSetup(NUM_TEAM_2, self);
+}
+
+/*QUAKED spawnfunc_item_flag_team3 (0 0.5 0.8) (-48 -48 -37) (48 48 37)
+CTF flag for team three (Yellow).
+Keys: 
+"angle" Angle the flag will point (minus 90 degrees)... 
+"model" model to use, note this needs red, blue yellow and pink as skins 0, 1, 2 and 3...
+"noise" sound played when flag is picked up...
+"noise1" sound played when flag is returned by a teammate...
+"noise2" sound played when flag is captured...
+"noise3" sound played when flag is lost in the field and respawns itself... 
+"noise4" sound played when flag is dropped by a player...
+"noise5" sound played when flag touches the ground... */
+void spawnfunc_item_flag_team3()
+{
+       if(!g_ctf) { remove(self); return; }
+
+       ctf_FlagSetup(NUM_TEAM_3, self);
+}
+
+/*QUAKED spawnfunc_item_flag_team4 (0 0.5 0.8) (-48 -48 -37) (48 48 37)
+CTF flag for team two (Pink).
+Keys: 
+"angle" Angle the flag will point (minus 90 degrees)... 
+"model" model to use, note this needs red, blue yellow and pink as skins 0, 1, 2 and 3...
+"noise" sound played when flag is picked up...
+"noise1" sound played when flag is returned by a teammate...
+"noise2" sound played when flag is captured...
+"noise3" sound played when flag is lost in the field and respawns itself... 
+"noise4" sound played when flag is dropped by a player...
+"noise5" sound played when flag touches the ground... */
+void spawnfunc_item_flag_team4()
+{
+       if(!g_ctf) { remove(self); return; }
+
+       ctf_FlagSetup(NUM_TEAM_4, self);
 }
 
 /*QUAKED spawnfunc_ctf_team (0 .5 .8) (-16 -16 -24) (16 16 32)
@@ -2144,9 +2256,10 @@ void spawnfunc_team_CTF_bluespawn()  { spawnfunc_info_player_team2();  }
 // ==============
 
 // scoreboard setup
-void ctf_ScoreRules()
+void ctf_ScoreRules(float teams)
 {
-       ScoreRules_basics(2, SFL_SORT_PRIO_PRIMARY, 0, TRUE);
+       CheckAllowedTeams(world);
+       ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, 0, TRUE);
        ScoreInfo_SetLabel_TeamScore  (ST_CTF_CAPS,     "caps",      SFL_SORT_PRIO_PRIMARY);
        ScoreInfo_SetLabel_PlayerScore(SP_CTF_CAPS,     "caps",      SFL_SORT_PRIO_SECONDARY);
        ScoreInfo_SetLabel_PlayerScore(SP_CTF_CAPTIME,  "captime",   SFL_LOWER_IS_BETTER | SFL_TIME);
@@ -2174,15 +2287,38 @@ void ctf_SpawnTeam (string teamname, float teamcolor)
 
 void ctf_DelayedInit() // Do this check with a delay so we can wait for teams to be set up.
 {
+       ctf_teams = 2;
+       
+       entity tmp_entity;
+       for(tmp_entity = ctf_worldflaglist; tmp_entity; tmp_entity = tmp_entity.ctf_worldflagnext)
+       if(tmp_entity.team == NUM_TEAM_3)
+       {
+               ++ctf_teams;
+               break; // found 1 flag for this team
+       }
+       for(tmp_entity = ctf_worldflaglist; tmp_entity; tmp_entity = tmp_entity.ctf_worldflagnext)
+       if(tmp_entity.team == NUM_TEAM_4)
+       {
+               ++ctf_teams;
+               break; // found 1 flag for this team
+       }
+       
+       ctf_teams = bound(2, ctf_teams, 4);
+
        // if no teams are found, spawn defaults
        if(find(world, classname, "ctf_team") == world)
        {
                print("No ""ctf_team"" entities found on this map, creating them anyway.\n");
                ctf_SpawnTeam("Red", NUM_TEAM_1 - 1);
                ctf_SpawnTeam("Blue", NUM_TEAM_2 - 1);
+               if(ctf_teams >= 3)
+                       ctf_SpawnTeam("Yellow", NUM_TEAM_3 - 1);
+               if(ctf_teams >= 4)
+                       ctf_SpawnTeam("Pink", NUM_TEAM_4 - 1);
        }
        
-       ctf_ScoreRules();
+       ret_float = ctf_teams;
+       ctf_ScoreRules(ctf_teams);
 }
 
 void ctf_Initialize()
@@ -2214,6 +2350,7 @@ MUTATOR_DEFINITION(gamemode_ctf)
        MUTATOR_HOOK(AbortSpeedrun, ctf_AbortSpeedrun, CBC_ORDER_ANY);
        MUTATOR_HOOK(HavocBot_ChooseRule, ctf_BotRoles, CBC_ORDER_ANY);
        MUTATOR_HOOK(GetCvars, ctf_GetCvars, CBC_ORDER_ANY);
+       MUTATOR_HOOK(GetTeamCount, ctf_GetTeamCount, CBC_ORDER_ANY);
        
        MUTATOR_ONADD
        {
index 882b106..5de51dd 100644 (file)
@@ -101,6 +101,7 @@ float ctf_captimerecord; // record time for capturing the flag
 .entity ctf_dropper; // don't allow spam of dropping the flag
 .float max_flag_health;
 .float next_take_time;
+float ctf_teams;
 
 // passing/throwing properties
 .float pass_distance;
index 0c22db0..5765125 100644 (file)
@@ -602,10 +602,6 @@ MUTATOR_HOOKFUNCTION(freezetag_SpectateCopy)
 
 MUTATOR_HOOKFUNCTION(freezetag_GetTeamCount)
 {
-       freezetag_teams = autocvar_g_freezetag_teams_override;
-       if(freezetag_teams < 2)
-               freezetag_teams = autocvar_g_freezetag_teams;
-       freezetag_teams = bound(2, freezetag_teams, 4);
        ret_float = freezetag_teams;
        return 0;
 }
@@ -621,7 +617,12 @@ MUTATOR_HOOKFUNCTION(freezetag_VehicleTouch)
 void freezetag_Initialize()
 {
        precache_model("models/ice/ice.md3");
-       ScoreRules_freezetag();
+
+       freezetag_teams = autocvar_g_freezetag_teams_override;
+       if(freezetag_teams < 2)
+               freezetag_teams = autocvar_g_freezetag_teams;
+       freezetag_teams = bound(2, freezetag_teams, 4);
+       ScoreRules_freezetag(freezetag_teams);
 
        round_handler_Spawn(freezetag_CheckTeams, freezetag_CheckWinner, func_null);
        round_handler_Init(5, autocvar_g_freezetag_warmup, autocvar_g_freezetag_round_timelimit);
index d60f456..d75cf04 100644 (file)
@@ -108,10 +108,18 @@ void ScoreRules_nexball(float teams)
 
 // FreezeTag stuff
 #define SP_FREEZETAG_REVIVALS 4
-void ScoreRules_freezetag()
+void ScoreRules_freezetag(float teams)
 {
        CheckAllowedTeams(world);
-       ScoreRules_basics(((c4>=0) ? 4 : (c3>=0) ? 3 : 2), SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, TRUE); // SFL_SORT_PRIO_PRIMARY
+       ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, TRUE); // SFL_SORT_PRIO_PRIMARY
        ScoreInfo_SetLabel_PlayerScore(SP_FREEZETAG_REVIVALS,           "revivals",             0);
        ScoreRules_basics_end();
 }
+#define ST_CA_ROUNDS 1
+void ScoreRules_ca(float teams)
+{
+       CheckAllowedTeams(world);
+       ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, 0, TRUE);
+       ScoreInfo_SetLabel_TeamScore(ST_CA_ROUNDS, "rounds", SFL_SORT_PRIO_PRIMARY);
+       ScoreRules_basics_end();
+}
index 2eceff3..e597938 100644 (file)
@@ -15,4 +15,22 @@ models/ctf/glow_blue
        tcMod scroll 0.1 -0.04
        tcMod rotate 0.1
  }
+}
+models/ctf/glow_yellow
+{
+ {
+       map models/ctf/glow_yellow.tga
+       tcMod scale 0.03 0.03
+       tcMod scroll 0.1 -0.04
+       tcMod rotate 0.1
+ }
+}
+models/ctf/glow_pink
+{
+ {
+       map models/ctf/glow_pink.tga
+       tcMod scale 0.03 0.03
+       tcMod scroll 0.1 -0.04
+       tcMod rotate 0.1
+ }
 }
\ No newline at end of file
diff --git a/sound/ctf/pink_capture.ogg b/sound/ctf/pink_capture.ogg
new file mode 100644 (file)
index 0000000..6320614
Binary files /dev/null and b/sound/ctf/pink_capture.ogg differ
diff --git a/sound/ctf/pink_dropped.wav b/sound/ctf/pink_dropped.wav
new file mode 100644 (file)
index 0000000..b3232e2
Binary files /dev/null and b/sound/ctf/pink_dropped.wav differ
diff --git a/sound/ctf/pink_returned.wav b/sound/ctf/pink_returned.wav
new file mode 100644 (file)
index 0000000..b0779a1
Binary files /dev/null and b/sound/ctf/pink_returned.wav differ
diff --git a/sound/ctf/pink_taken.wav b/sound/ctf/pink_taken.wav
new file mode 100644 (file)
index 0000000..fde3fe2
Binary files /dev/null and b/sound/ctf/pink_taken.wav differ
diff --git a/sound/ctf/yellow_capture.ogg b/sound/ctf/yellow_capture.ogg
new file mode 100644 (file)
index 0000000..6320614
Binary files /dev/null and b/sound/ctf/yellow_capture.ogg differ
diff --git a/sound/ctf/yellow_dropped.wav b/sound/ctf/yellow_dropped.wav
new file mode 100644 (file)
index 0000000..b3232e2
Binary files /dev/null and b/sound/ctf/yellow_dropped.wav differ
diff --git a/sound/ctf/yellow_returned.wav b/sound/ctf/yellow_returned.wav
new file mode 100644 (file)
index 0000000..b0779a1
Binary files /dev/null and b/sound/ctf/yellow_returned.wav differ
diff --git a/sound/ctf/yellow_taken.wav b/sound/ctf/yellow_taken.wav
new file mode 100644 (file)
index 0000000..fde3fe2
Binary files /dev/null and b/sound/ctf/yellow_taken.wav differ