Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
cl_nades.qh File Reference
#include "nades.qh"
Include dependency graph for cl_nades.qh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void DrawAmmoNades (vector myPos, vector mySize, bool draw_expanding, float expand_time)
bool Projectile_isnade (int proj)

Function Documentation

◆ DrawAmmoNades()

void DrawAmmoNades ( vector myPos,
vector mySize,
bool draw_expanding,
float expand_time )

Definition at line 81 of file cl_nades.qc.

82{
83 float bonusNades = STAT(NADE_BONUS);
84 float bonusProgress = STAT(NADE_BONUS_SCORE);
85 float bonusType = STAT(NADE_BONUS_TYPE);
86 Nade def = REGISTRY_GET(Nades, max(1, bonusType));
87 string nadeIcon = def.m_icon; // use the Normal Nade icon for the random nade, and draw it as rainbow
88 vector nadeColor;
89 if(bonusType)
90 nadeColor = def.m_color;
91 else
92 {
93 nadeColor.x = time % (M_PI * 2);
94 nadeColor.y = 1;
95 nadeColor.z = 1;
96 nadeColor = hsv_to_rgb(nadeColor);
97 }
98
99 vector iconPos, textPos;
100
102 {
103 iconPos = myPos + eX * 2 * mySize.y;
104 textPos = myPos;
105 }
106 else
107 {
108 iconPos = myPos;
109 textPos = myPos + eX * mySize.y;
110 }
111
112 if(bonusNades > 0 || bonusProgress > 0)
113 {
114 DrawNadeProgressBar(myPos, mySize, bonusProgress, nadeColor);
115
117 drawstring_aspect(textPos, ftos(bonusNades), vec2((2/3) * mySize.x, mySize.y), '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
118
119 if(draw_expanding)
120 drawpic_aspect_skin_expanding(iconPos, nadeIcon, '1 1 0' * mySize.y, (bonusType ? '1 1 1' : nadeColor), panel_fg_alpha, DRAWFLAG_NORMAL, expand_time);
121
122 drawpic_aspect_skin(iconPos, nadeIcon, '1 1 0' * mySize.y, (bonusType ? '1 1 1' : nadeColor), panel_fg_alpha, DRAWFLAG_NORMAL);
123 }
124}
Definition nades.qh:14
string m_icon
Definition nades.qh:18
vector m_color
Definition nades.qh:16
void drawstring_aspect(vector pos, string text, vector sz, vector color, float theAlpha, float drawflag)
Definition draw.qc:110
void drawpic_aspect_skin_expanding(vector position, string pic, vector theScale, vector rgb, float theAlpha, float flag, float fadelerp)
Definition draw.qc:61
#define drawpic_aspect_skin(pos, pic, sz, color, theAlpha, drawflag)
Definition draw.qh:78
void DrawNadeProgressBar(vector myPos, vector mySize, float progress, vector color)
Definition ammo.qc:25
bool autocvar_hud_panel_ammo_text
Definition ammo.qh:15
bool autocvar_hud_panel_ammo_iconalign
Definition ammo.qh:7
ERASEABLE vector hsv_to_rgb(vector hsv)
Definition color.qh:141
const float DRAWFLAG_NORMAL
float time
float panel_fg_alpha
Definition hud.qh:169
#define STAT(...)
Definition stats.qh:82
#define M_PI
Definition mathlib.qh:108
string ftos(float f)
float max(float f,...)
#define REGISTRY_GET(id, i)
Definition registry.qh:43
vector
Definition self.qh:92
const vector eX
Definition vector.qh:44
#define vec2(...)
Definition vector.qh:90

References autocvar_hud_panel_ammo_iconalign, autocvar_hud_panel_ammo_text, DRAWFLAG_NORMAL, DrawNadeProgressBar(), drawpic_aspect_skin, drawpic_aspect_skin_expanding(), drawstring_aspect(), eX, ftos(), hsv_to_rgb(), Nade::m_color, Nade::m_icon, M_PI, max(), panel_fg_alpha, REGISTRY_GET, STAT, time, vec2, and vector.

◆ Projectile_isnade()

bool Projectile_isnade ( int proj)

Definition at line 77 of file cl_nades.qc.

78{
79 return Nade_FromProjectile(p) != NADE_TYPE_Null;
80}
Nade Nade_FromProjectile(int proj)
Definition nades.qh:60

References Nade_FromProjectile().

Referenced by Projectile_Draw().