}
}
-void DrawNumIcon(vector myPos, vector mySize, float x, string icon, float vertical, float icon_right_align, vector color, float theAlpha)
+void DrawNumIcon_expanding(vector myPos, vector mySize, float x, string icon, float vertical, float icon_right_align, vector color, float theAlpha, float fadelerp)
{
vector newPos, newSize;
vector picpos, numpos;
picpos = newPos;
}
- 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);
+ // FIXME newSize_x is unused, is that right?
+
+ drawstring_aspect_expanding(numpos, ftos(x), '2 1 0' * newSize_y, color, panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL, fadelerp);
+ drawpic_aspect_skin_expanding(picpos, icon, '1 1 0' * newSize_y, '1 1 1', panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL, fadelerp);
}
-void DrawNumIcon_expanding(vector myPos, vector mySize, float x, string icon, float vertical, float icon_right_align, vector color, float fadelerp)
+void DrawNumIcon(vector myPos, vector mySize, float x, string icon, float vertical, float icon_right_align, vector color, float theAlpha)
{
- float sz;
- sz = expandingbox_sizefactor_from_fadelerp(fadelerp);
-
- DrawNumIcon(myPos + expandingbox_resize_centered_box_offset(sz, mySize, 1), mySize * sz, x, icon, vertical, icon_right_align, color, (1 - fadelerp));
+ DrawNumIcon_expanding(myPos, mySize, x, icon, vertical, icon_right_align, color, theAlpha, 0);
}
// Powerups (#2)
float is_vertical = (panel_ar < 1);
vector shield_offset, strength_offset, superweapons_offset;
+ float superweapons_is = -1;
+
+ if(superweapons_time)
+ {
+ if(strength_time)
+ {
+ if(shield_time)
+ superweapons_is = 0;
+ else
+ superweapons_is = 2;
+ }
+ else
+ {
+ if(shield_time)
+ superweapons_is = 1;
+ else
+ superweapons_is = 2;
+ }
+ }
+
// FIXME handle superweapons here
- if (panel_ar >= 4 || (panel_ar >= 1/4 && panel_ar < 1))
+ if(superweapons_is == 0)
{
- mySize_x *= 0.5;
- if (autocvar_hud_panel_powerups_flip)
- shield_offset_x = mySize_x;
+ if (panel_ar >= 4 || (panel_ar >= 1/4 && panel_ar < 1))
+ {
+ mySize_x *= (1.0 / 3.0);
+ superweapons_offset_x = mySize_x;
+ if (autocvar_hud_panel_powerups_flip)
+ shield_offset_x = 2*mySize_x;
+ else
+ strength_offset_x = 2*mySize_x;
+ }
else
- strength_offset_x = mySize_x;
+ {
+ mySize_y *= (1.0 / 3.0);
+ superweapons_offset_y = mySize_y;
+ if (autocvar_hud_panel_powerups_flip)
+ shield_offset_y = 2*mySize_y;
+ else
+ strength_offset_y = 2*mySize_y;
+ }
}
else
{
- mySize_y *= 0.5;
- if (autocvar_hud_panel_powerups_flip)
- shield_offset_y = mySize_y;
+ if (panel_ar >= 4 || (panel_ar >= 1/4 && panel_ar < 1))
+ {
+ mySize_x *= 0.5;
+ if (autocvar_hud_panel_powerups_flip)
+ shield_offset_x = mySize_x;
+ else
+ strength_offset_x = mySize_x;
+ }
else
- strength_offset_y = mySize_y;
+ {
+ mySize_y *= 0.5;
+ if (autocvar_hud_panel_powerups_flip)
+ shield_offset_y = mySize_y;
+ else
+ strength_offset_y = mySize_y;
+ }
}
float shield_baralign, strength_baralign, superweapons_baralign;
strength_iconalign = (autocvar_hud_panel_powerups_iconalign == 3 || autocvar_hud_panel_powerups_iconalign == 1);
}
- // TODO suboptimal
- superweapons_iconalign = strength_iconalign;
- superweapons_baralign = strength_baralign;
+ if(superweapons_is == 0)
+ {
+ superweapons_iconalign = strength_iconalign;
+ superweapons_baralign = 2;
+ }
+ else if(superweapons_is == 1)
+ {
+ superweapons_offset = strength_offset;
+ superweapons_iconalign = strength_iconalign;
+ superweapons_baralign = strength_baralign;
+ }
+ else if(superweapons_is == 2)
+ {
+ superweapons_offset = shield_offset;
+ superweapons_iconalign = shield_iconalign;
+ superweapons_baralign = shield_baralign;
+ }
if(shield_time)
{
if(shield > 1)
DrawNumIcon(pos + shield_offset, mySize, shield, "shield", is_vertical, shield_iconalign, '1 1 1', 1);
if(shield <= 5)
- DrawNumIcon_expanding(pos + shield_offset, mySize, shield, "shield", is_vertical, shield_iconalign, '1 1 1', bound(0, (shield - shield_time) / 0.5, 1));
+ DrawNumIcon_expanding(pos + shield_offset, mySize, shield, "shield", is_vertical, shield_iconalign, '1 1 1', 1, bound(0, (shield - shield_time) / 0.5, 1));
}
}
if(strength > 1)
DrawNumIcon(pos + strength_offset, mySize, strength, "strength", is_vertical, strength_iconalign, '1 1 1', 1);
if(strength <= 5)
- DrawNumIcon_expanding(pos + strength_offset, mySize, strength, "strength", is_vertical, strength_iconalign, '1 1 1', bound(0, (strength - strength_time) / 0.5, 1));
+ DrawNumIcon_expanding(pos + strength_offset, mySize, strength, "strength", is_vertical, strength_iconalign, '1 1 1', 1, bound(0, (strength - strength_time) / 0.5, 1));
}
}
if(superweapons > 1)
DrawNumIcon(pos + superweapons_offset, mySize, superweapons, "superweapons", is_vertical, superweapons_iconalign, '1 1 1', 1);
if(superweapons <= 5)
- DrawNumIcon_expanding(pos + superweapons_offset, mySize, superweapons, "superweapons", is_vertical, superweapons_iconalign, '1 1 1', bound(0, (superweapons - superweapons_time) / 0.5, 1));
+ DrawNumIcon_expanding(pos + superweapons_offset, mySize, superweapons, "superweapons", is_vertical, superweapons_iconalign, '1 1 1', 1, bound(0, (superweapons - superweapons_time) / 0.5, 1));
}
}
}
if(!self.invincible_finished)
self.invincible_finished = autocvar_g_balance_powerup_invincible_time;
if(!self.superweapons_finished)
- self.superweapons_finished = autocvar_g_balance_powerup_superweapons_time;
+ self.superweapons_finished = autocvar_g_balance_superweapons_time;
precache_sound("misc/itempickup.wav");
precache_sound("misc/megahealth.wav");
else if(argv(i) == "unlimited_superweapons") self.items |= IT_UNLIMITED_SUPERWEAPONS;
else if(argv(i) == "strength") self.items |= IT_STRENGTH;
else if(argv(i) == "invincible") self.items |= IT_INVINCIBLE;
- else if(argv(i) == "superweapons") self.items |= IT_SUPERWEAPONS;
+ else if(argv(i) == "superweapons") self.items |= IT_SUPERWEAPON;
else if(argv(i) == "jetpack") self.items |= IT_JETPACK;
else if(argv(i) == "fuel_regen") self.items |= IT_FUEL_REGEN;
else
self.netname = sprintf("%s %s%d %s", self.netname, itemprefix, !!(self.items & IT_UNLIMITED_SUPERWEAPONS), "unlimited_superweapons");
self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, self.strength_finished * !!(self.items & IT_STRENGTH), "strength");
self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, self.invincible_finished * !!(self.items & IT_INVINCIBLE), "invincible");
- self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, self.superweapons_finished * !!(self.items & IT_SUPERWEAPONS), "superweapons");
+ self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, self.superweapons_finished * !!(self.items & IT_SUPERWEAPON), "superweapons");
self.netname = sprintf("%s %s%d %s", self.netname, itemprefix, !!(self.items & IT_JETPACK), "jetpack");
self.netname = sprintf("%s %s%d %s", self.netname, itemprefix, !!(self.items & IT_FUEL_REGEN), "fuel_regen");
if(self.ammo_shells != 0) self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, max(0, self.ammo_shells), "shells");
POSTGIVE_VALUE_ROT(e, armorvalue, 1, pauserotarmor_finished, autocvar_g_balance_pause_armor_rot, pauseregen_finished, autocvar_g_balance_pause_health_regen, "misc/armor25.wav", string_null);
POSTGIVE_VALUE_ROT(e, health, 1, pauserothealth_finished, autocvar_g_balance_pause_health_rot, pauseregen_finished, autocvar_g_balance_pause_health_regen, "misc/megahealth.wav", string_null);
+ if(e.superweapons_finished <= 0)
+ if(self.weapons & WEPBIT_SUPERWEAPONS)
+ e.superweapons_finished = autocvar_g_balance_superweapons_time;
+
if (g_minstagib)
{
e.health = bound(0, e.health, 100);