1 #include "cl_survival.qh"
3 #include <client/draw.qh>
4 #include <client/hud/panel/modicons.qh>
6 NET_HANDLE(ENT_CLIENT_SURVIVALSTATUSES, bool isnew)
10 serialize(byte, 0, sf);
11 if (sf & BIT(0)) // make all players survivors
13 for (int j = 0; j < maxclients; ++j)
15 playerslots[j].survival_status = SURV_STATUS_PREY;
17 if (sf & BIT(1)) // receive hunter statuses
19 for (int i = 1; i <= maxclients; i += 8)
22 serialize(byte, 0, f);
23 for (int b = 0; b < 8; ++b)
25 if (!(f & BIT(b))) continue;
28 playerslots[j].survival_status = SURV_STATUS_HUNTER;
34 for (int i = 1; i <= maxclients; ++i)
36 entity e = playerslots[i - 1];
39 int plcolor = SURV_COLOR_PREY; // default color
40 if(e.survival_status == SURV_STATUS_HUNTER) // if client knows this hunter
41 plcolor = SURV_COLOR_HUNTER;
43 e.colormap = 1024 + plcolor; // override scoreboard and player model colors
49 void HUD_Mod_Survival(vector pos, vector mySize)
51 mod_active = 1; // survival should always show the mod HUD
53 int mystatus = playerslots[player_localnum].survival_status;
54 string player_text = "";
55 vector player_color = '1 1 1';
56 //string player_icon = "";
58 if(STAT(GAMESTARTTIME) > time || STAT(ROUNDSTARTTIME) > time || entcs_IsSpectating(player_localnum))
61 if(mystatus == SURV_STATUS_HUNTER)
63 player_text = _("Hunter");
64 player_color = '1 0 0';
65 //player_icon = "player_red";
67 else if(mystatus == SURV_STATUS_PREY)
69 player_text = _("Survivor");
70 player_color = '0 1 0';
71 //player_icon = "player_neutral";
74 drawstring_aspect(pos, player_text, vec2(mySize.x, mySize.y), player_color, panel_fg_alpha, DRAWFLAG_NORMAL);
77 REGISTER_MUTATOR(cl_surv, true);
79 MUTATOR_HOOKFUNCTION(cl_surv, ForcePlayercolors_Skip, CBC_ORDER_LAST)
81 if(!ISGAMETYPE(SURVIVAL))
84 entity player = M_ARGV(0, entity);
85 entity e = playerslots[player.entnum - 1];
87 player.colormap = e.colormap;
89 player.colormap = 1024 + SURV_COLOR_PREY;
93 MUTATOR_HOOKFUNCTION(cl_surv, DrawScoreboard)
95 if(!ISGAMETYPE(SURVIVAL))
98 // initialize colors of new players
99 for(entity pl = players.sort_next; pl; pl = pl.sort_next)
100 if(pl.gotscores && pl.colormap == 0)
101 pl.colormap = 1024 + SURV_COLOR_PREY;
105 MUTATOR_HOOKFUNCTION(cl_surv, DrawScoreboard_Force)
107 // show the scoreboard when the round ends, so players can see who the hunter was
108 return STAT(GAME_STOPPED);