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)));
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),
}
f = (f == 0x800000) ? 1 : f * 2;
}
-
- LOG_INFOF("Accuracy stats Client %d", entnum);
return true;
}
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)
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));
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)
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));
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)
+++ /dev/null
-#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;
-}
-
+++ /dev/null
-#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
-}