seta hud_panel_buffs_bg_alpha "" "if set to something else than \"\" = override default panel background alpha"
seta hud_panel_buffs_bg_border "" "if set to something else than \"\" = override default size of border around the background"
seta hud_panel_buffs_bg_padding "" "if set to something else than \"\" = override default padding of contents from border"
+seta hud_panel_buffs_progressbar "" "use progressbar behind buff names"
+seta hud_panel_buffs_progressbar_name "" "name of progressbar to use behind buff names"
seta hud_panel_buffs_bg_alpha ""
seta hud_panel_buffs_bg_border ""
seta hud_panel_buffs_bg_padding ""
+seta hud_panel_buffs_progressbar 1
+seta hud_panel_buffs_progressbar_name "progressbar"
menu_sync
seta hud_panel_buffs_bg_alpha ""
seta hud_panel_buffs_bg_border ""
seta hud_panel_buffs_bg_padding ""
+seta hud_panel_buffs_progressbar 1
+seta hud_panel_buffs_progressbar_name "progressbar"
menu_sync
seta hud_panel_buffs_bg_alpha ""
seta hud_panel_buffs_bg_border ""
seta hud_panel_buffs_bg_padding ""
+seta hud_panel_buffs_progressbar 1
+seta hud_panel_buffs_progressbar_name "progressbar"
menu_sync
seta hud_panel_buffs_bg_alpha ""
seta hud_panel_buffs_bg_border ""
seta hud_panel_buffs_bg_padding ""
+seta hud_panel_buffs_progressbar 1
+seta hud_panel_buffs_progressbar_name "progressbar"
menu_sync
seta hud_panel_buffs_bg_alpha ""
seta hud_panel_buffs_bg_border ""
seta hud_panel_buffs_bg_padding ""
+seta hud_panel_buffs_progressbar 1
+seta hud_panel_buffs_progressbar_name "progressbar"
menu_sync
seta hud_panel_buffs_bg_alpha ""
seta hud_panel_buffs_bg_border ""
seta hud_panel_buffs_bg_padding ""
+seta hud_panel_buffs_progressbar 1
+seta hud_panel_buffs_progressbar_name "progressbar"
menu_sync
set g_buffs_cooldown_activate 5 "cooldown period when buff is first activated"
set g_buffs_cooldown_respawn 3 "cooldown period when buff is reloading"
set g_buffs_ammo 1 "ammo buff: infinite ammunition"
+set g_buffs_ammo_time 60 "ammo buff carry time"
set g_buffs_resistance 1 "resistance buff: greatly reduces damage taken"
+set g_buffs_resistance_time 60 "resistance buff time"
set g_buffs_resistance_blockpercent 0.7 "damage reduction multiplier, higher values mean less damage"
set g_buffs_medic 1 "medic buff: increased regeneration speed, extra health, chance to survive a fatal attack"
+set g_buffs_medic_time 60 "medic buff carry time"
set g_buffs_medic_survive_chance 0.6 "multiplier chance of player surviving a fatal hit"
set g_buffs_medic_survive_health 5 "amount of health player survives with after taking a fatal hit"
set g_buffs_medic_rot 0.2 "health rot rate multiplier"
set g_buffs_medic_max 1.5 "stable health medic limit multiplier"
set g_buffs_medic_regen 1.7 "health medic rate multiplier"
set g_buffs_vengeance 1 "vengeance buff: attackers also take damage"
+set g_buffs_vengeance_time 60 "vengeance buff carry time"
set g_buffs_vengeance_damage_multiplier 0.6 "amount of damage dealt the attacker takes when hitting a target with vengeance"
set g_buffs_bash 1 "bash buff: increased knockback force and immunity to knockback"
+set g_buffs_bash_time 60 "bash buff carry time"
set g_buffs_bash_force 2 "bash force multiplier"
set g_buffs_bash_force_self 1.2 "bash self force multiplier"
set g_buffs_disability 1 "disability buff: attacks to players and monsters deal slowness (decreased movement/attack speed) for a few seconds"
-set g_buffs_disability_time 3 "time in seconds for target disability"
+set g_buffs_disability_time 60 "disability buff carry time"
+set g_buffs_disability_slowtime 3 "time in seconds for target disability"
set g_buffs_disability_speed 0.5 "player speed multiplier while disabled"
set g_buffs_disability_rate 1.7 "player weapon rate multiplier while disabled"
set g_buffs_speed 1 "speed buff: increased movement/attack/health regeneration speed, carrier takes slightly more damage"
+set g_buffs_speed_time 60 "speed buff carry time"
set g_buffs_speed_speed 1.7 "player speed multiplier while holding speed buff"
set g_buffs_speed_rate 0.8 "player weapon rate multiplier while holding speed buff"
set g_buffs_speed_damage_take 1.2 "damage taken multiplier while holding speed buff"
set g_buffs_speed_regen 1.2 "regeneration speed multiplier while holding speed buff"
set g_buffs_vampire 1 "vampire buff: attacks to players and monsters heal the carrier"
+set g_buffs_vampire_time 60 "vampire buff carry time"
set g_buffs_vampire_damage_steal 0.6 "damage stolen multiplier while holding vampire buff"
set g_buffs_jump 1 "jump buff: greatly increased jump height"
+set g_buffs_jump_time 60 "jump buff carry time"
set g_buffs_jump_height 600 "jump height while holding jump buff"
set g_buffs_flight 1 "flight buff: greatly decreased gravity"
+set g_buffs_flight_time 60 "flight buff carry time"
set g_buffs_flight_gravity 0.3 "player gravity multiplier while holding flight buff"
set g_buffs_invisible 1 "invisible buff: carrier becomes invisible"
+set g_buffs_invisible_time 60 "invisible buff carry time"
set g_buffs_invisible_alpha 0.4 "player invisibility multiplier while holding invisible buff"
set g_buffs_inferno 1 "inferno buff: targets damaged by player carrying inferno buff will also receive burning damage"
+set g_buffs_inferno_time 60 "inferno buff carry time"
set g_buffs_inferno_damagemultiplier 0.05 "multiplier of damage dealt during burn"
set g_buffs_inferno_burntime_factor 2 "burn time logarithm base. 0 < x < 1: increasingly increasing, x > 1: decreasingly increasing"
set g_buffs_inferno_burntime_min_time 0.5 "minimum seconds of burn time"
int autocvar_hud_panel_powerups_iconalign;
bool autocvar_hud_panel_powerups_progressbar;
bool autocvar_hud_panel_buffs;
+bool autocvar_hud_panel_buffs_progressbar;
+string autocvar_hud_panel_buffs_progressbar_name = "progressbar";
//float autocvar_hud_panel_buffs_iconalign;
string autocvar_hud_panel_powerups_progressbar_shield;
string autocvar_hud_panel_powerups_progressbar_strength;
//float buff_iconalign = autocvar_hud_panel_buffs_iconalign;
vector buff_offset = '0 0 0';
+ /*float strength = ceil(strength_time);
+ if(autocvar_hud_panel_powerups_progressbar)
+ HUD_Panel_DrawProgressBar(pos + strength_offset, mySize, autocvar_hud_panel_powerups_progressbar_strength, strength/maxstrength, is_vertical, strength_baralign, autocvar_hud_progressbar_strength_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+ if(autocvar_hud_panel_powerups_text)
+ {
+ 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', 1, bound(0, (strength - strength_time) / 0.5, 1));
+ }*/
+
+ float buff_time, buff_maxtime;
+ buff_time = bound(0, getstatf(STAT_BUFF_TIME) - time, 99);
+ buff_maxtime = 60; // TODO: stat?
for(e = Buff_Type_first; e; e = e.enemy) if(buffs & e.items)
{
+ if(buff_time && autocvar_hud_panel_buffs_progressbar)
+ HUD_Panel_DrawProgressBar(pos + buff_offset, mySize, autocvar_hud_panel_buffs_progressbar_name, buff_time/buff_maxtime, 0, 0,
+ Buff_Color(e.items) * 0.5, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+
//DrawNumIcon(pos + buff_offset, mySize, shield, "shield", is_vertical, buff_iconalign, '1 1 1', 1);
drawcolorcodedstring_aspect(pos + buff_offset, s, mySize, panel_fg_alpha * 0.5, DRAWFLAG_NORMAL);
}
HUD_Write_PanelCvar_q("_fade_subsequent_minfontsize");
HUD_Write_PanelCvar_q("_fade_minfontsize");
break;
+ case HUD_PANEL_BUFFS:
+ HUD_Write_PanelCvar_q("_progressbar");
+ HUD_Write_PanelCvar_q("_progressbar_name");
}
HUD_Write("\n");
}
return e.model2;
return "";
}
+
+float Buff_Timer(int buff_id)
+{
+ entity e;
+ for(e = Buff_Type_first; e; e = e.enemy)
+ if(buff_id == e.items)
+ return e.buff_time;
+ return 0;
+}
.vector colormod; // buff color
.string model2; // buff sprite
.int skin; // buff skin
+.float buff_time;
+
+// hacky function to return the cvar value only to server - TODO: do this properly!
+float sv_cvar(string cvarname)
+{
+#ifdef SVQC
+ return cvar(cvarname);
+#else
+ return 0;
+#endif
+}
#define REGISTER_BUFF(hname,sname,NAME,bskin,bcolor) \
int BUFF_##NAME; \
Buff_Type##sname.message = hname; \
Buff_Type##sname.skin = bskin; \
Buff_Type##sname.colormod = bcolor; \
+ Buff_Type##sname.buff_time = sv_cvar(strcat("g_buffs_", #sname, "_time")); \
Buff_Type##sname.model2 = strzone(strcat("buff-", #sname)); \
if(!Buff_Type_first) \
Buff_Type_first = Buff_Type##sname; \
int Buff_Type_FromSprite(string buff_sprite);
int Buff_Skin(int buff_id);
string Buff_Sprite(int buff_id);
+float Buff_Timer(int buff_id);
#endif
const int STAT_PLASMA = 84;
const int STAT_OK_AMMO_CHARGE = 85;
const int STAT_OK_AMMO_CHARGEPOOL = 86;
-// 87 empty?
+const int STAT_BUFF_TIME = 87;
// 88 empty?
// 89 empty?
// 90 empty?
float autocvar_g_buffs_vengeance_damage_multiplier;
float autocvar_g_buffs_bash_force;
float autocvar_g_buffs_bash_force_self;
-float autocvar_g_buffs_disability_time;
+float autocvar_g_buffs_disability_slowtime;
float autocvar_g_buffs_disability_speed;
float autocvar_g_buffs_disability_rate;
float autocvar_g_buffs_speed_speed;
if(frag_attacker.buffs & BUFF_DISABILITY)
if(frag_target != frag_attacker)
- frag_target.buff_disability_time = time + autocvar_g_buffs_disability_time;
+ frag_target.buff_disability_time = time + autocvar_g_buffs_disability_slowtime;
if(frag_attacker.buffs & BUFF_MEDIC)
if(DEATH_WEAPONOF(frag_deathtype) != WEP_ARC)
self.buff_disability_effect_time = time + 0.5;
}
- if(self.frozen)
+ // handle buff lost status
+ // 1: notify everyone else
+ // 2: notify carrier as well
+ int buff_lost = 0;
+
+ if(self.buff_time)
+ if(time >= self.buff_time)
+ buff_lost = 2;
+
+ if(self.frozen) { buff_lost = 1; }
+
+ if(buff_lost)
{
if(self.buffs)
{
Send_Notification(NOTIF_ALL_EXCEPT, self, MSG_INFO, INFO_ITEM_BUFF_LOST, self.netname, self.buffs);
+ if(buff_lost >= 2)
+ {
+ Send_Notification(NOTIF_ONE, self, MSG_MULTI, ITEM_BUFF_DROP, self.buffs); // TODO: special timeout message?
+ sound(self, CH_TRIGGER, "relics/relic_effect.wav", VOL_BASE, ATTN_NORM);
+ }
self.buffs = 0;
}
}
if(self.buffs != self.oldbuffs)
{
+ if(self.buffs && Buff_Timer(self.buffs))
+ self.buff_time = time + Buff_Timer(self.buffs);
+ else
+ self.buff_time = 0;
+
if(self.oldbuffs & BUFF_AMMO)
{
if(self.buff_ammo_prev_infitems)
precache_sound("keepaway/respawn.wav");
addstat(STAT_BUFFS, AS_INT, buffs);
+ addstat(STAT_BUFF_TIME, AS_FLOAT, buff_time);
addstat(STAT_MOVEVARS_JUMPVELOCITY, AS_FLOAT, stat_jumpheight);
InitializeEntity(world, buffs_DelayedInit, INITPRIO_FINDTARGET);
.float buff_flight_prev_gravity;
// jump
.float stat_jumpheight;
-//const float STAT_MOVEVARS_JUMPVELOCITY = 250; // engine hack
// disability
.float buff_disability_time;
.float buff_disability_effect_time;
.float buff_activetime;
.float buff_activetime_updated;
.entity buff_waypoint;
-.float oldbuffs; // for updating effects
+.int oldbuffs; // for updating effects
.entity buff_model; // controls effects (TODO: make csqc)
const vector BUFF_MIN = ('-16 -16 -20');