return stringwidth(s, FALSE, theSize);
}
-void drawstringright(vector position, string text, vector scale, vector rgb, float alpha, float flag)
+void drawstringright(vector position, string text, vector scale, vector rgb, float theAlpha, float flag)
{
position_x -= 2 / 3 * strlen(text) * scale_x;
- drawstring(position, text, scale, rgb, alpha, flag);
+ drawstring(position, text, scale, rgb, theAlpha, flag);
}
-void drawstringcenter(vector position, string text, vector scale, vector rgb, float alpha, float flag)
+void drawstringcenter(vector position, string text, vector scale, vector rgb, float theAlpha, float flag)
{
position_x = 0.5 * (vid_conwidth - 0.6025 * strlen(text) * scale_x);
- drawstring(position, text, scale, rgb, alpha, flag);
+ drawstring(position, text, scale, rgb, theAlpha, flag);
}
// return the string of the given race place
*/
// draw the background/borders
-#define HUD_Panel_DrawBg(alpha)\
+#define HUD_Panel_DrawBg(theAlpha)\
if(panel_bg != "0")\
- draw_BorderPicture(panel_pos - '1 1 0' * panel_bg_border, panel_bg, panel_size + '1 1 0' * 2 * panel_bg_border, panel_bg_color, panel_bg_alpha * alpha, '1 1 0' * (panel_bg_border/BORDER_MULTIPLIER))
+ draw_BorderPicture(panel_pos - '1 1 0' * panel_bg_border, panel_bg, panel_size + '1 1 0' * 2 * panel_bg_border, panel_bg_color, panel_bg_alpha * theAlpha, '1 1 0' * (panel_bg_border/BORDER_MULTIPLIER))
//basically the same code of draw_ButtonPicture and draw_VertButtonPicture for the menu
void HUD_Panel_DrawProgressBar(vector theOrigin, vector theSize, string pic, float length_ratio, float vertical, float baralign, vector theColor, float theAlpha, float drawflag)
}
}
-void HUD_Panel_DrawHighlight(vector pos, vector mySize, vector color, float alpha, float drawflag)
+void HUD_Panel_DrawHighlight(vector pos, vector mySize, vector color, float theAlpha, float drawflag)
{
- if(!alpha)
+ if(!theAlpha)
return;
string pic;
pic = "gfx/hud/default/num_leading";
}
- drawsubpic(pos, eX * min(mySize_x * 0.5, mySize_y) + eY * mySize_y, pic, '0 0 0', '0.25 1 0', color, alpha, drawflag);
+ drawsubpic(pos, eX * min(mySize_x * 0.5, mySize_y) + eY * mySize_y, pic, '0 0 0', '0.25 1 0', color, theAlpha, drawflag);
if(mySize_x/mySize_y > 2)
- drawsubpic(pos + eX * mySize_y, eX * (mySize_x - 2 * mySize_y) + eY * mySize_y, pic, '0.25 0 0', '0.5 1 0', color, alpha, drawflag);
- drawsubpic(pos + eX * mySize_x - eX * min(mySize_x * 0.5, mySize_y), eX * min(mySize_x * 0.5, mySize_y) + eY * mySize_y, pic, '0.75 0 0', '0.25 1 0', color, alpha, drawflag);
+ drawsubpic(pos + eX * mySize_y, eX * (mySize_x - 2 * mySize_y) + eY * mySize_y, pic, '0.25 0 0', '0.5 1 0', color, theAlpha, drawflag);
+ drawsubpic(pos + eX * mySize_x - eX * min(mySize_x * 0.5, mySize_y), eX * min(mySize_x * 0.5, mySize_y) + eY * mySize_y, pic, '0.75 0 0', '0.25 1 0', color, theAlpha, drawflag);
}
// Weapon icons (#0)
void HUD_Weapons(void)
{
// declarations
- float weapons_stat = getstati(STAT_WEAPONS);
+ float weapons_stat = getstati(STAT_WEAPONS);
float i, f, a, j, factor;
- float screen_ar, center_x, center_y;
- float weapon_count, weapon_id, weapon_alpha;
- float row, column, rows, columns;
+ float screen_ar, center_x, center_y;
+ float weapon_count, weapon_id, weapon_alpha;
+ float row, column, rows, columns;
float aspect = autocvar_hud_panel_weapons_aspect;
-
+
float show_accuracy, panel_weapon_accuracy;
-
+
float timeout = autocvar_hud_panel_weapons_timeout;
float timein_effect_length = (autocvar_hud_panel_weapons_timeout_effect ? 0.375 : 0);
float timeout_effect_length = (autocvar_hud_panel_weapons_timeout_effect ? 0.75 : 0);
-
+
float ammo_type, ammo_full, ammo_alpha;
float barsize_x, barsize_y, baroffset_x, baroffset_y;
-
+
float when = autocvar_hud_panel_weapons_complainbubble_time;
float fadetime = autocvar_hud_panel_weapons_complainbubble_fadetime;
-
+
vector weapon_pos, weapon_size;
- vector old_panel_size;
+ local noref vector old_panel_size; // fteqcc sucks
vector color, ammo_color;
-
+
// check to see if we want to continue
- if(hud != HUD_NORMAL) { return; }
-
+ if(hud != HUD_NORMAL) { return; }
+
if(!autocvar__hud_configure)
+ {
if((!autocvar_hud_panel_weapons) || (spectatee_status == -1))
return;
else if(timeout && time >= weapontime + timeout + timeout_effect_length)
weaponprevtime = time;
return;
}
+ }
else
hud_configure_active_panel = HUD_PANEL_WEAPONS;
// update generic hud functions
HUD_Panel_UpdateCvars(weapons);
HUD_Panel_ApplyFadeAlpha();
-
+
// calculate fading effect to weapon images for when the panel is idle
if(autocvar_hud_panel_weapons_fade)
{
}
}
for(i = weapon_cnt; i < WEP_MAXCOUNT; ++i)
- weaponorder[i] = NULL;
+ weaponorder[i] = world;
heapsort(weapon_cnt, weaponorder_swap, weaponorder_cmp, world);
weaponorder_cmp_str = string_null;
}
-
+
// determine which weapons are going to be shown
if (autocvar_hud_panel_weapons_onlyowned)
{
if (weapons_stat == 0) // create some fake weapons anyway
for(i = 0; i <= WEP_LAST-WEP_FIRST; i += floor((WEP_LAST-WEP_FIRST)/5))
weapons_stat |= power2of(i);
-
+
if(menu_enabled != 2)
HUD_Panel_DrawBg(1); // also draw the bg of the entire panel
}
-
+
// do we own this weapon?
for(i = 0; i <= WEP_LAST-WEP_FIRST; ++i)
if(weapons_stat & weaponorder[i].weapons)
++weapon_count;
-
+
// add it anyway if weaponcomplain is shown
if((!autocvar__hud_configure)
&& (autocvar_hud_panel_weapons_complainbubble
&& time - complain_weapon_time < when + fadetime))
++weapon_count;
-
+
// might as well commit suicide now, no reason to live ;)
if (weapon_count == 0) { return; }
-
+
// reduce size of the panel
if (panel_size_y > panel_size_x)
{
}
}
- // draw the background, then change the virtual size of it to better fit other items inside
+ // draw the background, then change the virtual size of it to better fit other items inside
HUD_Panel_DrawBg(1);
if(panel_bg_padding)
{
panel_pos += '1 1 0' * panel_bg_padding;
- panel_size -= '1 1 0' * panel_bg_padding;
+ panel_size -= '2 2 0' * panel_bg_padding;
}
// after the sizing and animations are done, update the other values
rows = bound(1, floor((sqrt(4 * aspect * rows * weapon_count + rows * rows) + rows + 0.5) / 2), weapon_count);
columns = ceil(weapon_count/rows);
weapon_size = eX * panel_size_x*(1/columns) + eY * panel_size_y*(1/rows);
-
+
// calculate position/size for visual bar displaying ammount of ammo status
if (autocvar_hud_panel_weapons_ammo)
{
// retrieve information about the current weapon to be drawn
self = weaponorder[i];
weapon_id = self.impulse;
-
+
// skip if this weapon doesn't exist
if (!self || self.impulse < 0) { continue; }
-
+
// skip this weapon if we don't own it (and onlyowned is enabled)-- or if weapons_complainbubble is showing for this weapon
if (autocvar_hud_panel_weapons_onlyowned
&& !((weapons_stat & self.weapons)
&& time - complain_weapon_time < when + fadetime
&& autocvar_hud_panel_weapons_complainbubble)))
continue;
-
+
// figure out the drawing position of weapon
weapon_pos = (panel_pos
+ eX * column * weapon_size_x
case 1: // weapon number
drawstring(weapon_pos, ftos(weapon_id), '1 1 0' * 0.5 * weapon_size_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
break;
-
+
case 2: // bind
drawstring(weapon_pos, getcommandkey(ftos(weapon_id), strcat("impulse ", ftos(weapon_id))), '1 1 0' * 0.5 * weapon_size_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
break;
-
+
case 3: // weapon name
drawstring(weapon_pos, self.netname, '1 1 0' * 0.5 * weapon_size_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
break;
-
+
default: // nothing
break;
}
-
+
// draw ammo status bar
if(autocvar_hud_panel_weapons_ammo && self.weapon != WEP_TUBA && self.weapon != WEP_LASER && self.weapon != WEP_PORTO)
{
{
drawpic_aspect_skin(weapon_pos, strcat("weapon", self.netname), weapon_size, '0 0 0', panel_fg_alpha * 0.5, DRAWFLAG_NORMAL);
}
-
+
// draw the complain message
if(time - complain_weapon_time < when + fadetime && self.weapon == complain_weapon && autocvar_hud_panel_weapons_complainbubble)
{
else
color = '1 1 1';
- float alpha;
+ float theAlpha;
if(currently_selected)
- alpha = 1;
+ theAlpha = 1;
else
- alpha = 0.7;
+ theAlpha = 0.7;
vector picpos, numpos;
if(autocvar_hud_panel_ammo_iconalign)
drawpic_aspect_skin(myPos, "ammo_current_bg", mySize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
if(a > 0 && autocvar_hud_panel_ammo_progressbar)
- HUD_Panel_DrawProgressBar(myPos + eX * autocvar_hud_panel_ammo_progressbar_xoffset * mySize_x, mySize - eX * autocvar_hud_panel_ammo_progressbar_xoffset * mySize_x, autocvar_hud_panel_ammo_progressbar_name, a/autocvar_hud_panel_ammo_maxammo, 0, 0, color, autocvar_hud_progressbar_alpha * panel_fg_alpha * alpha, DRAWFLAG_NORMAL);
+ HUD_Panel_DrawProgressBar(myPos + eX * autocvar_hud_panel_ammo_progressbar_xoffset * mySize_x, mySize - eX * autocvar_hud_panel_ammo_progressbar_xoffset * mySize_x, autocvar_hud_panel_ammo_progressbar_name, a/autocvar_hud_panel_ammo_maxammo, 0, 0, color, autocvar_hud_progressbar_alpha * panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL);
if(autocvar_hud_panel_ammo_text)
{
if(a > 0 || infinite_ammo)
- drawstring_aspect(numpos, ftos(a), eX * (2/3) * mySize_x + eY * mySize_y, color, panel_fg_alpha * alpha, DRAWFLAG_NORMAL);
+ drawstring_aspect(numpos, ftos(a), eX * (2/3) * mySize_x + eY * mySize_y, color, panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL);
else // "ghost" ammo count
- drawstring_aspect(numpos, ftos(a), eX * (2/3) * mySize_x + eY * mySize_y, '0 0 0', panel_fg_alpha * alpha * 0.5, DRAWFLAG_NORMAL);
+ drawstring_aspect(numpos, ftos(a), eX * (2/3) * mySize_x + eY * mySize_y, '0 0 0', panel_fg_alpha * theAlpha * 0.5, DRAWFLAG_NORMAL);
}
if(a > 0 || infinite_ammo)
- drawpic_aspect_skin(picpos, GetAmmoPicture(itemcode), '1 1 0' * mySize_y, '1 1 1', panel_fg_alpha * alpha, DRAWFLAG_NORMAL);
+ drawpic_aspect_skin(picpos, GetAmmoPicture(itemcode), '1 1 0' * mySize_y, '1 1 1', panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL);
else // "ghost" ammo icon
- drawpic_aspect_skin(picpos, GetAmmoPicture(itemcode), '1 1 0' * mySize_y, '0 0 0', panel_fg_alpha * alpha * 0.5, DRAWFLAG_NORMAL);
+ drawpic_aspect_skin(picpos, GetAmmoPicture(itemcode), '1 1 0' * mySize_y, '0 0 0', panel_fg_alpha * theAlpha * 0.5, DRAWFLAG_NORMAL);
}
void HUD_Ammo(void)
ammo_size = eX * mySize_x*(1/columns) + eY * mySize_y*(1/rows);
}
- vector offset;
+ local noref vector offset; // fteqcc sucks
float newSize;
if(ammo_size_x/ammo_size_y > 3)
{
}
}
-void DrawNumIcon(vector myPos, vector mySize, float x, string icon, float vertical, float icon_right_align, vector color, float alpha)
+void DrawNumIcon(vector myPos, vector mySize, float x, string icon, float vertical, float icon_right_align, vector color, float theAlpha)
{
vector newPos, newSize;
vector picpos, numpos;
}
newSize_y /= 2;
- drawpic_aspect_skin(picpos, icon, newSize, '1 1 1', panel_fg_alpha * alpha, DRAWFLAG_NORMAL);
+ drawpic_aspect_skin(picpos, icon, newSize, '1 1 1', panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL);
// make number smaller than icon, it looks better
// reduce only y to draw numbers with different number of digits with the same y size
numpos_y += newSize_y * ((1 - 0.7) / 2);
newSize_y *= 0.7;
- drawstring_aspect(numpos, ftos(x), newSize, color, panel_fg_alpha * alpha, DRAWFLAG_NORMAL);
+ drawstring_aspect(numpos, ftos(x), newSize, color, panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL);
return;
}
picpos = newPos;
}
- drawstring_aspect(numpos, ftos(x), '2 1 0' * newSize_y, color, panel_fg_alpha * alpha, DRAWFLAG_NORMAL);
- drawpic_aspect_skin(picpos, icon, '1 1 0' * newSize_y, '1 1 1', panel_fg_alpha * alpha, DRAWFLAG_NORMAL);
+ drawstring_aspect(numpos, ftos(x), '2 1 0' * newSize_y, color, panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL);
+ drawpic_aspect_skin(picpos, icon, '1 1 0' * newSize_y, '1 1 1', panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL);
}
void DrawNumIcon_expanding(vector myPos, vector mySize, float x, string icon, float vertical, float icon_right_align, vector color, float fadelerp)
gentle = (autocvar_cl_gentle || autocvar_cl_gentle_messages);
if(msg == MSG_SUICIDE) {
if (type == DEATH_TEAMCHANGE) {
- centerprint(sprintf(_("You are now on: %s"), s1));
+ centerprint_hud(sprintf(_("You are now on: %s"), s1));
} else if (type == DEATH_AUTOTEAMCHANGE) {
- centerprint(sprintf(_("You have been moved into a different team to improve team balance\nYou are now on: %s"), s1));
+ centerprint_hud(sprintf(_("You have been moved into a different team to improve team balance\nYou are now on: %s"), s1));
} else if (type == DEATH_CAMP) {
if(gentle)
- centerprint(_("^1Reconsider your tactics, camper!"));
+ centerprint_hud(_("^1Reconsider your tactics, camper!"));
else
- centerprint(_("^1Die camper!"));
+ centerprint_hud(_("^1Die camper!"));
} else if (type == DEATH_NOAMMO) {
if(gentle)
- centerprint(_("^1You are reinserted into the game for running out of ammo..."));
+ centerprint_hud(_("^1You are reinserted into the game for running out of ammo..."));
else
- centerprint(_("^1You were killed for running out of ammo..."));
+ centerprint_hud(_("^1You were killed for running out of ammo..."));
} else if (type == DEATH_ROT) {
if(gentle)
- centerprint(_("^1You need to preserve your health"));
+ centerprint_hud(_("^1You need to preserve your health"));
else
- centerprint(_("^1You grew too old without taking your medicine"));
+ centerprint_hud(_("^1You grew too old without taking your medicine"));
} else if (type == KILL_TEAM_RED || type == KILL_TEAM_BLUE) {
if(gentle)
- centerprint(_("^1Don't go against team mates!"));
+ centerprint_hud(_("^1Don't go against team mates!"));
else
- centerprint(_("^1Don't shoot your team mates!"));
+ centerprint_hud(_("^1Don't shoot your team mates!"));
} else if (type == DEATH_QUIET) {
// do nothing
} else { // generic message
if(gentle)
- centerprint(_("^1You need to be more careful!"));
+ centerprint_hud(_("^1You need to be more careful!"));
else
- centerprint(_("^1You killed your own dumb self!"));
+ centerprint_hud(_("^1You killed your own dumb self!"));
}
} else if(msg == MSG_KILL) {
if (type == KILL_TEAM_RED || type == KILL_TEAM_BLUE) {
if(gentle) {
- centerprint(sprintf(_("^1Moron! You went against ^7%s^1, a team mate!"), s1));
+ centerprint_hud(sprintf(_("^1Moron! You went against ^7%s^1, a team mate!"), s1));
} else {
- centerprint(sprintf(_("^1Moron! You fragged ^7%s^1, a team mate!"), s1));
+ centerprint_hud(sprintf(_("^1Moron! You fragged ^7%s^1, a team mate!"), s1));
}
} else if (type == KILL_FIRST_BLOOD) {
if(gentle) {
- centerprint(_("^1First score"));
+ centerprint_hud(_("^1First score"));
} else {
- centerprint(_("^1First blood"));
+ centerprint_hud(_("^1First blood"));
}
} else if (type == KILL_FIRST_VICTIM) {
if(gentle) {
- centerprint(_("^1First casualty"));
+ centerprint_hud(_("^1First casualty"));
} else {
- centerprint(_("^1First victim"));
+ centerprint_hud(_("^1First victim"));
}
} else if (type == KILL_TYPEFRAG) { // s2 contains "advanced kill messages" such as ping, handicap...
if(gentle) {
- centerprint(strcat(sprintf(_("^1You scored against ^7%s^1 who was typing!"), s1), s2));
+ centerprint_hud(strcat(sprintf(_("^1You scored against ^7%s^1 who was typing!"), s1), s2));
} else {
- centerprint(strcat(sprintf(_("^1You typefragged ^7%s"), s1), s2));
+ centerprint_hud(strcat(sprintf(_("^1You typefragged ^7%s"), s1), s2));
}
} else if (type == KILL_TYPEFRAGGED) {
if(gentle) {
- centerprint(strcat(sprintf(_("^1You were scored against by ^7%s^1 while you were typing!"), s1), s2));
+ centerprint_hud(strcat(sprintf(_("^1You were scored against by ^7%s^1 while you were typing!"), s1), s2));
} else {
- centerprint(strcat(sprintf(_("^1You were typefragged by ^7%s"), s1), s2));
+ centerprint_hud(strcat(sprintf(_("^1You were typefragged by ^7%s"), s1), s2));
}
} else if (type == KILL_FRAG) {
if(gentle) {
- centerprint(strcat(sprintf(_("^4You scored against ^7%s"), s1), s2));
+ centerprint_hud(strcat(sprintf(_("^4You scored against ^7%s"), s1), s2));
} else {
- centerprint(strcat(sprintf(_("^4You fragged ^7%s"), s1), s2));
+ centerprint_hud(strcat(sprintf(_("^4You fragged ^7%s"), s1), s2));
}
} else { // generic message
if(gentle) {
- centerprint(strcat(sprintf(_("^1You were scored against by ^7%s"), s1), s2));
+ centerprint_hud(strcat(sprintf(_("^1You were scored against by ^7%s"), s1), s2));
} else {
- centerprint(strcat(sprintf(_("^1You were fragged by ^7%s"), s1), s2));
+ centerprint_hud(strcat(sprintf(_("^1You were fragged by ^7%s"), s1), s2));
}
}
} else if(msg == MSG_KILL_ACTION) {
// TODO: invent more centerprints here?
- centerprint(_("^1Watch your step!"));
+ centerprint_hud(_("^1Watch your step!"));
}
}
c2 = rotate('1 0 0' * mi_min_x + '0 1 0' * mi_max_y, teamradar_angle * DEG2RAD);
c3 = rotate('1 0 0' * mi_max_x + '0 1 0' * mi_min_y, teamradar_angle * DEG2RAD);
span = '0 0 0';
- span_x = max4(c0_x, c1_x, c2_x, c3_x) - min4(c0_x, c1_x, c2_x, c3_x);
- span_y = max4(c0_y, c1_y, c2_y, c3_y) - min4(c0_y, c1_y, c2_y, c3_y);
+ span_x = max(c0_x, c1_x, c2_x, c3_x) - min(c0_x, c1_x, c2_x, c3_x);
+ span_y = max(c0_y, c1_y, c2_y, c3_y) - min(c0_y, c1_y, c2_y, c3_y);
// max-min distance must fit the radar in x=x, y=y
bigsize = min(
drawstring_aspect(pos + eX * 0.75 * mySize_x, distribution_str, eX * 0.25 * mySize_x + eY * (1/3) * mySize_y, distribution_color, panel_fg_alpha, DRAWFLAG_NORMAL);
} else { // teamgames
float scores_count, row, column, rows, columns;
- vector offset;
+ local noref vector offset; // fteqcc sucks
vector score_pos, score_size; //for scores other than myteam
if (spectatee_status == -1 || autocvar_hud_panel_score_rankings)
{
switch(keyteam)
{
case COLOR_TEAM1:
- drawpic_aspect_skin(pa, "kh_redarrow", kh_asize, '1 1 1', aa, DRAWFLAG_NORMAL); // show 30% alpha key
+ drawpic_aspect_skin(pa, "kh_redarrow", kh_asize, '1 1 1', aa, DRAWFLAG_NORMAL); // show 30% theAlpha key
break;
case COLOR_TEAM2:
- drawpic_aspect_skin(pa, "kh_bluearrow", kh_asize, '1 1 1', aa, DRAWFLAG_NORMAL); // show 30% alpha key
+ drawpic_aspect_skin(pa, "kh_bluearrow", kh_asize, '1 1 1', aa, DRAWFLAG_NORMAL); // show 30% theAlpha key
break;
case COLOR_TEAM3:
- drawpic_aspect_skin(pa, "kh_yellowarrow", kh_asize, '1 1 1', aa, DRAWFLAG_NORMAL); // show 30% alpha key
+ drawpic_aspect_skin(pa, "kh_yellowarrow", kh_asize, '1 1 1', aa, DRAWFLAG_NORMAL); // show 30% theAlpha key
break;
case COLOR_TEAM4:
- drawpic_aspect_skin(pa, "kh_pinkarrow", kh_asize, '1 1 1', aa, DRAWFLAG_NORMAL); // show 30% alpha key
+ drawpic_aspect_skin(pa, "kh_pinkarrow", kh_asize, '1 1 1', aa, DRAWFLAG_NORMAL); // show 30% theAlpha key
break;
default:
break;
switch(i) // YAY! switch(i) inside a for loop for i. DailyWTF, here we come!
{
case 0:
- drawpic_aspect_skin(p, "kh_red", kh_size, '1 1 1', a, DRAWFLAG_NORMAL); // show 30% alpha key
+ drawpic_aspect_skin(p, "kh_red", kh_size, '1 1 1', a, DRAWFLAG_NORMAL); // show 30% theAlpha key
break;
case 1:
- drawpic_aspect_skin(p, "kh_blue", kh_size, '1 1 1', a, DRAWFLAG_NORMAL); // show 30% alpha key
+ drawpic_aspect_skin(p, "kh_blue", kh_size, '1 1 1', a, DRAWFLAG_NORMAL); // show 30% theAlpha key
break;
case 2:
- drawpic_aspect_skin(p, "kh_yellow", kh_size, '1 1 1', a, DRAWFLAG_NORMAL); // show 30% alpha key
+ drawpic_aspect_skin(p, "kh_yellow", kh_size, '1 1 1', a, DRAWFLAG_NORMAL); // show 30% theAlpha key
break;
case 3:
- drawpic_aspect_skin(p, "kh_pink", kh_size, '1 1 1', a, DRAWFLAG_NORMAL); // show 30% alpha key
+ drawpic_aspect_skin(p, "kh_pink", kh_size, '1 1 1', a, DRAWFLAG_NORMAL); // show 30% theAlpha key
break;
}
}
}
}
}
- panel_bg_alpha = max(0.75, panel_bg_alpha); // force an alpha of at least 0.75
+ panel_bg_alpha = max(0.75, panel_bg_alpha); // force an theAlpha of at least 0.75
}
vector pos, mySize;
{
vector chatsize;
chatsize = '1 1 0' * autocvar_con_chatsize;
- cvar_set("con_chatrect_x", "9001"); // over 9000, we'll fake it instead for more control over alpha and such
+ cvar_set("con_chatrect_x", "9001"); // over 9000, we'll fake it instead for more control over theAlpha and such
float i, a;
for(i = 0; i < autocvar_con_chat; ++i)
{
speed_baralign = (autocvar_hud_panel_physics_baralign == 2);
acceleration_baralign = (autocvar_hud_panel_physics_baralign == 3);
}
- if (autocvar_hud_panel_physics_acceleration_progressbar_mode == 0)
+ if (autocvar_hud_panel_physics_acceleration_mode == 0)
acceleration_baralign = 3; //override hud_panel_physics_baralign value for acceleration
//draw speed
float centerprint_time[CENTERPRINT_MAX_MSGS];
float centerprint_expire_time[CENTERPRINT_MAX_MSGS];
float centerprint_countdown_num[CENTERPRINT_MAX_MSGS];
-float centerprint_fadetime;
float centerprint_showing;
void centerprint_generic(float new_id, string strMessage, float duration, float countdown_num)
if (!centerprint_showing)
centerprint_showing = TRUE;
- centerprint_fadetime = bound(0, autocvar_hud_panel_centerprint_fadetime, 1);
-
for (i=0, j=cpm_index; i<CENTERPRINT_MAX_MSGS; ++i, ++j)
{
if (j == CENTERPRINT_MAX_MSGS)
if (strMessage == "" && centerprint_messages[j] != "" && centerprint_countdown_num[j] == 0)
{
// fade out the current msg (duration and countdown_num are ignored)
- centerprint_time[j] = centerprint_fadetime;
- if (centerprint_expire_time[j] > time + centerprint_fadetime || centerprint_expire_time[j] < time)
- centerprint_expire_time[j] = time + centerprint_fadetime;
+ centerprint_time[j] = min(5, autocvar_hud_panel_centerprint_fade_out);
+ if (centerprint_expire_time[j] > time + min(5, autocvar_hud_panel_centerprint_fade_out) || centerprint_expire_time[j] < time)
+ centerprint_expire_time[j] = time + min(5, autocvar_hud_panel_centerprint_fade_out);
return;
}
break; // found a msg with the same id, at position j
centerprint_countdown_num[j] = countdown_num;
}
-void centerprint(string strMessage)
+void centerprint_hud(string strMessage)
{
centerprint_generic(0, strMessage, autocvar_hud_panel_centerprint_time, 0);
}
else if (r > 0.8)
centerprint_generic(0, sprintf("^1Multiline message at time %s that\n^1lasts longer than normal", seconds_tostring(time)), 20, 0);
else
- centerprint(sprintf("Message at time %s", seconds_tostring(time)));
+ centerprint_hud(sprintf("Message at time %s", seconds_tostring(time)));
hud_configure_cp_generation_time = time + 1 + random()*4;
}
}
if (scoreboard_bottom >= 0.96 * vid_conheight)
return;
vector target_pos;
+
target_pos = eY * scoreboard_bottom + eX * 0.5 * (vid_conwidth - panel_size_x);
- panel_pos = panel_pos + (target_pos - panel_pos) * sqrt(scoreboard_fade_alpha);
- panel_size_y = min(panel_size_y, vid_conheight - scoreboard_bottom);
+
+ if(target_pos_y > panel_pos_y)
+ {
+ panel_pos = panel_pos + (target_pos - panel_pos) * sqrt(scoreboard_fade_alpha);
+ panel_size_y = min(panel_size_y, vid_conheight - scoreboard_bottom);
+ }
}
HUD_Panel_DrawBg(1);
continue;
}
- // fade the centerprint in/out
- if (centerprint_time[j] < 0 || centerprint_expire_time[j] - centerprint_fadetime > time)
- {
- a = bound(0, (time - (centerprint_expire_time[j] - centerprint_time[j])) / centerprint_fadetime, 1);
- }
+ // fade the centerprint_hud in/out
+ if (centerprint_time[j] < 0 || centerprint_expire_time[j] - autocvar_hud_panel_centerprint_fade_out > time)
+ a = bound(0, (time - (centerprint_expire_time[j] - centerprint_time[j])) / max(0.0001, autocvar_hud_panel_centerprint_fade_in), 1);
else if (centerprint_expire_time[j] > time)
- {
- a = (centerprint_expire_time[j] - time) / centerprint_fadetime;
- }
+ a = (centerprint_expire_time[j] - time) / max(0.0001, autocvar_hud_panel_centerprint_fade_out);
+
+ // set the size from fading in/out before subsequent fading
+ sz = autocvar_hud_panel_centerprint_fade_minfontsize + a * (1 - autocvar_hud_panel_centerprint_fade_minfontsize);
// also fade it based on positioning
- a = a * bound(0.5, (1 - (i / 2)), 1); // pass one: all messages after the first have half alpha
- a = a * bound(0.5, (1 - (i / 10)), 1); // pass two: after that, gradually lower alpha even more for each message
+ if(autocvar_hud_panel_centerprint_fade_subsequent)
+ {
+ a = a * bound(autocvar_hud_panel_centerprint_fade_subsequent_passone_minalpha, (1 - (i / max(1, autocvar_hud_panel_centerprint_fade_subsequent_passone))), 1); // pass one: all messages after the first have half theAlpha
+ a = a * bound(autocvar_hud_panel_centerprint_fade_subsequent_passtwo_minalpha, (1 - (i / max(1, autocvar_hud_panel_centerprint_fade_subsequent_passtwo))), 1); // pass two: after that, gradually lower theAlpha even more for each message
+ }
- // finally set the size based on the new alpha
- sz = 0.75 + a * (1 - 0.75);
+ // finally set the size based on the new theAlpha from subsequent fading
+ sz = sz * (autocvar_hud_panel_centerprint_fade_subsequent_minfontsize + a * (1 - autocvar_hud_panel_centerprint_fade_subsequent_minfontsize));
drawfontscale = sz * '1 1 0';
if (centerprint_countdown_num[j])
n = tokenizebyseparator(sprintf(centerprint_messages[j], centerprint_countdown_num[j]), "\n");
else
n = tokenizebyseparator(centerprint_messages[j], "\n");
+
if (autocvar_hud_panel_centerprint_flip)
{
// check if the message can be entirely shown
pos_y -= fontsize_y;
else
pos_y -= fontsize_y * CENTERPRINT_SPACING/2;
- // NOTE: uncommented so as to not reject messages whenever they are "too large" -- This just continues drawing it anyway.
- //if (pos_y < panel_pos_y) // check if the next line can be shown
- //{
- // drawfontscale = '1 1 0';
- // return;
- //}
}
}
current_msg_pos_y = pos_y; // save starting pos (first line) of the current message
}
else
pos_y += fontsize_y * CENTERPRINT_SPACING/2;
- // NOTE: uncommented so as to not reject messages whenever they are "too large" -- This just continues drawing it anyway.
- //if (!autocvar_hud_panel_centerprint_flip && pos_y > panel_pos_y + panel_size_y - fontsize_y) // check if the next line can be shown
- //{
- // drawfontscale = '1 1 0';
- // return;
- //}
}
}
msg_size = pos_y - msg_size;
pos_y = current_msg_pos_y - CENTERPRINT_SPACING * fontsize_y;
if (a < 1 && centerprint_msgID[j] == 0) // messages with id can be replaced just after they are faded out, so never move over them the next messages
pos_y += (msg_size + CENTERPRINT_SPACING * fontsize_y) * (1 - sqrt(sz));
+
+ if (pos_y < panel_pos_y) // check if the next message can be shown
+ {
+ drawfontscale = '1 1 0';
+ return;
+ }
}
else
{
pos_y += CENTERPRINT_SPACING * fontsize_y;
if (a < 1 && centerprint_msgID[j] == 0) // messages with id can be replaced just after they are faded out, so never move over them the next messages
pos_y -= (msg_size + CENTERPRINT_SPACING * fontsize_y) * (1 - sqrt(sz));
+
+ if(pos_y > panel_pos_y + panel_size_y - fontsize_y) // check if the next message can be shown
+ {
+ drawfontscale = '1 1 0';
+ return;
+ }
}
}
drawfontscale = '1 1 0';
void HUD_Main (void)
{
float i;
- // global hud alpha fade
+ // global hud theAlpha fade
if(menu_enabled == 1)
hud_fade_alpha = 1;
else
vector color;
float hud_dock_color_team = autocvar_hud_dock_color_team;
if((teamplay) && hud_dock_color_team) {
- f = stof(getplayerkey(current_player - 1, "colors"));
+ f = stof(getplayerkeyvalue(current_player - 1, "colors"));
color = colormapPaletteColor(mod(f, 16), 1) * hud_dock_color_team;
}
else if(autocvar_hud_configure_teamcolorforced && autocvar__hud_configure && hud_dock_color_team) {
{
string hud_dock_color = autocvar_hud_dock_color;
if(hud_dock_color == "shirt") {
- f = stof(getplayerkey(current_player - 1, "colors"));
+ f = stof(getplayerkeyvalue(current_player - 1, "colors"));
color = colormapPaletteColor(floor(f / 16), 0);
}
else if(hud_dock_color == "pants") {
- f = stof(getplayerkey(current_player - 1, "colors"));
+ f = stof(getplayerkeyvalue(current_player - 1, "colors"));
color = colormapPaletteColor(mod(f, 16), 1);
}
else
hud_configure_prev = autocvar__hud_configure;
- if (!autocvar__hud_configure) // hud config mode disabled, enable normal alpha stuff again
+ if (!autocvar__hud_configure) // hud config mode disabled, enable normal theAlpha stuff again
if (menu_enabled)
menu_enabled = 0;
}