rows = ceil(item_count/columns);
}
- if(vertical)
- return eX * best_rows + eY * best_columns;
- else
- return eX * best_columns + eY * best_rows;
+ return (vertical) ? vec2(best_rows, best_columns) : vec2(best_columns, best_rows);
}
/*
new_size.x = max_panel_width; \
new_size.y = panel_size.y * (new_size.x / panel_size.x); \
} \
- vector new_pos = eX * (panel_bg_border + 0.5 * max_panel_width) + eY * 0.5 * vid_conheight - 0.5 * new_size; \
+ vector new_pos = vec2(panel_bg_border + 0.5 * max_panel_width, 0.5 * vid_conheight) - 0.5 * new_size; \
panel_pos = (1 - autocvar__menu_alpha) * panel_pos + (autocvar__menu_alpha) * new_pos; \
panel_size = (1 - autocvar__menu_alpha) * panel_size + (autocvar__menu_alpha) * new_size; \
} MACRO_END
hud_configure_realGridSize.y = hud_configure_gridSize.y * vid_conheight;
vector s;
// x-axis
- s = eX + eY * vid_conheight;
+ s = vec2(1, vid_conheight);
for(i = 1; i < 1/hud_configure_gridSize.x; ++i)
drawfill(eX * i * hud_configure_realGridSize.x, s, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
// y-axis
- s = eY + eX * vid_conwidth;
+ s = vec2(vid_conwidth, 1);
for(i = 1; i < 1/hud_configure_gridSize.y; ++i)
drawfill(eY * i * hud_configure_realGridSize.y, s, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
}
const string hlBorder2 = "gfx/hud/default/border_highlighted2";
void HUD_Panel_HlBorder(float myBorder, vector color, float theAlpha)
{
- drawfill(panel_pos - '1 1 0' * myBorder, panel_size + '2 2 0' * myBorder, '0 0.5 1', .5 * theAlpha, DRAWFLAG_NORMAL);
- drawpic_tiled(panel_pos - '1 1 0' * myBorder, hlBorder, '8 1 0' * hlBorderSize, eX * (panel_size.x + 2 * myBorder) + eY * hlBorderSize, color, theAlpha, DRAWFLAG_NORMAL);
- drawpic_tiled(panel_pos - '1 1 0' * myBorder + eY * (panel_size.y + 2 * myBorder - hlBorderSize), hlBorder, '8 1 0' * hlBorderSize, eX * (panel_size.x + 2 * myBorder) + eY * hlBorderSize, color, theAlpha, DRAWFLAG_NORMAL);
- drawpic_tiled(panel_pos - '1 1 0' * myBorder + eY * hlBorderSize, hlBorder2, '1 8 0' * hlBorderSize, eY * (panel_size.y + 2 * myBorder - 2 * hlBorderSize) + eX * hlBorderSize, color, theAlpha, DRAWFLAG_NORMAL);
- drawpic_tiled(panel_pos - '1 1 0' * myBorder + eY * hlBorderSize + eX * (panel_size.x + 2 * myBorder - hlBorderSize), hlBorder2, '1 8 0' * hlBorderSize, eY * (panel_size.y + 2 * myBorder - 2 * hlBorderSize) + eX * hlBorderSize, color, theAlpha, DRAWFLAG_NORMAL);
+ vector pos = panel_pos - vec2(myBorder, myBorder);
+ drawfill(pos, panel_size + '2 2 0' * myBorder, '0 0.5 1', .5 * theAlpha, DRAWFLAG_NORMAL);
+ drawpic_tiled(pos, hlBorder, '8 1 0' * hlBorderSize, vec2(panel_size.x + 2 * myBorder, hlBorderSize), color, theAlpha, DRAWFLAG_NORMAL);
+ drawpic_tiled(pos + eY * (panel_size.y + 2 * myBorder - hlBorderSize), hlBorder, '8 1 0' * hlBorderSize, vec2(panel_size.x + 2 * myBorder, hlBorderSize), color, theAlpha, DRAWFLAG_NORMAL);
+ pos.y += hlBorderSize;
+ drawpic_tiled(pos, hlBorder2, '1 8 0' * hlBorderSize, vec2(hlBorderSize, panel_size.y + 2 * myBorder - 2 * hlBorderSize), color, theAlpha, DRAWFLAG_NORMAL);
+ drawpic_tiled(pos + eX * (panel_size.x + 2 * myBorder - hlBorderSize), hlBorder2, '1 8 0' * hlBorderSize, vec2(hlBorderSize, panel_size.y + 2 * myBorder - 2 * hlBorderSize), color, theAlpha, DRAWFLAG_NORMAL);
}
void HUD_Configure_PostDraw()
rows = HUD_GetRowCount(total_ammo_count, mySize, 3);
columns = ceil((total_ammo_count)/rows);
- ammo_size = eX * mySize.x*(1/columns) + eY * mySize.y*(1/rows);
+ ammo_size = vec2(mySize.x / columns, mySize.y / rows);
vector offset = '0 0 0';
float newSize;
{
ammotype = GetAmmoFieldFromNum(i);
DrawAmmoItem(
- pos + eX * column * (ammo_size.x + offset.x) + eY * row * (ammo_size.y + offset.y),
+ pos + vec2(column * (ammo_size.x + offset.x), row * (ammo_size.y + offset.y)),
ammo_size,
ammotype,
(wep.ammo_field == ammotype),
float f = bound(0, nade_statuschange_elapsedtime*2, 1);
- DrawAmmoNades(pos + eX * column * (ammo_size.x + offset.x) + eY * row * (ammo_size.y + offset.y), ammo_size, nade_prevstatus < nade_cnt && nade_cnt != 0 && f < 1, f);
+ DrawAmmoNades(pos + vec2(column * (ammo_size.x + offset.x), row * (ammo_size.y + offset.y)), ammo_size, nade_prevstatus < nade_cnt && nade_cnt != 0 && f < 1, f);
}
draw_endBoldFont();
if (hud_panel_radar_bottom >= 0.96 * vid_conheight)
return;
- panel_pos = eY * hud_panel_radar_bottom + eX * 0.5 * (vid_conwidth - panel_size_x);
- panel_size_y = min(panel_size_y, vid_conheight - hud_panel_radar_bottom);
+ panel_pos.x = 0.5 * (vid_conwidth - panel_size.x);
+ panel_pos.y = hud_panel_radar_bottom;
+ panel_size.y = min(panel_size.y, vid_conheight - hud_panel_radar_bottom);
}
else if(!autocvar__hud_configure && scoreboard_fade_alpha)
{
// move the panel below the scoreboard
if (scoreboard_bottom >= 0.96 * vid_conheight)
return;
- vector target_pos;
- target_pos = eY * scoreboard_bottom + eX * 0.5 * (vid_conwidth - panel_size.x);
+ vector target_pos = vec2(0.5 * (vid_conwidth - panel_size.x), scoreboard_bottom);
if(target_pos.y > panel_pos.y)
{
panel_pos = panel_pos + (target_pos - panel_pos) * sqrt(scoreboard_fade_alpha);
DrawNumIcon(pos, mySize, hp, biggercount, 0, iconalign, HUD_Get_Num_Color(hp, maxtotal), 1);
if(fuel)
- HUD_Panel_DrawProgressBar(pos, eX * mySize.x + eY * 0.2 * mySize.y, "progressbar", fuel/100, 0, (baralign == 1 || baralign == 3), autocvar_hud_progressbar_fuel_color, panel_fg_alpha * 0.8, DRAWFLAG_NORMAL);
+ HUD_Panel_DrawProgressBar(pos, vec2(mySize.x, 0.2 * mySize.y), "progressbar", fuel/100, 0, (baralign == 1 || baralign == 3), autocvar_hud_progressbar_fuel_color, panel_fg_alpha * 0.8, DRAWFLAG_NORMAL);
}
else
{
if(layout)
{
- drawpic_aspect_skin(myPos, pic, eX * 0.7 * mySize.x + eY * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
- drawstring_aspect(myPos + eX * 0.7 * mySize.x, ftos(stat), eX * 0.3 * mySize.x + eY * mySize.y, color, panel_fg_alpha, DRAWFLAG_NORMAL);
+ drawpic_aspect_skin(myPos, pic, vec2(0.7 * mySize.x, mySize.y), '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+ drawstring_aspect(myPos + eX * 0.7 * mySize.x, ftos(stat), vec2(0.3 * mySize.x, mySize.y), color, panel_fg_alpha, DRAWFLAG_NORMAL);
}
else
drawstring_aspect(myPos, ftos(stat), mySize, color, panel_fg_alpha, DRAWFLAG_NORMAL);
int i;
float row = 0, column = 0;
- vector pos, itemSize;
- itemSize = eX * mySize.x*(1/columns) + eY * mySize.y*(1/rows);
+ vector pos = '0 0 0', itemSize;
+ itemSize = vec2(mySize.x / columns, mySize.y / rows);
for(i=0; i<team_count; ++i)
{
- pos = myPos + eX * column * itemSize.x + eY * row * itemSize.y;
+ pos.x = myPos.x + column * itemSize.x;
+ pos.y = myPos.y + row * itemSize.y;
DrawCAItem(pos, itemSize, aspect_ratio, layout, i);
if(all_keys == 4 && mySize.x * 0.5 < mySize.y && mySize.y * 0.5 < mySize.x)
{
// Quadratic arrangement
- slot_size = eX * mySize.x * 0.5 + eY * mySize.y * 0.5;
+ slot_size = vec2(mySize.x * 0.5, mySize.y * 0.5);
KH_SLOTS[0] = pos;
KH_SLOTS[1] = pos + eX * slot_size.x;
KH_SLOTS[2] = pos + eY * slot_size.y;
if(mySize.x > mySize.y)
{
// Horizontal arrangement
- slot_size = eX * mySize.x / all_keys + eY * mySize.y;
+ slot_size = vec2(mySize.x / all_keys, mySize.y);
for(i = 0; i < all_keys; ++i)
KH_SLOTS[i] = pos + eX * slot_size.x * i;
}
else
{
// Vertical arrangement
- slot_size = eX * mySize.x + eY * mySize.y / all_keys;
+ slot_size = vec2(mySize.x, mySize.y / all_keys);
for(i = 0; i < all_keys; ++i)
KH_SLOTS[i] = pos + eY * slot_size.y * i;
}
if(mySize.x > mySize.y) {
kaball_pos = pos + eX * 0.25 * mySize.x;
- kaball_size = eX * 0.5 * mySize.x + eY * mySize.y;
+ kaball_size = vec2(0.5 * mySize.x, mySize.y);
} else {
kaball_pos = pos + eY * 0.25 * mySize.y;
- kaball_size = eY * 0.5 * mySize.y + eX * mySize.x;
+ kaball_size = vec2(mySize.x, 0.5 * mySize.y);
}
float kaball_statuschange_elapsedtime = time - kaball_statuschange_time;
drawpic_aspect_skin_expanding(kaball_pos, "keepawayball_carrying", kaball_size, '1 1 1', panel_fg_alpha * kaball_alpha, DRAWFLAG_NORMAL, f);
if(kaball)
- drawpic_aspect_skin(pos, "keepawayball_carrying", eX * mySize.x + eY * mySize.y, '1 1 1', panel_fg_alpha * kaball_alpha * f, DRAWFLAG_NORMAL);
+ drawpic_aspect_skin(pos, "keepawayball_carrying", vec2(mySize.x, mySize.y), '1 1 1', panel_fg_alpha * kaball_alpha * f, DRAWFLAG_NORMAL);
}
if(mySize.x > mySize.y) {
// text on left side
squareSize = min(mySize.y, mySize.x/2);
- textPos = pos + eX * 0.5 * max(0, mySize.x/2 - squareSize) + eY * 0.5 * (mySize.y - squareSize);
- medalPos = pos + eX * 0.5 * max(0, mySize.x/2 - squareSize) + eX * 0.5 * mySize.x + eY * 0.5 * (mySize.y - squareSize);
+ vector ofs = vec2(0.5 * max(0, mySize.x/2 - squareSize), 0.5 * (mySize.y - squareSize));
+ textPos = pos + ofs;
+ ofs.y += 0.5 * mySize.x;
+ medalPos = pos + ofs;
} else {
// text on top
squareSize = min(mySize.x, mySize.y/2);
- textPos = pos + eY * 0.5 * max(0, mySize.y/2 - squareSize) + eX * 0.5 * (mySize.x - squareSize);
- medalPos = pos + eY * 0.5 * max(0, mySize.y/2 - squareSize) + eY * 0.5 * mySize.y + eX * 0.5 * (mySize.x - squareSize);
+ vector ofs = vec2(0.5 * (mySize.x - squareSize), 0.5 * max(0, mySize.y/2 - squareSize));
+ textPos = pos + ofs;
+ ofs.y += 0.5 * mySize.y;
+ medalPos = pos + ofs;
}
- vector textSize = eX * squareSize + eY * 0.25 * squareSize;
+ vector textSize = vec2(squareSize, 0.25 * squareSize);
race_showTime(_("Personal best"), textPos, eY * 0.25 * squareSize, t, textSize, time - crecordtime_change_time);
//draw the text
color *= 0.5 + pps_ratio * (1 - 0.5); // half saturated color at min, full saturated at max
if (layout == 2) // average pps
- drawstring_aspect(myPos + eX * mySize.y, ftos_decimals(stat, 2), eX * (2/3) * mySize.x + eY * mySize.y, color, panel_fg_alpha, DRAWFLAG_NORMAL);
+ drawstring_aspect(myPos + eX * mySize.y, ftos_decimals(stat, 2), vec2((2/3) * mySize.x, mySize.y), color, panel_fg_alpha, DRAWFLAG_NORMAL);
else // percentage of average pps
- drawstring_aspect(myPos + eX * mySize.y, strcat( ftos(floor(pps_ratio*100 + 0.5)), "%" ), eX * (2/3) * mySize.x + eY * mySize.y, color, panel_fg_alpha, DRAWFLAG_NORMAL);
+ drawstring_aspect(myPos + eX * mySize.y, strcat( ftos(floor(pps_ratio*100 + 0.5)), "%" ), vec2((2/3) * mySize.x, mySize.y), color, panel_fg_alpha, DRAWFLAG_NORMAL);
}
//draw the icon
int i;
float row = 0, column = 0;
vector pos, itemSize;
- itemSize = eX * mySize.x*(1/columns) + eY * mySize.y*(1/rows);
+ itemSize = vec2(mySize.x / columns, mySize.y / rows);
for(i=0; i<team_count; ++i)
{
- pos = myPos + eX * column * itemSize.x + eY * row * itemSize.y;
+ pos = myPos + vec2(column * itemSize.x, row * itemSize.y);
DrawDomItem(pos, itemSize, aspect_ratio, layout, i);
float name_maxwidth = panel_width_half - icon_width_half - size.x * NOTIFY_ICON_MARGIN;
vector font_size = '0.5 0.5 0' * entry_height * autocvar_hud_panel_notify_fontsize;
- vector icon_size = (eX * icon_aspect + eY) * entry_height;
+ vector icon_size = vec2(icon_aspect, 1) * entry_height;
vector icon_left = eX * (panel_width_half - icon_width_half);
vector attacker_right = eX * name_maxwidth;
vector victim_left = eX * (size.x - name_maxwidth);
// Draw items from linked list
vector itemPos = pos;
- vector itemSize = eX * (size.x / columns) + eY * (size.y / rows);
+ vector itemSize = vec2(size.x / columns, size.y / rows);
vector textColor = '1 1 1';
int fullSeconds = 0;
draw_beginBoldFont();
for(entity item = powerupItems; item.count; item = item.chain)
{
- itemPos = eX * (pos.x + column * itemSize.x) + eY * (pos.y + row * itemSize.y);
+ itemPos = vec2(pos.x + column * itemSize.x, pos.y + row * itemSize.y);
// Draw progressbar
if(autocvar_hud_panel_powerups_progressbar)
mySize = newSize;
}
- vector keysize;
- keysize = eX * mySize.x * (1/3.0) + eY * mySize.y * (1/(3.0 - !autocvar_hud_panel_pressedkeys_attack));
+ vector keysize = vec2(mySize.x / 3, mySize.y / (3 - !autocvar_hud_panel_pressedkeys_attack));
int pressedkeys = STAT(PRESSED_KEYS);
if(autocvar_hud_panel_pressedkeys_attack)
color = '1 1 0.3';
else
color = '1 1 1';
- drawfill(panel_pos, eX * panel_size.x + eY * fontsize.y, color, .2, DRAWFLAG_NORMAL);
+ drawfill(panel_pos, vec2(panel_size.x, fontsize.y), color, .2, DRAWFLAG_NORMAL);
if(!mouseClicked && (prevMouseClicked & S_MOUSE1))
QuickMenu_Page_ActiveEntry((entry_num < QUICKMENU_MAXLINES - 1) ? entry_num + 1 : 0);
pic = strcat("gfx/hud/default/", option);
vector option_size = '1 1 0' * fontsize.y * 0.8;
desc_width -= option_size.x;
- drawpic(pos + eX * desc_width + eY * (fontsize.y - option_size.y) / 2, pic, option_size, '1 1 1', panel_fg_alpha, DRAWFLAG_ADDITIVE);
+ drawpic(pos + vec2(desc_width, (fontsize.y - option_size.y) / 2), pic, option_size, '1 1 1', panel_fg_alpha, DRAWFLAG_ADDITIVE);
desc_width -= fontsize.x / 4;
}
entry = textShortenToWidth(desc, desc_width, fontsize, stringwidth_colors);
if(QuickMenu_Page_ActivatedEntry_Time && time < QuickMenu_Page_ActivatedEntry_Time
&& QuickMenu_Page_ActivatedEntry == i)
- drawfill(panel_pos, eX * panel_size.x + eY * fontsize.y, '0.5 1 0.5', .2, DRAWFLAG_NORMAL);
+ drawfill(panel_pos, vec2(panel_size.x, fontsize.y), '0.5 1 0.5', .2, DRAWFLAG_NORMAL);
panel_pos.y += fontsize.y;
}
float a, t;
string s, forcetime;
+ vector str_pos;
if(autocvar__hud_configure)
{
s = "0:13:37";
draw_beginBoldFont();
- drawstring(pos + eX * 0.5 * mySize.x - '0.5 0 0' * stringwidth(s, false, '0.60 0.60 0' * mySize.y), s, '0.60 0.60 0' * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+ str_pos = pos + eX * 0.5 * (mySize.x - stringwidth(s, false, '1 1 0' * 0.6 * mySize.y));
+ drawstring(str_pos, s, '1 1 0' * 0.6 * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
draw_endBoldFont();
s = _("^1Intermediate 1 (+15.42)");
- drawcolorcodedstring(pos + eX * 0.5 * mySize.x - '0.5 0 0' * stringwidth(s, true, '1 1 0' * 0.20 * mySize.y) + eY * 0.60 * mySize.y, s, '1 1 0' * 0.20 * mySize.y, panel_fg_alpha, DRAWFLAG_NORMAL);
+ str_pos = pos + vec2(0.5 * (mySize.x - stringwidth(s, true, '1 1 0' * 0.2 * mySize.y)), 0.6 * mySize.y);
+ drawcolorcodedstring(str_pos, s, '1 1 0' * 0.2 * mySize.y, panel_fg_alpha, DRAWFLAG_NORMAL);
s = sprintf(_("^1PENALTY: %.1f (%s)"), 2, "missing a checkpoint");
- drawcolorcodedstring(pos + eX * 0.5 * mySize.x - '0.5 0 0' * stringwidth(s, true, '1 1 0' * 0.20 * mySize.y) + eY * 0.80 * mySize.y, s, '1 1 0' * 0.20 * mySize.y, panel_fg_alpha, DRAWFLAG_NORMAL);
+ str_pos = pos + vec2(0.5 * (mySize.x - stringwidth(s, true, '1 1 0' * 0.2 * mySize.y)), 0.8 * mySize.y);
+ drawcolorcodedstring(str_pos, s, '1 1 0' * 0.2 * mySize.y, panel_fg_alpha, DRAWFLAG_NORMAL);
}
else if(race_checkpointtime)
{
{
a = bound(0, 2 - ((race_laptime + TIME_DECODE(race_nextbesttime)) - (time + TIME_DECODE(race_penaltyaccumulator))), 1);
if(a > 0) // next one?
- {
s = MakeRaceString(race_nextcheckpoint, (time + TIME_DECODE(race_penaltyaccumulator)) - race_laptime, TIME_DECODE(race_nextbesttime), 0, race_nextbestname);
- }
}
}
if(s != "" && a > 0)
{
- drawcolorcodedstring(pos + eX * 0.5 * mySize.x - '0.5 0 0' * stringwidth(s, true, '1 1 0' * 0.2 * mySize.y) + eY * 0.6 * mySize.y, s, '1 1 0' * 0.2 * mySize.y, panel_fg_alpha * a, DRAWFLAG_NORMAL);
+ str_pos = pos + vec2(0.5 * (mySize.x - stringwidth(s, true, '1 1 0' * 0.2 * mySize.y)), 0.6 * mySize.y);
+ drawcolorcodedstring(str_pos, s, '1 1 0' * 0.2 * mySize.y, panel_fg_alpha * a, DRAWFLAG_NORMAL);
}
if(race_penaltytime)
if(a > 0)
{
s = sprintf(_("^1PENALTY: %.1f (%s)"), race_penaltytime * 0.1, race_penaltyreason);
- drawcolorcodedstring(pos + eX * 0.5 * mySize.x - '0.5 0 0' * stringwidth(s, true, '1 1 0' * 0.2 * mySize.y) + eY * 0.8 * mySize.y, s, '1 1 0' * 0.2 * mySize.y, panel_fg_alpha * a, DRAWFLAG_NORMAL);
+ str_pos = pos + vec2(0.5 * (mySize.x - stringwidth(s, true, '1 1 0' * 0.2 * mySize.y)), 0.8 * mySize.y);
+ drawcolorcodedstring(str_pos, s, '1 1 0' * 0.2 * mySize.y, panel_fg_alpha * a, DRAWFLAG_NORMAL);
}
}
if(forcetime != "")
{
a = bound(0, (time - race_checkpointtime) / 0.5, 1);
- drawstring_expanding(pos + eX * 0.5 * mySize.x - '0.5 0 0' * stringwidth(forcetime, false, '1 1 0' * 0.6 * mySize.y), forcetime, '1 1 0' * 0.6 * mySize.y, '1 1 1', panel_fg_alpha, 0, a);
+ str_pos = pos + eX * 0.5 * (mySize.x - stringwidth(forcetime, false, '1 1 0' * 0.6 * mySize.y));
+ drawstring_expanding(str_pos, forcetime, '1 1 0' * 0.6 * mySize.y, '1 1 1', panel_fg_alpha, 0, a);
}
else
a = 1;
if(race_laptime && race_checkpoint != 255)
{
s = TIME_ENCODED_TOSTRING(TIME_ENCODE(time + TIME_DECODE(race_penaltyaccumulator) - race_laptime));
- drawstring(pos + eX * 0.5 * mySize.x - '0.5 0 0' * stringwidth(s, false, '0.6 0.6 0' * mySize.y), s, '0.6 0.6 0' * mySize.y, '1 1 1', panel_fg_alpha * a, DRAWFLAG_NORMAL);
+ str_pos = pos + eX * 0.5 * (mySize.x - stringwidth(s, false, '0.6 0.6 0' * mySize.y));
+ drawstring(str_pos, s, '0.6 0.6 0' * mySize.y, '1 1 1', panel_fg_alpha * a, DRAWFLAG_NORMAL);
}
draw_endBoldFont();
{
a = bound(0, 2 - (time - race_mycheckpointtime), 1);
s = MakeRaceString(race_mycheckpoint, TIME_DECODE(race_mycheckpointdelta), -(race_mycheckpointenemy == ""), race_mycheckpointlapsdelta, race_mycheckpointenemy);
- drawcolorcodedstring(pos + eX * 0.5 * mySize.x - '0.5 0 0' * stringwidth(s, true, '1 1 0' * 0.2 * mySize.y) + eY * 0.6 * mySize.y, s, '1 1 0' * 0.2 * mySize.y, panel_fg_alpha * a, DRAWFLAG_NORMAL);
+ str_pos = pos + vec2(0.5 * (mySize.x - stringwidth(s, true, '1 1 0' * 0.2 * mySize.y)), 0.6 * mySize.y);
+ drawcolorcodedstring(str_pos, s, '1 1 0' * 0.2 * mySize.y, panel_fg_alpha * a, DRAWFLAG_NORMAL);
}
if(race_othercheckpointtime && race_othercheckpointenemy != "")
{
a = bound(0, 2 - (time - race_othercheckpointtime), 1);
s = MakeRaceString(race_othercheckpoint, -TIME_DECODE(race_othercheckpointdelta), -(race_othercheckpointenemy == ""), race_othercheckpointlapsdelta, race_othercheckpointenemy);
- drawcolorcodedstring(pos + eX * 0.5 * mySize.x - '0.5 0 0' * stringwidth(s, true, '1 1 0' * 0.2 * mySize.y) + eY * 0.6 * mySize.y, s, '1 1 0' * 0.2 * mySize.y, panel_fg_alpha * a, DRAWFLAG_NORMAL);
+ str_pos = pos + vec2(0.5 * (mySize.x - stringwidth(s, true, '1 1 0' * 0.2 * mySize.y)), 0.6 * mySize.y);
+ drawcolorcodedstring(str_pos, s, '1 1 0' * 0.2 * mySize.y, panel_fg_alpha * a, DRAWFLAG_NORMAL);
}
if(race_penaltytime && !race_penaltyaccumulator)
s = sprintf(_("^1PENALTY: %.1f (%s)"), (t - time) * 0.1, race_penaltyreason);
else
s = sprintf(_("^2PENALTY: %.1f (%s)"), 0, race_penaltyreason);
- drawcolorcodedstring(pos + eX * 0.5 * mySize.x - '0.5 0 0' * stringwidth(s, true, '1 1 0' * 0.2 * mySize.y) + eY * 0.6 * mySize.y, s, '1 1 0' * 0.2 * mySize.y, panel_fg_alpha * a, DRAWFLAG_NORMAL);
+ str_pos = pos + vec2(0.5 * (mySize.x - stringwidth(s, true, '1 1 0' * 0.2 * mySize.y)), 0.6 * mySize.y);
+ drawcolorcodedstring(str_pos, s, '1 1 0' * 0.2 * mySize.y, panel_fg_alpha * a, DRAWFLAG_NORMAL);
}
}
}
players_per_team = max(2, ceil((entries - 1) / team_count));
for(i=0; i<team_count; ++i) {
if (i == floor((entries - 2) / players_per_team) || (entries == 1 && i == 0))
- HUD_Panel_DrawHighlight(pos + eX * score_size * i, eX * score_size + eY * fontsize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
- drawstring_aspect(pos + eX * score_size * i, ftos(175 - 23*i), eX * score_size + eY * fontsize.y, Team_ColorRGB(ColorByTeam(i)) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL);
+ HUD_Panel_DrawHighlight(pos + eX * score_size * i, vec2(score_size, fontsize.y), '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+ drawstring_aspect(pos + eX * score_size * i, ftos(175 - 23*i), vec2(score_size, fontsize.y), Team_ColorRGB(ColorByTeam(i)) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL);
}
first_pl = 1;
pos.y += fontsize.y;
if (i == entries-1 && autocvar_hud_panel_score_rankings == 1)
{
rgb = '1 1 0';
- drawfill(pos, eX * mySize.x + eY * fontsize.y, rgb, highlight_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+ drawfill(pos, vec2(mySize.x, fontsize.y), rgb, highlight_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
s = entcs_GetName(player_localnum);
score = 7;
}
continue;
if (tm.team == myteam)
- drawfill(pos + eX * score_size * i, eX * score_size + eY * fontsize.y, '1 1 1', highlight_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
- drawstring_aspect(pos + eX * score_size * i, ftos(tm.(teamscores(ts_primary))), eX * score_size + eY * fontsize.y, Team_ColorRGB(tm.team) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL);
+ drawfill(pos + eX * score_size * i, vec2(score_size, fontsize.y), '1 1 1', highlight_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+ drawstring_aspect(pos + eX * score_size * i, ftos(tm.(teamscores(ts_primary))), vec2(score_size, fontsize.y), Team_ColorRGB(tm.team) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL);
++i;
}
first_pl = 1;
distribution_color = '1 0 0';
sign = "+";
}
- drawstring_aspect(pos + eX * 0.75 * mySize.x, strcat(sign, distrtimer), eX * 0.25 * mySize.x + eY * (1/3) * mySize.y, distribution_color, panel_fg_alpha, DRAWFLAG_NORMAL);
+ drawstring_aspect(pos + eX * 0.75 * mySize.x, strcat(sign, distrtimer), vec2(0.25 * mySize.x, (1/3) * mySize.y), distribution_color, panel_fg_alpha, DRAWFLAG_NORMAL);
}
// race record display
if (distribution <= 0)
- HUD_Panel_DrawHighlight(pos, eX * 0.75 * mySize.x + eY * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
- drawstring_aspect(pos, timer, eX * 0.75 * mySize.x + eY * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+ HUD_Panel_DrawHighlight(pos, vec2(0.75 * mySize.x, mySize.y), '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+ drawstring_aspect(pos, timer, vec2(0.75 * mySize.x, mySize.y), '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
draw_endBoldFont();
} else if (!teamplay) { // non-teamgames
if ((spectatee_status == -1 && !autocvar__hud_configure) || autocvar_hud_panel_score_rankings)
HUD_Panel_DrawHighlight(pos, eX * 0.75 * mySize.x + eY * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
}
drawstring_aspect(pos, ftos(score), eX * 0.75 * mySize.x + eY * mySize.y, distribution_color, panel_fg_alpha, DRAWFLAG_NORMAL);
- 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);
+ drawstring_aspect(pos + eX * 0.75 * mySize.x, distribution_str, vec2(0.25 * mySize.x, (1/3) * mySize.y), distribution_color, panel_fg_alpha, DRAWFLAG_NORMAL);
draw_endBoldFont();
} else { // teamgames
float row, column, rows = 0, columns = 0;
{
rows = HUD_GetRowCount(team_count, mySize, 3);
columns = ceil(team_count/rows);
- score_size = eX * mySize.x*(1/columns) + eY * mySize.y*(1/rows);
+ score_size = vec2(mySize.x / columns, mySize.y / rows);
float newSize;
if(score_size.x/score_size.y > 3)
}
}
else
- score_size = eX * mySize.x*(1/4) + eY * mySize.y*(1/3);
+ score_size = vec2(mySize.x / 4, mySize.y / 3);
float max_fragcount;
max_fragcount = -99;
if (spectatee_status == -1)
{
- score_pos = pos + eX * column * (score_size.x + offset.x) + eY * row * (score_size.y + offset.y);
+ score_pos = pos + vec2(column * (score_size.x + offset.x), row * (score_size.y + offset.y));
if (max_fragcount == score)
HUD_Panel_DrawHighlight(score_pos, score_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
drawstring_aspect(score_pos, ftos(score), score_size, Team_ColorRGB(tm.team) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL);
}
else if(tm.team == myteam) {
if (max_fragcount == score)
- HUD_Panel_DrawHighlight(pos, eX * 0.75 * mySize.x + eY * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
- drawstring_aspect(pos, ftos(score), eX * 0.75 * mySize.x + eY * mySize.y, Team_ColorRGB(tm.team) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL);
+ HUD_Panel_DrawHighlight(pos, vec2(0.75 * mySize.x, mySize.y), '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+ drawstring_aspect(pos, ftos(score), vec2(0.75 * mySize.x, mySize.y), Team_ColorRGB(tm.team) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL);
} else {
if (max_fragcount == score)
- HUD_Panel_DrawHighlight(pos + eX * 0.75 * mySize.x + eY * (1/3) * rows * mySize.y, score_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
- drawstring_aspect(pos + eX * 0.75 * mySize.x + eY * (1/3) * rows * mySize.y, ftos(score), score_size, Team_ColorRGB(tm.team) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL);
+ HUD_Panel_DrawHighlight(pos + vec2(0.75 * mySize.x, (1/3) * rows * mySize.y), score_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+ drawstring_aspect(pos + vec2(0.75 * mySize.x, (1/3) * rows * mySize.y), ftos(score), score_size, Team_ColorRGB(tm.team) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL);
++rows;
}
}
bool is_spec = (entcs_GetTeam(pl.sv_entnum) == NUM_SPECTATOR);
vector h_pos = item_pos;
- vector h_size = eX * panel_size.x + eY * hud_fontsize.y * 1.25;
+ vector h_size = vec2(panel_size.x, hud_fontsize.y * 1.25);
// alternated rows highlighting
if(is_self)
drawfill(h_pos, h_size, rgb, sbt_highlight_alpha_self, DRAWFLAG_NORMAL);
float fg_alpha = (is_self ? sbt_fg_alpha_self : sbt_fg_alpha);
vector pos = item_pos;
+ vector pic_size = vec2(hud_fontsize.x * sbt_fixcolumnwidth_iconlen, hud_fontsize.y);
pos.x += hud_fontsize.x * 0.5;
pos.y += (1.25 - 1) / 2 * hud_fontsize.y; // center text vertically
vector tmp = '0 0 0';
tmp.x = sbt_field_size[i] + hud_fontsize.x;
if(sbt_field_icon0 != "")
- drawpic(pos - tmp, sbt_field_icon0, eY * hud_fontsize.y + eX * hud_fontsize.x * sbt_fixcolumnwidth_iconlen, sbt_field_icon1_rgb, fg_alpha, DRAWFLAG_NORMAL);
+ drawpic(pos - tmp, sbt_field_icon0, pic_size, sbt_field_icon1_rgb, fg_alpha, DRAWFLAG_NORMAL);
if(sbt_field_icon1 != "")
- drawpic(pos - tmp, sbt_field_icon1, eY * hud_fontsize.y + eX * hud_fontsize.x * sbt_fixcolumnwidth_iconlen, sbt_field_icon1_rgb, fg_alpha, DRAWFLAG_NORMAL);
+ drawpic(pos - tmp, sbt_field_icon1, pic_size, sbt_field_icon1_rgb, fg_alpha, DRAWFLAG_NORMAL);
if(sbt_field_icon2 != "")
- drawpic(pos - tmp, sbt_field_icon2, eY * hud_fontsize.y + eX * hud_fontsize.x * sbt_fixcolumnwidth_iconlen, sbt_field_icon2_rgb, fg_alpha, DRAWFLAG_NORMAL);
+ drawpic(pos - tmp, sbt_field_icon2, pic_size, sbt_field_icon2_rgb, fg_alpha, DRAWFLAG_NORMAL);
}
if(sbt_field[i] == SP_SEPARATOR)
tmp.x = sbt_field_size[i];
if(sbt_field_icon0 != "")
- drawpic(pos - tmp, sbt_field_icon0, eY * hud_fontsize.y + eX * hud_fontsize.x * sbt_fixcolumnwidth_iconlen, sbt_field_icon1_rgb, fg_alpha, DRAWFLAG_NORMAL);
+ drawpic(pos - tmp, sbt_field_icon0, pic_size, sbt_field_icon1_rgb, fg_alpha, DRAWFLAG_NORMAL);
if(sbt_field_icon1 != "")
- drawpic(pos - tmp, sbt_field_icon1, eY * hud_fontsize.y + eX * hud_fontsize.x * sbt_fixcolumnwidth_iconlen, sbt_field_icon1_rgb, fg_alpha, DRAWFLAG_NORMAL);
+ drawpic(pos - tmp, sbt_field_icon1, pic_size, sbt_field_icon1_rgb, fg_alpha, DRAWFLAG_NORMAL);
if(sbt_field_icon2 != "")
- drawpic(pos - tmp, sbt_field_icon2, eY * hud_fontsize.y + eX * hud_fontsize.x * sbt_fixcolumnwidth_iconlen, sbt_field_icon2_rgb, fg_alpha, DRAWFLAG_NORMAL);
+ drawpic(pos - tmp, sbt_field_icon2, pic_size, sbt_field_icon2_rgb, fg_alpha, DRAWFLAG_NORMAL);
pos.x -= sbt_field_size[i] + hud_fontsize.x;
}
}
{
int i = 0;
vector h_pos = item_pos;
- vector h_size = eX * panel_size.x + eY * hud_fontsize.y * 1.25;
+ vector h_size = vec2(panel_size.x, hud_fontsize.y * 1.25);
bool complete = (this_team == NUM_SPECTATOR);
pos.x += column_width;
pos.x += hud_fontsize.x;
}
- return eX * item_pos.x + eY * (item_pos.y + i * hud_fontsize.y * 1.25);
+ return vec2(item_pos.x, item_pos.y + i * hud_fontsize.y * 1.25);
}
vector Scoreboard_MakeTable(vector pos, entity tm, vector rgb, vector bg_size)
}
pos = panel_pos;
- vector tmp = eX * panel_size.x + eY * 1.25 * hud_fontsize.y;
+ vector tmp = vec2(panel_size.x, 1.25 * hud_fontsize.y);
// rounded header
if (sbt_bg_alpha)
// column highlighting
for (int i = 0; i < columnns; ++i)
if ((i % 2) == 0)
- drawfill(pos + eX * weapon_width * rows * i, eY * height * rows + eX * weapon_width * rows, '0 0 0', sbt_highlight_alpha, DRAWFLAG_NORMAL);
+ drawfill(pos + eX * weapon_width * rows * i, vec2(weapon_width * rows, height * rows), '0 0 0', sbt_highlight_alpha, DRAWFLAG_NORMAL);
// row highlighting
for (int i = 0; i < rows; ++i)
- drawfill(pos + eY * weapon_height + eY * height * i, eX * tmp.x + eY * hud_fontsize.y, rgb, sbt_highlight_alpha, DRAWFLAG_NORMAL);
+ drawfill(pos + eY * (weapon_height + height * i), vec2(tmp.x, hud_fontsize.y), rgb, sbt_highlight_alpha, DRAWFLAG_NORMAL);
}
average_accuracy = 0;
weapon_alpha = 0.2 * sbt_fg_alpha;
// weapon icon
- drawpic_aspect_skin(tmpos, it.model2, eX * weapon_width + eY * weapon_height, '1 1 1', weapon_alpha, DRAWFLAG_NORMAL);
+ drawpic_aspect_skin(tmpos, it.model2, vec2(weapon_width, weapon_height), '1 1 1', weapon_alpha, DRAWFLAG_NORMAL);
// the accuracy
if (weapon_stats >= 0) {
weapons_with_stats += 1;
if(!autocvar_hud_panel_scoreboard_accuracy_nocolors)
rgb = Accuracy_GetColor(weapon_stats);
- drawstring(tmpos + eX * padding + eY * weapon_height, s, hud_fontsize, rgb, sbt_fg_alpha, DRAWFLAG_NORMAL);
+ drawstring(tmpos + vec2(padding, weapon_height), s, hud_fontsize, rgb, sbt_fg_alpha, DRAWFLAG_NORMAL);
}
tmpos.x += weapon_width * rows;
pos.x += weapon_width * rows;
float ranksize = 3 * hud_fontsize.x;
float timesize = 5 * hud_fontsize.x;
- vector columnsize = eX * (ranksize + timesize + namesize + hud_fontsize.x) + eY * 1.25 * hud_fontsize.y;
+ vector columnsize = vec2(ranksize + timesize + namesize + hud_fontsize.x, 1.25 * hud_fontsize.y);
int columns = max(1, floor((panel_size.x - 2 * panel_bg_padding) / columnsize.x));
columns = min(columns, RANKINGS_RECEIVED_CNT);
if (sbt_bg_alpha)
drawpic_tiled(pos, "gfx/scoreboard/scoreboard_bg", bg_size, panel_size, rgb, sbt_bg_alpha, DRAWFLAG_NORMAL);
- vector text_ofs = eX * 0.5 * hud_fontsize.x + eY * (1.25 - 1) / 2 * hud_fontsize.y; // center text vertically
+ vector text_ofs = vec2(0.5 * hud_fontsize.x, (1.25 - 1) / 2 * hud_fontsize.y); // center text vertically
string str = "";
int column = 0, j = 0;
for(i = 0; i < RANKINGS_RECEIVED_CNT; ++i)
vector pos = panel_pos;
entity pl, tm;
string str;
+ vector str_pos;
// Heading
vector sb_heading_fontsize;
draw_beginBoldFont();
vector rgb = Team_ColorRGB(tm.team);
str = ftos(tm.(teamscores(ts_primary)));
- drawstring(pos + team_score_baseoffset - eX * stringwidth(str, false, hud_fontsize * 1.5), str, hud_fontsize * 1.5, rgb, panel_fg_alpha, DRAWFLAG_NORMAL);
+ str_pos = pos + team_score_baseoffset - eX * stringwidth(str, false, hud_fontsize * 1.5);
+ drawstring(str_pos, str, hud_fontsize * 1.5, rgb, panel_fg_alpha, DRAWFLAG_NORMAL);
if(ts_primary != ts_secondary)
{
str = ftos(tm.(teamscores(ts_secondary)));
- drawstring(pos + team_score_baseoffset - eX * stringwidth(str, false, hud_fontsize) + eY * hud_fontsize.y * 1.5, str, hud_fontsize, rgb, panel_fg_alpha, DRAWFLAG_NORMAL);
+ str_pos = pos + team_score_baseoffset - vec2(stringwidth(str, false, hud_fontsize), hud_fontsize.y * 1.5);
+ drawstring(str_pos, str, hud_fontsize, rgb, panel_fg_alpha, DRAWFLAG_NORMAL);
}
draw_endBoldFont();
if(autocvar_hud_panel_scoreboard_bg_teams_color_team > 0)
if(uid2name_dialog)
{
- panel_pos = eX * 0.3 * vid_conwidth + eY * 0.1 * vid_conheight;
- panel_size = eX * 0.4 * vid_conwidth + eY * 0.3 * vid_conheight;
+ panel_pos = vec2(0.3 * vid_conwidth, 0.1 * vid_conheight);
+ panel_size = vec2(0.4 * vid_conwidth, 0.3 * vid_conheight);
}
vector pos, mySize;
s = _("A vote has been called for:");
if(uid2name_dialog)
s = _("Allow servers to store and display your name?");
- drawstring_aspect(pos, s, eX * mySize.x + eY * (2/8) * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+ drawstring_aspect(pos, s, vec2(mySize.x, (2/8) * mySize.y), '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
s = textShortenToWidth(ColorTranslateRGB(vote_called_vote), mySize.x, '1 1 0' * mySize.y * (1/8), stringwidth_colors);
if(autocvar__hud_configure)
s = _("^1Configure the HUD");
- drawcolorcodedstring_aspect(pos + eY * (2/8) * mySize.y, s, eX * mySize.x + eY * (1.75/8) * mySize.y, panel_fg_alpha, DRAWFLAG_NORMAL);
+ drawcolorcodedstring_aspect(pos + eY * (2/8) * mySize.y, s, vec2(mySize.x, (1.75/8) * mySize.y), panel_fg_alpha, DRAWFLAG_NORMAL);
// print the yes/no counts
s = sprintf("^2%s ^7(%d)", getcommandkey_forcename(_("Yes"), "vyes"), vote_yescount);
- drawcolorcodedstring_aspect(pos + eY * (4/8) * mySize.y, s, eX * 0.5 * mySize.x + eY * (1.5/8) * mySize.y, panel_fg_alpha, DRAWFLAG_NORMAL);
+ drawcolorcodedstring_aspect(pos + eY * (4/8) * mySize.y, s, vec2(0.5 * mySize.x, (1.5/8) * mySize.y), panel_fg_alpha, DRAWFLAG_NORMAL);
s = sprintf("^1%s ^7(%d)", getcommandkey_forcename(_("No"), "vno"), vote_nocount);
- drawcolorcodedstring_aspect(pos + eX * 0.5 * mySize.x + eY * (4/8) * mySize.y, s, eX * 0.5 * mySize.x + eY * (1.5/8) * mySize.y, panel_fg_alpha, DRAWFLAG_NORMAL);
+ drawcolorcodedstring_aspect(pos + vec2(0.5 * mySize.x, (4/8) * mySize.y), s, vec2(0.5 * mySize.x, (1.5/8) * mySize.y), panel_fg_alpha, DRAWFLAG_NORMAL);
pos.y += (5/8) * mySize.y;
- vector tmp_size = eX * mySize.x + eY * (3/8) * mySize.y;
+ vector tmp_size = vec2(mySize.x, (3/8) * mySize.y);
// draw the progress bar backgrounds
drawpic_skin(pos, "voteprogress_back", tmp_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
}
// figure out the drawing position of weapon
- weapon_pos = (panel_pos + eX * column * weapon_size.x + eY * row * weapon_size.y);
+ weapon_pos = panel_pos + vec2(column * weapon_size.x, row * weapon_size.y);
// update position of the currently selected weapon
if(it == panel_switchweapon)
void draw_cursor(vector pos, vector ofs, string img, vector col, float a)
{
- ofs = eX * (ofs.x * SIZE_CURSOR.x) + eY * (ofs.y * SIZE_CURSOR.y);
+ ofs = vec2(ofs.x * SIZE_CURSOR.x, ofs.y * SIZE_CURSOR.y);
drawpic(pos - ofs, strcat(draw_currentSkin, img), SIZE_CURSOR, col, a, DRAWFLAG_NORMAL);
}
// higher than the image itself ratio for mapvote items to reserve space for long map names
int item_aspect = (gametypevote) ? 3/1 : 5/3;
- vector table_size = HUD_GetTableSize_BestItemAR(mv_num_maps, eX * (xmax - xmin) + eY * (ymax - ymin), item_aspect);
+ vector table_size = HUD_GetTableSize_BestItemAR(mv_num_maps, vec2(xmax - xmin, ymax - ymin), item_aspect);
mv_columns = table_size.x;
rows = table_size.y;
vector eo = project_3d_to_2d(it.origin);
if (eo.z < 0 || eo.x < 0 || eo.y < 0 || eo.x > vid_conwidth || eo.y > vid_conheight) continue;
eo.z = 0;
- if (vdist(((eX * o.x + eY * o.y) - eo), <, autocvar_hud_shownames_antioverlap_distance)
+ if (vdist((vec2(o) - eo), <, autocvar_hud_shownames_antioverlap_distance)
&& vlen2(it.origin - view_origin) < vlen2(this.origin - view_origin))
{
overlap = 1;
if (o.z >= 0)
{
o.z = 0;
- vector mySize = (eX * autocvar_hud_shownames_aspect + eY) * autocvar_hud_shownames_fontsize;
- vector myPos = o - '0.5 0 0' * mySize.x - '0 1 0' * mySize.y;
+ vector mySize = (vec2(autocvar_hud_shownames_aspect, 1)) * autocvar_hud_shownames_fontsize;
+ vector myPos = o - vec2(0.5 * mySize.x, mySize.y);
// size scaling
mySize.x *= resize;
mySize.y *= resize;
float namewidth = mySize.x;
if (autocvar_hud_shownames_status && this.sameteam)
{
- vector v = namepos + '0 1 0' * autocvar_hud_shownames_fontsize * resize;
- vector s = eX * 0.5 * mySize.x + eY * resize * autocvar_hud_shownames_statusbar_height;
+ vector pos = namepos + eY * autocvar_hud_shownames_fontsize * resize;
+ vector sz = vec2(0.5 * mySize.x, resize * autocvar_hud_shownames_statusbar_height);
if (this.healthvalue > 0)
{
- HUD_Panel_DrawProgressBar(v, s, "nametag_statusbar",
+ HUD_Panel_DrawProgressBar(pos, sz, "nametag_statusbar",
this.healthvalue / autocvar_hud_panel_healtharmor_maxhealth, false, 1, '1 0 0', a,
DRAWFLAG_NORMAL);
}
if (this.armorvalue > 0)
{
- HUD_Panel_DrawProgressBar(v + eX * 0.5 * mySize.x, s, "nametag_statusbar",
+ HUD_Panel_DrawProgressBar(pos + eX * 0.5 * mySize.x, sz, "nametag_statusbar",
this.armorvalue / autocvar_hud_panel_healtharmor_maxarmor, false, 0, '0 1 0', a,
DRAWFLAG_NORMAL);
}
}
ring_inner_alpha = autocvar_crosshair_ring_vortex_inner_alpha;
- ring_inner_rgb = eX * autocvar_crosshair_ring_vortex_inner_color_red + eY * autocvar_crosshair_ring_vortex_inner_color_green + eZ * autocvar_crosshair_ring_vortex_inner_color_blue;
+ ring_inner_rgb = vec3(autocvar_crosshair_ring_vortex_inner_color_red, autocvar_crosshair_ring_vortex_inner_color_green, autocvar_crosshair_ring_vortex_inner_color_blue);
ring_inner_image = "gfx/crosshair_ring_inner.tga";
// draw the outer ring to show the current charge of the weapon
if(!intermission)
if (MUTATOR_CALLHOOK(HUD_Draw_overlay))
{
- drawfill('0 0 0', eX * vid_conwidth + eY * vid_conheight, M_ARGV(0, vector), autocvar_hud_colorflash_alpha * M_ARGV(1, float), DRAWFLAG_ADDITIVE);
+ drawfill('0 0 0', vec2(vid_conwidth, vid_conheight), M_ARGV(0, vector), autocvar_hud_colorflash_alpha * M_ARGV(1, float), DRAWFLAG_ADDITIVE);
}
else if(STAT(FROZEN))
{
- drawfill('0 0 0', eX * vid_conwidth + eY * vid_conheight, ((STAT(REVIVE_PROGRESS)) ? ('0.25 0.90 1' + ('1 0 0' * STAT(REVIVE_PROGRESS)) + ('0 1 1' * STAT(REVIVE_PROGRESS) * -1)) : '0.25 0.90 1'), autocvar_hud_colorflash_alpha, DRAWFLAG_ADDITIVE);
+ drawfill('0 0 0', vec2(vid_conwidth, vid_conheight), ((STAT(REVIVE_PROGRESS)) ? ('0.25 0.90 1' + ('1 0 0' * STAT(REVIVE_PROGRESS)) + ('0 1 1' * STAT(REVIVE_PROGRESS) * -1)) : '0.25 0.90 1'), autocvar_hud_colorflash_alpha, DRAWFLAG_ADDITIVE);
}
HUD_Scale_Enable();
if(!intermission)
if(STAT(NADE_TIMER) && autocvar_cl_nade_timer) // give nade top priority, as it's a matter of life and death
{
- DrawCircleClippedPic(eX * 0.5 * vid_conwidth + eY * 0.6 * vid_conheight, 0.1 * vid_conheight, "gfx/crosshair_ring.tga", STAT(NADE_TIMER), '0.25 0.90 1' + ('1 0 0' * STAT(NADE_TIMER)) - ('0 1 1' * STAT(NADE_TIMER)), autocvar_hud_colorflash_alpha, DRAWFLAG_ADDITIVE);
- drawstring_aspect(eY * 0.64 * vid_conheight, ((autocvar_cl_nade_timer == 2) ? _("Nade timer") : ""), eX * vid_conwidth + eY * 0.025 * vid_conheight, '1 1 1', 1, DRAWFLAG_NORMAL);
+ DrawCircleClippedPic(vec2(0.5 * vid_conwidth, 0.6 * vid_conheight), 0.1 * vid_conheight, "gfx/crosshair_ring.tga", STAT(NADE_TIMER), '0.25 0.90 1' + vec3(STAT(NADE_TIMER), -STAT(NADE_TIMER), -STAT(NADE_TIMER)), autocvar_hud_colorflash_alpha, DRAWFLAG_ADDITIVE);
+ drawstring_aspect(eY * 0.64 * vid_conheight, ((autocvar_cl_nade_timer == 2) ? _("Nade timer") : ""), vec2(vid_conwidth, 0.025 * vid_conheight), '1 1 1', 1, DRAWFLAG_NORMAL);
}
else if(STAT(CAPTURE_PROGRESS))
{
- DrawCircleClippedPic(eX * 0.5 * vid_conwidth + eY * 0.6 * vid_conheight, 0.1 * vid_conheight, "gfx/crosshair_ring.tga", STAT(CAPTURE_PROGRESS), '0.25 0.90 1', autocvar_hud_colorflash_alpha, DRAWFLAG_ADDITIVE);
- drawstring_aspect(eY * 0.64 * vid_conheight, _("Capture progress"), eX * vid_conwidth + eY * 0.025 * vid_conheight, '1 1 1', 1, DRAWFLAG_NORMAL);
+ DrawCircleClippedPic(vec2(0.5 * vid_conwidth, 0.6 * vid_conheight), 0.1 * vid_conheight, "gfx/crosshair_ring.tga", STAT(CAPTURE_PROGRESS), '0.25 0.90 1', autocvar_hud_colorflash_alpha, DRAWFLAG_ADDITIVE);
+ drawstring_aspect(eY * 0.64 * vid_conheight, _("Capture progress"), vec2(vid_conwidth, 0.025 * vid_conheight), '1 1 1', 1, DRAWFLAG_NORMAL);
}
else if(STAT(REVIVE_PROGRESS))
{
- DrawCircleClippedPic(eX * 0.5 * vid_conwidth + eY * 0.6 * vid_conheight, 0.1 * vid_conheight, "gfx/crosshair_ring.tga", STAT(REVIVE_PROGRESS), '0.25 0.90 1', autocvar_hud_colorflash_alpha, DRAWFLAG_ADDITIVE);
- drawstring_aspect(eY * 0.64 * vid_conheight, _("Revival progress"), eX * vid_conwidth + eY * 0.025 * vid_conheight, '1 1 1', 1, DRAWFLAG_NORMAL);
+ DrawCircleClippedPic(vec2(0.5 * vid_conwidth, 0.6 * vid_conheight), 0.1 * vid_conheight, "gfx/crosshair_ring.tga", STAT(REVIVE_PROGRESS), '0.25 0.90 1', autocvar_hud_colorflash_alpha, DRAWFLAG_ADDITIVE);
+ drawstring_aspect(eY * 0.64 * vid_conheight, _("Revival progress"), vec2(vid_conwidth, 0.025 * vid_conheight), '1 1 1', 1, DRAWFLAG_NORMAL);
}
HUD_Scale_Disable();
contentavgalpha = contentavgalpha * (1 - contentalpha_temp) + incontent * contentalpha_temp;
if(contentavgalpha)
- drawfill('0 0 0', eX * vid_conwidth + eY * vid_conheight, liquidcolor_prev, contentavgalpha * liquidalpha_prev, DRAWFLAG_NORMAL);
+ drawfill('0 0 0', vec2(vid_conwidth, vid_conheight), liquidcolor_prev, contentavgalpha * liquidalpha_prev, DRAWFLAG_NORMAL);
if(autocvar_hud_postprocessing)
{
if(autocvar_cl_gentle_damage == 2)
{
if(myhealth_flash < pain_threshold) // only randomize when the flash is gone
- myhealth_gentlergb = eX * random() + eY * random() + eZ * random();
+ myhealth_gentlergb = randomvec();
}
else
myhealth_gentlergb = stov(autocvar_hud_damage_gentle_color);
if(myhealth_flash_temp > 0)
- drawfill('0 0 0', eX * vid_conwidth + eY * vid_conheight, myhealth_gentlergb, autocvar_hud_damage_gentle_alpha_multiplier * bound(0, myhealth_flash_temp, 1) * autocvar_hud_damage, DRAWFLAG_NORMAL);
+ drawfill('0 0 0', vec2(vid_conwidth, vid_conheight), myhealth_gentlergb, autocvar_hud_damage_gentle_alpha_multiplier * bound(0, myhealth_flash_temp, 1) * autocvar_hud_damage, DRAWFLAG_NORMAL);
}
else if(myhealth_flash_temp > 0)
drawpic(splash_pos, "gfx/blood", splash_size, stov(autocvar_hud_damage_color), bound(0, myhealth_flash_temp, 1) * autocvar_hud_damage, DRAWFLAG_NORMAL);
float best_trace_fraction = 0;
while(ang.y < 360)
{
- dir = eX * cos(ang.y * DEG2RAD) + eY * sin(ang.y * DEG2RAD);
+ dir = vec2(cos(ang.y * DEG2RAD), sin(ang.y * DEG2RAD));
dir *= 500;
traceline(this.origin, this.origin - dir, MOVE_WORLDONLY, this);
if(trace_fraction > best_trace_fraction)
// get point in the box nearest to the given one (2D)
vector box_nearest(vector box_min, vector box_max, vector p)
{
- return eX * ( p_x > box_max_x ? box_max_x : ( p_x < box_min_x ? box_min_x : p_x ) )
- + eY * ( p_y > box_max_y ? box_max_y : ( p_y < box_min_y ? box_min_y : p_y ) );
+ return vec2( p.x > box_max.x ? box_max.x : ( p.x < box_min.x ? box_min.x : p.x ),
+ p.y > box_max.y ? box_max.y : ( p.y < box_min.y ? box_min.y : p.y ) );
}
void pong_paddle_bounce(entity ball, int pteam)
vector pong_team_to_box_halfsize(int nteam, float length, float width)
{
if ( nteam > 2 )
- return eY*width/2 + eX*length/2;
- return eX*width/2 + eY*length/2;
+ return vec2(length/2, width/2);
+ return vec2(width/2, length/2);
}
vector pong_team_to_paddlepos(int nteam)
// Get relative position of the center of a given tile
vector minigame_tile_pos(string id, int rows, int columns)
{
- return eX*(minigame_tile_letter(id)+0.5)/columns +
- eY - eY*(minigame_tile_number(id)+0.5)/rows;
+ return vec2((minigame_tile_letter(id) + 0.5) / columns,
+ (1 - (minigame_tile_number(id) + 0.5) / rows));
}
// Get a tile name from indices
if (autocvar_hud_panel_itemstime_progressbar_reduced)
{
p_pos = numpos;
- p_size = eX * ((ar - 1)/ar) * mySize_x + eY * mySize_y;
+ p_size = vec2(((ar - 1)/ar) * mySize.x, mySize.y);
}
else
{
if(autocvar_hud_panel_itemstime_text)
{
if(t > 0)
- drawstring_aspect(numpos, ftos(t), eX * ((ar - 1)/ar) * mySize_x + eY * mySize_y, color, panel_fg_alpha, DRAWFLAG_NORMAL);
+ drawstring_aspect(numpos, ftos(t), vec2(((ar - 1)/ar) * mySize.x, mySize.y), color, panel_fg_alpha, DRAWFLAG_NORMAL);
else if(precache_pic("gfx/hud/default/checkmark")) // COMPAT: check if this image exists, as 0.8.1 clients lack it
- drawpic_aspect_skin(numpos, "checkmark", eX * (ar - 1) * mySize_y + eY * mySize_y, '1 1 1', panel_fg_alpha * picalpha, DRAWFLAG_NORMAL);
+ drawpic_aspect_skin(numpos, "checkmark", vec2((ar - 1) * mySize.y, mySize.y), '1 1 1', panel_fg_alpha * picalpha, DRAWFLAG_NORMAL);
else // legacy code, if the image is missing just center the icon
picpos.x = myPos.x + mySize.x / 2 - mySize.y / 2;
}
rows = HUD_GetRowCount(count, mySize, ar);
columns = ceil(count/rows);
- vector itemstime_size = eX * mySize.x*(1/columns) + eY * mySize.y*(1/rows);
+ vector itemstime_size = vec2(mySize.x / columns, mySize.y / rows);
vector offset = '0 0 0';
float newSize;
if (!(Item_ItemsTime_GetTime(id) > time))
continue;
- DrawItemsTimeItem(pos + eX * column * (itemstime_size.x + offset.x) + eY * row * (itemstime_size.y + offset.y), itemstime_size, ar, icon, item_time, item_available, f);
+ DrawItemsTimeItem(pos + vec2(column * (itemstime_size.x + offset.x), row * (itemstime_size.y + offset.y)), itemstime_size, ar, icon, item_time, item_available, f);
++row;
if (row >= rows)
{
DrawNadeProgressBar(myPos, mySize, bonusProgress, nadeColor);
if(autocvar_hud_panel_ammo_text)
- drawstring_aspect(textPos, ftos(bonusNades), eX * (2/3) * mySize.x + eY * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+ drawstring_aspect(textPos, ftos(bonusNades), vec2((2/3) * mySize.x, mySize.y), '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
if(draw_expanding)
drawpic_aspect_skin_expanding(iconPos, nadeIcon, '1 1 0' * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL, expand_time);
// cos(a)
// cos(a + 2pi/3)
// cos(a + 4pi/3)
- return
- u *
- (
- '1 0 0' * cos(a + 2.0/3.0*M_PI)
- +
- '0 1 0' * cos(a + 4.0/3.0*M_PI)
- +
- '0 0 1' * cos(a)
- );
+ return u * vec3(
+ cos(a + 2.0/3.0*M_PI),
+ cos(a + 4.0/3.0*M_PI),
+ cos(a)
+ );
}
else if(D == 0)
{
return '0 0 0';
u = 3*q/p;
v = -u/2;
- if(u >= v)
- return '1 1 0' * v + '0 0 1' * u;
- else
- return '0 1 1' * v + '1 0 0' * u;
+ return (u >= v) ? vec3(v, v, u) : vec3(u, v, v);
}
else
{
// cardano
- u = cbrt(-q/2.0 + sqrt(D));
- v = cbrt(-q/2.0 - sqrt(D));
- return '1 1 1' * (u + v);
+ //u = cbrt(-q/2.0 + sqrt(D));
+ //v = cbrt(-q/2.0 - sqrt(D));
+ a = cbrt(-q/2.0 + sqrt(D)) + cbrt(-q/2.0 - sqrt(D));
+ return vec3(a, a, a);
}
}
vector solve_cubic_abcd(float a, float b, float c, float d)
vector findperpendicular(vector v)
{
- vector p;
- p.x = v.z;
- p.y = -v.x;
- p.z = v.y;
- return normalize(cliptoplane(p, v));
+ return normalize(cliptoplane(vec3(v.z, -v.x, v.y), v));
}
#ifdef SVQC
if (actor.(weaponentity).tuba_note == this)
{
actor.(weaponentity).tuba_lastnotes_last = (actor.(weaponentity).tuba_lastnotes_last + 1) % MAX_TUBANOTES;
- actor.(weaponentity).(tuba_lastnotes[actor.(weaponentity).tuba_lastnotes_last]) = eX * this.spawnshieldtime + eY * time + eZ * this.cnt;
+ actor.(weaponentity).(tuba_lastnotes[actor.(weaponentity).tuba_lastnotes_last]) = vec3(this.spawnshieldtime, time, this.cnt);
actor.(weaponentity).tuba_note = NULL;
actor.(weaponentity).tuba_lastnotes_cnt = bound(0, actor.(weaponentity).tuba_lastnotes_cnt + 1, MAX_TUBANOTES);
vector Rotate(vector v, float a)
{
float a_sin = sin(a), a_cos = cos(a);
- vector r = '0 0 0';
- r.x = v.x * a_cos + v.y * a_sin;
- r.y = -1 * v.x * a_sin + v.y * a_cos;
- return r;
+ return vec2(v.x * a_cos + v.y * a_sin, -v.x * a_sin + v.y * a_cos);
}
noref vector _yinvert;
vector m1 = box.mins + box.origin;
vector m2 = box.maxs + box.origin;
- vector ret;
- ret.x = bound(m1.x, org.x, m2.x);
- ret.y = bound(m1.y, org.y, m2.y);
- ret.z = bound(m1.z, org.z, m2.z);
- return ret;
+ return vec3(
+ bound(m1.x, org.x, m2.x),
+ bound(m1.y, org.y, m2.y),
+ bound(m1.z, org.z, m2.z)
+ );
}
#endif