From f1909e34d77bd146d4786dd56c6c7df4e9e62cfb Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Thu, 12 Jan 2012 18:19:58 +0100 Subject: [PATCH] make it compile and work --- hud_luminos.cfg | 2 + qcsrc/client/autocvars.qh | 1 + qcsrc/client/hud.qc | 103 ++++++++++++++++++++++++++-------- qcsrc/client/miscfunctions.qc | 2 +- qcsrc/server/t_items.qc | 10 +++- 5 files changed, 91 insertions(+), 27 deletions(-) diff --git a/hud_luminos.cfg b/hud_luminos.cfg index f32279f2b..25e7dea1f 100644 --- a/hud_luminos.cfg +++ b/hud_luminos.cfg @@ -14,6 +14,7 @@ seta hud_dock_alpha "1" seta hud_progressbar_alpha "0.500000" seta hud_progressbar_strength_color "0 0 0.6" +seta hud_progressbar_superweapons_color "0.6 0.3 0" seta hud_progressbar_shield_color "0.6 0 0.6" seta hud_progressbar_health_color "0.6 0 0" seta hud_progressbar_armor_color "0 0.6 0" @@ -86,6 +87,7 @@ seta hud_panel_powerups_baralign "3" seta hud_panel_powerups_progressbar "1" seta hud_panel_powerups_progressbar_strength "progressbar" seta hud_panel_powerups_progressbar_shield "progressbar" +seta hud_panel_powerups_progressbar_superweapons "progressbar" seta hud_panel_powerups_text "1" seta hud_panel_healtharmor 1 diff --git a/qcsrc/client/autocvars.qh b/qcsrc/client/autocvars.qh index 705e2c519..5c05e2fee 100644 --- a/qcsrc/client/autocvars.qh +++ b/qcsrc/client/autocvars.qh @@ -270,6 +270,7 @@ float autocvar_hud_panel_powerups_iconalign; float autocvar_hud_panel_powerups_progressbar; string autocvar_hud_panel_powerups_progressbar_shield; string autocvar_hud_panel_powerups_progressbar_strength; +string autocvar_hud_panel_powerups_progressbar_superweapons; float autocvar_hud_panel_powerups_text; float autocvar_hud_panel_pressedkeys; float autocvar_hud_panel_pressedkeys_aspect; diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index e941e5954..9305673ed 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -988,7 +988,7 @@ void HUD_Ammo(void) } } -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; @@ -1061,16 +1061,15 @@ void DrawNumIcon(vector myPos, vector mySize, float x, string icon, float vertic 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) @@ -1115,22 +1114,66 @@ void HUD_Powerups(void) 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; @@ -1151,9 +1194,23 @@ void HUD_Powerups(void) 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) { @@ -1169,7 +1226,7 @@ void HUD_Powerups(void) 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)); } } @@ -1187,7 +1244,7 @@ void HUD_Powerups(void) 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)); } } @@ -1205,7 +1262,7 @@ void HUD_Powerups(void) 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)); } } } diff --git a/qcsrc/client/miscfunctions.qc b/qcsrc/client/miscfunctions.qc index 93a47f50e..f4eaf927f 100644 --- a/qcsrc/client/miscfunctions.qc +++ b/qcsrc/client/miscfunctions.qc @@ -601,4 +601,4 @@ float getplayerisdead(float pl) return e.csqcmodel_isdead; return FALSE; -} \ No newline at end of file +} diff --git a/qcsrc/server/t_items.qc b/qcsrc/server/t_items.qc index edb0bef19..828c81049 100644 --- a/qcsrc/server/t_items.qc +++ b/qcsrc/server/t_items.qc @@ -1321,7 +1321,7 @@ void spawnfunc_target_items (void) 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"); @@ -1344,7 +1344,7 @@ void spawnfunc_target_items (void) 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 @@ -1392,7 +1392,7 @@ void spawnfunc_target_items (void) 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"); @@ -1726,6 +1726,10 @@ float GiveItems(entity e, float beginarg, float endarg) 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); -- 2.39.2