From: Mario Date: Tue, 6 Aug 2013 14:04:07 +0000 (+1000) Subject: Merge changes from local copies X-Git-Tag: xonotic-v0.8.1~29^2~59 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=8683f95feaa114556a160e928820d203fa44fecf;p=xonotic%2Fxonotic-data.pk3dir.git Merge changes from local copies --- diff --git a/effectinfo.txt b/effectinfo.txt index c2f702fa5..02098969a 100644 --- a/effectinfo.txt +++ b/effectinfo.txt @@ -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 diff --git a/gamemodes.cfg b/gamemodes.cfg index b7e65c8eb..d1a3201e4 100644 --- a/gamemodes.cfg +++ b/gamemodes.cfg @@ -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 index 000000000..275396934 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 index 000000000..7b48ee536 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 index 000000000..3c185f6d9 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 index 000000000..3bbfaac8c 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 index 000000000..158482185 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 index 000000000..f5a02e9a8 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 index 000000000..c904cf4ab 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 index 000000000..16e7b2ad6 Binary files /dev/null and b/gfx/hud/default/flag_yellow_taken.tga differ diff --git a/models/ctf/glow_pink.tga b/models/ctf/glow_pink.tga new file mode 100644 index 000000000..6a3bb8c06 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 index 000000000..8da95a975 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 index 000000000..0d98b143c 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 index 000000000..5dca40c3d Binary files /dev/null and b/models/ctf/glow_yellow_glow.tga differ diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index 273f427e4..2ebdf741d 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -2731,30 +2731,41 @@ 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; + 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 +2774,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 +2794,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 +2831,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 +2844,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 +2859,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,31 +2872,159 @@ 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; } + + 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; + } + + if(teams_count >= 3) + { + fs = 0.75; + fs2 = 0.25; + } + else + { + fs = 0.5; + fs2 = 0.5; + } - if(mySize_x > mySize_y) { - if (myteam == NUM_TEAM_1) { // always draw own flag on left - redflag_pos = pos; - blueflag_pos = pos + eX * 0.5 * mySize_x; - } else { - blueflag_pos = pos; - redflag_pos = pos + eX * 0.5 * mySize_x; + if(mySize_x > mySize_y) + { + switch(myteam) + { + default: + case NUM_TEAM_1: + { + redflag_pos = pos; + blueflag_pos = pos + eX * fs2 * mySize_x; + yellowflag_pos = pos - eX * fs2 * mySize_x; + pinkflag_pos = pos + eX * 0.5 * mySize_x; + break; + } + case NUM_TEAM_2: + { + redflag_pos = pos + eX * fs2 * mySize_x; + blueflag_pos = pos; + yellowflag_pos = pos + eX * 0.5 * mySize_x; + pinkflag_pos = pos - eX * fs2 * mySize_x; + break; + } + case NUM_TEAM_3: + { + redflag_pos = pos + eX * 0.5 * mySize_x; + blueflag_pos = pos - eX * fs2 * mySize_x; + yellowflag_pos = pos; + pinkflag_pos = pos + eX * fs2 * mySize_x; + break; + } + case NUM_TEAM_4: + { + redflag_pos = pos - eX * fs2 * mySize_x; + blueflag_pos = pos + eX * 0.5 * mySize_x; + yellowflag_pos = pos + eX * fs2 * mySize_x; + pinkflag_pos = pos; + 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 { - blueflag_pos = pos; - redflag_pos = pos + eY * 0.5 * mySize_y; + flag_size = eX * fs * mySize_x + eY * mySize_y; + } + else + { + switch(myteam) + { + default: + case NUM_TEAM_1: + { + redflag_pos = pos; + blueflag_pos = pos + eX * fs2 * mySize_y; + yellowflag_pos = pos - eX * fs2 * mySize_y; + pinkflag_pos = pos + eX * 0.5 * mySize_y; + break; + } + case NUM_TEAM_2: + { + redflag_pos = pos + eX * fs2 * mySize_y; + blueflag_pos = pos; + yellowflag_pos = pos + eX * 0.5 * mySize_y; + pinkflag_pos = pos - eX * fs2 * mySize_y; + break; + } + case NUM_TEAM_3: + { + redflag_pos = pos + eX * 0.5 * mySize_y; + blueflag_pos = pos + eX * fs2 * mySize_y; + yellowflag_pos = pos; + pinkflag_pos = pos - eX * fs2 * mySize_y; + break; + } + case NUM_TEAM_4: + { + redflag_pos = pos - eX * fs2 * mySize_y; + blueflag_pos = pos + eX * 0.5 * mySize_y; + yellowflag_pos = pos + eX * fs2 * mySize_y; + pinkflag_pos = pos; + break; + } } - flag_size = eY * 0.5 * mySize_y + eX * mySize_x; + flag_size = eY * fs * mySize_y + eX * mySize_x; } f = bound(0, redflag_statuschange_elapsedtime*2, 1); @@ -2879,6 +3038,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 diff --git a/qcsrc/common/items.qh b/qcsrc/common/items.qh index ba42d55ac..a936a4c0e 100644 --- a/qcsrc/common/items.qh +++ b/qcsrc/common/items.qh @@ -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; diff --git a/qcsrc/common/notifications.qh b/qcsrc/common/notifications.qh index 094fa4359..0fe62e6b5 100644 --- a/qcsrc/common/notifications.qh +++ b/qcsrc/common/notifications.qh @@ -439,7 +439,7 @@ void Send_Notification_WOVA( MSG_CENTER_NOTIF(1, CENTER_ROUND_TIED, 0, 0, "", CPID_ROUND, "0 0", _("^BGRound tied"), "") \ MSG_CENTER_NOTIF(1, CENTER_ROUND_OVER, 0, 0, "", CPID_ROUND, "0 0", _("^BGRound over, there's no winner"), "") \ 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."), "") \ + 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_, 4, 2, 0, "s1 s2", CPID_CTF_PASS, "0 0", _("^BG%s^BG passed the ^TC^TT^BG flag to %s"), "") \ @@ -450,8 +450,8 @@ void Send_Notification_WOVA( 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_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!"), "") \ diff --git a/qcsrc/server/autocvars.qh b/qcsrc/server/autocvars.qh index 85be46fdb..0bac46be4 100644 --- a/qcsrc/server/autocvars.qh +++ b/qcsrc/server/autocvars.qh @@ -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; @@ -798,8 +794,6 @@ float autocvar_g_ctf_stalemate_time; float autocvar_g_ctf_reverse; float autocvar_g_ctf_dropped_capture_delay; float autocvar_g_ctf_dropped_capture_radius; -float autocvar_g_ctf_teams; -float autocvar_g_ctf_teams_override; float autocvar_g_cts_finish_kill_delay; float autocvar_g_cts_selfdamage; float autocvar_g_debug_bot_commands; diff --git a/qcsrc/server/mutators/gamemode_ctf.qc b/qcsrc/server/mutators/gamemode_ctf.qc index 6c5b5f9ee..13ae3d4e0 100644 --- a/qcsrc/server/mutators/gamemode_ctf.qc +++ b/qcsrc/server/mutators/gamemode_ctf.qc @@ -138,15 +138,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 +160,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; } @@ -407,6 +419,7 @@ 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(IsDifferentTeam(player, flag)) { return; } // messages and sounds Send_Notification(NOTIF_ONE, player, MSG_CENTER, APP_TEAM_ENT_4(enemy_flag, CENTER_CTF_CAPTURE_)); @@ -513,11 +526,11 @@ void ctf_Handle_Pickup(entity flag, entity player, float pickuptype) 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) && !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); @@ -601,7 +614,7 @@ void ctf_CheckFlagReturn(entity flag, float returntype) void ctf_CheckStalemate(void) { // declarations - float stale_red_flags = 0, stale_blue_flags = 0; + float 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 @@ -620,16 +633,45 @@ void ctf_CheckStalemate(void) { case NUM_TEAM_1: ++stale_red_flags; break; case NUM_TEAM_2: ++stale_blue_flags; break; + case NUM_TEAM_3: ++stale_yellow_flags; break; + case NUM_TEAM_4: ++stale_pink_flags; break; } } } - - if(stale_red_flags && stale_blue_flags) - ctf_stalemate = TRUE; - else if((!stale_red_flags && !stale_blue_flags) && 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) - { ctf_stalemate = FALSE; wpforenemy_announced = FALSE; } + + switch(ctf_teams) + { + case 2: + { + if(stale_red_flags && stale_blue_flags) + ctf_stalemate = TRUE; + else if((!stale_red_flags && !stale_blue_flags) && 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) + { ctf_stalemate = FALSE; wpforenemy_announced = FALSE; } + break; + } + case 3: + { + if(stale_red_flags && stale_blue_flags && stale_yellow_flags) + ctf_stalemate = TRUE; + else if((!stale_red_flags && !stale_blue_flags && !stale_yellow_flags) && autocvar_g_ctf_stalemate_endcondition == 2) + { ctf_stalemate = FALSE; wpforenemy_announced = FALSE; } + else if((!stale_red_flags || !stale_blue_flags || !stale_yellow_flags) && autocvar_g_ctf_stalemate_endcondition == 1) + { ctf_stalemate = FALSE; wpforenemy_announced = FALSE; } + break; + } + case 4: + { + if(stale_red_flags && stale_blue_flags && stale_yellow_flags && stale_pink_flags) + ctf_stalemate = TRUE; + else if((!stale_red_flags && !stale_blue_flags && !stale_yellow_flags && !stale_pink_flags) && autocvar_g_ctf_stalemate_endcondition == 2) + { ctf_stalemate = FALSE; wpforenemy_announced = FALSE; } + else if((!stale_red_flags || !stale_blue_flags || !stale_yellow_flags || !stale_pink_flags) && autocvar_g_ctf_stalemate_endcondition == 1) + { ctf_stalemate = FALSE; wpforenemy_announced = FALSE; } + break; + } + } // if sufficient stalemate, then set up the waypointsprite and announce the stalemate if necessary if(ctf_stalemate) @@ -709,7 +751,6 @@ void ctf_FlagThink() if(tmp_entity.ctf_status == FLAG_DROPPED) if(vlen(self.origin - tmp_entity.origin) < autocvar_g_ctf_dropped_capture_radius) if(time > tmp_entity.ctf_droptime + autocvar_g_ctf_dropped_capture_delay) - if(!IsDifferentTeam(self, tmp_entity.flagcarried)) ctf_Handle_Capture(self, tmp_entity, CAPTURE_DROPPED); } return; @@ -988,10 +1029,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.netname = strcat(strtoupper(Static_Team_ColorName(teamnumber)), "^7 flag"); flag.team = teamnumber; - flag.items = ((teamnumber) ? IT_KEY2 : IT_KEY1); // IT_KEY2: gold key (redish enough) - IT_KEY1: silver key (bluish enough) flag.classname = "item_flag_team"; flag.target = "###item###"; // wut? flag.flags = FL_ITEM | FL_NOTARGET; @@ -1014,29 +1053,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.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) - { - switch(teamnumber) - { - case NUM_TEAM_1: flag.skin = autocvar_g_ctf_flag_red_skin; break; - case NUM_TEAM_2: flag.skin = autocvar_g_ctf_flag_blue_skin; break; - case NUM_TEAM_3: flag.skin = 2; break; - case NUM_TEAM_4: flag.skin = 3; break; - } - } + if(!flag.scale) { flag.scale = FLAG_SCALE; } + if(flag.model == "") { flag.model = strzone(cvar_string(strcat("g_ctf_flag_", strtolower(Static_Team_ColorName(teamnumber)), "_model"))); } + if(flag.toucheffect == "") { flag.toucheffect = strzone(strcat(strtolower(Static_Team_ColorName(teamnumber)), "_touch")); } + if(flag.passeffect == "") { flag.passeffect = strzone(strcat(strtolower(Static_Team_ColorName(teamnumber)), "_pass")); } + if(flag.capeffect == "") { flag.capeffect = strzone(strcat(strtolower(Static_Team_ColorName(teamnumber)), "_cap")); } + if(!flag.skin) { flag.skin = cvar(strcat("g_ctf_flag_", strtolower(Static_Team_ColorName(teamnumber)), "_skin")); } // 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/", strtolower(Static_Team_ColorName(teamnumber)), "_taken.wav")); } + if(flag.snd_flag_returned == "") { flag.snd_flag_returned = strzone(strcat("ctf/", strtolower(Static_Team_ColorName(teamnumber)), "_returned.wav")); } + if(flag.snd_flag_capture == "") { flag.snd_flag_capture = strzone(strcat("ctf/", strtolower(Static_Team_ColorName(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/", strtolower(Static_Team_ColorName(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 @@ -1059,7 +1088,14 @@ 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 + //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; } @@ -1752,27 +1788,40 @@ 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) { + switch(flag.team) + { + case NUM_TEAM_1: t = IT_RED_FLAG_CARRYING; t2 = IT_RED_FLAG_TAKEN; t3 = IT_RED_FLAG_LOST; break; + case NUM_TEAM_2: t = IT_BLUE_FLAG_CARRYING; t2 = IT_BLUE_FLAG_TAKEN; t3 = IT_BLUE_FLAG_LOST; break; + case NUM_TEAM_3: t = IT_YELLOW_FLAG_CARRYING; t2 = IT_YELLOW_FLAG_TAKEN; t3 = IT_YELLOW_FLAG_LOST; break; + case NUM_TEAM_4: t = IT_PINK_FLAG_CARRYING; t2 = IT_PINK_FLAG_TAKEN; t3 = IT_PINK_FLAG_LOST; break; + } + 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; } } @@ -2255,19 +2304,22 @@ 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 = autocvar_g_ctf_teams_override; - if(ctf_teams < 2) - ctf_teams = autocvar_g_ctf_teams; - - + ctf_teams = 2; + entity tmp_entity; for(tmp_entity = ctf_worldflaglist; tmp_entity; tmp_entity = tmp_entity.ctf_worldflagnext) - switch(tmp_entity.team) + if(tmp_entity.team == NUM_TEAM_3) { - case NUM_TEAM_3: ++ctf_teams; - case NUM_TEAM_4: ++ctf_teams; + ++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 diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index c5a079f8b..0ba1e7c84 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -406,8 +406,8 @@ void CheckAllowedTeams (entity for_whom) } else if(g_domination) teament_name = "dom_team"; - //else if(g_ctf) - //teament_name = "ctf_team"; + else if(g_ctf) + teament_name = "ctf_team"; else if(g_tdm) teament_name = "tdm_team"; else if(g_nexball) diff --git a/sound/ctf/pink_capture.ogg b/sound/ctf/pink_capture.ogg new file mode 100644 index 000000000..63206142a 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 index 000000000..b3232e243 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 index 000000000..b0779a1f5 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 index 000000000..fde3fe2eb 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 index 000000000..63206142a 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 index 000000000..b3232e243 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 index 000000000..b0779a1f5 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 index 000000000..fde3fe2eb Binary files /dev/null and b/sound/ctf/yellow_taken.wav differ