]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Added defense medal in CA and FT
authorz411 <z411@omaera.org>
Sat, 3 Oct 2020 05:07:24 +0000 (02:07 -0300)
committerz411 <z411@omaera.org>
Sat, 3 Oct 2020 05:07:24 +0000 (02:07 -0300)
qcsrc/client/hud/panel/scoreboard.qc
qcsrc/client/main.qc
qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc
qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc
qcsrc/common/medals.qh [deleted file]
qcsrc/common/medals/all.qh [deleted file]

index 0fcb5c5608ec68e370278364818bd3b5053e8bda..5e75693fb92882e43ad436ae31fba7d749e5860d 100644 (file)
@@ -1442,9 +1442,7 @@ vector Scoreboard_MedalStats_Draw(vector pos)
        total_medals = 0;
        
        pos = Scoreboard_DrawMedal(pos, "gfx/medal/airshot",            height, pl.(scores(SP_MEDAL_AIRSHOT)));
-       pos = Scoreboard_DrawMedal(pos, "gfx/medal/assist",             height, pl.(scores(SP_MEDAL_ASSIST)));
        pos = Scoreboard_DrawMedal(pos, "gfx/medal/damage",             height, pl.(scores(SP_MEDAL_DAMAGE)));
-       pos = Scoreboard_DrawMedal(pos, "gfx/medal/defense",            height, pl.(scores(SP_MEDAL_DEFENSE)));
        pos = Scoreboard_DrawMedal(pos, "gfx/medal/electrobitch",       height, pl.(scores(SP_MEDAL_ELECTROBITCH)));
        pos = Scoreboard_DrawMedal(pos, "gfx/medal/excellent",          height, pl.(scores(SP_MEDAL_EXCELLENT)));
        pos = Scoreboard_DrawMedal(pos, "gfx/medal/firstblood",         height, pl.(scores(SP_MEDAL_FIRSTBLOOD)));
@@ -1453,6 +1451,11 @@ vector Scoreboard_MedalStats_Draw(vector pos)
        pos = Scoreboard_DrawMedal(pos, "gfx/medal/impressive",         height, pl.(scores(SP_MEDAL_IMPRESSIVE)));
        pos = Scoreboard_DrawMedal(pos, "gfx/medal/yoda",                       height, pl.(scores(SP_MEDAL_YODA)));
        
+       pos.x += hud_fontsize.x * 2;
+       
+       pos = Scoreboard_DrawMedal(pos, "gfx/medal/assist",             height, pl.(scores(SP_MEDAL_ASSIST)));
+       pos = Scoreboard_DrawMedal(pos, "gfx/medal/defense",            height, pl.(scores(SP_MEDAL_DEFENSE)));
+       
        if(!total_medals) return orig;
        
        drawstring(title_pos, sprintf(_("Medal stats (total %d)"), total_medals),
index dd01090f334d31367c122290311b7b052b5ec720..74bb88ca901cbf6cb32fdf8e4fddd57ac7f58c84 100644 (file)
@@ -635,8 +635,6 @@ NET_HANDLE(ENT_CLIENT_ACCURACY, bool isnew)
                }
                f = (f == 0x800000) ? 1 : f * 2;
        }
-
-       LOG_INFOF("Accuracy stats Client %d", entnum);
        
        return true;
 }
index 1992f14b926a3230de110514ae5bbb582a551aab..6c18b2d335560bb33844a6de6b86a5616b988b02 100644 (file)
@@ -62,6 +62,22 @@ int CA_GetWinnerTeam()
 
 void nades_Clear(entity player);
 
+entity ca_LastPlayer(float tm)
+{
+       entity last_pl = NULL;
+       FOREACH_CLIENT(IS_PLAYER(it) && it.team == tm, {
+               if (!IS_DEAD(it))
+               {
+                       if (!last_pl)
+                               last_pl = it;
+                       else
+                               return NULL;
+               }
+       });
+       return last_pl;
+}
+
+
 float CA_CheckWinner()
 {
        if(round_handler_GetEndTime() > 0 && round_handler_GetEndTime() - time <= 0)
@@ -87,6 +103,11 @@ float CA_CheckWinner()
        int winner_team = CA_GetWinnerTeam();
        if(winner_team > 0)
        {
+               entity last_pl = ca_LastPlayer(winner_team);
+               if(last_pl) {
+                       Give_Medal(last_pl, DEFENSE);
+               }
+               
                Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, APP_TEAM_NUM(winner_team, CENTER_ROUND_TEAM_WIN));
                Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(winner_team, INFO_ROUND_TEAM_WIN));
                Send_Notification(NOTIF_ALL, NULL, MSG_ANNCE, APP_TEAM_NUM(winner_team, ANNCE_ROUND_TEAM_WIN));
