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 86 of file cl_nades.qc.

87{
88 float bonusNades = STAT(NADE_BONUS);
89 float bonusProgress = STAT(NADE_BONUS_SCORE);
90 float bonusType = STAT(NADE_BONUS_TYPE);
91 Nade def = REGISTRY_GET(Nades, max(1, bonusType));
92 string nadeIcon = def.m_icon; // use the Normal Nade icon for the random nade, and draw it as rainbow
93 vector nadeColor;
94 if (bonusType)
95 nadeColor = def.m_color;
96 else
97 {
98 nadeColor.x = time % (2 * M_PI);
99 nadeColor.y = 1;
100 nadeColor.z = 1;
101 nadeColor = hsv_to_rgb(nadeColor);
102 }
103
104 vector iconPos, textPos;
105
107 {
108 iconPos = myPos + eX * 2 * mySize.y;
109 textPos = myPos;
110 }
111 else
112 {
113 iconPos = myPos;
114 textPos = myPos + eX * mySize.y;
115 }
116
117 if (bonusNades > 0 || bonusProgress > 0)
118 {
119 DrawNadeProgressBar(myPos, mySize, bonusProgress, nadeColor);
120
122 drawstring_aspect(textPos, ftos(bonusNades), vec2((2/3) * mySize.x, mySize.y), '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
123
124 if (draw_expanding)
125 drawpic_aspect_skin_expanding(iconPos, nadeIcon, '1 1 0' * mySize.y, (bonusType ? '1 1 1' : nadeColor), panel_fg_alpha, DRAWFLAG_NORMAL, expand_time);
126
127 drawpic_aspect_skin(iconPos, nadeIcon, '1 1 0' * mySize.y, (bonusType ? '1 1 1' : nadeColor), panel_fg_alpha, DRAWFLAG_NORMAL);
128 }
129}
Definition nades.qh:14
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:109
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, M_PI, max(), panel_fg_alpha, REGISTRY_GET, STAT, time, vec2, and vector.

◆ Projectile_isnade()

bool Projectile_isnade ( int proj)

Definition at line 82 of file cl_nades.qc.

83{
84 return Nade_FromProjectile(p) != NADE_TYPE_Null;
85}
Nade Nade_FromProjectile(int proj)
Definition nades.qh:65

References Nade_FromProjectile().

Referenced by Projectile_Draw().