1 #include "cl_survival.qh"
3 #include <client/draw.qh>
4 #include <client/hud/panel/modicons.qh>
6 void HUD_Mod_Survival(vector pos, vector mySize)
8 mod_active = 1; // survival should always show the mod HUD
10 int mystatus = entcs_receiver(player_localnum).survival_status;
11 string player_text = "";
12 vector player_color = '1 1 1';
13 //string player_icon = "";
14 if(mystatus == SV_STATUS_HUNTER)
16 player_text = _("Hunter");
17 player_color = '1 0 0';
18 //player_icon = "player_red";
20 else if(mystatus == SV_STATUS_PREY)
22 player_text = _("Survivor");
23 player_color = '0 1 0';
24 //player_icon = "player_neutral";
28 // if the player has no valid status, don't draw anything
32 string time_text = string_null;
33 vector timer_color = '1 1 1';
34 if(!STAT(GAME_STOPPED) && !warmup_stage && STAT(SURVIVAL_ROUNDTIMER) > 0)
36 float timeleft = max(0, STAT(SURVIVAL_ROUNDTIMER) - time);
37 timeleft = ceil(timeleft);
38 float minutesLeft = floor(timeleft / 60);
39 time_text = seconds_tostring(timeleft);
40 if(intermission_time || minutesLeft >= 5 || warmup_stage || STAT(SURVIVAL_ROUNDTIMER) == 0)
41 timer_color = '1 1 1'; //white
42 else if(minutesLeft >= 1)
43 timer_color = '1 1 0'; //yellow
45 timer_color = '1 0 0'; //red
48 //drawpic_aspect_skin(pos, player_icon, vec2(0.5 * mySize.x, mySize.y), '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
50 drawstring_aspect(pos, player_text, vec2(mySize.x, mySize.y), player_color, panel_fg_alpha, DRAWFLAG_NORMAL);
53 drawstring_aspect(pos, player_text, vec2(0.5 * mySize.x, mySize.y), player_color, panel_fg_alpha, DRAWFLAG_NORMAL);
54 drawstring_aspect(pos + eX * (0.5 * mySize.x), time_text, vec2(0.5 * mySize.x, mySize.y), timer_color, panel_fg_alpha, DRAWFLAG_NORMAL);
58 REGISTER_MUTATOR(cl_sv, true);
60 MUTATOR_HOOKFUNCTION(cl_sv, ForcePlayercolors_Skip, CBC_ORDER_LAST)
62 if(!ISGAMETYPE(SURVIVAL))
65 entity player = M_ARGV(0, entity);
66 entity e = entcs_receiver(player.entnum - 1);
67 int surv_status = ((e) ? e.survival_status : 0);
68 int mystatus = entcs_receiver(player_localnum).survival_status;
70 int plcolor = SV_COLOR_PREY; // default to survivor
71 if((mystatus == SV_STATUS_HUNTER || intermission || STAT(GAME_STOPPED)) && surv_status == SV_STATUS_HUNTER)
72 plcolor = SV_COLOR_HUNTER;
74 player.colormap = 1024 + plcolor;
78 MUTATOR_HOOKFUNCTION(cl_sv, DrawScoreboard_Force)
80 // show the scoreboard when the round ends, so players can see who the hunter was
81 return STAT(GAME_STOPPED);