From e5d4e721f370fb516b4b91457ac213ba36158f15 Mon Sep 17 00:00:00 2001 From: z411 Date: Wed, 11 Nov 2020 03:37:09 -0300 Subject: [PATCH] Implemented Capture medal (CTF) --- qcsrc/client/hud/panel/scoreboard.qc | 1 + qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc | 3 +++ qcsrc/common/notifications/all.inc | 1 + qcsrc/common/notifications/all.qc | 9 +++++++-- qcsrc/common/scores.qh | 1 + 5 files changed, 13 insertions(+), 2 deletions(-) diff --git a/qcsrc/client/hud/panel/scoreboard.qc b/qcsrc/client/hud/panel/scoreboard.qc index 43df946cf..2391ceadc 100644 --- a/qcsrc/client/hud/panel/scoreboard.qc +++ b/qcsrc/client/hud/panel/scoreboard.qc @@ -1524,6 +1524,7 @@ vector Scoreboard_MedalStats_Draw(vector pos) pos = Scoreboard_DrawMedal(pos, "gfx/medal/accuracy", height, pl.(scores(SP_MEDAL_ACCURACY))); pos = Scoreboard_DrawMedal(pos, "gfx/medal/assist", height, pl.(scores(SP_MEDAL_ASSIST))); + pos = Scoreboard_DrawMedal(pos, "gfx/medal/capture", height, pl.(scores(SP_MEDAL_CAPTURE))); pos = Scoreboard_DrawMedal(pos, "gfx/medal/defense", height, pl.(scores(SP_MEDAL_DEFENSE))); pos = Scoreboard_DrawMedal(pos, "gfx/medal/perfect", height, pl.(scores(SP_MEDAL_PERFECT))); diff --git a/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc b/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc index f285d6270..9602a16d5 100644 --- a/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc +++ b/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc @@ -611,6 +611,8 @@ void ctf_Handle_Capture(entity flag, entity toucher, int capturetype) if(!old_time || new_time < old_time) GameRules_scoring_add(player, CTF_CAPTIME, new_time - old_time); + Give_Medal(player, CAPTURE); + // announcer WinningConditionHelper(NULL); if (Score_NewLeader()) @@ -2268,6 +2270,7 @@ MUTATOR_HOOKFUNCTION(ctf, PlayerDies) // Killing an enemy flag carrier GameRules_scoring_add_team(frag_attacker, SCORE, ((SAME_TEAM(frag_attacker, frag_target)) ? -autocvar_g_ctf_score_kill : autocvar_g_ctf_score_kill)); GameRules_scoring_add(frag_attacker, CTF_FCKILLS, 1); + } else if(frag_attacker.flagcarried) { Give_Medal(frag_attacker, DEFENSE); } else { entity tmp_entity; diff --git a/qcsrc/common/notifications/all.inc b/qcsrc/common/notifications/all.inc index 9bbf7fac7..db42a40a2 100644 --- a/qcsrc/common/notifications/all.inc +++ b/qcsrc/common/notifications/all.inc @@ -255,6 +255,7 @@ MSG_MEDAL_NOTIF(IMPRESSIVE, N__ALWAYS, "impressive", ANNCE_ACHIEVEMENT_IMPRESSIVE) MSG_MEDAL_NOTIF(YODA, N__ALWAYS, "yoda", ANNCE_ACHIEVEMENT_YODA) + MSG_MEDAL_NOTIF(CAPTURE, N__ALWAYS, "capture", NULL) MSG_MEDAL_NOTIF(PERFECT, N__ALWAYS, "perfect", ANNCE_ACHIEVEMENT_PERFECT) MSG_MEDAL_NOTIF(ACCURACY, N__ALWAYS, "accuracy", ANNCE_ACHIEVEMENT_ACCURACY) diff --git a/qcsrc/common/notifications/all.qc b/qcsrc/common/notifications/all.qc index cc031b60a..88f0a4ad0 100644 --- a/qcsrc/common/notifications/all.qc +++ b/qcsrc/common/notifications/all.qc @@ -1236,7 +1236,12 @@ void Local_Notification_Queue_Run(MSG net_type, entity notif, float f1) case MSG_MEDAL: { centerprint_Medal(notif.nent_icon, f1); - Local_Notification_sound(notif.nent_msgannce.nent_channel, notif.nent_msgannce.nent_snd, notif.nent_msgannce.nent_vol, notif.nent_msgannce.nent_position); + if(notif.nent_msgannce) + Local_Notification_sound( + notif.nent_msgannce.nent_channel, + notif.nent_msgannce.nent_snd, + notif.nent_msgannce.nent_vol, + notif.nent_msgannce.nent_position); break; } } @@ -1480,7 +1485,7 @@ void Local_Notification(MSG net_type, Notification net_name, ...count) Local_Notification_Queue_Add( net_type, notif, - MSG_MEDAL_TIME, + (notif.nent_msgannce ? MSG_MEDAL_TIME : 0), f1); break; } diff --git a/qcsrc/common/scores.qh b/qcsrc/common/scores.qh index b40378d18..669af3d27 100644 --- a/qcsrc/common/scores.qh +++ b/qcsrc/common/scores.qh @@ -98,6 +98,7 @@ REGISTER_SP(MEDAL_YODA); REGISTER_SP(MEDAL_ACCURACY); REGISTER_SP(MEDAL_ASSIST); +REGISTER_SP(MEDAL_CAPTURE); REGISTER_SP(MEDAL_DEFENSE); REGISTER_SP(MEDAL_PERFECT); -- 2.39.2