Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
weapons.qc
Go to the documentation of this file.
1#include "weapons.qh"
2
3#include <client/draw.qh>
4#include <client/view.qh>
5#include <common/wepent.qh>
6
7// Weapons (#0)
8
10{
11 HUD_Write_Cvar("hud_panel_weapons_accuracy");
12 HUD_Write_Cvar("hud_panel_weapons_label");
13 HUD_Write_Cvar("hud_panel_weapons_label_scale");
14 HUD_Write_Cvar("hud_panel_weapons_complainbubble");
15 HUD_Write_Cvar("hud_panel_weapons_complainbubble_padding");
16 HUD_Write_Cvar("hud_panel_weapons_complainbubble_time");
17 HUD_Write_Cvar("hud_panel_weapons_complainbubble_fadetime");
18 HUD_Write_Cvar("hud_panel_weapons_complainbubble_color_outofammo");
19 HUD_Write_Cvar("hud_panel_weapons_complainbubble_color_donthave");
20 HUD_Write_Cvar("hud_panel_weapons_complainbubble_color_unavailable");
21 HUD_Write_Cvar("hud_panel_weapons_ammo");
22 HUD_Write_Cvar("hud_panel_weapons_ammo_color");
23 HUD_Write_Cvar("hud_panel_weapons_ammo_alpha");
24 HUD_Write_Cvar("hud_panel_weapons_aspect");
25 HUD_Write_Cvar("hud_panel_weapons_timeout");
26 HUD_Write_Cvar("hud_panel_weapons_timeout_effect");
27 HUD_Write_Cvar("hud_panel_weapons_timeout_fadebgmin");
28 HUD_Write_Cvar("hud_panel_weapons_timeout_fadefgmin");
29 HUD_Write_Cvar("hud_panel_weapons_timeout_speed_in");
30 HUD_Write_Cvar("hud_panel_weapons_timeout_speed_out");
31 HUD_Write_Cvar("hud_panel_weapons_onlyowned");
32 HUD_Write_Cvar("hud_panel_weapons_noncurrent_alpha");
33 HUD_Write_Cvar("hud_panel_weapons_noncurrent_scale");
34 HUD_Write_Cvar("hud_panel_weapons_selection_radius");
35 HUD_Write_Cvar("hud_panel_weapons_selection_speed");
36}
37
39{
41 {
46 if (acc_levels < 2)
47 LOG_INFO("Warning: accuracy_color_levels must contain at least 2 values");
48
49 for (int i = 0; i < acc_levels; ++i)
50 acc_lev[i] = stof(argv(i)) / 100.0;
51 }
52}
53
55{
56 if (time > acc_col_loadtime && acc_levels >= 2)
57 {
58 for (int i = 0; i < acc_levels; ++i)
59 acc_col[i] = stov(cvar_string(strcat("accuracy_color", ftos(i))));
61 }
62}
63
65{
66 if (acc_levels < 2)
67 return '0 0 0'; // return black, can't determine the right color
68
69 // find the max level lower than acc
70 int j = acc_levels - 1;
71 while (j && accuracy < acc_lev[j])
72 --j;
73
74 // inject color j+1 in color j, how much depending on how much accuracy is higher than level j
75 float factor = (accuracy - acc_lev[j]) / (acc_lev[j+1] - acc_lev[j]);
76 vector color = acc_col[j];
77 color += factor * (acc_col[j+1] - color);
78 return color;
79}
80
82void weaponorder_swap(int i, int j, entity pass)
83{
84 TC(int, i); TC(int, j);
85 entity h = weaponorder[i];
87 weaponorder[j] = h;
88}
89
91int weaponorder_cmp(int i, int j, entity pass)
92{
93 TC(int, i); TC(int, j);
94 int ai = strstrofs(weaponorder_cmp_str, sprintf(" %d ", weaponorder[i].m_id), 0);
95 int aj = strstrofs(weaponorder_cmp_str, sprintf(" %d ", weaponorder[j].m_id), 0);
96 return aj - ai; // the string is in REVERSE order (higher prio at the right is what we want, but higher prio first is the string)
97}
98
99#define HUD_WEAPONS_GET_FULL_LAYOUT() MACRO_BEGIN \
100 int nHidden = 0; \
101 FOREACH(Weapons, it != WEP_Null, \
102 { \
103 if (weapons_stat & WepSet_FromWeapon(it)) \
104 continue; \
105 if (it.spawnflags & (WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED)) \
106 ++nHidden; \
107 }); \
108 vector table_size = HUD_GetTableSize_BestItemAR((REGISTRY_COUNT(Weapons) - 1) - nHidden, panel_size, aspect); \
109 columns = table_size.x; \
110 rows = table_size.y; \
111 weapon_size.x = panel_size.x / columns; \
112 weapon_size.y = panel_size.y / rows; \
113MACRO_END
114
118{
119 // check to see if we want to continue
120 if (hud != HUD_NORMAL)
121 return;
122
124 {
126 return;
128 return;
129
131 float timeout_effect_length = autocvar_hud_panel_weapons_timeout_speed_out; //? 0.75 : 0);
132
133 if (timeout && time >= weapontime + timeout + timeout_effect_length)
136 {
138 return;
139 }
140 }
141
142 // declarations
143 WepSet weapons_stat = WepSet_GetFromStat();
144 entity panel_switchweapon = NULL;
145 vector center = '0 0 0';
146
149
150 vector weapon_size = '0 0 0';
151
152 // update generic hud functions
154
156 {
161 weporder = W_FixWeaponOrder_BuildImpulseList(weporder);
162
163 weaponorder_cmp_str = strcat(" ", weporder, " ");
164
165 int weapon_cnt = 0;
166 FOREACH(Weapons, it != WEP_Null && it.impulse >= 0, weaponorder[weapon_cnt++] = it);
167 for (int i = weapon_cnt; i < REGISTRY_MAX(Weapons); ++i)
168 weaponorder[i] = NULL;
170
172 }
173
176
177 entity wepent = viewmodels[0]; // TODO: unhardcode
178
179 if (wepent.switchweapon == WEP_Null)
180 panel_switchweapon = NULL;
181 else if (!panel_switchweapon)
182 panel_switchweapon = wepent.switchweapon;
183
185 {
186 if (!weapons_stat)
187 {
188 int j = 0;
189 FOREACH(Weapons, it != WEP_Null && it.impulse >= 0 && (it.impulse % 3 != 0) && j < 6,
190 {
191 if (!(it.spawnflags & (WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_SPECIALATTACK)))
192 {
193 if (!panel_switchweapon || j < 4)
194 panel_switchweapon = it;
195 weapons_stat |= it.m_wepset;
196 ++j;
197 }
198 });
199 }
200
201 #if 0
203 if (cvar("wep_add"))
204 {
205 int nHidden = 0;
206 FOREACH(Weapons, it != WEP_Null && it.spawnflags & WEP_FLAG_MUTATORBLOCKED, ++nHidden);
207 weapons_stat = '0 0 0';
208 float countw = 1 + floor((floor(time * cvar("wep_add"))) % (REGISTRY_COUNT(Weapons) - 1 - nHidden));
209 for (int i = 0, j = 0; i <= REGISTRY_COUNT(Weapons) - 1 && j < countw; ++i)
210 {
212 continue;
213 weapons_stat |= weaponorder[i].m_wepset;
214 ++j;
215 }
216 }
217 #endif
218 }
219
220 // determine which weapons are going to be shown
221 int weapon_count;
222 int rows = 0, columns = 0;
223 bool vertical_order = true;
224 float aspect = max(0.001, autocvar_hud_panel_weapons_aspect);
226 {
228 {
230 HUD_Panel_DrawBg(); // also draw the bg of the entire panel
231 }
232
233 // do we own this weapon?
234 weapon_count = 0;
235 if (autocvar_hud_panel_weapons_onlyowned >= 2) // only current
236 {
237 for (int i = 0; i <= WEP_LAST-WEP_FIRST; ++i)
238 if (weaponorder[i] == panel_switchweapon || weaponorder[i] == complain_weapon)
239 ++weapon_count;
240 }
241 else
242 {
243 for (int i = 0; i <= WEP_LAST-WEP_FIRST; ++i)
244 if ((weapons_stat & WepSet_FromWeapon(weaponorder[i])) || weaponorder[i] == complain_weapon)
245 ++weapon_count;
246 }
247
248 // might as well commit suicide now, no reason to live ;)
249 if (weapon_count == 0)
250 return;
251
252 vector old_panel_size = panel_size;
253 panel_size -= '2 2 0' * panel_bg_padding;
254
256
257 // NOTE: although weapons should aways look the same even if onlyowned is enabled,
258 // we enlarge them a bit when possible to better match the desired aspect ratio
259 vertical_order = panel_size.x / panel_size.y >= aspect;
260 if (vertical_order)
261 {
262 // maximum number of columns that allows to display items with the desired aspect ratio
263 int max_columns = floor(panel_size.x / (weapon_size.y * aspect));
264 rows = min(rows, ceil(weapon_count / max_columns));
265 columns = ceil(weapon_count / rows);
266 weapon_size.x = min(panel_size.x / columns, aspect * weapon_size.y);
267 weapon_size.y = min(panel_size.y / rows, weapon_size.x / aspect);
268 }
269 else
270 {
271 int max_rows = floor(panel_size.y / (weapon_size.x / aspect));
272 columns = min(columns, ceil(weapon_count / max_rows));
273 rows = ceil(weapon_count / columns);
274 weapon_size.y = min(panel_size.y / rows, weapon_size.x / aspect);
275 weapon_size.x = min(panel_size.x / columns, aspect * weapon_size.y);
276 }
277
278 // reduce size of the panel
279 panel_size.x = columns * weapon_size.x;
280 panel_size.y = rows * weapon_size.y;
281 panel_size += '2 2 0' * panel_bg_padding;
282
283 // center the resized panel, or snap it to the screen edge when close enough
284 if (panel_pos.x > vid_conwidth * 0.001)
285 {
286 if (panel_pos.x + old_panel_size.x > vid_conwidth * 0.999)
287 panel_pos.x += old_panel_size.x - panel_size.x;
288 else
289 panel_pos.x += (old_panel_size.x - panel_size.x) * 0.5;
290 }
291 else if (old_panel_size.x > vid_conwidth * 0.999)
292 panel_pos.x += (old_panel_size.x - panel_size.x) * 0.5;
293
294 if (panel_pos.y > vid_conheight * 0.001)
295 {
296 if (panel_pos.y + old_panel_size.y > vid_conheight * 0.999)
297 panel_pos.y += old_panel_size.y - panel_size.y;
298 else
299 panel_pos.y += (old_panel_size.y - panel_size.y) * 0.5;
300 }
301 else if (old_panel_size.y > vid_conheight * 0.999)
302 panel_pos.y += (old_panel_size.y - panel_size.y) * 0.5;
303 }
304 else
305 weapon_count = REGISTRY_COUNT(Weapons) - 1; // unused value
306
307
308 Weapons_Fade(center);
309 Weapons_Draw(panel_switchweapon, weapons_stat, center, weapon_size, aspect, when, fadetime, rows, columns, vertical_order);
310}
311
312
313// animation for fading in/out the panel respectively when not in use
315{
317 return;
318
320 float timein_effect_length = autocvar_hud_panel_weapons_timeout_speed_in; //? 0.375 : 0);
321 float timeout_effect_length = autocvar_hud_panel_weapons_timeout_speed_out; //? 0.75 : 0);
322
323 if (timeout && time >= weapontime + timeout) // apply timeout effect if needed
324 {
325 float f = bound(0, (time - (weapontime + timeout)) / timeout_effect_length, 1);
326
327 // fade the panel alpha
329 {
332 }
334 {
335 panel_bg_alpha *= (1 - f);
336 panel_fg_alpha *= (1 - f);
337 }
338
339 // move the panel off the screen
342 {
343 f *= f; // for a cooler movement
344 center.x = panel_pos.x + panel_size.x / 2;
345 center.y = panel_pos.y + panel_size.y / 2;
346 float screen_ar = vid_conwidth / vid_conheight;
347 if (center.x / center.y < screen_ar) // bottom left
348 {
349 if ((vid_conwidth - center.x) / center.y < screen_ar) // bottom
350 panel_pos.y += f * (vid_conheight - panel_pos.y);
351 else // left
352 panel_pos.x -= f * (panel_pos.x + panel_size.x);
353 }
354 else // top right
355 {
356 if ((vid_conwidth - center.x) / center.y < screen_ar) // right
357 panel_pos.x += f * (vid_conwidth - panel_pos.x);
358 else // top
359 panel_pos.y -= f * (panel_pos.y + panel_size.y);
360 }
361 if (f == 1)
362 center.x = -1; // mark the panel as off screen
363 }
364 weaponprevtime = time - (1 - f) * timein_effect_length;
365 }
366 else if (timeout && time < weaponprevtime + timein_effect_length) // apply timein effect if needed
367 {
368 float f = bound(0, (time - weaponprevtime) / timein_effect_length, 1);
369
370 // fade the panel alpha
372 {
375 }
377 {
378 panel_bg_alpha *= f;
379 panel_fg_alpha *= f;
380 }
381
382 // move the panel back on screen
385 {
386 f *= f; // for a cooler movement
387 f = 1 - f;
388 center.x = panel_pos.x + panel_size.x / 2;
389 center.y = panel_pos.y + panel_size.y / 2;
390 float screen_ar = vid_conwidth / vid_conheight;
391 if (center.x / center.y < screen_ar) // bottom left
392 {
393 if ((vid_conwidth - center.x) / center.y < screen_ar) // bottom
394 panel_pos.y += f * (vid_conheight - panel_pos.y);
395 else // left
396 panel_pos.x -= f * (panel_pos.x + panel_size.x);
397 }
398 else // top right
399 {
400 if ((vid_conwidth - center.x) / center.y < screen_ar) // right
401 panel_pos.x += f * (vid_conwidth - panel_pos.x);
402 else // top
403 panel_pos.y -= f * (panel_pos.y + panel_size.y);
404 }
405 }
406 }
407}
408
410 entity panel_switchweapon, WepSet weapons_stat,
411 vector center, vector weapon_size, float aspect,
412 float when, float fadetime,
413 int rows, int columns, bool vertical_order)
414{
415 // draw the background, then change the virtual size of it to better fit other items inside
418 else
421
422 if (center.x == -1)
423 return; // panel has gone off screen
424
426 vector barsize = '0 0 0', baroffset = '0 0 0';
427
428 vector ammo_color = '1 0 1';
429 float ammo_alpha = 1;
430 bool infinite_ammo = (STAT(ITEMS) & IT_UNLIMITED_AMMO);
431
432 int row = 0, column = 0;
433
435 {
436 panel_pos += '1 1 0' * panel_bg_padding;
437 panel_size -= '2 2 0' * panel_bg_padding;
438 }
439
440 // after the sizing and animations are done, update the other values
441
442 if (!rows) // if rows is > 0 onlyowned code has already updated these vars
443 {
445 vertical_order = panel_size.x / panel_size.y >= aspect;
446 }
447
448 // calculate position/size for visual bar displaying ammount of ammo status
449 if (!infinite_ammo && autocvar_hud_panel_weapons_ammo)
450 {
453
454 if (weapon_size.x / weapon_size.y > aspect)
455 {
456 barsize.x = aspect * weapon_size.y;
457 barsize.y = weapon_size.y;
458 baroffset.x = (weapon_size.x - barsize.x) * 0.5;
459 }
460 else
461 {
462 barsize.y = 1 / aspect * weapon_size.x;
463 barsize.x = weapon_size.x;
464 baroffset.y = (weapon_size.y - barsize.y) * 0.5;
465 }
466 }
469
470 // draw items
471 vector label_size = '1 1 0' * min(weapon_size.x, weapon_size.y) * bound(0, autocvar_hud_panel_weapons_label_scale, 1);
472 vector noncurrent_size = weapon_size * bound(0.01, autocvar_hud_panel_weapons_noncurrent_scale, 1);
473 float noncurrent_alpha = panel_fg_alpha * bound(0, autocvar_hud_panel_weapons_noncurrent_alpha, 1);
474 static vector weapon_pos_current = '-1 0 0';
475 if (weapon_pos_current.x == -1)
476 weapon_pos_current = panel_pos;
477
479 ? 999
481 vector radius_size = weapon_size * (autocvar_hud_panel_weapons_selection_radius + 1);
482
483 // draw background behind currently selected weapon
484 // do it earlier to make sure bg is drawn behind every weapon icons while it's moving
485 if (panel_switchweapon)
486 drawpic_aspect_skin(weapon_pos_current, "weapon_current_bg", weapon_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
487
488 for (int i = 0; i <= WEP_LAST-WEP_FIRST; ++i)
489 {
490 // retrieve information about the current weapon to be drawn
491 entity it = weaponorder[i];
492 int weapon_id = it.impulse;
493
494 // skip if this weapon doesn't exist
495 if (!it || weapon_id < 0)
496 continue;
497
498 // skip this weapon if we don't own it (and onlyowned is enabled)-- or if weapons_complainbubble is showing for this weapon
500 {
501 if (autocvar_hud_panel_weapons_onlyowned >= 2) // only current
502 {
503 if (!(it == panel_switchweapon || it == complain_weapon))
504 continue;
505 }
506 else
507 {
508 if (!((weapons_stat & WepSet_FromWeapon(it)) || it == complain_weapon))
509 continue;
510 }
511 }
512 else
513 {
514 if ((it.spawnflags & (WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED))
515 && !(weapons_stat & WepSet_FromWeapon(it)))
516 {
517 continue;
518 }
519 }
520
521 // figure out the drawing position of weapon
522 vector weapon_pos = panel_pos + vec2(column * weapon_size.x, row * weapon_size.y);
523
524 // update position of the currently selected weapon
525 if (it == panel_switchweapon)
526 {
527 if (weapon_pos_current.y > weapon_pos.y)
528 weapon_pos_current.y = max(weapon_pos.y, weapon_pos_current.y - switch_speed * (weapon_pos_current.y - weapon_pos.y));
529 else if (weapon_pos_current.y < weapon_pos.y)
530 weapon_pos_current.y = min(weapon_pos.y, weapon_pos_current.y + switch_speed * (weapon_pos.y - weapon_pos_current.y));
531 if (weapon_pos_current.x > weapon_pos.x)
532 weapon_pos_current.x = max(weapon_pos.x, weapon_pos_current.x - switch_speed * (weapon_pos_current.x - weapon_pos.x));
533 else if (weapon_pos_current.x < weapon_pos.x)
534 weapon_pos_current.x = min(weapon_pos.x, weapon_pos_current.x + switch_speed * (weapon_pos.x - weapon_pos_current.x));
535 }
536
537 // draw the weapon accuracy
539 {
540 float panel_weapon_accuracy = weapon_accuracy[it.m_id-WEP_FIRST];
541 if (autocvar__hud_configure && panel_weapon_accuracy == -1)
542 panel_weapon_accuracy = (it.m_id % 7 - 2) * 0.11 + 0.3; // make up something
543 if (panel_weapon_accuracy >= 0)
544 {
545 color = Accuracy_GetColor(panel_weapon_accuracy);
546 drawpic_aspect_skin(weapon_pos, "weapon_accuracy", weapon_size, color, panel_fg_alpha, DRAWFLAG_NORMAL);
547 }
548 }
549
550 vector weapon_size_real = noncurrent_size;
551 float weapon_alpha_real = noncurrent_alpha;
552 float radius_factor_x = 1 - bound(0, fabs(weapon_pos.x - weapon_pos_current.x) / radius_size.x, 1);
553 float radius_factor_y = 1 - bound(0, fabs(weapon_pos.y - weapon_pos_current.y) / radius_size.y, 1);
554 if (radius_factor_x || radius_factor_y)
555 {
556 weapon_size_real.x += (weapon_size.x - noncurrent_size.x) * radius_factor_x;
557 weapon_size_real.y += (weapon_size.y - noncurrent_size.y) * radius_factor_y;
558 weapon_alpha_real += (panel_fg_alpha - noncurrent_alpha) * min(radius_factor_x, radius_factor_y);
559 }
560
561 vector weapon_pos_real = weapon_pos;
562 weapon_pos_real.x = weapon_pos.x + (weapon_size.x - weapon_size_real.x) * 0.5;
563 weapon_pos_real.y = weapon_pos.y + (weapon_size.y - weapon_size_real.y) * 0.5;
564
565 // drawing all the weapon items
566 if (weapons_stat & WepSet_FromWeapon(it))
567 {
568 // draw the weapon image
569 drawpic_aspect_skin(weapon_pos_real, it.model2, weapon_size_real, '1 1 1', weapon_alpha_real, DRAWFLAG_NORMAL);
570
571 // draw weapon label string
573 {
574 case 1: // weapon number
575 drawstring(weapon_pos, ftos(weapon_id), label_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
576 break;
577
578 case 2: // bind
579 drawstring(weapon_pos, getcommandkey(ftos(weapon_id), strcat("weapon_group_", ftos(weapon_id))), label_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
580 break;
581
582 case 3: // weapon name
583 drawstring(weapon_pos, strtolower(it.m_name), label_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
584 break;
585
586 default: // nothing
587 break;
588 }
589
590 // draw ammo status bar
591 if (!infinite_ammo && autocvar_hud_panel_weapons_ammo && (it.ammo_type != RES_NONE))
592 {
593 float ammo_full;
594 float a = getstati(GetAmmoStat(it.ammo_type)); // how much ammo do we have?
595
596 if (autocvar__hud_configure && a == 0)
597 a = 60; // make up something
598
599 if (a > 0)
600 {
601 // TODO: registry handles
602 switch (it.ammo_type)
603 {
604 case RES_SHELLS: ammo_full = autocvar_hud_panel_weapons_ammo_full_shells; break;
605 case RES_BULLETS: ammo_full = autocvar_hud_panel_weapons_ammo_full_nails; break;
606 case RES_ROCKETS: ammo_full = autocvar_hud_panel_weapons_ammo_full_rockets; break;
607 case RES_CELLS: ammo_full = autocvar_hud_panel_weapons_ammo_full_cells; break;
608 case RES_FUEL: ammo_full = autocvar_hud_panel_weapons_ammo_full_fuel; break;
609 default: ammo_full = 60;
610 }
611
613 weapon_pos.x + baroffset.x,
614 weapon_pos.y + baroffset.y,
615 barsize.x * bound(0, a / ammo_full, 1),
616 barsize.y
617 );
618
620 weapon_pos,
621 "weapon_ammo",
622 weapon_size,
623 ammo_color,
624 ammo_alpha,
626 );
627
629 }
630 }
631 }
632 else // draw a "ghost weapon icon" if you don't have the weapon
633 drawpic_aspect_skin(weapon_pos_real, it.model2, weapon_size_real, '0.2 0.2 0.2', weapon_alpha_real * 0.5, DRAWFLAG_NORMAL);
634
635 // draw the complain message
636 if (it == complain_weapon)
637 {
638 float a = fadetime
639 ? ((complain_weapon_time + when > time) ? 1 : bound(0, (complain_weapon_time + when + fadetime - time) / fadetime, 1))
640 : ((complain_weapon_time + when > time) ? 1 : 0);
641
642 string s;
643 if (complain_weapon_type == 0)
644 {
645 s = _("Out of ammo");
647 }
648 else if (complain_weapon_type == 1)
649 {
650 s = _("Don't have");
652 }
653 else
654 {
655 s = _("Unavailable");
657 }
659 drawpic_aspect_skin(weapon_pos + '1 1 0' * padding, "weapon_complainbubble", weapon_size - '2 2 0' * padding, color, a * panel_fg_alpha, DRAWFLAG_NORMAL);
660 drawstring_aspect(weapon_pos + '1 1 0' * padding, s, weapon_size - '2 2 0' * padding, '1 1 1', panel_fg_alpha * a, DRAWFLAG_NORMAL);
661 }
662
663 #if 0
666 {
667 drawfill(weapon_pos + '1 1 0', weapon_size - '2 2 0', '1 1 1', panel_fg_alpha * 0.2, DRAWFLAG_NORMAL);
668 drawstring(weapon_pos, ftos(i + 1), label_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
669 }
670 #endif
671
672 // continue with new position for the next weapon
673 if (vertical_order)
674 {
675 ++column;
676 if (column >= columns)
677 {
678 column = 0;
679 ++row;
680 }
681 }
682 else
683 {
684 ++row;
685 if (row >= rows)
686 {
687 row = 0;
688 ++column;
689 }
690 }
691 }
692}
entity accuracy
Definition accuracy.qh:26
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
void drawstring_aspect(vector pos, string text, vector sz, vector color, float theAlpha, float drawflag)
Definition draw.qc:110
#define drawsetcliparea(xposition, yposition, w, h)
Definition draw.qh:39
#define drawstring(position, text, scale, rgb, alpha, flag)
Definition draw.qh:27
#define drawpic_aspect_skin(pos, pic, sz, color, theAlpha, drawflag)
Definition draw.qh:78
#define drawfill(position, size, rgb, alpha, flag)
Definition draw.qh:36
#define getcommandkey(cmd_name, command)
Definition main.qh:137
int spectatee_status
the -1 disables HUD panels before CSQC receives necessary data
Definition main.qh:197
int hud
Definition main.qh:173
int spawnflags
Definition ammo.qh:15
const int IT_UNLIMITED_AMMO
Definition item.qh:23
string strtolower(string s)
const int HUD_NORMAL
Definition constants.qh:47
const float DRAWFLAG_NORMAL
float frametime
float time
#define strstrofs
#define tokenize_console
vector color
Definition dynlight.qc:15
int m_id
Definition effect.qh:19
#define pass(name, colormin, colormax)
Weapons
Definition guide.qh:113
void HUD_Panel_LoadCvars()
Definition hud.qc:215
void HUD_Scale_Enable()
Definition hud.qc:91
void HUD_Scale_Disable()
Definition hud.qc:84
vector panel_size
Definition hud.qh:163
float panel_fg_alpha
Definition hud.qh:169
int complain_weapon_type
Definition hud.qh:114
float weaponprevtime
Definition hud.qh:123
float panel_bg_padding
Definition hud.qh:174
entity complain_weapon
Definition hud.qh:113
float complain_weapon_time
Definition hud.qh:115
int weapon_accuracy[REGISTRY_MAX(Weapons)]
Definition hud.qh:111
#define HUD_Panel_DrawBg()
Definition hud.qh:55
vector panel_pos
Definition hud.qh:162
float panel_bg_alpha
Definition hud.qh:170
float weapontime
Definition hud.qh:122
#define HUD_Write_Cvar(cvar)
Definition hud_config.qh:40
bool autocvar__hud_configure
Definition hud_config.qh:3
float hud_configure_menu_open
Definition hud_config.qh:22
#define FOREACH(list, cond, body)
Definition iter.qh:19
#define TC(T, sym)
Definition _all.inc:82
noref float vid_conwidth
Definition draw.qh:8
noref float vid_conheight
Definition draw.qh:9
#define STAT(...)
Definition stats.qh:82
#define LOG_INFO(...)
Definition log.qh:65
float ceil(float f)
float stof(string val,...)
void drawresetcliparea(void)
float bound(float min, float value, float max)
float cvar(string name)
vector stov(string s)
const string cvar_string(string name)
float min(float f,...)
string ftos(float f)
float fabs(float f)
float floor(float f)
string argv(float n)
float max(float f,...)
fadetime
string string_null
Definition nil.qh:9
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
#define NULL
Definition post.qh:14
#define REGISTRY_COUNT(id)
Definition registry.qh:18
#define REGISTRY_MAX(id)
Definition registry.qh:17
vector
Definition self.qh:92
ERASEABLE void heapsort(int n, swapfunc_t swap, comparefunc_t cmp, entity pass)
Definition sort.qh:9
#define strcpy(this, s)
Definition string.qh:52
#define vec2(...)
Definition vector.qh:90
entity viewmodels[MAX_WEAPONSLOTS]
Definition view.qh:108
string W_FixWeaponOrder_ForceComplete(string order)
Definition all.qc:166
int GetAmmoStat(Resource ammotype)
Definition all.qc:210
string W_NumberWeaponOrder(string order)
Definition all.qc:120
string W_FixWeaponOrder_BuildImpulseList(string o)
Definition all.qc:146
WepSet WepSet_GetFromStat()
Definition all.qc:79
#define WEP_LAST
Definition all.qh:327
const int WEP_FIRST
Definition all.qh:326
#define WepSet_FromWeapon(it)
Definition all.qh:46
const int WEP_FLAG_MUTATORBLOCKED
Definition weapon.qh:219
vector WepSet
Definition weapon.qh:14
const int WEP_FLAG_HIDDEN
Definition weapon.qh:216
string cl_weaponpriority_old
Definition weapons.qc:115
#define HUD_WEAPONS_GET_FULL_LAYOUT()
Definition weapons.qc:99
int weaponorder_cmp(int i, int j, entity pass)
Definition weapons.qc:91
vector Accuracy_GetColor(float accuracy)
Definition weapons.qc:64
void weaponorder_swap(int i, int j, entity pass)
Definition weapons.qc:82
void Accuracy_LoadLevels()
Definition weapons.qc:38
string weaponorder_cmp_str
Definition weapons.qc:90
bool weapons_orderbyimpulse_old
Definition weapons.qc:116
void Accuracy_LoadColors()
Definition weapons.qc:54
void HUD_Weapons()
Definition weapons.qc:117
void Weapons_Draw(entity panel_switchweapon, WepSet weapons_stat, vector center, vector weapon_size, float aspect, float when, float fadetime, int rows, int columns, bool vertical_order)
Definition weapons.qc:409
entity weaponorder[REGISTRY_MAX(Weapons)]
Definition weapons.qc:81
void Weapons_Fade(vector center)
Definition weapons.qc:314
void HUD_Weapons_Export(int fh)
Definition weapons.qc:9
int acc_levels
Definition weapons.qh:46
bool autocvar_hud_panel_weapons
Definition weapons.qh:4
vector acc_col[MAX_ACCURACY_LEVELS]
Definition weapons.qh:44
int autocvar_hud_panel_weapons_onlyowned
Definition weapons.qh:26
float autocvar_hud_panel_weapons_selection_radius
Definition weapons.qh:29
bool autocvar_hud_panel_weapons_complainbubble
Definition weapons.qh:15
float autocvar_hud_panel_weapons_timeout_fadefgmin
Definition weapons.qh:35
float acc_lev[MAX_ACCURACY_LEVELS]
Definition weapons.qh:43
float autocvar_hud_panel_weapons_ammo_alpha
Definition weapons.qh:7
float autocvar_hud_panel_weapons_timeout_fadebgmin
Definition weapons.qh:34
string acc_color_levels
Definition weapons.qh:47
bool autocvar_hud_panel_weapons_hide_ondeath
Definition weapons.qh:23
bool autocvar_hud_panel_weapons_ammo
Definition weapons.qh:6
float acc_col_loadtime
Definition weapons.qh:45
int autocvar_hud_panel_weapons_ammo_full_nails
Definition weapons.qh:11
float autocvar_hud_panel_weapons_aspect
Definition weapons.qh:14
float autocvar_hud_panel_weapons_timeout_speed_out
Definition weapons.qh:37
int autocvar_hud_panel_weapons_ammo_full_fuel
Definition weapons.qh:10
string autocvar_accuracy_color_levels
Definition weapons.qh:39
string autocvar_cl_weaponpriority
Definition weapons.qh:40
bool autocvar_hud_panel_weapons_accuracy
Definition weapons.qh:5
float autocvar_hud_panel_weapons_label_scale
Definition weapons.qh:25
string autocvar_hud_panel_weapons_ammo_color
Definition weapons.qh:8
int autocvar_hud_panel_weapons_ammo_full_shells
Definition weapons.qh:13
float autocvar_hud_panel_weapons_complainbubble_padding
Definition weapons.qh:20
int autocvar_hud_panel_weapons_label
Definition weapons.qh:24
float autocvar_hud_panel_weapons_complainbubble_time
Definition weapons.qh:21
string autocvar_hud_panel_weapons_complainbubble_color_outofammo
Definition weapons.qh:17
bool autocvar_hud_panel_weapons_dynamichud
Definition weapons.qh:22
bool autocvar_hud_panel_weapons_orderbyimpulse
Definition weapons.qh:33
int autocvar_hud_panel_weapons_timeout_effect
Definition weapons.qh:32
int autocvar_hud_panel_weapons_ammo_full_cells
Definition weapons.qh:9
string autocvar_hud_panel_weapons_complainbubble_color_donthave
Definition weapons.qh:16
float autocvar_hud_panel_weapons_selection_speed
Definition weapons.qh:30
int autocvar_hud_panel_weapons_ammo_full_rockets
Definition weapons.qh:12
float autocvar_hud_panel_weapons_noncurrent_scale
Definition weapons.qh:28
float autocvar_hud_panel_weapons_timeout_speed_in
Definition weapons.qh:36
float autocvar_hud_panel_weapons_timeout
Definition weapons.qh:31
float autocvar_hud_panel_weapons_complainbubble_fadetime
Definition weapons.qh:19
const int MAX_ACCURACY_LEVELS
Definition weapons.qh:42
string autocvar_hud_panel_weapons_complainbubble_color_unavailable
Definition weapons.qh:18
float autocvar_hud_panel_weapons_noncurrent_alpha
Definition weapons.qh:27