fputs(fh, strcat("seta hud_skin \"", cvar_string("hud_skin"), "\"", "\n"));
fputs(fh, strcat("seta hud_bg \"", cvar_string("hud_bg"), "\"", "\n"));
fputs(fh, strcat("seta hud_bg_color \"", cvar_string("hud_bg_color"), "\"", "\n"));
- fputs(fh, strcat("seta hud_bg_alpha ", ftos(cvar("hud_bg_alpha")), "\n"));
- fputs(fh, strcat("seta hud_bg_border ", ftos(cvar("hud_bg_border")), "\n"));
- fputs(fh, strcat("seta hud_fg_alpha ", ftos(cvar("hud_fg_alpha")), "\n"));
+ fputs(fh, strcat("seta hud_bg_alpha ", cvar_string("hud_bg_alpha"), "\n"));
+ fputs(fh, strcat("seta hud_bg_border ", cvar_string("hud_bg_border"), "\n"));
+ fputs(fh, strcat("seta hud_bg_padding ", cvar_string("hud_bg_padding"), "\n"));
+ fputs(fh, strcat("seta hud_fg_alpha ", cvar_string("hud_fg_alpha"), "\n"));
fputs(fh, "\n");
fputs(fh, strcat("seta hud_dock \"", cvar_string("hud_dock"), "\"", "\n"));
fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_size \"", cvar_string(strcat("hud_", HUD_Panel_GetName(i), "_size")), "\"", "\n"));
fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_bg \"", cvar_string(strcat("hud_", HUD_Panel_GetName(i), "_bg")), "\"", "\n"));
fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_bg_color \"", cvar_string(strcat("hud_", HUD_Panel_GetName(i), "_bg_color")), "\"", "\n"));
- fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_bg_alpha ", ftos(cvar(strcat("hud_", HUD_Panel_GetName(i), "_bg_alpha"))), "\n"));
- fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_bg_border ", ftos(cvar(strcat("hud_", HUD_Panel_GetName(i), "_bg_border"))), "\n"));
+ fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_bg_alpha ", cvar_string(strcat("hud_", HUD_Panel_GetName(i), "_bg_alpha")), "\n"));
+ fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_bg_border ", cvar_string(strcat("hud_", HUD_Panel_GetName(i), "_bg_border")), "\n"));
+ fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_bg_padding ", cvar_string(strcat("hud_", HUD_Panel_GetName(i), "_bg_padding")), "\n"));
switch(i) {
case 0:
fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_accuracy_height ", ftos(cvar(strcat("hud_", HUD_Panel_GetName(i), "_accuracy_height"))), "\n"));
float HUD_Panel_GetBorder(float id)
{
- float border;
- border = cvar(strcat("hud_", HUD_Panel_GetName(id), "_bg_border"));
- if(!border)
- border = cvar("hud_bg_border");
- return border;
+ string border;
+ border = cvar_string(strcat("hud_", HUD_Panel_GetName(id), "_bg_border"));
+ if(border == "")
+ border = cvar_string("hud_bg_border");
+ return stof(border);
+}
+
+vector HUD_Panel_GetColor(float id)
+{
+ string color;
+ color = cvar_string(strcat("hud_", HUD_Panel_GetName(id), "_bg_color"));
+ if(color == "")
+ color = cvar_string("hud_bg_color");
+ return stov(color);
+}
+
+float HUD_Panel_GetAlpha(float id)
+{
+ string alpha;
+ alpha = cvar_string(strcat("hud_", HUD_Panel_GetName(id), "_bg_alpha"));
+ if(alpha == "")
+ alpha = cvar_string("hud_bg_alpha");
+ return stof(alpha);
+}
+
+float HUD_Panel_GetPadding(float id)
+{
+ string padding;
+ padding = cvar_string(strcat("hud_", HUD_Panel_GetName(id), "_bg_padding"));
+ if(padding == "")
+ padding = cvar_string("hud_bg_padding");
+ return stof(padding);
}
// draw the background/borders
void HUD_Panel_DrawBg(float id, vector pos, vector mySize)
{
+ float alpha;
+
if(!hud_configure && cvar_string(strcat("hud_", HUD_Panel_GetName(id), "_bg")) == "0")
return;
if(bg == "")
bg = cvar_string("hud_bg");
+ if(bg == "0" && hud_configure) {
+ bg = "border"; // we probably want to see a background in config mode at all times...
+ alpha = cvar("hud_configure_bg_minalpha");
+ }
+
if(bg != "0")
{
float border;
border = max(0.0000001, HUD_Panel_GetBorder(id)); // draw_BorderPicture does not like border = 0
vector color;
- if(cvar_string(strcat("hud_", HUD_Panel_GetName(id), "_bg_color")) != "")
- color = stov(cvar_string(strcat("hud_", HUD_Panel_GetName(id), "_bg_color")));
- else
- color = stov(cvar_string("hud_bg_color"));
+ color = HUD_Panel_GetColor(id);
- float alpha;
- alpha = cvar(strcat("hud_", HUD_Panel_GetName(id), "_bg_alpha"));
if(!alpha)
- alpha = cvar("hud_bg_alpha");
- if(hud_configure)
- alpha = max(cvar("hud_configure_bg_minalpha"), alpha);
+ alpha = HUD_Panel_GetAlpha(id);
draw_BorderPicture(pos - '1 1 0' * border, strcat("gfx/hud/", cvar_string("hud_skin"), "/", bg), mySize + '1 1 0' * 2 * border, color, alpha, '1 1 0' * (border/BORDER_MULTIPLIER));
}
vector targSize;
vector myCenter;
vector targCenter;
+ myCenter = '0 0 0'; // shut up fteqcc, there IS a reference
+ targCenter = '0 0 0'; // shut up fteqcc, there IS a reference
for (i = 0; i < panel_cnt; ++i) {
if(i == id || !HUD_Panel_CheckActive(i))
targCenter_x = targPos_x + 0.5 * targSize_x;
targCenter_y = targPos_y + 0.5 * targSize_y;
- float k, y;
if(myCenter_x < targCenter_x && myCenter_y < targCenter_y && resizeCorner != 1) // top left (of target panel)
{
if(myPos_x + mySize_x - targPos_x < myPos_y + mySize_y - targPos_y) // push it to the side
vector targSize;
vector myCenter;
vector targCenter;
+ myCenter = '0 0 0'; // shut up fteqcc, there IS a reference
+ targCenter = '0 0 0'; // shut up fteqcc, there IS a reference
for (i = 0; i < panel_cnt; ++i) {
if(i == id || !HUD_Panel_CheckActive(i))
targCenter_x = targPos_x + 0.5 * targSize_x;
targCenter_y = targPos_y + 0.5 * targSize_y;
- float k, y;
if(myCenter_x < targCenter_x && myCenter_y < targCenter_y) // top left (of the target panel)
{
if(myPos_x + mySize_x - targPos_x < myPos_y + mySize_y - targPos_y) // push it to the side
float weaponorder_cmp(float i, float j, entity pass)
{
- float d, ii, ij;
+ float d;
d = mod(weaponorder[i].impulse + 9, 10) - mod(weaponorder[j].impulse + 9, 10);
if(d)
return d;
void HUD_WeaponIcons()
{
float id = 0;
- float alpha, height, accuracybar_height, stat_weapons; // "constants"
- vector pos, mySize, mysize, mypos, accuracy_color;
+ float alpha, stat_weapons; // "constants"
+ vector pos, mySize, accuracy_color;
float i, weapid, fade, weapon_stats, weapon_hit, weapon_damage, weapon_cnt; // variables
pos = HUD_Panel_GetPos(id);
mySize = HUD_Panel_GetSize(id);
- accuracybar_height = cvar_or("hud_weaponicons_accuracy_height", 3);
stat_weapons = getstati(STAT_WEAPONS);
for(i = WEP_FIRST; i <= WEP_LAST; ++i)
weapon_hit = weapon_hits[self.weapon-WEP_FIRST];
weapon_damage = weapon_fired[self.weapon-WEP_FIRST];
+ // draw background behind currently selected weapon
if(self.weapon == activeweapon)
drawpic_skin(pos + eX * column * mySize_x*(1/columns) + eY * row * mySize_y*(1/rows), "weapon_current_bg", eX * mySize_x*(1/columns) + eY * mySize_y*(1/rows), '1 1 1', fade * hud_alpha_fg, DRAWFLAG_NORMAL);
- drawpic(pos + eX * column * mySize_x*(1/columns) + eY * row * mySize_y*(1/rows), strcat("gfx/weapons/weapon", self.netname), eX * mySize_x*(1/columns) + eY * mySize_y*(1/rows), '1 1 1', fade * hud_alpha_fg, DRAWFLAG_NORMAL);
-
- if(cvar_or("hud_weaponicons_number", 1))
- drawstring(pos + eX * column * mySize_x*(1/columns) + eY * row * mySize_y*(1/rows), ftos(weapid), '1 1 0' * 0.5 * mySize_y*(1/rows), '1 1 1', hud_alpha_fg, DRAWFLAG_NORMAL);
// draw the weapon accuracy on the HUD
if(hud_accuracy_hud && !(gametype == GAME_RACE || gametype == GAME_CTS))
accuracy_color = HUD_AccuracyColor(weapon_stats);
if(weapon_damage)
- drawpic_skin(pos + eX * column * mySize_x*(1/columns) + eY * row * mySize_y*(1/rows) - '2 0 0' + eY * (mySize_y/rows - accuracybar_height), "accuracy_bar.tga", eX * mySize_x*(1/columns) + eY * accuracybar_height, accuracy_color, hud_alpha_fg, DRAWFLAG_NORMAL);
+ drawpic_skin(pos + eX * column * mySize_x*(1/columns) + eY * row * mySize_y*(1/rows), "weapon_accuracy", eX * mySize_x*(1/columns) + eY * mySize_y*(1/rows), accuracy_color, hud_alpha_fg, DRAWFLAG_NORMAL);
}
+
+ // draw the weapon icon
+ drawpic(pos + eX * column * mySize_x*(1/columns) + eY * row * mySize_y*(1/rows), strcat("gfx/weapons/weapon", self.netname), eX * mySize_x*(1/columns) + eY * mySize_y*(1/rows), '1 1 1', fade * hud_alpha_fg, DRAWFLAG_NORMAL);
+
+ if(cvar_or("hud_weaponicons_number", 1))
+ drawstring(pos + eX * column * mySize_x*(1/columns) + eY * row * mySize_y*(1/rows), ftos(weapid), '1 1 0' * 0.5 * mySize_y*(1/rows), '1 1 1', hud_alpha_fg, DRAWFLAG_NORMAL);
}
++row;
if(cvar("hud_inventory_onlycurrent")) {
if (stat_items & GetAmmoItemCode(i)) {
- drawpic_skin(pos, "ammo_current_bg", mySize, '1 1 1', hud_alpha_fg, DRAWFLAG_NORMAL);
drawpic_skin(pos + eY * 0.05 * mySize_y, GetAmmoPicture(i), '1 1 0' * 0.8 * mySize_y, '1 1 1', hud_alpha_fg, DRAWFLAG_NORMAL);
if(a < 10)
HUD_DrawXNum(pos + eX * 0.8 * mySize_y + eY * 0.25 * mySize_y, a, strlen(ftos(a)), 0, 0.5 * mySize_y, '0.7 0 0', 0, 0, hud_alpha_fg, DRAWFLAG_NORMAL);
// Powerups (#2)
//
-float shield_maxtime;
-float strength_maxtime;
void HUD_Powerups() {
float id = 2;
float stat_items;
mySize -= '2 2 0' * padding;
}
- float armor, health, x;
+ float armor, health;
armor = getstati(STAT_ARMOR);
health = getstati(STAT_HEALTH);
float score, distribution, leader;
float score_len, distr_len;
- vector score_pos, secondary_score_pos, distribution_color;
+ vector distribution_color;
entity tm, pl, me;
me = (spectatee_status > 0) ? playerslots[spectatee_status - 1] : playerslots[player_localentnum - 1];
//Manage the progress bar if any
if (nb_pb_starttime > 0)
{
- vector s;
dt = mod(time - nb_pb_starttime, nb_pb_period);
// one period of positive triangle
p = 2 * dt / nb_pb_period;