index 7c505abfe9b4ddbea1191ae1a4c8f75a6c18e727..88e16a1ad166a855d0fb208c74eb233135bb30c6 100644 (file)
@@ -105,6 +105,21 @@ int freezetag_getWinnerTeam()
 void nades_Clear(entity);
 void nades_GiveBonus(entity player, float score);
 
+entity freezetag_LastPlayer(float tm)
+{
+       entity last_pl = NULL;
+       FOREACH_CLIENT(IS_PLAYER(it) && it.team == tm, {
+               if (STAT(FROZEN, it) != FROZEN_NORMAL && GetResource(it, RES_HEALTH) >= 1)
+               {
+                       if (!last_pl)
+                               last_pl = it;
+                       else
+                               return NULL;
+               }
+       });
+       return last_pl;
+}
+
 bool freezetag_CheckWinner()
 {
        if(round_handler_GetEndTime() > 0 && round_handler_GetEndTime() - time <= 0)
@@ -131,6 +146,11 @@ bool freezetag_CheckWinner()
        int winner_team = freezetag_getWinnerTeam();
        if(winner_team > 0)
        {
+               entity last_pl = freezetag_LastPlayer(winner_team);
+               if(last_pl) {
+                       Give_Medal(last_pl, DEFENSE);
+               }
+       
                Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, APP_TEAM_NUM(winner_team, CENTER_ROUND_TEAM_SCORES));
                Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(winner_team, INFO_ROUND_TEAM_SCORES));
                Send_Notification(NOTIF_ALL, NULL, MSG_ANNCE, APP_TEAM_NUM(winner_team, ANNCE_ROUND_TEAM_WIN));
@@ -563,6 +583,7 @@ MUTATOR_HOOKFUNCTION(ft, PlayerPreThink, CBC_ORDER_FIRST)
                        Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_FREEZETAG_REVIVED, first.netname);
                        Send_Notification(NOTIF_ONE, first, MSG_CENTER, CENTER_FREEZETAG_REVIVE, player.netname);
                        Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_FREEZETAG_REVIVED, player.netname, first.netname);
+                       Give_Medal(first, ASSIST);
                }
 
                for(entity it = reviving_players_first; it; it = it.chain)
diff --git a/qcsrc/common/medals.qh b/qcsrc/common/medals.qh
deleted file mode 100644 (file)
index b12581b..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-#pragma once
-
-#include <common/command/_mod.qh>
-
-#include <common/notifications/all.qh>
-
-REGISTRY(Medals, 32)
-REGISTER_REGISTRY(Medals)
-#define REGISTER_MEDAL(id, class) REGISTER(Medals, MEDAL, id, m_id, NEW(class))
-
-REGISTRY_SORT(Medals)
-REGISTRY_CHECK(Medals)
-
-REGISTRY_DEFINE_GET(Medals, NULL)
-STATIC_INIT(Medals) { FOREACH(Medals, true, it.m_id = i); }
-
-CLASS(Medal, Object)
-ENDCLASS(Medal)
-
-REGISTER_MEDAL(Airshot, Medal) {
-    this.netname                =   "airshot";
-    this.m_name                 =   _("Airshot");
-    this.m_icon                 =   "airshot";
-       this.m_annce                                    =   ANNCE_ACHIEVEMENT_IMPRESSIVE;
-}
-
-REGISTER_MEDAL(Impressive, Medal) {
-    this.netname                =   "impressive";
-    this.m_name                 =   _("Impressive");
-    this.m_icon                 =   "impressive";
-       //this.m_annce                                  =   ANNCE_ACHIEVEMENT_IMPRESSIVE;
-}
-
diff --git a/qcsrc/common/medals/all.qh b/qcsrc/common/medals/all.qh
deleted file mode 100644 (file)
index bfbc610..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-#pragma once
-
-#include <common/command/_mod.qh>
-
-#include "medal.qh"
-
-// NOTE: 24 is the limit for the .items field
-REGISTRY(Medals, 32)
-REGISTER_REGISTRY(Medals)
-#define REGISTER_MEDAL(id, class) REGISTER(Medals, MEDAL, id, m_id, NEW(class))
-
-REGISTRY_SORT(Medals)
-REGISTRY_CHECK(Medals)
-
-REGISTRY_DEFINE_GET(Medals, NULL)
-STATIC_INIT(Medals) { FOREACH(Medals, true, it.m_id = i); }
-
-CLASS(Medal)
-ENDCLASS(Medal)
-
-REGISTER_ITEM(Impressive, Medal) {
-#ifdef GAMEQC
-       this.spawnflags = ITEM_FLAG_NORMAL | ITEM_FLAG_RESOURCE;
-    this.m_model                =   MDL_HealthSmall_ITEM;
-    this.m_sound                =   SND_HealthSmall;
-#endif
-    this.netname                =   "impressive";
-    this.m_name                 =   _("Impressive");
-    this.m_icon                 =   "impressive";
-#ifdef SVQC
-       this.annce                                      =   ANNCE_ACHIEVEMENT_IMPRESSIVE;
-#endif
-}