1 // Mod icons panel (#10)
3 bool mod_active; // is there any active mod icon?
5 void DrawCAItem(vector myPos, vector mySize, float aspect_ratio, int layout, int i)
9 vector color = '0 0 0';
13 stat = STAT(REDALIVE);
14 pic = "player_red.tga";
18 stat = STAT(BLUEALIVE);
19 pic = "player_blue.tga";
23 stat = STAT(YELLOWALIVE);
24 pic = "player_yellow.tga";
29 stat = STAT(PINKALIVE);
30 pic = "player_pink.tga";
35 if(mySize.x/mySize.y > aspect_ratio)
37 i = aspect_ratio * mySize.y;
38 myPos.x = myPos.x + (mySize.x - i) / 2;
43 i = 1/aspect_ratio * mySize.x;
44 myPos.y = myPos.y + (mySize.y - i) / 2;
50 drawpic_aspect_skin(myPos, pic, eX * 0.7 * mySize.x + eY * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
51 drawstring_aspect(myPos + eX * 0.7 * mySize.x, ftos(stat), eX * 0.3 * mySize.x + eY * mySize.y, color, panel_fg_alpha, DRAWFLAG_NORMAL);
54 drawstring_aspect(myPos, ftos(stat), mySize, color, panel_fg_alpha, DRAWFLAG_NORMAL);
57 // Clan Arena and Freeze Tag HUD modicons
58 void HUD_Mod_CA(vector myPos, vector mySize)
60 mod_active = 1; // required in each mod function that always shows something
63 if(gametype == MAPINFO_TYPE_CA)
64 layout = autocvar_hud_panel_modicons_ca_layout;
65 else //if(gametype == MAPINFO_TYPE_FREEZETAG)
66 layout = autocvar_hud_panel_modicons_freezetag_layout;
69 aspect_ratio = (layout) ? 2 : 1;
70 rows = HUD_GetRowCount(team_count, mySize, aspect_ratio);
71 columns = ceil(team_count/rows);
74 float row = 0, column = 0;
76 itemSize = eX * mySize.x*(1/columns) + eY * mySize.y*(1/rows);
77 for(i=0; i<team_count; ++i)
79 pos = myPos + eX * column * itemSize.x + eY * row * itemSize.y;
81 DrawCAItem(pos, itemSize, aspect_ratio, layout, i);
92 // CTF HUD modicon section
93 int redflag_prevframe, blueflag_prevframe, yellowflag_prevframe, pinkflag_prevframe, neutralflag_prevframe; // status during previous frame
94 int redflag_prevstatus, blueflag_prevstatus, yellowflag_prevstatus, pinkflag_prevstatus, neutralflag_prevstatus; // last remembered status
95 float redflag_statuschange_time, blueflag_statuschange_time, yellowflag_statuschange_time, pinkflag_statuschange_time, neutralflag_statuschange_time; // time when the status changed
97 void HUD_Mod_CTF_Reset()
99 redflag_prevstatus = blueflag_prevstatus = yellowflag_prevstatus = pinkflag_prevstatus = neutralflag_prevstatus = 0;
100 redflag_prevframe = blueflag_prevframe = yellowflag_prevframe = pinkflag_prevframe = neutralflag_prevframe = 0;
101 redflag_statuschange_time = blueflag_statuschange_time = yellowflag_statuschange_time = pinkflag_statuschange_time = neutralflag_statuschange_time = 0;
104 void HUD_Mod_CTF(vector pos, vector mySize)
106 vector redflag_pos, blueflag_pos, yellowflag_pos, pinkflag_pos, neutralflag_pos;
108 float f; // every function should have that
110 int redflag, blueflag, yellowflag, pinkflag, neutralflag; // current status
111 float redflag_statuschange_elapsedtime = 0, blueflag_statuschange_elapsedtime = 0, yellowflag_statuschange_elapsedtime = 0, pinkflag_statuschange_elapsedtime = 0, neutralflag_statuschange_elapsedtime = 0; // time since the status changed
112 bool ctf_oneflag; // one-flag CTF mode enabled/disabled
113 int stat_items = STAT(CTF_FLAGSTATUS);
114 float fs, fs2, fs3, size1, size2;
117 redflag = (stat_items/CTF_RED_FLAG_TAKEN) & 3;
118 blueflag = (stat_items/CTF_BLUE_FLAG_TAKEN) & 3;
119 yellowflag = (stat_items/CTF_YELLOW_FLAG_TAKEN) & 3;
120 pinkflag = (stat_items/CTF_PINK_FLAG_TAKEN) & 3;
121 neutralflag = (stat_items/CTF_NEUTRAL_FLAG_TAKEN) & 3;
123 ctf_oneflag = (stat_items & CTF_FLAG_NEUTRAL);
125 mod_active = (redflag || blueflag || yellowflag || pinkflag || neutralflag);
127 if (autocvar__hud_configure) {
134 ctf_oneflag = neutralflag = 0; // disable neutral flag in hud editor?
137 // when status CHANGES, set old status into prevstatus and current status into status
138 #define X(team) MACRO_BEGIN { \
139 if (team##flag != team##flag_prevframe) { \
140 team##flag_statuschange_time = time; \
141 team##flag_prevstatus = team##flag_prevframe; \
142 team##flag_prevframe = team##flag; \
144 team##flag_statuschange_elapsedtime = time - team##flag_statuschange_time; \
153 const float BLINK_FACTOR = 0.15;
154 const float BLINK_BASE = 0.85;
156 // RMS = sqrt(BLINK_BASE^2 + 0.5 * BLINK_FACTOR^2)
158 // BLINK_BASE = sqrt(RMS^2 - 0.5 * BLINK_FACTOR^2)
160 const float BLINK_FREQ = 5; // circle frequency, = 2*pi*frequency in hertz
162 #define X(team, cond) \
163 string team##_icon = string_null, team##_icon_prevstatus = string_null; \
164 int team##_alpha, team##_alpha_prevstatus; \
165 team##_alpha = team##_alpha_prevstatus = 1; \
167 switch (team##flag) { \
168 case 1: team##_icon = "flag_" #team "_taken"; break; \
169 case 2: team##_icon = "flag_" #team "_lost"; break; \
170 case 3: team##_icon = "flag_" #team "_carrying"; team##_alpha = BLINK_BASE + BLINK_FACTOR * cos(time * BLINK_FREQ); break; \
172 if ((stat_items & CTF_SHIELDED) && (cond)) { \
173 team##_icon = "flag_" #team "_shielded"; \
175 team##_icon = string_null; \
179 switch (team##flag_prevstatus) { \
180 case 1: team##_icon_prevstatus = "flag_" #team "_taken"; break; \
181 case 2: team##_icon_prevstatus = "flag_" #team "_lost"; break; \
182 case 3: team##_icon_prevstatus = "flag_" #team "_carrying"; team##_alpha_prevstatus = BLINK_BASE + BLINK_FACTOR * cos(time * BLINK_FREQ); break; \
184 if (team##flag == 3) { \
185 team##_icon_prevstatus = "flag_" #team "_carrying"; /* make it more visible */\
186 } else if((stat_items & CTF_SHIELDED) && (cond)) { \
187 team##_icon_prevstatus = "flag_" #team "_shielded"; \
189 team##_icon_prevstatus = string_null; \
194 X(red, myteam != NUM_TEAM_1);
195 X(blue, myteam != NUM_TEAM_2);
196 X(yellow, myteam != NUM_TEAM_3);
197 X(pink, myteam != NUM_TEAM_4);
202 // hacky, but these aren't needed
203 red_icon = red_icon_prevstatus = blue_icon = blue_icon_prevstatus = yellow_icon = yellow_icon_prevstatus = pink_icon = pink_icon_prevstatus = string_null;
205 } else switch (team_count) {
207 case 2: fs = 0.5; fs2 = 0.5; fs3 = 0.5; break;
208 case 3: fs = 1; fs2 = 0.35; fs3 = 0.35; break;
209 case 4: fs = 0.75; fs2 = 0.25; fs3 = 0.5; break;
212 if (mySize_x > mySize_y) {
228 blueflag_pos = pos + eX * fs2 * size1;
229 yellowflag_pos = pos - eX * fs2 * size1;
230 pinkflag_pos = pos + eX * fs3 * size1;
234 redflag_pos = pos + eX * fs2 * size1;
236 yellowflag_pos = pos - eX * fs2 * size1;
237 pinkflag_pos = pos + eX * fs3 * size1;
241 redflag_pos = pos + eX * fs3 * size1;
242 blueflag_pos = pos - eX * fs2 * size1;
243 yellowflag_pos = pos;
244 pinkflag_pos = pos + eX * fs2 * size1;
248 redflag_pos = pos - eX * fs2 * size1;
249 blueflag_pos = pos + eX * fs3 * size1;
250 yellowflag_pos = pos + eX * fs2 * size1;
255 neutralflag_pos = pos;
256 flag_size = e1 * fs * size1 + e2 * size2;
258 #define X(team) MACRO_BEGIN { \
259 f = bound(0, team##flag_statuschange_elapsedtime * 2, 1); \
260 if (team##_icon_prevstatus && f < 1) \
261 drawpic_aspect_skin_expanding(team##flag_pos, team##_icon_prevstatus, flag_size, '1 1 1', panel_fg_alpha * team##_alpha_prevstatus, DRAWFLAG_NORMAL, f); \
263 drawpic_aspect_skin(team##flag_pos, team##_icon, flag_size, '1 1 1', panel_fg_alpha * team##_alpha * f, DRAWFLAG_NORMAL); \
273 // Keyhunt HUD modicon section
276 void HUD_Mod_KH(vector pos, vector mySize)
278 mod_active = 1; // keyhunt should never hide the mod icons panel
280 // Read current state
282 int state = STAT(KH_KEYS);
284 int all_keys, team1_keys, team2_keys, team3_keys, team4_keys, dropped_keys, carrying_keys;
285 all_keys = team1_keys = team2_keys = team3_keys = team4_keys = dropped_keys = carrying_keys = 0;
287 for(i = 0; i < 4; ++i)
289 key_state = (bitshift(state, i * -5) & 31) - 1;
302 case NUM_TEAM_1: ++team1_keys; break;
303 case NUM_TEAM_2: ++team2_keys; break;
304 case NUM_TEAM_3: ++team3_keys; break;
305 case NUM_TEAM_4: ++team4_keys; break;
306 case 29: ++dropped_keys; break;
312 // Calculate slot measurements
316 if(all_keys == 4 && mySize.x * 0.5 < mySize.y && mySize.y * 0.5 < mySize.x)
318 // Quadratic arrangement
319 slot_size = eX * mySize.x * 0.5 + eY * mySize.y * 0.5;
321 KH_SLOTS[1] = pos + eX * slot_size.x;
322 KH_SLOTS[2] = pos + eY * slot_size.y;
323 KH_SLOTS[3] = pos + eX * slot_size.x + eY * slot_size.y;
327 if(mySize.x > mySize.y)
329 // Horizontal arrangement
330 slot_size = eX * mySize.x / all_keys + eY * mySize.y;
331 for(i = 0; i < all_keys; ++i)
332 KH_SLOTS[i] = pos + eX * slot_size.x * i;
336 // Vertical arrangement
337 slot_size = eX * mySize.x + eY * mySize.y / all_keys;
338 for(i = 0; i < all_keys; ++i)
339 KH_SLOTS[i] = pos + eY * slot_size.y * i;
343 // Make icons blink in case of RUN HERE
345 float blink = 0.6 + sin(2*M_PI*time) / 2.5; // Oscillate between 0.2 and 1
352 case NUM_TEAM_1: if(team1_keys == all_keys) alpha = blink; break;
353 case NUM_TEAM_2: if(team2_keys == all_keys) alpha = blink; break;
354 case NUM_TEAM_3: if(team3_keys == all_keys) alpha = blink; break;
355 case NUM_TEAM_4: if(team4_keys == all_keys) alpha = blink; break;
363 if(myteam == NUM_TEAM_1 && carrying_keys)
365 drawpic_aspect_skin(KH_SLOTS[i++], "kh_red_carrying", slot_size, '1 1 1', alpha, DRAWFLAG_NORMAL);
369 drawpic_aspect_skin(KH_SLOTS[i++], "kh_red_taken", slot_size, '1 1 1', alpha, DRAWFLAG_NORMAL);
372 if(myteam == NUM_TEAM_2 && carrying_keys)
374 drawpic_aspect_skin(KH_SLOTS[i++], "kh_blue_carrying", slot_size, '1 1 1', alpha, DRAWFLAG_NORMAL);
378 drawpic_aspect_skin(KH_SLOTS[i++], "kh_blue_taken", slot_size, '1 1 1', alpha, DRAWFLAG_NORMAL);
381 if(myteam == NUM_TEAM_3 && carrying_keys)
383 drawpic_aspect_skin(KH_SLOTS[i++], "kh_yellow_carrying", slot_size, '1 1 1', alpha, DRAWFLAG_NORMAL);
387 drawpic_aspect_skin(KH_SLOTS[i++], "kh_yellow_taken", slot_size, '1 1 1', alpha, DRAWFLAG_NORMAL);
390 if(myteam == NUM_TEAM_4 && carrying_keys)
392 drawpic_aspect_skin(KH_SLOTS[i++], "kh_pink_carrying", slot_size, '1 1 1', alpha, DRAWFLAG_NORMAL);
396 drawpic_aspect_skin(KH_SLOTS[i++], "kh_pink_taken", slot_size, '1 1 1', alpha, DRAWFLAG_NORMAL);
398 while(dropped_keys--)
399 drawpic_aspect_skin(KH_SLOTS[i++], "kh_dropped", slot_size, '1 1 1', alpha, DRAWFLAG_NORMAL);
402 // Keepaway HUD mod icon
403 int kaball_prevstatus; // last remembered status
404 float kaball_statuschange_time; // time when the status changed
406 // we don't need to reset for keepaway since it immediately
407 // autocorrects prevstatus as to if the player has the ball or not
409 void HUD_Mod_Keepaway(vector pos, vector mySize)
411 mod_active = 1; // keepaway should always show the mod HUD
413 float BLINK_FACTOR = 0.15;
414 float BLINK_BASE = 0.85;
415 float BLINK_FREQ = 5;
416 float kaball_alpha = BLINK_BASE + BLINK_FACTOR * cos(time * BLINK_FREQ);
418 int stat_items = STAT(ITEMS);
419 int kaball = (stat_items/IT_KEY1) & 1;
421 if(kaball != kaball_prevstatus)
423 kaball_statuschange_time = time;
424 kaball_prevstatus = kaball;
427 vector kaball_pos, kaball_size;
429 if(mySize.x > mySize.y) {
430 kaball_pos = pos + eX * 0.25 * mySize.x;
431 kaball_size = eX * 0.5 * mySize.x + eY * mySize.y;
433 kaball_pos = pos + eY * 0.25 * mySize.y;
434 kaball_size = eY * 0.5 * mySize.y + eX * mySize.x;
437 float kaball_statuschange_elapsedtime = time - kaball_statuschange_time;
438 float f = bound(0, kaball_statuschange_elapsedtime*2, 1);
440 if(kaball_prevstatus && f < 1)
441 drawpic_aspect_skin_expanding(kaball_pos, "keepawayball_carrying", kaball_size, '1 1 1', panel_fg_alpha * kaball_alpha, DRAWFLAG_NORMAL, f);
444 drawpic_aspect_skin(pos, "keepawayball_carrying", eX * mySize.x + eY * mySize.y, '1 1 1', panel_fg_alpha * kaball_alpha * f, DRAWFLAG_NORMAL);
448 // Nexball HUD mod icon
449 void HUD_Mod_NexBall(vector pos, vector mySize)
451 float nb_pb_starttime, dt, p;
454 stat_items = STAT(ITEMS);
455 nb_pb_starttime = STAT(NB_METERSTART);
457 if (stat_items & IT_KEY1)
462 //Manage the progress bar if any
463 if (nb_pb_starttime > 0)
465 dt = (time - nb_pb_starttime) % nb_pb_period;
466 // one period of positive triangle
467 p = 2 * dt / nb_pb_period;
471 HUD_Panel_DrawProgressBar(pos, mySize, "progressbar", p, (mySize.x <= mySize.y), 0, autocvar_hud_progressbar_nexball_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
474 if (stat_items & IT_KEY1)
475 drawpic_aspect_skin(pos, "nexball_carrying", eX * mySize.x + eY * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
478 // Race/CTS HUD mod icons
479 float crecordtime_prev; // last remembered crecordtime
480 float crecordtime_change_time; // time when crecordtime last changed
481 float srecordtime_prev; // last remembered srecordtime
482 float srecordtime_change_time; // time when srecordtime last changed
484 float race_status_time;
485 int race_status_prev;
486 string race_status_name_prev;
488 // Check if the given name already exist in race rankings? In that case, where? (otherwise return 0)
489 int race_CheckName(string net_name)
492 for (i=RANKINGS_CNT-1;i>=0;--i)
493 if(grecordholder[i] == net_name)
498 void race_showTime(string text, vector pos, vector timeText_ofs, float theTime, vector textSize, float f)
500 drawstring_aspect(pos, text, textSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
501 drawstring_aspect(pos + timeText_ofs, TIME_ENCODED_TOSTRING(theTime), textSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
503 drawstring_aspect_expanding(pos, text, textSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL, f);
504 drawstring_aspect_expanding(pos + timeText_ofs, TIME_ENCODED_TOSTRING(theTime), textSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL, f);
508 void HUD_Mod_Race(vector pos, vector mySize)
510 mod_active = 1; // race should never hide the mod icons panel
512 me = playerslots[player_localnum];
514 score = me.(scores[ps_primary]);
516 if(!(scores_flags[ps_primary] & SFL_TIME) || teamplay) // race/cts record display on HUD
517 return; // no records in the actual race
519 // clientside personal record
521 if(gametype == MAPINFO_TYPE_CTS)
525 float t = stof(db_get(ClientProgsDB, strcat(shortmapname, rr, "time")));
527 if(score && (score < t || !t)) {
528 db_put(ClientProgsDB, strcat(shortmapname, rr, "time"), ftos(score));
529 if(autocvar_cl_autodemo_delete_keeprecords)
531 float f = autocvar_cl_autodemo_delete;
533 cvar_set("cl_autodemo_delete", ftos(f)); // don't delete demo with new record!
537 if(t != crecordtime_prev) {
538 crecordtime_prev = t;
539 crecordtime_change_time = time;
542 vector textPos, medalPos;
544 if(mySize.x > mySize.y) {
546 squareSize = min(mySize.y, mySize.x/2);
547 textPos = pos + eX * 0.5 * max(0, mySize.x/2 - squareSize) + eY * 0.5 * (mySize.y - squareSize);
548 medalPos = pos + eX * 0.5 * max(0, mySize.x/2 - squareSize) + eX * 0.5 * mySize.x + eY * 0.5 * (mySize.y - squareSize);
551 squareSize = min(mySize.x, mySize.y/2);
552 textPos = pos + eY * 0.5 * max(0, mySize.y/2 - squareSize) + eX * 0.5 * (mySize.x - squareSize);
553 medalPos = pos + eY * 0.5 * max(0, mySize.y/2 - squareSize) + eY * 0.5 * mySize.y + eX * 0.5 * (mySize.x - squareSize);
555 vector textSize = eX * squareSize + eY * 0.25 * squareSize;
557 race_showTime(_("Personal best"), textPos, eY * 0.25 * squareSize, t, textSize, time - crecordtime_change_time);
560 t = race_server_record;
561 if(t != srecordtime_prev) {
562 srecordtime_prev = t;
563 srecordtime_change_time = time;
566 textPos += eY * 0.5 * squareSize;
567 race_showTime(_("Server best"), textPos, eY * 0.25 * squareSize, t, textSize, time - srecordtime_change_time);
569 if (race_status != race_status_prev || race_status_name != race_status_name_prev) {
570 race_status_time = time + 5;
571 race_status_prev = race_status;
572 if (race_status_name_prev)
573 strunzone(race_status_name_prev);
574 race_status_name_prev = strzone(race_status_name);
579 a = bound(0, race_status_time - time, 1);
582 s = textShortenToWidth(race_status_name, squareSize, '1 1 0' * 0.1 * squareSize, stringwidth_colors);
586 rank = race_CheckName(race_status_name);
590 rankname = count_ordinal(rank);
593 namepos = medalPos + '0 0.8 0' * squareSize;
595 rankpos = medalPos + '0 0.15 0' * squareSize;
598 drawpic_aspect_skin(medalPos, "race_newfail", '1 1 0' * squareSize, '1 1 1', panel_fg_alpha * a, DRAWFLAG_NORMAL);
599 else if(race_status == 1) {
600 drawpic_aspect_skin(medalPos + '0.1 0 0' * squareSize, "race_newtime", '1 1 0' * 0.8 * squareSize, '1 1 1', panel_fg_alpha * a, DRAWFLAG_NORMAL);
601 drawcolorcodedstring_aspect(namepos, s, '1 0.2 0' * squareSize, panel_fg_alpha * a, DRAWFLAG_NORMAL);
602 drawstring_aspect(rankpos, rankname, '1 0.15 0' * squareSize, '1 1 1', panel_fg_alpha * a, DRAWFLAG_NORMAL);
603 } else if(race_status == 2) {
604 if(race_status_name == entcs_GetName(player_localnum) || !race_myrank || race_myrank < rank)
605 drawpic_aspect_skin(medalPos + '0.1 0 0' * squareSize, "race_newrankgreen", '1 1 0' * 0.8 * squareSize, '1 1 1', panel_fg_alpha * a, DRAWFLAG_NORMAL);
607 drawpic_aspect_skin(medalPos + '0.1 0 0' * squareSize, "race_newrankyellow", '1 1 0' * 0.8 * squareSize, '1 1 1', panel_fg_alpha * a, DRAWFLAG_NORMAL);
608 drawcolorcodedstring_aspect(namepos, s, '1 0.2 0' * squareSize, panel_fg_alpha * a, DRAWFLAG_NORMAL);
609 drawstring_aspect(rankpos, rankname, '1 0.15 0' * squareSize, '1 1 1', panel_fg_alpha * a, DRAWFLAG_NORMAL);
610 } else if(race_status == 3) {
611 drawpic_aspect_skin(medalPos + '0.1 0 0' * squareSize, "race_newrecordserver", '1 1 0' * 0.8 * squareSize, '1 1 1', panel_fg_alpha * a, DRAWFLAG_NORMAL);
612 drawcolorcodedstring_aspect(namepos, s, '1 0.2 0' * squareSize, panel_fg_alpha * a, DRAWFLAG_NORMAL);
613 drawstring_aspect(rankpos, rankname, '1 0.15 0' * squareSize, '1 1 1', panel_fg_alpha * a, DRAWFLAG_NORMAL);
616 if (race_status_time - time <= 0) {
617 race_status_prev = -1;
620 strunzone(race_status_name);
621 race_status_name = string_null;
622 if(race_status_name_prev)
623 strunzone(race_status_name_prev);
624 race_status_name_prev = string_null;
628 void DrawDomItem(vector myPos, vector mySize, float aspect_ratio, int layout, int i)
632 vector color = '0 0 0';
636 stat = STAT(DOM_PPS_RED);
637 pic = "dom_icon_red";
641 stat = STAT(DOM_PPS_BLUE);
642 pic = "dom_icon_blue";
646 stat = STAT(DOM_PPS_YELLOW);
647 pic = "dom_icon_yellow";
652 stat = STAT(DOM_PPS_PINK);
653 pic = "dom_icon_pink";
657 float pps_ratio = stat / STAT(DOM_TOTAL_PPS);
659 if(mySize.x/mySize.y > aspect_ratio)
661 i = aspect_ratio * mySize.y;
662 myPos.x = myPos.x + (mySize.x - i) / 2;
667 i = 1/aspect_ratio * mySize.x;
668 myPos.y = myPos.y + (mySize.y - i) / 2;
672 if (layout) // show text too
675 color *= 0.5 + pps_ratio * (1 - 0.5); // half saturated color at min, full saturated at max
676 if (layout == 2) // average pps
677 drawstring_aspect(myPos + eX * mySize.y, ftos_decimals(stat, 2), eX * (2/3) * mySize.x + eY * mySize.y, color, panel_fg_alpha, DRAWFLAG_NORMAL);
678 else // percentage of average pps
679 drawstring_aspect(myPos + eX * mySize.y, strcat( ftos(floor(pps_ratio*100 + 0.5)), "%" ), eX * (2/3) * mySize.x + eY * mySize.y, color, panel_fg_alpha, DRAWFLAG_NORMAL);
683 drawpic_aspect_skin(myPos, pic, '1 1 0' * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
686 drawsetcliparea(myPos.x, myPos.y + mySize.y * (1 - pps_ratio), mySize.y, mySize.y * pps_ratio);
687 drawpic_aspect_skin(myPos, strcat(pic, "-highlighted"), '1 1 0' * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
692 void HUD_Mod_Dom(vector myPos, vector mySize)
694 mod_active = 1; // required in each mod function that always shows something
696 int layout = autocvar_hud_panel_modicons_dom_layout;
699 aspect_ratio = (layout) ? 3 : 1;
700 rows = HUD_GetRowCount(team_count, mySize, aspect_ratio);
701 columns = ceil(team_count/rows);
704 float row = 0, column = 0;
705 vector pos, itemSize;
706 itemSize = eX * mySize.x*(1/columns) + eY * mySize.y*(1/rows);
707 for(i=0; i<team_count; ++i)
709 pos = myPos + eX * column * itemSize.x + eY * row * itemSize.y;
711 DrawDomItem(pos, itemSize, aspect_ratio, layout, i);
722 void HUD_ModIcons_SetFunc()
726 case MAPINFO_TYPE_KEYHUNT: HUD_ModIcons_GameType = HUD_Mod_KH; break;
727 case MAPINFO_TYPE_CTF: HUD_ModIcons_GameType = HUD_Mod_CTF; break;
728 case MAPINFO_TYPE_NEXBALL: HUD_ModIcons_GameType = HUD_Mod_NexBall; break;
729 case MAPINFO_TYPE_CTS:
730 case MAPINFO_TYPE_RACE: HUD_ModIcons_GameType = HUD_Mod_Race; break;
731 case MAPINFO_TYPE_CA:
732 case MAPINFO_TYPE_FREEZETAG: HUD_ModIcons_GameType = HUD_Mod_CA; break;
733 case MAPINFO_TYPE_DOMINATION: HUD_ModIcons_GameType = HUD_Mod_Dom; break;
734 case MAPINFO_TYPE_KEEPAWAY: HUD_ModIcons_GameType = HUD_Mod_Keepaway; break;
738 int mod_prev; // previous state of mod_active to check for a change
740 float mod_change; // "time" when mod_active changed
744 if(!autocvar__hud_configure)
746 if(!autocvar_hud_panel_modicons) return;
747 if(!HUD_ModIcons_GameType) return;
750 HUD_Panel_UpdateCvars();
752 draw_beginBoldFont();
754 if(mod_active != mod_prev) {
756 mod_prev = mod_active;
759 if(mod_active || autocvar__hud_configure)
760 mod_alpha = bound(0, (time - mod_change) * 2, 1);
762 mod_alpha = bound(0, 1 - (time - mod_change) * 2, 1);
765 HUD_Panel_DrawBg(mod_alpha);
769 panel_pos += '1 1 0' * panel_bg_padding;
770 panel_size -= '2 2 0' * panel_bg_padding;
773 if(autocvar__hud_configure)
774 HUD_Mod_CTF(panel_pos, panel_size);
776 HUD_ModIcons_GameType(panel_pos, panel_size);