seta hud_progressbar_alpha "" "alpha of progressbars"
seta hud_progressbar_strength_color "" "R G B vector of the progress bar background color"
+seta hud_progressbar_superweapons_color "" "R G B vector of the progress bar background color"
seta hud_progressbar_shield_color "" "R G B vector of the progress bar background color"
seta hud_progressbar_health_color "" "R G B vector of the progress bar background color"
seta hud_progressbar_armor_color "" "R G B vector of the progress bar background color"
seta hud_panel_powerups_progressbar "" "enable progressbar in panel"
seta hud_panel_powerups_progressbar_strength "" "progressbar image for strength"
seta hud_panel_powerups_progressbar_shield "" "progressbar image for shield"
+seta hud_panel_powerups_progressbar_superweapons "" "progressbar image for superweapons"
seta hud_panel_powerups_text "" "show text/icons in the powerups panel"
seta hud_panel_healtharmor "" "enable/disable this panel, 2 = combined health/armor display"
set g_balance_powerup_strength_time 30
set g_balance_powerup_strength_selfdamage 1.5
set g_balance_powerup_strength_selfforce 1.5
+set g_balance_superweapons_time 30
// }}}
// {{{ jetpack/hook
set g_balance_powerup_strength_time 30
set g_balance_powerup_strength_selfdamage 1.5
set g_balance_powerup_strength_selfforce 1.5
+set g_balance_superweapons_time 30
// }}}
// {{{ jetpack/hook
set g_balance_powerup_strength_time 30
set g_balance_powerup_strength_selfdamage 1.5
set g_balance_powerup_strength_selfforce 1.5
+set g_balance_superweapons_time 30
// }}}
// {{{ jetpack/hook
set g_balance_powerup_strength_time 30
set g_balance_powerup_strength_selfdamage 1.5
set g_balance_powerup_strength_selfforce 1.5
+set g_balance_superweapons_time 30
// }}}
// {{{ jetpack/hook
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"
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
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"
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
seta hud_progressbar_alpha "0.3"
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"
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
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"
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
seta hud_progressbar_alpha "0.5"
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"
seta hud_panel_powerups_progressbar "0"
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
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;
}
}
-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)
//
void HUD_Powerups(void)
{
- float strength_time, shield_time;
+ float strength_time, shield_time, superweapons_time;
if(!autocvar__hud_configure)
{
if(!autocvar_hud_panel_powerups) return;
if(spectatee_status == -1) return;
- if not(getstati(STAT_ITEMS, 0, 24) & (IT_STRENGTH | IT_INVINCIBLE)) return;
+ if not(getstati(STAT_ITEMS, 0, 24) & (IT_STRENGTH | IT_INVINCIBLE | IT_SUPERWEAPON)) return;
if (getstati(STAT_HEALTH) <= 0) return;
strength_time = bound(0, getstatf(STAT_STRENGTH_FINISHED) - time, 99);
shield_time = bound(0, getstatf(STAT_INVINCIBLE_FINISHED) - time, 99);
+ superweapons_time = bound(0, getstatf(STAT_SUPERWEAPONS_FINISHED) - time, 99);
+
+ if (getstati(STAT_ITEMS, 0, 24) & IT_UNLIMITED_SUPERWEAPONS)
+ superweapons_time = 99; // force max
+
+ // prevent stuff to show up on mismatch that will be fixed next frame
+ if (!(getstati(STAT_ITEMS, 0, 24) & IT_SUPERWEAPON))
+ superweapons_time = 0;
}
else
{
strength_time = 15;
shield_time = 27;
+ superweapons_time = 13;
}
HUD_Panel_UpdateCvars(powerups);
pos = panel_pos;
mySize = panel_size;
- HUD_Panel_DrawBg(bound(0, max(strength_time, shield_time), 1));
+ HUD_Panel_DrawBg(bound(0, max(strength_time, shield_time, superweapons_time), 1));
if(panel_bg_padding)
{
pos += '1 1 0' * panel_bg_padding;
float panel_ar = mySize_x/mySize_y;
float is_vertical = (panel_ar < 1);
- vector shield_offset, strength_offset;
- if (panel_ar >= 4 || (panel_ar >= 1/4 && 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(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;
- float shield_iconalign, strength_iconalign;
+ float shield_baralign, strength_baralign, superweapons_baralign;
+ float shield_iconalign, strength_iconalign, superweapons_iconalign;
+
if (autocvar_hud_panel_powerups_flip)
{
strength_baralign = (autocvar_hud_panel_powerups_baralign == 2 || autocvar_hud_panel_powerups_baralign == 1);
strength_iconalign = (autocvar_hud_panel_powerups_iconalign == 3 || autocvar_hud_panel_powerups_iconalign == 1);
}
+ 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)
{
const float maxshield = 30;
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_time)
+ {
+ const float maxsuperweapons = 30;
+ float superweapons = ceil(superweapons_time);
+ if(autocvar_hud_panel_powerups_progressbar)
+ {
+ HUD_Panel_GetProgressBarColor(superweapons);
+ HUD_Panel_DrawProgressBar(pos + superweapons_offset, mySize, autocvar_hud_panel_powerups_progressbar_superweapons, superweapons/maxsuperweapons, is_vertical, superweapons_baralign, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+ }
+ if(autocvar_hud_panel_powerups_text)
+ {
+ 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', 1, bound(0, (superweapons - superweapons_time) / 0.5, 1));
}
}
}
return e.csqcmodel_isdead;
return FALSE;
-}
\ No newline at end of file
+}
const float STAT_LAYED_MINES = 56;
const float STAT_HAGAR_LOAD = 57;
const float STAT_SWITCHINGWEAPON = 58;
+const float STAT_SUPERWEAPONS_FINISHED = 59;
// see DP source, quakedef.h
const float STAT_MOVEVARS_AIRSPEEDLIMIT_NONQW = 222;
float BOT_PICKUP_RATING_MID = 5000;
float BOT_PICKUP_RATING_HIGH = 10000;
-float WEP_TYPE_OTHER = 0x00; // e.g: Hook, Port-o-launch, etc
-float WEP_TYPE_SPLASH = 0x01;
-float WEP_TYPE_HITSCAN = 0x02;
-float WEP_TYPEMASK = 0x0F;
-float WEP_FLAG_CANCLIMB = 0x10;
-float WEP_FLAG_NORMAL = 0x20;
-float WEP_FLAG_HIDDEN = 0x40;
-float WEP_FLAG_RELOADABLE = 0x80;
+float WEP_TYPE_OTHER = 0x00; // e.g: Hook, Port-o-launch, etc
+float WEP_TYPE_SPLASH = 0x01;
+float WEP_TYPE_HITSCAN = 0x02;
+float WEP_TYPEMASK = 0x0F;
+float WEP_FLAG_CANCLIMB = 0x10;
+float WEP_FLAG_NORMAL = 0x20;
+float WEP_FLAG_HIDDEN = 0x40;
+float WEP_FLAG_RELOADABLE = 0x80;
+float WEP_FLAG_SUPERWEAPON = 0x100;
-float IT_UNLIMITED_WEAPON_AMMO = 1;
+float IT_UNLIMITED_WEAPON_AMMO = 1;
// when this bit is set, using a weapon does not reduce ammo. Checkpoints can give this powerup.
-float IT_UNLIMITED_SUPERWEAPONS = 2;
-// when this bit is set, using a superweapon does not throw it away. Checkpoints can give this powerup.
-float IT_CTF_SHIELDED = 4; // set for the flag shield
-// using jetpack
-float IT_USING_JETPACK = 8; // confirmation that button is pressed
-float IT_JETPACK = 16; // actual item
-float IT_FUEL_REGEN = 32; // fuel regeneration trigger
-float IT_SHELLS = 256;
-float IT_NAILS = 512;
-float IT_ROCKETS = 1024;
-float IT_CELLS = 2048;
-float IT_SUPERWEAPON = 4096;
-float IT_FUEL = 128;
-float IT_STRENGTH = 8192;
-float IT_INVINCIBLE = 16384;
-float IT_HEALTH = 32768;
+float IT_UNLIMITED_SUPERWEAPONS = 2;
+// when this bit is set, superweapons don't expire. Checkpoints can give this powerup.
+float IT_CTF_SHIELDED = 4; // set for the flag shield
+float IT_USING_JETPACK = 8; // confirmation that button is pressed
+float IT_JETPACK = 16; // actual item
+float IT_FUEL_REGEN = 32; // fuel regeneration trigger
+float IT_SHELLS = 256;
+float IT_NAILS = 512;
+float IT_ROCKETS = 1024;
+float IT_CELLS = 2048;
+float IT_SUPERWEAPON = 4096;
+float IT_FUEL = 128;
+float IT_STRENGTH = 8192;
+float IT_INVINCIBLE = 16384;
+float IT_HEALTH = 32768;
// union:
- // for items:
- float IT_KEY1 = 131072;
- float IT_KEY2 = 262144;
- // for players:
- float IT_RED_FLAG_TAKEN = 32768;
- float IT_RED_FLAG_LOST = 65536;
- float IT_RED_FLAG_CARRING = 98304;
- float IT_BLUE_FLAG_TAKEN = 131072;
- float IT_BLUE_FLAG_LOST = 262144;
- float IT_BLUE_FLAG_CARRING = 393216;
+ // for items:
+ float IT_KEY1 = 131072;
+ float IT_KEY2 = 262144;
+ // for players:
+ float IT_RED_FLAG_TAKEN = 32768;
+ float IT_RED_FLAG_LOST = 65536;
+ float IT_RED_FLAG_CARRING = 98304;
+ float IT_BLUE_FLAG_TAKEN = 131072;
+ float IT_BLUE_FLAG_LOST = 262144;
+ float IT_BLUE_FLAG_CARRING = 393216;
// end
-float IT_5HP = 524288;
-float IT_25HP = 1048576;
-float IT_ARMOR_SHARD = 2097152;
-float IT_ARMOR = 4194304;
+float IT_5HP = 524288;
+float IT_25HP = 1048576;
+float IT_ARMOR_SHARD = 2097152;
+float IT_ARMOR = 4194304;
-float IT_AMMO = 8064; // IT_SHELLS | IT_NAILS | IT_ROCKETS | IT_CELLS | IT_SUPERWEAPON | IT_FUEL;
-float IT_PICKUPMASK = 51; // IT_FUEL_REGEN | IT_JETPACK | IT_UNLIMITED_AMMO; // strength and invincible are handled separately
-float IT_UNLIMITED_AMMO = 3; // IT_UNLIMITED_SUPERWEAPONS | IT_UNLIMITED_WEAPON_AMMO;
+float IT_AMMO = 3968; // IT_SHELLS | IT_NAILS | IT_ROCKETS | IT_CELLS | IT_FUEL;
+float IT_PICKUPMASK = 51; // IT_FUEL_REGEN | IT_JETPACK | IT_UNLIMITED_AMMO; // strength and invincible are handled separately
+float IT_UNLIMITED_AMMO = 3; // IT_UNLIMITED_SUPERWEAPONS | IT_UNLIMITED_WEAPON_AMMO;
float AMMO_COUNT = 4; // amount of ammo types to show in the inventory panel
float WEP_LAST;
#define WEP_MAXCOUNT 24
float WEPBIT_ALL;
+float WEPBIT_SUPERWEAPONS;
#define REGISTER_WEAPON_2(id,bit,func,ammotype,i,weapontype,pickupbasevalue,modelname,shortname,wname) \
float id; \
float bit; \
{ \
WEP_LAST = (id = WEP_FIRST + WEP_COUNT); \
WEPBIT_ALL |= (bit = power2of(WEP_COUNT)); \
+ WEPBIT_SUPERWEAPONS |= (bit = power2of(WEP_COUNT)) * !!(weapontype & WEP_FLAG_SUPERWEAPON); \
++WEP_COUNT; \
register_weapon(id,func,ammotype,i,weapontype,pickupbasevalue,modelname,shortname,wname); \
} \
float autocvar_g_balance_powerup_strength_selfdamage;
float autocvar_g_balance_powerup_strength_selfforce;
float autocvar_g_balance_powerup_strength_time;
+float autocvar_g_balance_superweapons_time;
float autocvar_g_balance_rocketlauncher_ammo;
float autocvar_g_balance_rocketlauncher_animtime;
float autocvar_g_balance_rocketlauncher_damage;
self.pain_finished = 0;
self.strength_finished = 0;
self.invincible_finished = 0;
+ self.superweapons_finished = 0;
self.pushltime = 0;
self.think = SUB_Null;
self.nextthink = 0;
self.weapons = start_weapons;
}
+ if(self.weapons & WEPBIT_SUPERWEAPONS) // exception for minstagib, as minstanex is a superweapon
+ self.superweapons_finished = time + autocvar_g_balance_superweapons_time;
+ else
+ self.superweapons_finished = 0;
+
if(g_weaponarena_random)
{
if(g_weaponarena_random_with_laser)
sprint(self, "^3Shield surrounds you\n");
}
}
+ if (self.items & IT_SUPERWEAPON)
+ {
+ self.effects = self.effects | EF_RED;
+ if (!(self.weapons & WEPBIT_SUPERWEAPONS))
+ {
+ self.superweapons_finished = 0;
+ self.items = self.items - (self.items & IT_SUPERWEAPON);
+ sprint(self, "^3Superweapons have been lost\n");
+ }
+ else if (self.items & IT_UNLIMITED_SUPERWEAPONS)
+ {
+ // don't let them run out
+ }
+ else
+ {
+ play_countdown(self.superweapons_finished, "misc/poweroff.wav");
+ if (time > self.superweapons_finished)
+ {
+ self.items = self.items - (self.items & IT_SUPERWEAPON);
+ self.weapons &~= WEPBIT_SUPERWEAPONS;
+ sprint(self, "^3Superweapons have broken down\n");
+ }
+ }
+ }
+ else
+ {
+ if (time < self.superweapons_finished)
+ {
+ self.items = self.items | IT_SUPERWEAPON;
+ sprint(self, "^3You now have a superweapon\n");
+ }
+ else
+ self.weapons &~= WEPBIT_SUPERWEAPONS; // just in case
+ }
}
if(autocvar_g_nodepthtestplayers)
float W_AmmoItemCode(float wpn)
{
- return (get_weaponinfo(wpn)).items;
+ return (get_weaponinfo(wpn)).items & IT_AMMO;
}
void thrown_wep_think()
wep.colormap = own.colormap;
wa = W_AmmoItemCode(wpn);
- if(wa == IT_SUPERWEAPON || wa == 0)
+ if(wa == 0)
{
oldself = self;
self = wep;
wb = W_WeaponBit(w);
if(!wb)
return 0;
+ if(wb & WEPBIT_SUPERWEAPONS) // can't throw a superweapon, they don't work
+ return 0;
wa = W_AmmoItemCode(w);
if(start_weapons & wb)
{
- if(wa == IT_SUPERWEAPON && start_items & IT_UNLIMITED_SUPERWEAPONS)
- return 0;
- if(wa != IT_SUPERWEAPON && start_items & IT_UNLIMITED_WEAPON_AMMO)
- return 0;
// start weapons that take no ammo can't be dropped (this prevents dropping the laser, as long as it continues to use no ammo)
+ if(start_items & IT_UNLIMITED_WEAPON_AMMO)
+ return 0;
if(wa == 0)
return 0;
}
entity e;
e = get_weaponinfo(windex);
self.items &~= IT_AMMO;
- self.items = self.items | e.items;
+ self.items = self.items | (e.items & IT_AMMO);
// the two weapon entities will notice this has changed and update their models
self.weapon = windex;
.float crouch; // Crouching or not?
.float strength_finished;
-//.float speed_finished;
.float invincible_finished;
-//.float slowmo_finished;
+.float superweapons_finished;
.vector finaldest, finalangle; //plat.qc stuff
.void() think1;
addstat(STAT_STRENGTH_FINISHED, AS_FLOAT, strength_finished);
addstat(STAT_INVINCIBLE_FINISHED, AS_FLOAT, invincible_finished);
+ addstat(STAT_SUPERWEAPONS_FINISHED, AS_FLOAT, superweapons_finished);
addstat(STAT_PRESSED_KEYS, AS_FLOAT, pressedkeys);
addstat(STAT_FUEL, AS_INT, ammo_fuel);
addstat(STAT_SHOTORG, AS_INT, stat_shotorg);
start_weapons = WEPBIT_MINSTANEX;
weapon_action(WEP_MINSTANEX, WR_PRECACHE);
g_minstagib_invis_alpha = cvar("g_minstagib_invis_alpha");
+ start_items |= IT_UNLIMITED_SUPERWEAPONS;
if (g_minstagib_invis_alpha <= 0)
g_minstagib_invis_alpha = -1;
{
self.nix_lastchange_id = -1;
NIX_GiveCurrentWeapon(); // overrides the weapons you got when spawning
+ self.items |= IT_UNLIMITED_SUPERWEAPONS;
return 0;
}
void Item_ScheduleRespawnIn(entity e, float t)
{
- if((e.flags & FL_POWERUP) || (e.items & IT_SUPERWEAPON))
+ if((e.flags & FL_POWERUP) || (e.weapons & WEPBIT_SUPERWEAPONS))
{
e.think = Item_RespawnCountdown;
e.nextthink = time + max(0, t - ITEM_RESPAWN_TICKS);
if (item.strength_finished)
{
pickedup = TRUE;
- player.strength_finished = max(player.strength_finished, time) + autocvar_g_balance_powerup_strength_time;
+ player.strength_finished = max(player.strength_finished, time) + item.strength_finished;
}
if (item.invincible_finished)
{
pickedup = TRUE;
- player.invincible_finished = max(player.invincible_finished, time) + autocvar_g_balance_powerup_invincible_time;
+ player.invincible_finished = max(player.invincible_finished, time) + item.invincible_finished;
+ }
+ if (item.superweapons_finished)
+ {
+ pickedup = TRUE;
+ player.superweapons_finished = max(player.superweapons_finished, time) + item.superweapons_finished;
}
}
}
}
+void Item_Reset()
+{
+ Item_Show(self, !self.state);
+ setorigin (self, self.origin);
+ self.think = SUB_Null;
+ self.nextthink = 0;
+
+ if((self.flags & FL_POWERUP) | (self.weapons & WEPBIT_SUPERWEAPONS)) // do not spawn powerups initially!
+ Item_ScheduleInitialRespawn(self);
+}
+
void Item_FindTeam()
{
entity head, e;
head.effects &~= EF_NODRAW;
}
- if(e.flags & FL_POWERUP) // do not spawn powerups initially!
- Item_ScheduleInitialRespawn(e);
+ Item_Reset();
}
}
-void Item_Reset()
-{
- Item_Show(self, !self.state);
- setorigin (self, self.origin);
- self.think = SUB_Null;
- self.nextthink = 0;
-
- if(self.flags & FL_POWERUP) // do not spawn powerups initially!
- Item_ScheduleInitialRespawn(self);
-}
-
// Savage: used for item garbage-collection
// TODO: perhaps nice special effect?
void RemoveItem(void)
self.bot_pickupbasevalue = pickupbasevalue;
self.mdl = itemmodel;
self.item_pickupsound = pickupsound;
+ if(self.weapons)
+ self.weapon = WEP_FIRST + log2of(lowestbit(self.weapons));
+ else
+ self.weapon = 0;
// let mappers override respawntime
if(!self.respawntime) // both set
{
self.effects = self.effects | EF_NODRAW; // marker for item team search
InitializeEntity(self, Item_FindTeam, INITPRIO_FINDTARGET);
}
- else if(self.flags & FL_POWERUP) // do not spawn powerups initially!
- Item_ScheduleInitialRespawn(self);
+ else
+ Item_Reset();
}
/* replace items in minstagib
// replace with invis
if (itemid == IT_STRENGTH)
{
- self.strength_finished = 30;
+ if(!self.strength_finished)
+ self.strength_finished = autocvar_g_balance_powerup_strength_time;
StartItem ("models/items/g_strength.md3",
"misc/powerup.wav", g_pickup_respawntime_powerup, g_pickup_respawntimejitter_powerup,
"Invisibility", IT_STRENGTH, 0, FL_POWERUP, generic_pickupevalfunc, BOT_PICKUP_RATING_MID);
// replace with speed
if (itemid == IT_INVINCIBLE)
{
- self.invincible_finished = 30;
+ if(!self.invincible_finished)
+ self.invincible_finished = autocvar_g_balance_powerup_invincible_time;
StartItem ("models/items/g_invincible.md3",
"misc/powerup_shield.wav", g_pickup_respawntime_powerup, g_pickup_respawntimejitter_powerup,
"Speed", IT_INVINCIBLE, 0, FL_POWERUP, generic_pickupevalfunc, BOT_PICKUP_RATING_MID);
e = get_weaponinfo(wpn);
- if(e.items & IT_SUPERWEAPON)
- self.items |= IT_SUPERWEAPON;
-
if(!self.respawntime)
{
- if(self.items & IT_SUPERWEAPON)
+ if(e.weapons & WEPBIT_SUPERWEAPONS)
{
self.respawntime = g_pickup_respawntime_superweapon;
self.respawntimejitter = g_pickup_respawntimejitter_superweapon;
}
}
+ if(e.weapons & WEPBIT_SUPERWEAPONS)
+ if(!self.superweapons_finished)
+ self.superweapons_finished = autocvar_g_balance_superweapons_time;
+
if(e.items)
{
for(i = 0, j = 1; i < 24; ++i, j *= 2)
}
// no weapon-stay on superweapons
- if(self.items & IT_SUPERWEAPON)
+ if(self.weapons & WEPBIT_SUPERWEAPONS)
self.flags |= FL_NO_WEAPON_STAY;
// weapon stay isn't supported for teamed weapons
minstagib_items(IT_STRENGTH);
} else {
precache_sound("weapons/strength_fire.wav");
- self.strength_finished = 30;
+ if(!self.strength_finished)
+ self.strength_finished = autocvar_g_balance_powerup_strength_time;
StartItem ("models/items/g_strength.md3", "misc/powerup.wav", g_pickup_respawntime_powerup, g_pickup_respawntimejitter_powerup, "Strength Powerup", IT_STRENGTH, 0, FL_POWERUP, generic_pickupevalfunc, 100000);
}
}
if(g_minstagib) {
minstagib_items(IT_INVINCIBLE);
} else {
- self.invincible_finished = 30;
+ if(!self.invincible_finished)
+ self.invincible_finished = autocvar_g_balance_powerup_invincible_time;
StartItem ("models/items/g_invincible.md3", "misc/powerup_shield.wav", g_pickup_respawntime_powerup, g_pickup_respawntimejitter_powerup, "Shield", IT_INVINCIBLE, 0, FL_POWERUP, generic_pickupevalfunc, 100000);
}
}
self.strength_finished = autocvar_g_balance_powerup_strength_time;
if(!self.invincible_finished)
self.invincible_finished = autocvar_g_balance_powerup_invincible_time;
+ if(!self.superweapons_finished)
+ 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_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_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");
e.strength_finished = max(0, e.strength_finished - time);
e.invincible_finished = max(0, e.invincible_finished - time);
+ e.superweapons_finished = max(0, e.superweapons_finished - time);
PREGIVE(e, items);
PREGIVE(e, weapons);
PREGIVE(e, strength_finished);
PREGIVE(e, invincible_finished);
+ PREGIVE(e, superweapons_finished);
PREGIVE(e, ammo_nails);
PREGIVE(e, ammo_cells);
PREGIVE(e, ammo_shells);
continue;
case "ALL":
got += GiveBit(e, items, IT_FUEL_REGEN, op, val);
- got += GiveValue(e, strength_finished, op, time);
- got += GiveValue(e, invincible_finished, op, time);
+ got += GiveValue(e, strength_finished, op, val);
+ got += GiveValue(e, invincible_finished, op, val);
+ got += GiveValue(e, superweapons_finished, op, val);
got += GiveBit(e, items, IT_UNLIMITED_AMMO, op, val);
case "all":
got += GiveBit(e, items, IT_JETPACK, op, val);
case "invincible":
got += GiveValue(e, invincible_finished, op, val);
break;
+ case "superweapons":
+ got += GiveValue(e, superweapons_finished, op, val);
+ break;
case "cells":
got += GiveValue(e, ammo_cells, op, val);
break;
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);
e.invincible_finished = 0;
else
e.invincible_finished += time;
+ if(e.superweapons_finished <= 0)
+ e.superweapons_finished = 0;
+ else
+ e.superweapons_finished += time;
if not(e.weapons & W_WeaponBit(e.switchweapon))
_switchweapon = TRUE;
#ifdef REGISTER_WEAPON
-REGISTER_WEAPON(FIREBALL, w_fireball, IT_FUEL, 9, WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH, BOT_PICKUP_RATING_MID, "fireball", "fireball", _("Fireball"));
+REGISTER_WEAPON(FIREBALL, w_fireball, IT_FUEL, 9, WEP_FLAG_RELOADABLE | WEP_FLAG_SUPERWEAPON | WEP_TYPE_SPLASH, BOT_PICKUP_RATING_MID, "fireball", "fireball", _("Fireball"));
#else
#ifdef SVQC
.float bot_primary_fireballmooth; // whatever a mooth is
#ifdef REGISTER_WEAPON
-REGISTER_WEAPON(MINSTANEX, w_minstanex, IT_CELLS, 7, WEP_FLAG_HIDDEN | WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_TYPE_HITSCAN, BOT_PICKUP_RATING_HIGH, "minstanex", "minstanex", _("MinstaNex"))
+REGISTER_WEAPON(MINSTANEX, w_minstanex, IT_CELLS, 7, WEP_FLAG_HIDDEN | WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_FLAG_SUPERWEAPON | WEP_TYPE_HITSCAN, BOT_PICKUP_RATING_HIGH, "minstanex", "minstanex", _("MinstaNex"))
#else
#ifdef SVQC
.float minstanex_lasthit;