float w_arc(float req)
{
- if (req == WR_AIM)
+ switch(req)
{
- self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, FALSE);
- /*
- self.BUTTON_ATCK=FALSE;
- self.BUTTON_ATCK2=FALSE;
- if(vlen(self.origin-self.enemy.origin) > 1000)
- self.bot_aim_whichfiretype = 0;
- if(self.bot_aim_whichfiretype == 0)
+ case WR_AIM:
{
- float shoot;
+ self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, FALSE);
+ /*
+ self.BUTTON_ATCK=FALSE;
+ self.BUTTON_ATCK2=FALSE;
+ if(vlen(self.origin-self.enemy.origin) > 1000)
+ self.bot_aim_whichfiretype = 0;
+ if(self.bot_aim_whichfiretype == 0)
+ {
+ float shoot;
- if(autocvar_g_balance_arc_primary_speed)
- shoot = bot_aim(autocvar_g_balance_arc_primary_speed, 0, autocvar_g_balance_arc_primary_lifetime, FALSE);
- else
- shoot = bot_aim(1000000, 0, 0.001, FALSE);
+ if(autocvar_g_balance_arc_primary_speed)
+ shoot = bot_aim(autocvar_g_balance_arc_primary_speed, 0, autocvar_g_balance_arc_primary_lifetime, FALSE);
+ else
+ shoot = bot_aim(1000000, 0, 0.001, FALSE);
- if(shoot)
+ if(shoot)
+ {
+ self.BUTTON_ATCK = TRUE;
+ if(random() < 0.01) self.bot_aim_whichfiretype = 1;
+ }
+ }
+ else // todo
{
- self.BUTTON_ATCK = TRUE;
- if(random() < 0.01) self.bot_aim_whichfiretype = 1;
+ //if(bot_aim(autocvar_g_balance_arc_secondary_speed, autocvar_g_balance_grenadelauncher_secondary_speed_up, autocvar_g_balance_arc_secondary_lifetime, TRUE))
+ //{
+ // self.BUTTON_ATCK2 = TRUE;
+ // if(random() < 0.03) self.bot_aim_whichfiretype = 0;
+ //}
}
+ */
+
+ return TRUE;
}
- else // todo
- {
- //if(bot_aim(autocvar_g_balance_arc_secondary_speed, autocvar_g_balance_grenadelauncher_secondary_speed_up, autocvar_g_balance_arc_secondary_lifetime, TRUE))
- //{
- // self.BUTTON_ATCK2 = TRUE;
- // if(random() < 0.03) self.bot_aim_whichfiretype = 0;
- //}
- }
- */
- }
- else if (req == WR_THINK)
- {
- if (self.BUTTON_ATCK)
+ case WR_THINK:
{
- if(self.BUTTON_ATCK_prev) // TODO: Find another way to implement this!
- /*if(self.animstate_startframe == self.anim_shoot_x && self.animstate_numframes == self.anim_shoot_y)
- weapon_thinkf(WFRAME_DONTCHANGE, autocvar_g_balance_arc_primary_animtime, w_ready);
- else*/
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(arc, animtime), w_ready);
-
- if (weapon_prepareattack(0, 0))
+ if (self.BUTTON_ATCK)
{
- if ((!self.arc_beam) || wasfreed(self.arc_beam))
- W_Arc_Attack1();
+ if(self.BUTTON_ATCK_prev) // TODO: Find another way to implement this!
+ /*if(self.animstate_startframe == self.anim_shoot_x && self.animstate_numframes == self.anim_shoot_y)
+ weapon_thinkf(WFRAME_DONTCHANGE, autocvar_g_balance_arc_primary_animtime, w_ready);
+ else*/
+ weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(arc, animtime), w_ready);
- if(!self.BUTTON_ATCK_prev)
+ if (weapon_prepareattack(0, 0))
+ {
+ if ((!self.arc_beam) || wasfreed(self.arc_beam))
+ W_Arc_Attack1();
+
+ if(!self.BUTTON_ATCK_prev)
+ {
+ weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(arc, animtime), w_ready);
+ self.BUTTON_ATCK_prev = 1;
+ }
+ }
+ }
+ else // todo
+ {
+ if (self.BUTTON_ATCK_prev != 0)
{
weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(arc, animtime), w_ready);
- self.BUTTON_ATCK_prev = 1;
+ ATTACK_FINISHED(self) = time + WEP_CVAR_PRI(arc, refire) * W_WeaponRateFactor();
}
+ self.BUTTON_ATCK_prev = 0;
}
- }
- else // todo
+
+ //if (self.BUTTON_ATCK2)
+ //if (weapon_prepareattack(1, autocvar_g_balance_arc_secondary_refire))
+ //{
+ // W_Arc_Attack2();
+ // self.arc_count = autocvar_g_balance_arc_secondary_count;
+ // weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_arc_secondary_animtime, w_arc_checkattack);
+ // self.arc_secondarytime = time + autocvar_g_balance_arc_secondary_refire2 * W_WeaponRateFactor();
+ //}
+
+ return TRUE;
+ }
+ case WR_PRECACHE:
{
- if (self.BUTTON_ATCK_prev != 0)
- {
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(arc, animtime), w_ready);
- ATTACK_FINISHED(self) = time + WEP_CVAR_PRI(arc, refire) * W_WeaponRateFactor();
- }
- self.BUTTON_ATCK_prev = 0;
+ precache_model ("models/weapons/g_arc.md3");
+ precache_model ("models/weapons/v_arc.md3");
+ precache_model ("models/weapons/h_arc.iqm");
+ //precache_sound ("weapons/arc_bounce.wav");
+ precache_sound ("weapons/arc_fire.wav");
+ precache_sound ("weapons/arc_fire2.wav");
+ precache_sound ("weapons/arc_impact.wav");
+ //precache_sound ("weapons/arc_impact_combo.wav");
+ //precache_sound ("weapons/W_Arc_Beam_fire.wav");
+ return TRUE;
}
-
- //if (self.BUTTON_ATCK2)
- //if (weapon_prepareattack(1, autocvar_g_balance_arc_secondary_refire))
- //{
- // W_Arc_Attack2();
- // self.arc_count = autocvar_g_balance_arc_secondary_count;
- // weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_arc_secondary_animtime, w_arc_checkattack);
- // self.arc_secondarytime = time + autocvar_g_balance_arc_secondary_refire2 * W_WeaponRateFactor();
- //}
- }
- else if (req == WR_PRECACHE)
- {
- precache_model ("models/weapons/g_arc.md3");
- precache_model ("models/weapons/v_arc.md3");
- precache_model ("models/weapons/h_arc.iqm");
- //precache_sound ("weapons/arc_bounce.wav");
- precache_sound ("weapons/arc_fire.wav");
- precache_sound ("weapons/arc_fire2.wav");
- precache_sound ("weapons/arc_impact.wav");
- //precache_sound ("weapons/arc_impact_combo.wav");
- //precache_sound ("weapons/W_Arc_Beam_fire.wav");
- }
- else if (req == WR_SETUP)
- weapon_setup(WEP_ARC);
- else if (req == WR_CHECKAMMO1)
- {
- return !WEP_CVAR_PRI(arc, ammo) || (self.ammo_cells > 0);
- }
- else if (req == WR_CHECKAMMO2)
- return self.ammo_cells >= WEP_CVAR_SEC(arc, ammo);
- else if (req == WR_KILLMESSAGE)
- {
- if(w_deathtype & HITTYPE_SECONDARY)
+ case WR_SETUP:
+ {
+ weapon_setup(WEP_ARC);
+ return TRUE;
+ }
+ case WR_CHECKAMMO1:
+ {
+ return !WEP_CVAR_PRI(arc, ammo) || (self.ammo_cells > 0);
+ }
+ case WR_CHECKAMMO2:
{
- return WEAPON_ELECTRO_MURDER_ORBS;
+ return self.ammo_cells >= WEP_CVAR_SEC(arc, ammo);
}
- else
+ case WR_KILLMESSAGE:
{
- if(w_deathtype & HITTYPE_BOUNCE)
- return WEAPON_ELECTRO_MURDER_COMBO;
+ if(w_deathtype & HITTYPE_SECONDARY)
+ {
+ return WEAPON_ELECTRO_MURDER_ORBS;
+ }
else
- return WEAPON_ELECTRO_MURDER_BOLT;
+ {
+ if(w_deathtype & HITTYPE_BOUNCE)
+ return WEAPON_ELECTRO_MURDER_COMBO;
+ else
+ return WEAPON_ELECTRO_MURDER_BOLT;
+ }
+ }
+ case WR_RESETPLAYER:
+ {
+ //self.arc_secondarytime = time;
+ return TRUE;
}
- }
- else if (req == WR_RESETPLAYER)
- {
- //self.arc_secondarytime = time;
}
return TRUE;
-};
+}
void ArcInit()
{
#ifdef CSQC
float w_arc(float req)
{
- if(req == WR_IMPACTEFFECT)
+ switch(req)
{
- vector org2;
- org2 = w_org + w_backoff * 6;
-
- if(w_deathtype & HITTYPE_SECONDARY)
+ case WR_IMPACTEFFECT:
{
- pointparticles(particleeffectnum("arc_ballexplode"), org2, '0 0 0', 1);
- if(!w_issilent)
- sound(self, CH_SHOTS, "weapons/arc_impact.wav", VOL_BASE, ATTN_NORM);
+ vector org2;
+ org2 = w_org + w_backoff * 6;
+
+ if(w_deathtype & HITTYPE_SECONDARY)
+ {
+ pointparticles(particleeffectnum("arc_ballexplode"), org2, '0 0 0', 1);
+ if(!w_issilent)
+ sound(self, CH_SHOTS, "weapons/arc_impact.wav", VOL_BASE, ATTN_NORM);
+ }
+ else
+ {
+ pointparticles(particleeffectnum("arc_impact"), org2, '0 0 0', 1);
+ if(!w_issilent)
+ sound(self, CH_SHOTS, "weapons/arc_impact.wav", VOL_BASE, ATTN_NORM);
+ }
+
+ return TRUE;
}
- else
+ case WR_PRECACHE:
{
- pointparticles(particleeffectnum("arc_impact"), org2, '0 0 0', 1);
- if(!w_issilent)
- sound(self, CH_SHOTS, "weapons/arc_impact.wav", VOL_BASE, ATTN_NORM);
+ precache_sound("weapons/arc_impact.wav");
+ precache_sound("weapons/arc_impact_combo.wav");
+ return TRUE;
}
}
- else if(req == WR_PRECACHE)
- {
- precache_sound("weapons/arc_impact.wav");
- precache_sound("weapons/arc_impact_combo.wav");
- }
return TRUE;
}
#endif
float w_crylink(float req)
{
float ammo_amount;
- if (req == WR_AIM)
+ switch(req)
{
- if (random() < 0.10)
- self.BUTTON_ATCK = bot_aim(autocvar_g_balance_crylink_primary_speed, 0, autocvar_g_balance_crylink_primary_middle_lifetime, FALSE);
- else
- self.BUTTON_ATCK2 = bot_aim(autocvar_g_balance_crylink_secondary_speed, 0, autocvar_g_balance_crylink_secondary_middle_lifetime, FALSE);
- }
- else if (req == WR_THINK)
- {
- if(autocvar_g_balance_crylink_reload_ammo && self.clip_load < min(autocvar_g_balance_crylink_primary_ammo, autocvar_g_balance_crylink_secondary_ammo)) // forced reload
- weapon_action(self.weapon, WR_RELOAD);
-
- if (self.BUTTON_ATCK)
+ case WR_AIM:
{
- if (self.crylink_waitrelease != 1)
- if (weapon_prepareattack(0, autocvar_g_balance_crylink_primary_refire))
- {
- W_Crylink_Attack();
- weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_crylink_primary_animtime, w_ready);
- }
+ if (random() < 0.10)
+ self.BUTTON_ATCK = bot_aim(autocvar_g_balance_crylink_primary_speed, 0, autocvar_g_balance_crylink_primary_middle_lifetime, FALSE);
+ else
+ self.BUTTON_ATCK2 = bot_aim(autocvar_g_balance_crylink_secondary_speed, 0, autocvar_g_balance_crylink_secondary_middle_lifetime, FALSE);
+
+ return TRUE;
}
-
- if(self.BUTTON_ATCK2 && autocvar_g_balance_crylink_secondary)
+ case WR_THINK:
{
- if (self.crylink_waitrelease != 2)
- if (weapon_prepareattack(1, autocvar_g_balance_crylink_secondary_refire))
+ if(autocvar_g_balance_crylink_reload_ammo && self.clip_load < min(autocvar_g_balance_crylink_primary_ammo, autocvar_g_balance_crylink_secondary_ammo)) // forced reload
+ weapon_action(self.weapon, WR_RELOAD);
+
+ if (self.BUTTON_ATCK)
{
- W_Crylink_Attack2();
- weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_crylink_secondary_animtime, w_ready);
+ if (self.crylink_waitrelease != 1)
+ if (weapon_prepareattack(0, autocvar_g_balance_crylink_primary_refire))
+ {
+ W_Crylink_Attack();
+ weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_crylink_primary_animtime, w_ready);
+ }
}
- }
- if ((self.crylink_waitrelease == 1 && !self.BUTTON_ATCK) || (self.crylink_waitrelease == 2 && !self.BUTTON_ATCK2))
- {
- if (!self.crylink_lastgroup || time > self.crylink_lastgroup.teleport_time)
+ if(self.BUTTON_ATCK2 && autocvar_g_balance_crylink_secondary)
{
- // fired and released now!
- if(self.crylink_lastgroup)
+ if (self.crylink_waitrelease != 2)
+ if (weapon_prepareattack(1, autocvar_g_balance_crylink_secondary_refire))
{
- vector pos;
- entity linkjoineffect;
+ W_Crylink_Attack2();
+ weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_crylink_secondary_animtime, w_ready);
+ }
+ }
- if(self.crylink_waitrelease == 1)
+ if ((self.crylink_waitrelease == 1 && !self.BUTTON_ATCK) || (self.crylink_waitrelease == 2 && !self.BUTTON_ATCK2))
+ {
+ if (!self.crylink_lastgroup || time > self.crylink_lastgroup.teleport_time)
+ {
+ // fired and released now!
+ if(self.crylink_lastgroup)
{
- pos = W_Crylink_LinkJoin(self.crylink_lastgroup, autocvar_g_balance_crylink_primary_joinspread * autocvar_g_balance_crylink_primary_speed, autocvar_g_balance_crylink_primary_jointime);
-
+ vector pos;
+ entity linkjoineffect;
+
+ if(self.crylink_waitrelease == 1)
+ {
+ pos = W_Crylink_LinkJoin(self.crylink_lastgroup, autocvar_g_balance_crylink_primary_joinspread * autocvar_g_balance_crylink_primary_speed, autocvar_g_balance_crylink_primary_jointime);
+
+ }
+ else
+ {
+ pos = W_Crylink_LinkJoin(self.crylink_lastgroup, autocvar_g_balance_crylink_secondary_joinspread * autocvar_g_balance_crylink_secondary_speed, autocvar_g_balance_crylink_secondary_jointime);
+ }
+
+ linkjoineffect = spawn();
+ linkjoineffect.think = W_Crylink_LinkJoinEffect_Think;
+ linkjoineffect.classname = "linkjoineffect";
+ linkjoineffect.nextthink = time + w_crylink_linkjoin_time;
+ linkjoineffect.owner = self;
+ setorigin(linkjoineffect, pos);
}
- else
+ self.crylink_waitrelease = 0;
+ if(!w_crylink(WR_CHECKAMMO1) && !w_crylink(WR_CHECKAMMO2))
+ if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
{
- pos = W_Crylink_LinkJoin(self.crylink_lastgroup, autocvar_g_balance_crylink_secondary_joinspread * autocvar_g_balance_crylink_secondary_speed, autocvar_g_balance_crylink_secondary_jointime);
+ // ran out of ammo!
+ self.cnt = WEP_CRYLINK;
+ self.switchweapon = w_getbestweapon(self);
}
-
- linkjoineffect = spawn();
- linkjoineffect.think = W_Crylink_LinkJoinEffect_Think;
- linkjoineffect.classname = "linkjoineffect";
- linkjoineffect.nextthink = time + w_crylink_linkjoin_time;
- linkjoineffect.owner = self;
- setorigin(linkjoineffect, pos);
- }
- self.crylink_waitrelease = 0;
- if(!w_crylink(WR_CHECKAMMO1) && !w_crylink(WR_CHECKAMMO2))
- if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
- {
- // ran out of ammo!
- self.cnt = WEP_CRYLINK;
- self.switchweapon = w_getbestweapon(self);
}
}
+
+ return TRUE;
}
- }
- else if (req == WR_PRECACHE)
- {
- precache_model ("models/weapons/g_crylink.md3");
- precache_model ("models/weapons/v_crylink.md3");
- precache_model ("models/weapons/h_crylink.iqm");
- precache_sound ("weapons/crylink_fire.wav");
- precache_sound ("weapons/crylink_fire2.wav");
- precache_sound ("weapons/crylink_linkjoin.wav");
- //precache_sound ("weapons/reload.wav"); // until weapons have individual reload sounds, precache the reload sound somewhere else
- }
- else if (req == WR_SETUP)
- {
- weapon_setup(WEP_CRYLINK);
- self.current_ammo = ammo_cells;
- }
- else if (req == WR_CHECKAMMO1)
- {
- // don't "run out of ammo" and switch weapons while waiting for release
- if(self.crylink_lastgroup && self.crylink_waitrelease)
+ case WR_PRECACHE:
+ {
+ precache_model ("models/weapons/g_crylink.md3");
+ precache_model ("models/weapons/v_crylink.md3");
+ precache_model ("models/weapons/h_crylink.iqm");
+ precache_sound ("weapons/crylink_fire.wav");
+ precache_sound ("weapons/crylink_fire2.wav");
+ precache_sound ("weapons/crylink_linkjoin.wav");
return TRUE;
-
- ammo_amount = self.ammo_cells >= autocvar_g_balance_crylink_primary_ammo;
- ammo_amount += self.(weapon_load[WEP_CRYLINK]) >= autocvar_g_balance_crylink_primary_ammo;
- return ammo_amount;
- }
- else if (req == WR_CHECKAMMO2)
- {
- // don't "run out of ammo" and switch weapons while waiting for release
- if(self.crylink_lastgroup && self.crylink_waitrelease)
+ }
+ case WR_SETUP:
+ {
+ weapon_setup(WEP_CRYLINK);
+ self.current_ammo = ammo_cells;
return TRUE;
+ }
+ case WR_CHECKAMMO1:
+ {
+ // don't "run out of ammo" and switch weapons while waiting for release
+ if(self.crylink_lastgroup && self.crylink_waitrelease)
+ return TRUE;
- ammo_amount = self.ammo_cells >= autocvar_g_balance_crylink_secondary_ammo;
- ammo_amount += self.(weapon_load[WEP_CRYLINK]) >= autocvar_g_balance_crylink_secondary_ammo;
- return ammo_amount;
- }
- else if (req == WR_RELOAD)
- {
- W_Reload(min(autocvar_g_balance_crylink_primary_ammo, autocvar_g_balance_crylink_secondary_ammo), autocvar_g_balance_crylink_reload_ammo, autocvar_g_balance_crylink_reload_time, "weapons/reload.wav");
- }
- else if (req == WR_SUICIDEMESSAGE)
- {
- return WEAPON_CRYLINK_SUICIDE;
- }
- else if (req == WR_KILLMESSAGE)
- {
- return WEAPON_CRYLINK_MURDER;
+ ammo_amount = self.ammo_cells >= autocvar_g_balance_crylink_primary_ammo;
+ ammo_amount += self.(weapon_load[WEP_CRYLINK]) >= autocvar_g_balance_crylink_primary_ammo;
+ return ammo_amount;
+ }
+ case WR_CHECKAMMO2:
+ {
+ // don't "run out of ammo" and switch weapons while waiting for release
+ if(self.crylink_lastgroup && self.crylink_waitrelease)
+ return TRUE;
+
+ ammo_amount = self.ammo_cells >= autocvar_g_balance_crylink_secondary_ammo;
+ ammo_amount += self.(weapon_load[WEP_CRYLINK]) >= autocvar_g_balance_crylink_secondary_ammo;
+ return ammo_amount;
+ }
+ case WR_RELOAD:
+ {
+ W_Reload(min(autocvar_g_balance_crylink_primary_ammo, autocvar_g_balance_crylink_secondary_ammo), autocvar_g_balance_crylink_reload_ammo, autocvar_g_balance_crylink_reload_time, "weapons/reload.wav");
+ return TRUE;
+ }
+ case WR_SUICIDEMESSAGE:
+ {
+ return WEAPON_CRYLINK_SUICIDE;
+ }
+ case WR_KILLMESSAGE:
+ {
+ return WEAPON_CRYLINK_MURDER;
+ }
}
return TRUE;
}
#ifdef CSQC
float w_crylink(float req)
{
- if(req == WR_IMPACTEFFECT)
+ switch(req)
{
- vector org2;
- org2 = w_org + w_backoff * 2;
- if(w_deathtype & HITTYPE_SECONDARY)
+ case WR_IMPACTEFFECT:
{
- pointparticles(particleeffectnum("crylink_impact"), org2, '0 0 0', 1);
- if(!w_issilent)
- sound(self, CH_SHOTS, "weapons/crylink_impact2.wav", VOL_BASE, ATTN_NORM);
+ vector org2;
+ org2 = w_org + w_backoff * 2;
+ if(w_deathtype & HITTYPE_SECONDARY)
+ {
+ pointparticles(particleeffectnum("crylink_impact"), org2, '0 0 0', 1);
+ if(!w_issilent)
+ sound(self, CH_SHOTS, "weapons/crylink_impact2.wav", VOL_BASE, ATTN_NORM);
+ }
+ else
+ {
+ pointparticles(particleeffectnum("crylink_impactbig"), org2, '0 0 0', 1);
+ if(!w_issilent)
+ sound(self, CH_SHOTS, "weapons/crylink_impact.wav", VOL_BASE, ATTN_NORM);
+ }
+
+ return TRUE;
}
- else
+ case WR_PRECACHE:
{
- pointparticles(particleeffectnum("crylink_impactbig"), org2, '0 0 0', 1);
- if(!w_issilent)
- sound(self, CH_SHOTS, "weapons/crylink_impact.wav", VOL_BASE, ATTN_NORM);
+ precache_sound("weapons/crylink_impact2.wav");
+ precache_sound("weapons/crylink_impact.wav");
+ return TRUE;
}
}
- else if(req == WR_PRECACHE)
- {
- precache_sound("weapons/crylink_impact2.wav");
- precache_sound("weapons/crylink_impact.wav");
- }
return TRUE;
}
#endif
entity rock;
float rockfound;
float ammo_amount;
-
- if (req == WR_AIM)
+ switch(req)
{
- // aim and decide to fire if appropriate
- self.BUTTON_ATCK = bot_aim(WEP_CVAR(devastator, speed), 0, WEP_CVAR(devastator, lifetime), FALSE);
- if(skill >= 2) // skill 0 and 1 bots won't detonate rockets!
+ case WR_AIM:
{
- // decide whether to detonate rockets
- entity missile, targetlist, targ;
- float edgedamage, coredamage, edgeradius, recipricoledgeradius, d;
- float selfdamage, teamdamage, enemydamage;
- edgedamage = WEP_CVAR(devastator, edgedamage);
- coredamage = WEP_CVAR(devastator, damage);
- edgeradius = WEP_CVAR(devastator, radius);
- recipricoledgeradius = 1 / edgeradius;
- selfdamage = 0;
- teamdamage = 0;
- enemydamage = 0;
- targetlist = findchainfloat(bot_attack, TRUE);
- missile = find(world, classname, "rocket");
- while (missile)
+ // aim and decide to fire if appropriate
+ self.BUTTON_ATCK = bot_aim(WEP_CVAR(devastator, speed), 0, WEP_CVAR(devastator, lifetime), FALSE);
+ if(skill >= 2) // skill 0 and 1 bots won't detonate rockets!
{
- if (missile.realowner != self)
- {
- missile = find(missile, classname, "rocket");
- continue;
- }
- targ = targetlist;
- while (targ)
- {
- d = vlen(targ.origin + (targ.mins + targ.maxs) * 0.5 - missile.origin);
- d = bound(0, edgedamage + (coredamage - edgedamage) * sqrt(1 - d * recipricoledgeradius), 10000);
- // count potential damage according to type of target
- if (targ == self)
- selfdamage = selfdamage + d;
- else if (targ.team == self.team && teamplay)
- teamdamage = teamdamage + d;
- else if (bot_shouldattack(targ))
- enemydamage = enemydamage + d;
- targ = targ.chain;
- }
- missile = find(missile, classname, "rocket");
- }
- float desirabledamage;
- desirabledamage = enemydamage;
- if (time > self.invincible_finished && time > self.spawnshieldtime)
- desirabledamage = desirabledamage - selfdamage * autocvar_g_balance_selfdamagepercent;
- if (teamplay && self.team)
- desirabledamage = desirabledamage - teamdamage;
-
- missile = find(world, classname, "rocket");
- while (missile)
- {
- if (missile.realowner != self)
- {
- missile = find(missile, classname, "rocket");
- continue;
- }
- makevectors(missile.v_angle);
- targ = targetlist;
- if (skill > 9) // normal players only do this for the target they are tracking
+ // decide whether to detonate rockets
+ entity missile, targetlist, targ;
+ float edgedamage, coredamage, edgeradius, recipricoledgeradius, d;
+ float selfdamage, teamdamage, enemydamage;
+ edgedamage = WEP_CVAR(devastator, edgedamage);
+ coredamage = WEP_CVAR(devastator, damage);
+ edgeradius = WEP_CVAR(devastator, radius);
+ recipricoledgeradius = 1 / edgeradius;
+ selfdamage = 0;
+ teamdamage = 0;
+ enemydamage = 0;
+ targetlist = findchainfloat(bot_attack, TRUE);
+ missile = find(world, classname, "rocket");
+ while (missile)
{
+ if (missile.realowner != self)
+ {
+ missile = find(missile, classname, "rocket");
+ continue;
+ }
targ = targetlist;
while (targ)
{
- if (
- (v_forward * normalize(missile.origin - targ.origin)< 0.1)
- && desirabledamage > 0.1*coredamage
- )self.BUTTON_ATCK2 = TRUE;
+ d = vlen(targ.origin + (targ.mins + targ.maxs) * 0.5 - missile.origin);
+ d = bound(0, edgedamage + (coredamage - edgedamage) * sqrt(1 - d * recipricoledgeradius), 10000);
+ // count potential damage according to type of target
+ if (targ == self)
+ selfdamage = selfdamage + d;
+ else if (targ.team == self.team && teamplay)
+ teamdamage = teamdamage + d;
+ else if (bot_shouldattack(targ))
+ enemydamage = enemydamage + d;
targ = targ.chain;
}
- }else{
- float distance; distance= bound(300,vlen(self.origin-self.enemy.origin),30000);
- //As the distance gets larger, a correct detonation gets near imposible
- //Bots are assumed to use the rocket spawnfunc_light to see if the rocket gets near a player
- if(v_forward * normalize(missile.origin - self.enemy.origin)< 0.1)
- if(IS_PLAYER(self.enemy))
- if(desirabledamage >= 0.1*coredamage)
- if(random()/distance*300 > frametime*bound(0,(10-skill)*0.2,1))
- self.BUTTON_ATCK2 = TRUE;
- // dprint(ftos(random()/distance*300),">");dprint(ftos(frametime*bound(0,(10-skill)*0.2,1)),"\n");
+ missile = find(missile, classname, "rocket");
}
+ float desirabledamage;
+ desirabledamage = enemydamage;
+ if (time > self.invincible_finished && time > self.spawnshieldtime)
+ desirabledamage = desirabledamage - selfdamage * autocvar_g_balance_selfdamagepercent;
+ if (teamplay && self.team)
+ desirabledamage = desirabledamage - teamdamage;
+
+ missile = find(world, classname, "rocket");
+ while (missile)
+ {
+ if (missile.realowner != self)
+ {
+ missile = find(missile, classname, "rocket");
+ continue;
+ }
+ makevectors(missile.v_angle);
+ targ = targetlist;
+ if (skill > 9) // normal players only do this for the target they are tracking
+ {
+ targ = targetlist;
+ while (targ)
+ {
+ if (
+ (v_forward * normalize(missile.origin - targ.origin)< 0.1)
+ && desirabledamage > 0.1*coredamage
+ )self.BUTTON_ATCK2 = TRUE;
+ targ = targ.chain;
+ }
+ }else{
+ float distance; distance= bound(300,vlen(self.origin-self.enemy.origin),30000);
+ //As the distance gets larger, a correct detonation gets near imposible
+ //Bots are assumed to use the rocket spawnfunc_light to see if the rocket gets near a player
+ if(v_forward * normalize(missile.origin - self.enemy.origin)< 0.1)
+ if(IS_PLAYER(self.enemy))
+ if(desirabledamage >= 0.1*coredamage)
+ if(random()/distance*300 > frametime*bound(0,(10-skill)*0.2,1))
+ self.BUTTON_ATCK2 = TRUE;
+ // dprint(ftos(random()/distance*300),">");dprint(ftos(frametime*bound(0,(10-skill)*0.2,1)),"\n");
+ }
- missile = find(missile, classname, "rocket");
+ missile = find(missile, classname, "rocket");
+ }
+ // if we would be doing at X percent of the core damage, detonate it
+ // but don't fire a new shot at the same time!
+ if (desirabledamage >= 0.75 * coredamage) //this should do group damage in rare fortunate events
+ self.BUTTON_ATCK2 = TRUE;
+ if ((skill > 6.5) && (selfdamage > self.health))
+ self.BUTTON_ATCK2 = FALSE;
+ //if(self.BUTTON_ATCK2 == TRUE)
+ // dprint(ftos(desirabledamage),"\n");
+ if (self.BUTTON_ATCK2 == TRUE) self.BUTTON_ATCK = FALSE;
}
- // if we would be doing at X percent of the core damage, detonate it
- // but don't fire a new shot at the same time!
- if (desirabledamage >= 0.75 * coredamage) //this should do group damage in rare fortunate events
- self.BUTTON_ATCK2 = TRUE;
- if ((skill > 6.5) && (selfdamage > self.health))
- self.BUTTON_ATCK2 = FALSE;
- //if(self.BUTTON_ATCK2 == TRUE)
- // dprint(ftos(desirabledamage),"\n");
- if (self.BUTTON_ATCK2 == TRUE) self.BUTTON_ATCK = FALSE;
+
+ return TRUE;
}
- }
- else if (req == WR_THINK)
- {
- if(WEP_CVAR(devastator, reload_ammo) && self.clip_load < WEP_CVAR(devastator, ammo)) // forced reload
- weapon_action(self.weapon, WR_RELOAD);
- else
+ case WR_THINK:
{
- if (self.BUTTON_ATCK)
+ if(WEP_CVAR(devastator, reload_ammo) && self.clip_load < WEP_CVAR(devastator, ammo)) // forced reload
+ weapon_action(self.weapon, WR_RELOAD);
+ else
{
- if(self.rl_release || WEP_CVAR(devastator, guidestop))
- if(weapon_prepareattack(0, WEP_CVAR(devastator, refire)))
+ if (self.BUTTON_ATCK)
{
- W_Devastator_Attack();
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(devastator, animtime), w_ready);
- self.rl_release = 0;
+ if(self.rl_release || WEP_CVAR(devastator, guidestop))
+ if(weapon_prepareattack(0, WEP_CVAR(devastator, refire)))
+ {
+ W_Devastator_Attack();
+ weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(devastator, animtime), w_ready);
+ self.rl_release = 0;
+ }
}
- }
- else
- self.rl_release = 1;
+ else
+ self.rl_release = 1;
- if (self.BUTTON_ATCK2)
- {
- rockfound = 0;
- for(rock = world; (rock = find(rock, classname, "rocket")); ) if(rock.realowner == self)
+ if (self.BUTTON_ATCK2)
{
- if(!rock.rl_detonate_later)
+ rockfound = 0;
+ for(rock = world; (rock = find(rock, classname, "rocket")); ) if(rock.realowner == self)
{
- rock.rl_detonate_later = TRUE;
- rockfound = 1;
+ if(!rock.rl_detonate_later)
+ {
+ rock.rl_detonate_later = TRUE;
+ rockfound = 1;
+ }
}
+ if(rockfound)
+ sound (self, CH_WEAPON_B, "weapons/rocket_det.wav", VOL_BASE, ATTN_NORM);
}
- if(rockfound)
- sound (self, CH_WEAPON_B, "weapons/rocket_det.wav", VOL_BASE, ATTN_NORM);
}
+
+ return TRUE;
}
- }
- else if (req == WR_PRECACHE)
- {
- if(autocvar_sv_precacheweapons)
+ case WR_PRECACHE:
{
- precache_model ("models/flash.md3");
- precache_model ("models/weapons/g_rl.md3");
- precache_model ("models/weapons/v_rl.md3");
- precache_model ("models/weapons/h_rl.iqm");
- precache_sound ("weapons/rocket_det.wav");
- precache_sound ("weapons/rocket_fire.wav");
- precache_sound ("weapons/rocket_mode.wav");
- }
+ if(autocvar_sv_precacheweapons)
+ {
+ precache_model ("models/flash.md3");
+ precache_model ("models/weapons/g_rl.md3");
+ precache_model ("models/weapons/v_rl.md3");
+ precache_model ("models/weapons/h_rl.iqm");
+ precache_sound ("weapons/rocket_det.wav");
+ precache_sound ("weapons/rocket_fire.wav");
+ precache_sound ("weapons/rocket_mode.wav");
+ }
- #define WEP_ADD_CVAR(weapon,mode,name) /*nothing*/
- #define WEP_ADD_PROP(weapon,prop,name) get_weaponinfo(WEP_DEVASTATOR).##prop = autocvar_g_balance_##weapon##_##name;
- ARC_SETTINGS(devastator)
- #undef WEP_ADD_CVAR
- #undef WEP_ADD_PROP
- //precache_sound ("weapons/reload.wav"); // until weapons have individual reload sounds, precache the reload sound somewhere else
- }
- else if (req == WR_SETUP)
- {
- weapon_setup(WEP_DEVASTATOR);
- self.current_ammo = ammo_rockets;
- self.rl_release = 1;
- }
- else if (req == WR_CHECKAMMO1)
- {
- // don't switch while guiding a missile
- if (ATTACK_FINISHED(self) <= time || self.weapon != WEP_DEVASTATOR)
+ #define WEP_ADD_CVAR(weapon,mode,name) /*nothing*/
+ #define WEP_ADD_PROP(weapon,prop,name) get_weaponinfo(WEP_DEVASTATOR).##prop = autocvar_g_balance_##weapon##_##name;
+ ARC_SETTINGS(devastator)
+ #undef WEP_ADD_CVAR
+ #undef WEP_ADD_PROP
+
+ return TRUE;
+ }
+ case WR_SETUP:
{
- ammo_amount = FALSE;
- if(WEP_CVAR(devastator, reload_ammo))
+ weapon_setup(WEP_DEVASTATOR);
+ self.current_ammo = ammo_rockets;
+ self.rl_release = 1;
+ return TRUE;
+ }
+ case WR_CHECKAMMO1:
+ {
+ // don't switch while guiding a missile
+ if (ATTACK_FINISHED(self) <= time || self.weapon != WEP_DEVASTATOR)
{
- if(self.ammo_rockets < WEP_CVAR(devastator, ammo) && self.(weapon_load[WEP_DEVASTATOR]) < WEP_CVAR(devastator, ammo))
+ ammo_amount = FALSE;
+ if(WEP_CVAR(devastator, reload_ammo))
+ {
+ if(self.ammo_rockets < WEP_CVAR(devastator, ammo) && self.(weapon_load[WEP_DEVASTATOR]) < WEP_CVAR(devastator, ammo))
+ ammo_amount = TRUE;
+ }
+ else if(self.ammo_rockets < WEP_CVAR(devastator, ammo))
ammo_amount = TRUE;
+ return !ammo_amount;
}
- else if(self.ammo_rockets < WEP_CVAR(devastator, ammo))
- ammo_amount = TRUE;
- return !ammo_amount;
+
+ return TRUE;
+ }
+ case WR_CHECKAMMO2:
+ {
+ return FALSE;
+ }
+ case WR_RESETPLAYER:
+ {
+ self.rl_release = 0;
+ return TRUE;
+ }
+ case WR_RELOAD:
+ {
+ W_Reload(WEP_CVAR(devastator, ammo), WEP_CVAR(devastator, reload_ammo), WEP_CVAR(devastator, reload_time), "weapons/reload.wav");
+ return TRUE;
+ }
+ case WR_SUICIDEMESSAGE:
+ {
+ return WEAPON_ROCKETLAUNCHER_SUICIDE;
+ }
+ case WR_KILLMESSAGE:
+ {
+ if((w_deathtype & HITTYPE_BOUNCE) || (w_deathtype & HITTYPE_SPLASH))
+ return WEAPON_ROCKETLAUNCHER_MURDER_SPLASH;
+ else
+ return WEAPON_ROCKETLAUNCHER_MURDER_DIRECT;
}
- }
- else if (req == WR_CHECKAMMO2)
- return FALSE;
- else if (req == WR_RESETPLAYER)
- {
- self.rl_release = 0;
- }
- else if (req == WR_RELOAD)
- {
- W_Reload(WEP_CVAR(devastator, ammo), WEP_CVAR(devastator, reload_ammo), WEP_CVAR(devastator, reload_time), "weapons/reload.wav");
- }
- else if (req == WR_SUICIDEMESSAGE)
- {
- return WEAPON_ROCKETLAUNCHER_SUICIDE;
- }
- else if (req == WR_KILLMESSAGE)
- {
- if((w_deathtype & HITTYPE_BOUNCE) || (w_deathtype & HITTYPE_SPLASH))
- return WEAPON_ROCKETLAUNCHER_MURDER_SPLASH;
- else
- return WEAPON_ROCKETLAUNCHER_MURDER_DIRECT;
}
return TRUE;
}
#ifdef CSQC
float W_Devastator(float req)
{
- if(req == WR_IMPACTEFFECT)
- {
- vector org2;
- org2 = w_org + w_backoff * 12;
- pointparticles(particleeffectnum("rocket_explode"), org2, '0 0 0', 1);
- if(!w_issilent)
- sound(self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTN_NORM);
- }
- else if(req == WR_PRECACHE)
+ switch(req)
{
- precache_sound("weapons/rocket_impact.wav");
+ case WR_IMPACTEFFECT:
+ {
+ vector org2;
+ org2 = w_org + w_backoff * 12;
+ pointparticles(particleeffectnum("rocket_explode"), org2, '0 0 0', 1);
+ if(!w_issilent)
+ sound(self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTN_NORM);
+
+ return TRUE;
+ }
+ case WR_PRECACHE:
+ {
+ precache_sound("weapons/rocket_impact.wav");
+ return TRUE;
+ }
}
return TRUE;
}
float w_electro(float req)
{
float ammo_amount;
- if (req == WR_AIM)
+ switch(req)
{
- self.BUTTON_ATCK=FALSE;
- self.BUTTON_ATCK2=FALSE;
- if(vlen(self.origin-self.enemy.origin) > 1000)
- self.bot_secondary_electromooth = 0;
- if(self.bot_secondary_electromooth == 0)
+ case WR_AIM:
{
- float shoot;
+ self.BUTTON_ATCK=FALSE;
+ self.BUTTON_ATCK2=FALSE;
+ if(vlen(self.origin-self.enemy.origin) > 1000)
+ self.bot_secondary_electromooth = 0;
+ if(self.bot_secondary_electromooth == 0)
+ {
+ float shoot;
- if(autocvar_g_balance_electro_primary_speed)
- shoot = bot_aim(autocvar_g_balance_electro_primary_speed, 0, autocvar_g_balance_electro_primary_lifetime, FALSE);
- else
- shoot = bot_aim(1000000, 0, 0.001, FALSE);
+ if(autocvar_g_balance_electro_primary_speed)
+ shoot = bot_aim(autocvar_g_balance_electro_primary_speed, 0, autocvar_g_balance_electro_primary_lifetime, FALSE);
+ else
+ shoot = bot_aim(1000000, 0, 0.001, FALSE);
- if(shoot)
- {
- self.BUTTON_ATCK = TRUE;
- if(random() < 0.01) self.bot_secondary_electromooth = 1;
+ if(shoot)
+ {
+ self.BUTTON_ATCK = TRUE;
+ if(random() < 0.01) self.bot_secondary_electromooth = 1;
+ }
}
- }
- else
- {
- if(bot_aim(autocvar_g_balance_electro_secondary_speed, autocvar_g_balance_grenadelauncher_secondary_speed_up, autocvar_g_balance_electro_secondary_lifetime, TRUE))
+ else
{
- self.BUTTON_ATCK2 = TRUE;
- if(random() < 0.03) self.bot_secondary_electromooth = 0;
+ if(bot_aim(autocvar_g_balance_electro_secondary_speed, autocvar_g_balance_grenadelauncher_secondary_speed_up, autocvar_g_balance_electro_secondary_lifetime, TRUE))
+ {
+ self.BUTTON_ATCK2 = TRUE;
+ if(random() < 0.03) self.bot_secondary_electromooth = 0;
+ }
}
+
+ return TRUE;
}
- }
- else if (req == WR_THINK)
- {
- if(autocvar_g_balance_electro_reload_ammo) // forced reload
+ case WR_THINK:
{
- ammo_amount = 0;
- if(autocvar_g_balance_electro_lightning)
+ if(autocvar_g_balance_electro_reload_ammo) // forced reload
{
- if(self.clip_load > 0)
+ ammo_amount = 0;
+ if(autocvar_g_balance_electro_lightning)
+ {
+ if(self.clip_load > 0)
+ ammo_amount = 1;
+ }
+ else if(self.clip_load >= autocvar_g_balance_electro_primary_ammo)
ammo_amount = 1;
- }
- else if(self.clip_load >= autocvar_g_balance_electro_primary_ammo)
- ammo_amount = 1;
- if(self.clip_load >= autocvar_g_balance_electro_secondary_ammo)
- ammo_amount += 1;
+ if(self.clip_load >= autocvar_g_balance_electro_secondary_ammo)
+ ammo_amount += 1;
- if(!ammo_amount)
- {
- weapon_action(self.weapon, WR_RELOAD);
- return FALSE;
+ if(!ammo_amount)
+ {
+ weapon_action(self.weapon, WR_RELOAD);
+ return FALSE;
+ }
+
+ return TRUE;
}
- }
- if (self.BUTTON_ATCK)
- {
- if(autocvar_g_balance_electro_lightning)
- if(self.BUTTON_ATCK_prev)
- weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_electro_primary_animtime, w_ready);
-
- if (weapon_prepareattack(0, (autocvar_g_balance_electro_lightning ? 0 : autocvar_g_balance_electro_primary_refire)))
+ if (self.BUTTON_ATCK)
{
if(autocvar_g_balance_electro_lightning)
+ if(self.BUTTON_ATCK_prev)
+ weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_electro_primary_animtime, w_ready);
+
+ if (weapon_prepareattack(0, (autocvar_g_balance_electro_lightning ? 0 : autocvar_g_balance_electro_primary_refire)))
{
- if ((!self.lgbeam) || wasfreed(self.lgbeam))
+ if(autocvar_g_balance_electro_lightning)
{
- W_Electro_Attack3();
+ if ((!self.lgbeam) || wasfreed(self.lgbeam))
+ {
+ W_Electro_Attack3();
+ }
+ if(!self.BUTTON_ATCK_prev)
+ {
+ weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_electro_primary_animtime, w_ready);
+ self.BUTTON_ATCK_prev = 1;
+ }
}
- if(!self.BUTTON_ATCK_prev)
+ else
{
+ W_Electro_Attack();
weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_electro_primary_animtime, w_ready);
- self.BUTTON_ATCK_prev = 1;
}
}
- else
- {
- W_Electro_Attack();
- weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_electro_primary_animtime, w_ready);
- }
- }
- } else {
- if(autocvar_g_balance_electro_lightning)
- {
- if (self.BUTTON_ATCK_prev != 0)
+ } else {
+ if(autocvar_g_balance_electro_lightning)
{
- weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_electro_primary_animtime, w_ready);
- ATTACK_FINISHED(self) = time + autocvar_g_balance_electro_primary_refire * W_WeaponRateFactor();
+ if (self.BUTTON_ATCK_prev != 0)
+ {
+ weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_electro_primary_animtime, w_ready);
+ ATTACK_FINISHED(self) = time + autocvar_g_balance_electro_primary_refire * W_WeaponRateFactor();
+ }
+ self.BUTTON_ATCK_prev = 0;
}
- self.BUTTON_ATCK_prev = 0;
- }
- if (self.BUTTON_ATCK2)
- {
- if (time >= self.electro_secondarytime)
- if (weapon_prepareattack(1, autocvar_g_balance_electro_secondary_refire))
+ if (self.BUTTON_ATCK2)
{
- W_Electro_Attack2();
- self.electro_count = autocvar_g_balance_electro_secondary_count;
- weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_electro_secondary_animtime, w_electro_checkattack);
- self.electro_secondarytime = time + autocvar_g_balance_electro_secondary_refire2 * W_WeaponRateFactor();
+ if (time >= self.electro_secondarytime)
+ if (weapon_prepareattack(1, autocvar_g_balance_electro_secondary_refire))
+ {
+ W_Electro_Attack2();
+ self.electro_count = autocvar_g_balance_electro_secondary_count;
+ weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_electro_secondary_animtime, w_electro_checkattack);
+ self.electro_secondarytime = time + autocvar_g_balance_electro_secondary_refire2 * W_WeaponRateFactor();
+ }
}
}
+
+ return TRUE;
}
- }
- else if (req == WR_PRECACHE)
- {
- precache_model ("models/weapons/g_electro.md3");
- precache_model ("models/weapons/v_electro.md3");
- precache_model ("models/weapons/h_electro.iqm");
- precache_sound ("weapons/electro_bounce.wav");
- precache_sound ("weapons/electro_fire.wav");
- precache_sound ("weapons/electro_fire2.wav");
- precache_sound ("weapons/electro_impact.wav");
- precache_sound ("weapons/electro_impact_combo.wav");
- //precache_sound ("weapons/reload.wav"); // until weapons have individual reload sounds, precache the reload sound somewhere else
- if(autocvar_g_balance_electro_lightning)
+ case WR_PRECACHE:
{
- precache_sound ("weapons/lgbeam_fire.wav");
+ precache_model ("models/weapons/g_electro.md3");
+ precache_model ("models/weapons/v_electro.md3");
+ precache_model ("models/weapons/h_electro.iqm");
+ precache_sound ("weapons/electro_bounce.wav");
+ precache_sound ("weapons/electro_fire.wav");
+ precache_sound ("weapons/electro_fire2.wav");
+ precache_sound ("weapons/electro_impact.wav");
+ precache_sound ("weapons/electro_impact_combo.wav");
+
+ if(autocvar_g_balance_electro_lightning)
+ precache_sound ("weapons/lgbeam_fire.wav");
+
+ return TRUE;
}
- }
- else if (req == WR_SETUP)
- {
- weapon_setup(WEP_ELECTRO);
- self.current_ammo = ammo_cells;
- }
- else if (req == WR_CHECKAMMO1)
- {
- if(autocvar_g_balance_electro_lightning)
+ case WR_SETUP:
{
- if(!autocvar_g_balance_electro_primary_ammo)
- ammo_amount = 1;
+ weapon_setup(WEP_ELECTRO);
+ self.current_ammo = ammo_cells;
+ return TRUE;
+ }
+ case WR_CHECKAMMO1:
+ {
+ if(autocvar_g_balance_electro_lightning)
+ {
+ if(!autocvar_g_balance_electro_primary_ammo)
+ ammo_amount = 1;
+ else
+ ammo_amount = self.ammo_cells > 0;
+ ammo_amount += self.(weapon_load[WEP_ELECTRO]) > 0;
+ }
else
- ammo_amount = self.ammo_cells > 0;
- ammo_amount += self.(weapon_load[WEP_ELECTRO]) > 0;
+ {
+ ammo_amount = self.ammo_cells >= autocvar_g_balance_electro_primary_ammo;
+ ammo_amount += self.(weapon_load[WEP_ELECTRO]) >= autocvar_g_balance_electro_primary_ammo;
+ }
+ return ammo_amount;
}
- else
+ case WR_CHECKAMMO2:
{
- ammo_amount = self.ammo_cells >= autocvar_g_balance_electro_primary_ammo;
- ammo_amount += self.(weapon_load[WEP_ELECTRO]) >= autocvar_g_balance_electro_primary_ammo;
+ if(autocvar_g_balance_electro_combo_safeammocheck) // true if you can fire at least one secondary blob AND one primary shot after it, otherwise false.
+ {
+ ammo_amount = self.ammo_cells >= autocvar_g_balance_electro_secondary_ammo + autocvar_g_balance_electro_primary_ammo;
+ ammo_amount += self.(weapon_load[WEP_ELECTRO]) >= autocvar_g_balance_electro_secondary_ammo + autocvar_g_balance_electro_primary_ammo;
+ }
+ else
+ {
+ ammo_amount = self.ammo_cells >= autocvar_g_balance_electro_secondary_ammo;
+ ammo_amount += self.(weapon_load[WEP_ELECTRO]) >= autocvar_g_balance_electro_secondary_ammo;
+ }
+ return ammo_amount;
}
- return ammo_amount;
- }
- else if (req == WR_CHECKAMMO2)
- {
- if(autocvar_g_balance_electro_combo_safeammocheck) // true if you can fire at least one secondary blob AND one primary shot after it, otherwise false.
+ case WR_RESETPLAYER:
{
- ammo_amount = self.ammo_cells >= autocvar_g_balance_electro_secondary_ammo + autocvar_g_balance_electro_primary_ammo;
- ammo_amount += self.(weapon_load[WEP_ELECTRO]) >= autocvar_g_balance_electro_secondary_ammo + autocvar_g_balance_electro_primary_ammo;
+ self.electro_secondarytime = time;
+ return TRUE;
}
- else
+ case WR_RELOAD:
{
- ammo_amount = self.ammo_cells >= autocvar_g_balance_electro_secondary_ammo;
- ammo_amount += self.(weapon_load[WEP_ELECTRO]) >= autocvar_g_balance_electro_secondary_ammo;
+ W_Reload(min(autocvar_g_balance_electro_primary_ammo, autocvar_g_balance_electro_secondary_ammo), autocvar_g_balance_electro_reload_ammo, autocvar_g_balance_electro_reload_time, "weapons/reload.wav");
+ return TRUE;
}
- return ammo_amount;
- }
- else if (req == WR_RESETPLAYER)
- {
- self.electro_secondarytime = time;
- }
- else if (req == WR_RELOAD)
- {
- W_Reload(min(autocvar_g_balance_electro_primary_ammo, autocvar_g_balance_electro_secondary_ammo), autocvar_g_balance_electro_reload_ammo, autocvar_g_balance_electro_reload_time, "weapons/reload.wav");
- }
- else if (req == WR_SUICIDEMESSAGE)
- {
- if(w_deathtype & HITTYPE_SECONDARY)
- return WEAPON_ELECTRO_SUICIDE_ORBS;
- else
- return WEAPON_ELECTRO_SUICIDE_BOLT;
- }
- else if (req == WR_KILLMESSAGE)
- {
- if(w_deathtype & HITTYPE_SECONDARY)
+ case WR_SUICIDEMESSAGE:
{
- return WEAPON_ELECTRO_MURDER_ORBS;
+ if(w_deathtype & HITTYPE_SECONDARY)
+ return WEAPON_ELECTRO_SUICIDE_ORBS;
+ else
+ return WEAPON_ELECTRO_SUICIDE_BOLT;
}
- else
+ case WR_KILLMESSAGE:
{
- if(w_deathtype & HITTYPE_BOUNCE)
- return WEAPON_ELECTRO_MURDER_COMBO;
+ if(w_deathtype & HITTYPE_SECONDARY)
+ {
+ return WEAPON_ELECTRO_MURDER_ORBS;
+ }
else
- return WEAPON_ELECTRO_MURDER_BOLT;
+ {
+ if(w_deathtype & HITTYPE_BOUNCE)
+ return WEAPON_ELECTRO_MURDER_COMBO;
+ else
+ return WEAPON_ELECTRO_MURDER_BOLT;
+ }
}
}
return TRUE;
#ifdef CSQC
float w_electro(float req)
{
- if(req == WR_IMPACTEFFECT)
+ switch(req)
{
- vector org2;
- org2 = w_org + w_backoff * 6;
- if(w_deathtype & HITTYPE_SECONDARY)
- {
- pointparticles(particleeffectnum("electro_ballexplode"), org2, '0 0 0', 1);
- if(!w_issilent)
- sound(self, CH_SHOTS, "weapons/electro_impact.wav", VOL_BASE, ATTN_NORM);
- }
- else
+ case WR_IMPACTEFFECT:
{
- if(w_deathtype & HITTYPE_BOUNCE)
+ vector org2;
+ org2 = w_org + w_backoff * 6;
+ if(w_deathtype & HITTYPE_SECONDARY)
{
- // this is sent as "primary (w_deathtype & HITTYPE_BOUNCE)" to distinguish it from (w_deathtype & HITTYPE_SECONDARY) bounced balls
- pointparticles(particleeffectnum("electro_combo"), org2, '0 0 0', 1);
+ pointparticles(particleeffectnum("electro_ballexplode"), org2, '0 0 0', 1);
if(!w_issilent)
- sound(self, CH_SHOTS, "weapons/electro_impact_combo.wav", VOL_BASE, ATTN_NORM);
+ sound(self, CH_SHOTS, "weapons/electro_impact.wav", VOL_BASE, ATTN_NORM);
}
else
{
- pointparticles(particleeffectnum("electro_impact"), org2, '0 0 0', 1);
- if(!w_issilent)
- sound(self, CH_SHOTS, "weapons/electro_impact.wav", VOL_BASE, ATTN_NORM);
+ if(w_deathtype & HITTYPE_BOUNCE)
+ {
+ // this is sent as "primary (w_deathtype & HITTYPE_BOUNCE)" to distinguish it from (w_deathtype & HITTYPE_SECONDARY) bounced balls
+ pointparticles(particleeffectnum("electro_combo"), org2, '0 0 0', 1);
+ if(!w_issilent)
+ sound(self, CH_SHOTS, "weapons/electro_impact_combo.wav", VOL_BASE, ATTN_NORM);
+ }
+ else
+ {
+ pointparticles(particleeffectnum("electro_impact"), org2, '0 0 0', 1);
+ if(!w_issilent)
+ sound(self, CH_SHOTS, "weapons/electro_impact.wav", VOL_BASE, ATTN_NORM);
+ }
}
+
+ return TRUE;
+ }
+ case WR_PRECACHE:
+ {
+ precache_sound("weapons/electro_impact.wav");
+ precache_sound("weapons/electro_impact_combo.wav");
+ return TRUE;
}
- }
- else if(req == WR_PRECACHE)
- {
- precache_sound("weapons/electro_impact.wav");
- precache_sound("weapons/electro_impact_combo.wav");
}
return TRUE;
}
float w_fireball(float req)
{
- //float ammo_amount;
- if (req == WR_AIM)
+ switch(req)
{
- self.BUTTON_ATCK = FALSE;
- self.BUTTON_ATCK2 = FALSE;
- if (self.bot_primary_fireballmooth == 0)
+ case WR_AIM:
{
- if(bot_aim(autocvar_g_balance_fireball_primary_speed, 0, autocvar_g_balance_fireball_primary_lifetime, FALSE))
+ self.BUTTON_ATCK = FALSE;
+ self.BUTTON_ATCK2 = FALSE;
+ if (self.bot_primary_fireballmooth == 0)
{
- self.BUTTON_ATCK = TRUE;
- if(random() < 0.02) self.bot_primary_fireballmooth = 0;
+ if(bot_aim(autocvar_g_balance_fireball_primary_speed, 0, autocvar_g_balance_fireball_primary_lifetime, FALSE))
+ {
+ self.BUTTON_ATCK = TRUE;
+ if(random() < 0.02) self.bot_primary_fireballmooth = 0;
+ }
}
- }
- else
- {
- if(bot_aim(autocvar_g_balance_fireball_secondary_speed, autocvar_g_balance_fireball_secondary_speed_up, autocvar_g_balance_fireball_secondary_lifetime, TRUE))
+ else
{
- self.BUTTON_ATCK2 = TRUE;
- if(random() < 0.01) self.bot_primary_fireballmooth = 1;
+ if(bot_aim(autocvar_g_balance_fireball_secondary_speed, autocvar_g_balance_fireball_secondary_speed_up, autocvar_g_balance_fireball_secondary_lifetime, TRUE))
+ {
+ self.BUTTON_ATCK2 = TRUE;
+ if(random() < 0.01) self.bot_primary_fireballmooth = 1;
+ }
}
+
+ return TRUE;
}
- }
- else if (req == WR_THINK)
- {
- if (self.BUTTON_ATCK)
+ case WR_THINK:
{
- if (time >= self.fireball_primarytime)
- if (weapon_prepareattack(0, autocvar_g_balance_fireball_primary_refire))
+ if (self.BUTTON_ATCK)
{
- W_Fireball_Attack1_Frame0();
- self.fireball_primarytime = time + autocvar_g_balance_fireball_primary_refire2 * W_WeaponRateFactor();
+ if (time >= self.fireball_primarytime)
+ if (weapon_prepareattack(0, autocvar_g_balance_fireball_primary_refire))
+ {
+ W_Fireball_Attack1_Frame0();
+ self.fireball_primarytime = time + autocvar_g_balance_fireball_primary_refire2 * W_WeaponRateFactor();
+ }
}
- }
- else if (self.BUTTON_ATCK2)
- {
- if (weapon_prepareattack(1, autocvar_g_balance_fireball_secondary_refire))
+ else if (self.BUTTON_ATCK2)
{
- W_Fireball_Attack2();
- weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_fireball_secondary_animtime, w_ready);
+ if (weapon_prepareattack(1, autocvar_g_balance_fireball_secondary_refire))
+ {
+ W_Fireball_Attack2();
+ weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_fireball_secondary_animtime, w_ready);
+ }
}
+
+ return TRUE;
}
- }
- else if (req == WR_PRECACHE)
- {
- precache_model ("models/weapons/g_fireball.md3");
- precache_model ("models/weapons/v_fireball.md3");
- precache_model ("models/weapons/h_fireball.iqm");
- precache_model ("models/sphere/sphere.md3");
- precache_sound ("weapons/fireball_fire.wav");
- precache_sound ("weapons/fireball_fire2.wav");
- precache_sound ("weapons/fireball_prefire2.wav");
- //precache_sound ("weapons/reload.wav"); // until weapons have individual reload sounds, precache the reload sound somewhere else
- }
- else if (req == WR_SETUP)
- {
- weapon_setup(WEP_FIREBALL);
- self.current_ammo = ammo_none;
- }
- else if (req == WR_CHECKAMMO1)
- {
- return 1;
- }
- else if (req == WR_CHECKAMMO2)
- {
- return 1;
- }
- else if (req == WR_RESETPLAYER)
- {
- self.fireball_primarytime = time;
- }
- else if (req == WR_SUICIDEMESSAGE)
- {
- if(w_deathtype & HITTYPE_SECONDARY)
- return WEAPON_FIREBALL_SUICIDE_FIREMINE;
- else
- return WEAPON_FIREBALL_SUICIDE_BLAST;
- }
- else if (req == WR_KILLMESSAGE)
- {
- if(w_deathtype & HITTYPE_SECONDARY)
+ case WR_PRECACHE:
{
- return WEAPON_FIREBALL_MURDER_FIREMINE;
+ precache_model ("models/weapons/g_fireball.md3");
+ precache_model ("models/weapons/v_fireball.md3");
+ precache_model ("models/weapons/h_fireball.iqm");
+ precache_model ("models/sphere/sphere.md3");
+ precache_sound ("weapons/fireball_fire.wav");
+ precache_sound ("weapons/fireball_fire2.wav");
+ precache_sound ("weapons/fireball_prefire2.wav");
+ return TRUE;
}
- else
+ case WR_SETUP:
+ {
+ weapon_setup(WEP_FIREBALL);
+ self.current_ammo = ammo_none;
+ return TRUE;
+ }
+ case WR_CHECKAMMO1:
+ case WR_CHECKAMMO2:
+ {
+ return TRUE; // fireball has infinite ammo
+ }
+ case WR_RESETPLAYER:
+ {
+ self.fireball_primarytime = time;
+ return TRUE;
+ }
+ case WR_SUICIDEMESSAGE:
{
- return WEAPON_FIREBALL_MURDER_BLAST;
+ if(w_deathtype & HITTYPE_SECONDARY)
+ return WEAPON_FIREBALL_SUICIDE_FIREMINE;
+ else
+ return WEAPON_FIREBALL_SUICIDE_BLAST;
+ }
+ case WR_KILLMESSAGE:
+ {
+ if(w_deathtype & HITTYPE_SECONDARY)
+ return WEAPON_FIREBALL_MURDER_FIREMINE;
+ else
+ return WEAPON_FIREBALL_MURDER_BLAST;
}
}
return TRUE;
#ifdef CSQC
float w_fireball(float req)
{
- if(req == WR_IMPACTEFFECT)
+ switch(req)
{
- vector org2;
- if(w_deathtype & HITTYPE_SECONDARY)
+ case WR_IMPACTEFFECT:
{
- // firemine goes out silently
+ vector org2;
+ if(w_deathtype & HITTYPE_SECONDARY)
+ {
+ // firemine goes out silently
+ }
+ else
+ {
+ org2 = w_org + w_backoff * 16;
+ pointparticles(particleeffectnum("fireball_explode"), org2, '0 0 0', 1);
+ if(!w_issilent)
+ sound(self, CH_SHOTS, "weapons/fireball_impact2.wav", VOL_BASE, ATTN_NORM * 0.25); // long range boom
+ }
+
+ return TRUE;
}
- else
+ case WR_PRECACHE:
{
- org2 = w_org + w_backoff * 16;
- pointparticles(particleeffectnum("fireball_explode"), org2, '0 0 0', 1);
- if(!w_issilent)
- sound(self, CH_SHOTS, "weapons/fireball_impact2.wav", VOL_BASE, ATTN_NORM * 0.25); // long range boom
+ precache_sound("weapons/fireball_impact2.wav");
+ return TRUE;
}
}
- else if(req == WR_PRECACHE)
- {
- precache_sound("weapons/fireball_impact2.wav");
- }
return TRUE;
}
float w_hagar(float req)
{
float ammo_amount;
- if (req == WR_AIM)
- if (random()>0.15)
- self.BUTTON_ATCK = bot_aim(autocvar_g_balance_hagar_primary_speed, 0, autocvar_g_balance_hagar_primary_lifetime, FALSE);
- else
+ switch(req)
+ {
+ case WR_AIM:
{
- // not using secondary_speed since these are only 15% and should cause some ricochets without re-aiming
- self.BUTTON_ATCK2 = bot_aim(autocvar_g_balance_hagar_primary_speed, 0, autocvar_g_balance_hagar_primary_lifetime, FALSE);
+ if (random()>0.15)
+ self.BUTTON_ATCK = bot_aim(autocvar_g_balance_hagar_primary_speed, 0, autocvar_g_balance_hagar_primary_lifetime, FALSE);
+ else // not using secondary_speed since these are only 15% and should cause some ricochets without re-aiming
+ self.BUTTON_ATCK2 = bot_aim(autocvar_g_balance_hagar_primary_speed, 0, autocvar_g_balance_hagar_primary_lifetime, FALSE);
+
+ return TRUE;
}
- else if (req == WR_THINK)
- {
- float loadable_secondary;
- loadable_secondary = (autocvar_g_balance_hagar_secondary_load && autocvar_g_balance_hagar_secondary);
-
- if (loadable_secondary)
- W_Hagar_Attack2_Load(); // must always run each frame
- if(autocvar_g_balance_hagar_reload_ammo && self.clip_load < min(autocvar_g_balance_hagar_primary_ammo, autocvar_g_balance_hagar_secondary_ammo)) // forced reload
- weapon_action(self.weapon, WR_RELOAD);
- else if (self.BUTTON_ATCK && !self.hagar_load && !self.hagar_loadblock) // not while secondary is loaded or awaiting reset
+ case WR_THINK:
{
- if (weapon_prepareattack(0, autocvar_g_balance_hagar_primary_refire))
+ float loadable_secondary;
+ loadable_secondary = (autocvar_g_balance_hagar_secondary_load && autocvar_g_balance_hagar_secondary);
+
+ if (loadable_secondary)
+ W_Hagar_Attack2_Load(); // must always run each frame
+ if(autocvar_g_balance_hagar_reload_ammo && self.clip_load < min(autocvar_g_balance_hagar_primary_ammo, autocvar_g_balance_hagar_secondary_ammo)) // forced reload
+ weapon_action(self.weapon, WR_RELOAD);
+ else if (self.BUTTON_ATCK && !self.hagar_load && !self.hagar_loadblock) // not while secondary is loaded or awaiting reset
+ {
+ if (weapon_prepareattack(0, autocvar_g_balance_hagar_primary_refire))
+ {
+ W_Hagar_Attack();
+ weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_hagar_primary_refire, w_ready);
+ }
+ }
+ else if (self.BUTTON_ATCK2 && !loadable_secondary && autocvar_g_balance_hagar_secondary)
{
- W_Hagar_Attack();
- weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_hagar_primary_refire, w_ready);
+ if (weapon_prepareattack(1, autocvar_g_balance_hagar_secondary_refire))
+ {
+ W_Hagar_Attack2();
+ weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_hagar_secondary_refire, w_ready);
+ }
}
+
+ return TRUE;
}
- else if (self.BUTTON_ATCK2 && !loadable_secondary && autocvar_g_balance_hagar_secondary)
+ case WR_GONETHINK:
{
- if (weapon_prepareattack(1, autocvar_g_balance_hagar_secondary_refire))
+ // we lost the weapon and want to prepare switching away
+ if(self.hagar_load)
{
- W_Hagar_Attack2();
- weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_hagar_secondary_refire, w_ready);
+ self.weaponentity.state = WS_READY;
+ W_Hagar_Attack2_Load_Release();
}
+
+ return TRUE;
}
- }
- else if (req == WR_GONETHINK)
- {
- // we lost the weapon and want to prepare switching away
- if(self.hagar_load)
+ case WR_PRECACHE:
{
- self.weaponentity.state = WS_READY;
- W_Hagar_Attack2_Load_Release();
+ precache_model ("models/weapons/g_hagar.md3");
+ precache_model ("models/weapons/v_hagar.md3");
+ precache_model ("models/weapons/h_hagar.iqm");
+ precache_sound ("weapons/hagar_fire.wav");
+ precache_sound ("weapons/hagar_load.wav");
+ precache_sound ("weapons/hagar_beep.wav");
+ return TRUE;
}
- }
- else if (req == WR_PRECACHE)
- {
- precache_model ("models/weapons/g_hagar.md3");
- precache_model ("models/weapons/v_hagar.md3");
- precache_model ("models/weapons/h_hagar.iqm");
- precache_sound ("weapons/hagar_fire.wav");
- precache_sound ("weapons/hagar_load.wav");
- precache_sound ("weapons/hagar_beep.wav");
- //precache_sound ("weapons/reload.wav"); // until weapons have individual reload sounds, precache the reload sound somewhere else
- }
- else if (req == WR_SETUP)
- {
- weapon_setup(WEP_HAGAR);
- self.current_ammo = ammo_rockets;
- self.hagar_loadblock = FALSE;
+ case WR_SETUP:
+ {
+ weapon_setup(WEP_HAGAR);
+ self.current_ammo = ammo_rockets;
+ self.hagar_loadblock = FALSE;
- if(self.hagar_load)
+ if(self.hagar_load)
+ {
+ W_DecreaseAmmo(ammo_rockets, autocvar_g_balance_hagar_secondary_ammo * self.hagar_load * -1, autocvar_g_balance_hagar_reload_ammo); // give back ammo if necessary
+ self.hagar_load = 0;
+ }
+
+ return TRUE;
+ }
+ case WR_CHECKAMMO1:
+ {
+ ammo_amount = self.ammo_rockets >= autocvar_g_balance_hagar_primary_ammo;
+ ammo_amount += self.(weapon_load[WEP_HAGAR]) >= autocvar_g_balance_hagar_primary_ammo;
+ return ammo_amount;
+ }
+ case WR_CHECKAMMO2:
+ {
+ ammo_amount = self.ammo_rockets >= autocvar_g_balance_hagar_secondary_ammo;
+ ammo_amount += self.(weapon_load[WEP_HAGAR]) >= autocvar_g_balance_hagar_secondary_ammo;
+ return ammo_amount;
+ }
+ case WR_RESETPLAYER:
{
- W_DecreaseAmmo(ammo_rockets, autocvar_g_balance_hagar_secondary_ammo * self.hagar_load * -1, autocvar_g_balance_hagar_reload_ammo); // give back ammo if necessary
self.hagar_load = 0;
+ return TRUE;
+ }
+ case WR_PLAYERDEATH:
+ {
+ // if we have any rockets loaded when we die, release them
+ if(self.hagar_load && autocvar_g_balance_hagar_secondary_load_releasedeath)
+ W_Hagar_Attack2_Load_Release();
+
+ return TRUE;
+ }
+ case WR_RELOAD:
+ {
+ if not(self.hagar_load) // require releasing loaded rockets first
+ W_Reload(min(autocvar_g_balance_hagar_primary_ammo, autocvar_g_balance_hagar_secondary_ammo), autocvar_g_balance_hagar_reload_ammo, autocvar_g_balance_hagar_reload_time, "weapons/reload.wav");
+
+ return TRUE;
+ }
+ case WR_SUICIDEMESSAGE:
+ {
+ return WEAPON_HAGAR_SUICIDE;
+ }
+ case WR_KILLMESSAGE:
+ {
+ if(w_deathtype & HITTYPE_SECONDARY)
+ return WEAPON_HAGAR_MURDER_BURST;
+ else
+ return WEAPON_HAGAR_MURDER_SPRAY;
}
- }
- else if (req == WR_CHECKAMMO1)
- {
- ammo_amount = self.ammo_rockets >= autocvar_g_balance_hagar_primary_ammo;
- ammo_amount += self.(weapon_load[WEP_HAGAR]) >= autocvar_g_balance_hagar_primary_ammo;
- return ammo_amount;
- }
- else if (req == WR_CHECKAMMO2)
- {
- ammo_amount = self.ammo_rockets >= autocvar_g_balance_hagar_secondary_ammo;
- ammo_amount += self.(weapon_load[WEP_HAGAR]) >= autocvar_g_balance_hagar_secondary_ammo;
- return ammo_amount;
- }
- else if (req == WR_RESETPLAYER)
- {
- self.hagar_load = 0;
- }
- else if (req == WR_PLAYERDEATH)
- {
- // if we have any rockets loaded when we die, release them
- if(self.hagar_load && autocvar_g_balance_hagar_secondary_load_releasedeath)
- W_Hagar_Attack2_Load_Release();
- }
- else if (req == WR_RELOAD)
- {
- if not(self.hagar_load) // require releasing loaded rockets first
- W_Reload(min(autocvar_g_balance_hagar_primary_ammo, autocvar_g_balance_hagar_secondary_ammo), autocvar_g_balance_hagar_reload_ammo, autocvar_g_balance_hagar_reload_time, "weapons/reload.wav");
- }
- else if (req == WR_SUICIDEMESSAGE)
- {
- return WEAPON_HAGAR_SUICIDE;
- }
- else if (req == WR_KILLMESSAGE)
- {
- if(w_deathtype & HITTYPE_SECONDARY)
- return WEAPON_HAGAR_MURDER_BURST;
- else
- return WEAPON_HAGAR_MURDER_SPRAY;
}
return TRUE;
}
#ifdef CSQC
float w_hagar(float req)
{
- if(req == WR_IMPACTEFFECT)
+ switch(req)
{
- vector org2;
- org2 = w_org + w_backoff * 6;
- pointparticles(particleeffectnum("hagar_explode"), org2, '0 0 0', 1);
- if(!w_issilent)
+ case WR_IMPACTEFFECT:
{
- if (w_random<0.15)
- sound(self, CH_SHOTS, "weapons/hagexp1.wav", VOL_BASE, ATTN_NORM);
- else if (w_random<0.7)
- sound(self, CH_SHOTS, "weapons/hagexp2.wav", VOL_BASE, ATTN_NORM);
- else
- sound(self, CH_SHOTS, "weapons/hagexp3.wav", VOL_BASE, ATTN_NORM);
+ vector org2;
+ org2 = w_org + w_backoff * 6;
+ pointparticles(particleeffectnum("hagar_explode"), org2, '0 0 0', 1);
+ if(!w_issilent)
+ {
+ if (w_random<0.15)
+ sound(self, CH_SHOTS, "weapons/hagexp1.wav", VOL_BASE, ATTN_NORM);
+ else if (w_random<0.7)
+ sound(self, CH_SHOTS, "weapons/hagexp2.wav", VOL_BASE, ATTN_NORM);
+ else
+ sound(self, CH_SHOTS, "weapons/hagexp3.wav", VOL_BASE, ATTN_NORM);
+ }
+
+ return TRUE;
+ }
+ case WR_PRECACHE:
+ {
+ precache_sound("weapons/hagexp1.wav");
+ precache_sound("weapons/hagexp2.wav");
+ precache_sound("weapons/hagexp3.wav");
+ return TRUE;
}
- }
- else if(req == WR_PRECACHE)
- {
- precache_sound("weapons/hagexp1.wav");
- precache_sound("weapons/hagexp2.wav");
- precache_sound("weapons/hagexp3.wav");
}
return TRUE;
}
float w_hlac(float req)
{
float ammo_amount;
- if (req == WR_AIM)
- self.BUTTON_ATCK = bot_aim(autocvar_g_balance_hlac_primary_speed, 0, autocvar_g_balance_hlac_primary_lifetime, FALSE);
- else if (req == WR_THINK)
+ switch(req)
{
- if(autocvar_g_balance_hlac_reload_ammo && self.clip_load < min(autocvar_g_balance_hlac_primary_ammo, autocvar_g_balance_hlac_secondary_ammo)) // forced reload
- weapon_action(self.weapon, WR_RELOAD);
- else if (self.BUTTON_ATCK)
+ case WR_AIM:
{
- if (weapon_prepareattack(0, autocvar_g_balance_hlac_primary_refire))
+ self.BUTTON_ATCK = bot_aim(autocvar_g_balance_hlac_primary_speed, 0, autocvar_g_balance_hlac_primary_lifetime, FALSE);
+ return TRUE;
+ }
+ case WR_THINK:
+ {
+ if(autocvar_g_balance_hlac_reload_ammo && self.clip_load < min(autocvar_g_balance_hlac_primary_ammo, autocvar_g_balance_hlac_secondary_ammo)) // forced reload
+ weapon_action(self.weapon, WR_RELOAD);
+ else if (self.BUTTON_ATCK)
{
- self.misc_bulletcounter = 0;
- W_HLAC_Attack();
- weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_hlac_primary_refire, HLAC_fire1_02);
+ if (weapon_prepareattack(0, autocvar_g_balance_hlac_primary_refire))
+ {
+ self.misc_bulletcounter = 0;
+ W_HLAC_Attack();
+ weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_hlac_primary_refire, HLAC_fire1_02);
+ }
}
- }
- else if (self.BUTTON_ATCK2 && autocvar_g_balance_hlac_secondary)
- {
- if (weapon_prepareattack(1, autocvar_g_balance_hlac_secondary_refire))
+ else if (self.BUTTON_ATCK2 && autocvar_g_balance_hlac_secondary)
{
- W_HLAC_Attack2();
- weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_hlac_secondary_animtime, w_ready);
+ if (weapon_prepareattack(1, autocvar_g_balance_hlac_secondary_refire))
+ {
+ W_HLAC_Attack2();
+ weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_hlac_secondary_animtime, w_ready);
+ }
}
+
+ return TRUE;
+ }
+ case WR_PRECACHE:
+ {
+ precache_model ("models/weapons/g_hlac.md3");
+ precache_model ("models/weapons/v_hlac.md3");
+ precache_model ("models/weapons/h_hlac.iqm");
+ precache_sound ("weapons/lasergun_fire.wav");
+ return TRUE;
+ }
+ case WR_SETUP:
+ {
+ weapon_setup(WEP_HLAC);
+ self.current_ammo = ammo_cells;
+ return TRUE;
+ }
+ case WR_CHECKAMMO1:
+ {
+ ammo_amount = self.ammo_cells >= autocvar_g_balance_hlac_primary_ammo;
+ ammo_amount += self.(weapon_load[WEP_HLAC]) >= autocvar_g_balance_hlac_primary_ammo;
+ return ammo_amount;
+ }
+ case WR_CHECKAMMO2:
+ {
+ ammo_amount = self.ammo_cells >= autocvar_g_balance_hlac_secondary_ammo;
+ ammo_amount += self.(weapon_load[WEP_HLAC]) >= autocvar_g_balance_hlac_secondary_ammo;
+ return ammo_amount;
+ }
+ case WR_RELOAD:
+ {
+ W_Reload(min(autocvar_g_balance_hlac_primary_ammo, autocvar_g_balance_hlac_secondary_ammo), autocvar_g_balance_hlac_reload_ammo, autocvar_g_balance_hlac_reload_time, "weapons/reload.wav");
+ return TRUE;
+ }
+ case WR_SUICIDEMESSAGE:
+ {
+ return WEAPON_HLAC_SUICIDE;
+ }
+ case WR_KILLMESSAGE:
+ {
+ return WEAPON_HLAC_MURDER;
}
- }
- else if (req == WR_PRECACHE)
- {
- precache_model ("models/weapons/g_hlac.md3");
- precache_model ("models/weapons/v_hlac.md3");
- precache_model ("models/weapons/h_hlac.iqm");
- precache_sound ("weapons/lasergun_fire.wav");
- //precache_sound ("weapons/reload.wav"); // until weapons have individual reload sounds, precache the reload sound somewhere else
-
- }
- else if (req == WR_SETUP)
- {
- weapon_setup(WEP_HLAC);
- self.current_ammo = ammo_cells;
- }
- else if (req == WR_CHECKAMMO1)
- {
- ammo_amount = self.ammo_cells >= autocvar_g_balance_hlac_primary_ammo;
- ammo_amount += self.(weapon_load[WEP_HLAC]) >= autocvar_g_balance_hlac_primary_ammo;
- return ammo_amount;
- }
- else if (req == WR_CHECKAMMO2)
- {
- ammo_amount = self.ammo_cells >= autocvar_g_balance_hlac_secondary_ammo;
- ammo_amount += self.(weapon_load[WEP_HLAC]) >= autocvar_g_balance_hlac_secondary_ammo;
- return ammo_amount;
- }
- else if (req == WR_RELOAD)
- {
- W_Reload(min(autocvar_g_balance_hlac_primary_ammo, autocvar_g_balance_hlac_secondary_ammo), autocvar_g_balance_hlac_reload_ammo, autocvar_g_balance_hlac_reload_time, "weapons/reload.wav");
- }
- else if (req == WR_SUICIDEMESSAGE)
- {
- return WEAPON_HLAC_SUICIDE;
- }
- else if (req == WR_KILLMESSAGE)
- {
- return WEAPON_HLAC_MURDER;
}
return TRUE;
}
#ifdef CSQC
float w_hlac(float req)
{
- if(req == WR_IMPACTEFFECT)
- {
- vector org2;
- org2 = w_org + w_backoff * 6;
- pointparticles(particleeffectnum("laser_impact"), org2, w_backoff * 1000, 1);
- if(!w_issilent)
- sound(self, CH_SHOTS, "weapons/laserimpact.wav", VOL_BASE, ATTN_NORM);
- }
- else if(req == WR_PRECACHE)
+ switch(req)
{
- precache_sound("weapons/laserimpact.wav");
+ case WR_IMPACTEFFECT:
+ {
+ vector org2;
+ org2 = w_org + w_backoff * 6;
+ pointparticles(particleeffectnum("laser_impact"), org2, w_backoff * 1000, 1);
+ if(!w_issilent)
+ sound(self, CH_SHOTS, "weapons/laserimpact.wav", VOL_BASE, ATTN_NORM);
+
+ return TRUE;
+ }
+ case WR_PRECACHE:
+ {
+ precache_sound("weapons/laserimpact.wav");
+ return TRUE;
+ }
}
return TRUE;
}
{
float hooked_time_max, hooked_fuel;
- if (req == WR_AIM)
+ switch(req)
{
- // ... sorry ...
- }
- else if (req == WR_THINK)
- {
- if (self.BUTTON_ATCK || (!(self.items & IT_JETPACK) && self.BUTTON_HOOK))
+ case WR_AIM:
{
- if(!self.hook)
- if not(self.hook_state & HOOK_WAITING_FOR_RELEASE)
- if not(self.hook_state & HOOK_FIRING)
- if (time > self.hook_refire)
- if (weapon_prepareattack(0, -1))
- {
- W_DecreaseAmmo(ammo_fuel, autocvar_g_balance_hook_primary_fuel, FALSE);
- self.hook_state |= HOOK_FIRING;
- weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_hook_primary_animtime, w_ready);
- }
+ // no bot AI for hook (yet?)
+ return TRUE;
}
-
- if (self.BUTTON_ATCK2)
+ case WR_THINK:
{
- if (weapon_prepareattack(1, autocvar_g_balance_hook_secondary_refire))
+ if (self.BUTTON_ATCK || (!(self.items & IT_JETPACK) && self.BUTTON_HOOK))
{
- W_Hook_Attack2();
- weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_hook_secondary_animtime, w_ready);
+ if(!self.hook)
+ if not(self.hook_state & HOOK_WAITING_FOR_RELEASE)
+ if not(self.hook_state & HOOK_FIRING)
+ if (time > self.hook_refire)
+ if (weapon_prepareattack(0, -1))
+ {
+ W_DecreaseAmmo(ammo_fuel, autocvar_g_balance_hook_primary_fuel, FALSE);
+ self.hook_state |= HOOK_FIRING;
+ weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_hook_primary_animtime, w_ready);
+ }
}
- }
-
- if(self.hook)
- {
- // if hooked, no bombs, and increase the timer
- self.hook_refire = max(self.hook_refire, time + autocvar_g_balance_hook_primary_refire * W_WeaponRateFactor());
- // hook also inhibits health regeneration, but only for 1 second
- if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
- self.pauseregen_finished = max(self.pauseregen_finished, time + autocvar_g_balance_pause_fuel_regen);
- }
+ if (self.BUTTON_ATCK2)
+ {
+ if (weapon_prepareattack(1, autocvar_g_balance_hook_secondary_refire))
+ {
+ W_Hook_Attack2();
+ weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_hook_secondary_animtime, w_ready);
+ }
+ }
- if(self.hook && self.hook.state == 1)
- {
- hooked_time_max = autocvar_g_balance_hook_primary_hooked_time_max;
- if (hooked_time_max > 0)
+ if(self.hook)
{
- if ( time > self.hook_time_hooked + hooked_time_max )
- self.hook_state |= HOOK_REMOVING;
+ // if hooked, no bombs, and increase the timer
+ self.hook_refire = max(self.hook_refire, time + autocvar_g_balance_hook_primary_refire * W_WeaponRateFactor());
+
+ // hook also inhibits health regeneration, but only for 1 second
+ if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
+ self.pauseregen_finished = max(self.pauseregen_finished, time + autocvar_g_balance_pause_fuel_regen);
}
-
- hooked_fuel = autocvar_g_balance_hook_primary_hooked_fuel;
- if (hooked_fuel > 0)
+
+ if(self.hook && self.hook.state == 1)
{
- if ( time > self.hook_time_fueldecrease )
+ hooked_time_max = autocvar_g_balance_hook_primary_hooked_time_max;
+ if (hooked_time_max > 0)
+ {
+ if ( time > self.hook_time_hooked + hooked_time_max )
+ self.hook_state |= HOOK_REMOVING;
+ }
+
+ hooked_fuel = autocvar_g_balance_hook_primary_hooked_fuel;
+ if (hooked_fuel > 0)
{
- if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
+ if ( time > self.hook_time_fueldecrease )
{
- if ( self.ammo_fuel >= (time - self.hook_time_fueldecrease) * hooked_fuel )
- {
- W_DecreaseAmmo(ammo_fuel, (time - self.hook_time_fueldecrease) * hooked_fuel, FALSE);
- self.hook_time_fueldecrease = time;
- // decrease next frame again
- }
- else
+ if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
{
- self.ammo_fuel = 0;
- self.hook_state |= HOOK_REMOVING;
- W_SwitchWeapon_Force(self, w_getbestweapon(self));
+ if ( self.ammo_fuel >= (time - self.hook_time_fueldecrease) * hooked_fuel )
+ {
+ W_DecreaseAmmo(ammo_fuel, (time - self.hook_time_fueldecrease) * hooked_fuel, FALSE);
+ self.hook_time_fueldecrease = time;
+ // decrease next frame again
+ }
+ else
+ {
+ self.ammo_fuel = 0;
+ self.hook_state |= HOOK_REMOVING;
+ W_SwitchWeapon_Force(self, w_getbestweapon(self));
+ }
}
}
}
}
- }
- else
- {
- self.hook_time_hooked = time;
- self.hook_time_fueldecrease = time + autocvar_g_balance_hook_primary_hooked_time_free;
- }
-
- if (self.BUTTON_CROUCH)
- {
- self.hook_state &~= HOOK_PULLING;
- if (self.BUTTON_ATCK || (!(self.items & IT_JETPACK) && self.BUTTON_HOOK))
- self.hook_state &~= HOOK_RELEASING;
else
- self.hook_state |= HOOK_RELEASING;
- }
- else
- {
- self.hook_state |= HOOK_PULLING;
- self.hook_state &~= HOOK_RELEASING;
+ {
+ self.hook_time_hooked = time;
+ self.hook_time_fueldecrease = time + autocvar_g_balance_hook_primary_hooked_time_free;
+ }
- if (self.BUTTON_ATCK || (!(self.items & IT_JETPACK) && self.BUTTON_HOOK))
+ if (self.BUTTON_CROUCH)
{
- // already fired
- if(self.hook)
- self.hook_state |= HOOK_WAITING_FOR_RELEASE;
+ self.hook_state &~= HOOK_PULLING;
+ if (self.BUTTON_ATCK || (!(self.items & IT_JETPACK) && self.BUTTON_HOOK))
+ self.hook_state &~= HOOK_RELEASING;
+ else
+ self.hook_state |= HOOK_RELEASING;
}
else
{
- self.hook_state |= HOOK_REMOVING;
- self.hook_state &~= HOOK_WAITING_FOR_RELEASE;
+ self.hook_state |= HOOK_PULLING;
+ self.hook_state &~= HOOK_RELEASING;
+
+ if (self.BUTTON_ATCK || (!(self.items & IT_JETPACK) && self.BUTTON_HOOK))
+ {
+ // already fired
+ if(self.hook)
+ self.hook_state |= HOOK_WAITING_FOR_RELEASE;
+ }
+ else
+ {
+ self.hook_state |= HOOK_REMOVING;
+ self.hook_state &~= HOOK_WAITING_FOR_RELEASE;
+ }
}
+
+ return TRUE;
+ }
+ case WR_PRECACHE:
+ {
+ precache_model ("models/weapons/g_hookgun.md3");
+ precache_model ("models/weapons/v_hookgun.md3");
+ precache_model ("models/weapons/h_hookgun.iqm");
+ precache_sound ("weapons/hook_impact.wav"); // done by g_hook.qc
+ precache_sound ("weapons/hook_fire.wav");
+ precache_sound ("weapons/hookbomb_fire.wav");
+ return TRUE;
+ }
+ case WR_SETUP:
+ {
+ weapon_setup(WEP_HOOK);
+ self.current_ammo = ammo_fuel;
+ self.hook_state &~= HOOK_WAITING_FOR_RELEASE;
+ return TRUE;
+ }
+ case WR_CHECKAMMO1:
+ {
+ if(self.hook)
+ return self.ammo_fuel > 0;
+ else
+ return self.ammo_fuel >= autocvar_g_balance_hook_primary_fuel;
+ }
+ case WR_CHECKAMMO2:
+ {
+ return self.ammo_cells >= autocvar_g_balance_hook_secondary_ammo;
+ }
+ case WR_RESETPLAYER:
+ {
+ self.hook_refire = time;
+ return TRUE;
+ }
+ case WR_SUICIDEMESSAGE:
+ {
+ return FALSE;
+ }
+ case WR_KILLMESSAGE:
+ {
+ return WEAPON_HOOK_MURDER;
}
- }
- else if (req == WR_PRECACHE)
- {
- precache_model ("models/weapons/g_hookgun.md3");
- precache_model ("models/weapons/v_hookgun.md3");
- precache_model ("models/weapons/h_hookgun.iqm");
- precache_sound ("weapons/hook_impact.wav"); // done by g_hook.qc
- precache_sound ("weapons/hook_fire.wav");
- precache_sound ("weapons/hookbomb_fire.wav");
- }
- else if (req == WR_SETUP)
- {
- weapon_setup(WEP_HOOK);
- self.current_ammo = ammo_fuel;
- self.hook_state &~= HOOK_WAITING_FOR_RELEASE;
- }
- else if (req == WR_CHECKAMMO1)
- {
- if(self.hook)
- return self.ammo_fuel > 0;
- else
- return self.ammo_fuel >= autocvar_g_balance_hook_primary_fuel;
- }
- else if (req == WR_CHECKAMMO2)
- {
- return self.ammo_cells >= autocvar_g_balance_hook_secondary_ammo;
- }
- else if (req == WR_RESETPLAYER)
- {
- self.hook_refire = time;
- }
- else if (req == WR_SUICIDEMESSAGE)
- {
- return FALSE;
- }
- else if (req == WR_KILLMESSAGE)
- {
- return WEAPON_HOOK_MURDER;
}
return TRUE;
}
#ifdef CSQC
float w_hook(float req)
{
- if(req == WR_IMPACTEFFECT)
- {
- vector org2;
- org2 = w_org + w_backoff * 2;
- pointparticles(particleeffectnum("hookbomb_explode"), org2, '0 0 0', 1);
- if(!w_issilent)
- sound(self, CH_SHOTS, "weapons/hookbomb_impact.wav", VOL_BASE, ATTN_NORM);
- }
- else if(req == WR_PRECACHE)
+ switch(req)
{
- precache_sound("weapons/hookbomb_impact.wav");
+ case WR_IMPACTEFFECT:
+ {
+ vector org2;
+ org2 = w_org + w_backoff * 2;
+ pointparticles(particleeffectnum("hookbomb_explode"), org2, '0 0 0', 1);
+ if(!w_issilent)
+ sound(self, CH_SHOTS, "weapons/hookbomb_impact.wav", VOL_BASE, ATTN_NORM);
+
+ return TRUE;
+ }
+ case WR_PRECACHE:
+ {
+ precache_sound("weapons/hookbomb_impact.wav");
+ return TRUE;
+ }
}
return TRUE;
}
float w_uzi(float req)
{
float ammo_amount;
- if (req == WR_AIM)
- if(vlen(self.origin-self.enemy.origin) < 3000 - bound(0, skill, 10) * 200)
- self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, FALSE);
- else
+ switch(req)
+ {
+ case WR_AIM:
{
- self.BUTTON_ATCK2 = bot_aim(1000000, 0, 0.001, FALSE);
+ if(vlen(self.origin-self.enemy.origin) < 3000 - bound(0, skill, 10) * 200)
+ self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, FALSE);
+ else
+ self.BUTTON_ATCK2 = bot_aim(1000000, 0, 0.001, FALSE);
+
+ return TRUE;
}
- else if (req == WR_THINK)
- {
- if(autocvar_g_balance_uzi_reload_ammo && self.clip_load < min(max(autocvar_g_balance_uzi_sustained_ammo, autocvar_g_balance_uzi_first_ammo), autocvar_g_balance_uzi_burst_ammo)) // forced reload
- weapon_action(self.weapon, WR_RELOAD);
- else if(autocvar_g_balance_uzi_mode == 1)
+ case WR_THINK:
{
- if (self.BUTTON_ATCK)
- if (weapon_prepareattack(0, 0))
+ if(autocvar_g_balance_uzi_reload_ammo && self.clip_load < min(max(autocvar_g_balance_uzi_sustained_ammo, autocvar_g_balance_uzi_first_ammo), autocvar_g_balance_uzi_burst_ammo)) // forced reload
+ weapon_action(self.weapon, WR_RELOAD);
+ else if(autocvar_g_balance_uzi_mode == 1)
{
- self.misc_bulletcounter = 0;
- uzi_mode1_fire_auto();
- }
+ if (self.BUTTON_ATCK)
+ if (weapon_prepareattack(0, 0))
+ {
+ self.misc_bulletcounter = 0;
+ uzi_mode1_fire_auto();
+ }
- if(self.BUTTON_ATCK2)
- if(weapon_prepareattack(1, 0))
- {
- if (!weapon_action(self.weapon, WR_CHECKAMMO2))
- if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
+ if(self.BUTTON_ATCK2)
+ if(weapon_prepareattack(1, 0))
{
- W_SwitchWeapon_Force(self, w_getbestweapon(self));
- w_ready();
- return FALSE;
+ if (!weapon_action(self.weapon, WR_CHECKAMMO2))
+ if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
+ {
+ W_SwitchWeapon_Force(self, w_getbestweapon(self));
+ w_ready();
+ return FALSE;
+ }
+
+ W_DecreaseAmmo(ammo_nails, autocvar_g_balance_uzi_burst_ammo, autocvar_g_balance_uzi_reload_ammo);
+
+ self.misc_bulletcounter = autocvar_g_balance_uzi_burst * -1;
+ uzi_mode1_fire_burst();
}
+ }
+ else
+ {
- W_DecreaseAmmo(ammo_nails, autocvar_g_balance_uzi_burst_ammo, autocvar_g_balance_uzi_reload_ammo);
+ if (self.BUTTON_ATCK)
+ if (weapon_prepareattack(0, 0))
+ {
+ self.misc_bulletcounter = 1;
+ W_UZI_Attack(WEP_UZI); // sets attack_finished
+ weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_uzi_sustained_refire, uzi_fire1_02);
+ }
- self.misc_bulletcounter = autocvar_g_balance_uzi_burst * -1;
- uzi_mode1_fire_burst();
+ if (self.BUTTON_ATCK2 && autocvar_g_balance_uzi_first)
+ if (weapon_prepareattack(1, 0))
+ {
+ self.misc_bulletcounter = 1;
+ W_UZI_Attack(WEP_UZI | HITTYPE_SECONDARY); // sets attack_finished
+ weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_uzi_first_refire, w_ready);
+ }
}
+
+ return TRUE;
+ }
+ case WR_PRECACHE:
+ {
+ precache_model ("models/uziflash.md3");
+ precache_model ("models/weapons/g_uzi.md3");
+ precache_model ("models/weapons/v_uzi.md3");
+ precache_model ("models/weapons/h_uzi.iqm");
+ precache_sound ("weapons/uzi_fire.wav");
+ return TRUE;
}
- else
+ case WR_SETUP:
{
+ weapon_setup(WEP_UZI);
+ self.current_ammo = ammo_nails;
+ return TRUE;
+ }
+ case WR_CHECKAMMO1:
+ {
+ if(autocvar_g_balance_uzi_mode == 1)
+ ammo_amount = self.ammo_nails >= autocvar_g_balance_uzi_sustained_ammo;
+ else
+ ammo_amount = self.ammo_nails >= autocvar_g_balance_uzi_first_ammo;
- if (self.BUTTON_ATCK)
- if (weapon_prepareattack(0, 0))
+ if(autocvar_g_balance_uzi_reload_ammo)
{
- self.misc_bulletcounter = 1;
- W_UZI_Attack(WEP_UZI); // sets attack_finished
- weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_uzi_sustained_refire, uzi_fire1_02);
+ if(autocvar_g_balance_uzi_mode == 1)
+ ammo_amount += self.(weapon_load[WEP_UZI]) >= autocvar_g_balance_uzi_sustained_ammo;
+ else
+ ammo_amount += self.(weapon_load[WEP_UZI]) >= autocvar_g_balance_uzi_first_ammo;
}
+ return ammo_amount;
+ }
+ case WR_CHECKAMMO2:
+ {
+ if(autocvar_g_balance_uzi_mode == 1)
+ ammo_amount = self.ammo_nails >= autocvar_g_balance_uzi_burst_ammo;
+ else
+ ammo_amount = self.ammo_nails >= autocvar_g_balance_uzi_first_ammo;
- if (self.BUTTON_ATCK2 && autocvar_g_balance_uzi_first)
- if (weapon_prepareattack(1, 0))
+ if(autocvar_g_balance_uzi_reload_ammo)
{
- self.misc_bulletcounter = 1;
- W_UZI_Attack(WEP_UZI | HITTYPE_SECONDARY); // sets attack_finished
- weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_uzi_first_refire, w_ready);
+ if(autocvar_g_balance_uzi_mode == 1)
+ ammo_amount += self.(weapon_load[WEP_UZI]) >= autocvar_g_balance_uzi_burst_ammo;
+ else
+ ammo_amount += self.(weapon_load[WEP_UZI]) >= autocvar_g_balance_uzi_first_ammo;
}
+ return ammo_amount;
}
- }
- else if (req == WR_PRECACHE)
- {
- precache_model ("models/uziflash.md3");
- precache_model ("models/weapons/g_uzi.md3");
- precache_model ("models/weapons/v_uzi.md3");
- precache_model ("models/weapons/h_uzi.iqm");
- precache_sound ("weapons/uzi_fire.wav");
- //precache_sound ("weapons/reload.wav"); // until weapons have individual reload sounds, precache the reload sound somewhere else
- }
- else if (req == WR_SETUP)
- {
- weapon_setup(WEP_UZI);
- self.current_ammo = ammo_nails;
- }
- else if (req == WR_CHECKAMMO1)
- {
- if(autocvar_g_balance_uzi_mode == 1)
- ammo_amount = self.ammo_nails >= autocvar_g_balance_uzi_sustained_ammo;
- else
- ammo_amount = self.ammo_nails >= autocvar_g_balance_uzi_first_ammo;
-
- if(autocvar_g_balance_uzi_reload_ammo)
+ case WR_RELOAD:
{
- if(autocvar_g_balance_uzi_mode == 1)
- ammo_amount += self.(weapon_load[WEP_UZI]) >= autocvar_g_balance_uzi_sustained_ammo;
- else
- ammo_amount += self.(weapon_load[WEP_UZI]) >= autocvar_g_balance_uzi_first_ammo;
+ W_Reload(min(max(autocvar_g_balance_uzi_sustained_ammo, autocvar_g_balance_uzi_first_ammo), autocvar_g_balance_uzi_burst_ammo), autocvar_g_balance_uzi_reload_ammo, autocvar_g_balance_uzi_reload_time, "weapons/reload.wav");
+ return TRUE;
}
- return ammo_amount;
- }
- else if (req == WR_CHECKAMMO2)
- {
- if(autocvar_g_balance_uzi_mode == 1)
- ammo_amount = self.ammo_nails >= autocvar_g_balance_uzi_burst_ammo;
- else
- ammo_amount = self.ammo_nails >= autocvar_g_balance_uzi_first_ammo;
-
- if(autocvar_g_balance_uzi_reload_ammo)
+ case WR_SUICIDEMESSAGE:
{
- if(autocvar_g_balance_uzi_mode == 1)
- ammo_amount += self.(weapon_load[WEP_UZI]) >= autocvar_g_balance_uzi_burst_ammo;
+ return WEAPON_THINKING_WITH_PORTALS;
+ }
+ case WR_KILLMESSAGE:
+ {
+ if(w_deathtype & HITTYPE_SECONDARY)
+ return WEAPON_UZI_MURDER_SNIPE;
else
- ammo_amount += self.(weapon_load[WEP_UZI]) >= autocvar_g_balance_uzi_first_ammo;
+ return WEAPON_UZI_MURDER_SPRAY;
}
- return ammo_amount;
- }
- else if (req == WR_RELOAD)
- {
- W_Reload(min(max(autocvar_g_balance_uzi_sustained_ammo, autocvar_g_balance_uzi_first_ammo), autocvar_g_balance_uzi_burst_ammo), autocvar_g_balance_uzi_reload_ammo, autocvar_g_balance_uzi_reload_time, "weapons/reload.wav");
- }
- else if (req == WR_SUICIDEMESSAGE)
- {
- return WEAPON_THINKING_WITH_PORTALS;
- }
- else if (req == WR_KILLMESSAGE)
- {
- if(w_deathtype & HITTYPE_SECONDARY)
- return WEAPON_UZI_MURDER_SNIPE;
- else
- return WEAPON_UZI_MURDER_SPRAY;
}
return TRUE;
}
#ifdef CSQC
float w_uzi(float req)
{
- if(req == WR_IMPACTEFFECT)
+ switch(req)
{
- vector org2;
- org2 = w_org + w_backoff * 2;
- pointparticles(particleeffectnum("machinegun_impact"), org2, w_backoff * 1000, 1);
- if(!w_issilent)
- if(w_random < 0.05)
- sound(self, CH_SHOTS, "weapons/ric1.wav", VOL_BASE, ATTN_NORM);
- else if(w_random < 0.1)
- sound(self, CH_SHOTS, "weapons/ric2.wav", VOL_BASE, ATTN_NORM);
- else if(w_random < 0.2)
- sound(self, CH_SHOTS, "weapons/ric3.wav", VOL_BASE, ATTN_NORM);
- }
- else if(req == WR_PRECACHE)
- {
- precache_sound("weapons/ric1.wav");
- precache_sound("weapons/ric2.wav");
- precache_sound("weapons/ric3.wav");
+ case WR_IMPACTEFFECT:
+ {
+ vector org2;
+ org2 = w_org + w_backoff * 2;
+ pointparticles(particleeffectnum("machinegun_impact"), org2, w_backoff * 1000, 1);
+ if(!w_issilent)
+ if(w_random < 0.05)
+ sound(self, CH_SHOTS, "weapons/ric1.wav", VOL_BASE, ATTN_NORM);
+ else if(w_random < 0.1)
+ sound(self, CH_SHOTS, "weapons/ric2.wav", VOL_BASE, ATTN_NORM);
+ else if(w_random < 0.2)
+ sound(self, CH_SHOTS, "weapons/ric3.wav", VOL_BASE, ATTN_NORM);
+
+ return TRUE;
+ }
+ case WR_PRECACHE:
+ {
+ precache_sound("weapons/ric1.wav");
+ precache_sound("weapons/ric2.wav");
+ precache_sound("weapons/ric3.wav");
+ return TRUE;
+ }
}
return TRUE;
}
{
entity mine;
float ammo_amount;
-
- if (req == WR_AIM)
+ switch(req)
{
- // aim and decide to fire if appropriate
- if(self.minelayer_mines >= autocvar_g_balance_minelayer_limit)
- self.BUTTON_ATCK = FALSE;
- else
- self.BUTTON_ATCK = bot_aim(autocvar_g_balance_minelayer_speed, 0, autocvar_g_balance_minelayer_lifetime, FALSE);
- if(skill >= 2) // skill 0 and 1 bots won't detonate mines!
+ case WR_AIM:
{
- // decide whether to detonate mines
- entity targetlist, targ;
- float edgedamage, coredamage, edgeradius, recipricoledgeradius, d;
- float selfdamage, teamdamage, enemydamage;
- edgedamage = autocvar_g_balance_minelayer_edgedamage;
- coredamage = autocvar_g_balance_minelayer_damage;
- edgeradius = autocvar_g_balance_minelayer_radius;
- recipricoledgeradius = 1 / edgeradius;
- selfdamage = 0;
- teamdamage = 0;
- enemydamage = 0;
- targetlist = findchainfloat(bot_attack, TRUE);
- mine = find(world, classname, "mine");
- while (mine)
+ // aim and decide to fire if appropriate
+ if(self.minelayer_mines >= autocvar_g_balance_minelayer_limit)
+ self.BUTTON_ATCK = FALSE;
+ else
+ self.BUTTON_ATCK = bot_aim(autocvar_g_balance_minelayer_speed, 0, autocvar_g_balance_minelayer_lifetime, FALSE);
+ if(skill >= 2) // skill 0 and 1 bots won't detonate mines!
{
- if (mine.realowner != self)
+ // decide whether to detonate mines
+ entity targetlist, targ;
+ float edgedamage, coredamage, edgeradius, recipricoledgeradius, d;
+ float selfdamage, teamdamage, enemydamage;
+ edgedamage = autocvar_g_balance_minelayer_edgedamage;
+ coredamage = autocvar_g_balance_minelayer_damage;
+ edgeradius = autocvar_g_balance_minelayer_radius;
+ recipricoledgeradius = 1 / edgeradius;
+ selfdamage = 0;
+ teamdamage = 0;
+ enemydamage = 0;
+ targetlist = findchainfloat(bot_attack, TRUE);
+ mine = find(world, classname, "mine");
+ while (mine)
{
+ if (mine.realowner != self)
+ {
+ mine = find(mine, classname, "mine");
+ continue;
+ }
+ targ = targetlist;
+ while (targ)
+ {
+ d = vlen(targ.origin + (targ.mins + targ.maxs) * 0.5 - mine.origin);
+ d = bound(0, edgedamage + (coredamage - edgedamage) * sqrt(1 - d * recipricoledgeradius), 10000);
+ // count potential damage according to type of target
+ if (targ == self)
+ selfdamage = selfdamage + d;
+ else if (targ.team == self.team && teamplay)
+ teamdamage = teamdamage + d;
+ else if (bot_shouldattack(targ))
+ enemydamage = enemydamage + d;
+ targ = targ.chain;
+ }
mine = find(mine, classname, "mine");
- continue;
}
- targ = targetlist;
- while (targ)
+ float desirabledamage;
+ desirabledamage = enemydamage;
+ if (time > self.invincible_finished && time > self.spawnshieldtime)
+ desirabledamage = desirabledamage - selfdamage * autocvar_g_balance_selfdamagepercent;
+ if (teamplay && self.team)
+ desirabledamage = desirabledamage - teamdamage;
+
+ mine = find(world, classname, "mine");
+ while (mine)
{
- d = vlen(targ.origin + (targ.mins + targ.maxs) * 0.5 - mine.origin);
- d = bound(0, edgedamage + (coredamage - edgedamage) * sqrt(1 - d * recipricoledgeradius), 10000);
- // count potential damage according to type of target
- if (targ == self)
- selfdamage = selfdamage + d;
- else if (targ.team == self.team && teamplay)
- teamdamage = teamdamage + d;
- else if (bot_shouldattack(targ))
- enemydamage = enemydamage + d;
- targ = targ.chain;
+ if (mine.realowner != self)
+ {
+ mine = find(mine, classname, "mine");
+ continue;
+ }
+ makevectors(mine.v_angle);
+ targ = targetlist;
+ if (skill > 9) // normal players only do this for the target they are tracking
+ {
+ targ = targetlist;
+ while (targ)
+ {
+ if (
+ (v_forward * normalize(mine.origin - targ.origin)< 0.1)
+ && desirabledamage > 0.1*coredamage
+ )self.BUTTON_ATCK2 = TRUE;
+ targ = targ.chain;
+ }
+ }else{
+ float distance; distance= bound(300,vlen(self.origin-self.enemy.origin),30000);
+ //As the distance gets larger, a correct detonation gets near imposible
+ //Bots are assumed to use the mine spawnfunc_light to see if the mine gets near a player
+ if(v_forward * normalize(mine.origin - self.enemy.origin)< 0.1)
+ if(IS_PLAYER(self.enemy))
+ if(desirabledamage >= 0.1*coredamage)
+ if(random()/distance*300 > frametime*bound(0,(10-skill)*0.2,1))
+ self.BUTTON_ATCK2 = TRUE;
+ // dprint(ftos(random()/distance*300),">");dprint(ftos(frametime*bound(0,(10-skill)*0.2,1)),"\n");
+ }
+
+ mine = find(mine, classname, "mine");
}
- mine = find(mine, classname, "mine");
+ // if we would be doing at X percent of the core damage, detonate it
+ // but don't fire a new shot at the same time!
+ if (desirabledamage >= 0.75 * coredamage) //this should do group damage in rare fortunate events
+ self.BUTTON_ATCK2 = TRUE;
+ if ((skill > 6.5) && (selfdamage > self.health))
+ self.BUTTON_ATCK2 = FALSE;
+ //if(self.BUTTON_ATCK2 == TRUE)
+ // dprint(ftos(desirabledamage),"\n");
+ if (self.BUTTON_ATCK2 == TRUE) self.BUTTON_ATCK = FALSE;
}
- float desirabledamage;
- desirabledamage = enemydamage;
- if (time > self.invincible_finished && time > self.spawnshieldtime)
- desirabledamage = desirabledamage - selfdamage * autocvar_g_balance_selfdamagepercent;
- if (teamplay && self.team)
- desirabledamage = desirabledamage - teamdamage;
-
- mine = find(world, classname, "mine");
- while (mine)
+
+ return TRUE;
+ }
+ case WR_THINK:
+ {
+ if(autocvar_g_balance_minelayer_reload_ammo && self.clip_load < autocvar_g_balance_minelayer_ammo) // forced reload
{
- if (mine.realowner != self)
- {
- mine = find(mine, classname, "mine");
- continue;
- }
- makevectors(mine.v_angle);
- targ = targetlist;
- if (skill > 9) // normal players only do this for the target they are tracking
+ // not if we're holding the minelayer without enough ammo, but can detonate existing mines
+ if not (W_PlacedMines(FALSE) && self.ammo_rockets < autocvar_g_balance_minelayer_ammo)
+ weapon_action(self.weapon, WR_RELOAD);
+ }
+ else if (self.BUTTON_ATCK)
+ {
+ if(weapon_prepareattack(0, autocvar_g_balance_minelayer_refire))
{
- targ = targetlist;
- while (targ)
- {
- if (
- (v_forward * normalize(mine.origin - targ.origin)< 0.1)
- && desirabledamage > 0.1*coredamage
- )self.BUTTON_ATCK2 = TRUE;
- targ = targ.chain;
- }
- }else{
- float distance; distance= bound(300,vlen(self.origin-self.enemy.origin),30000);
- //As the distance gets larger, a correct detonation gets near imposible
- //Bots are assumed to use the mine spawnfunc_light to see if the mine gets near a player
- if(v_forward * normalize(mine.origin - self.enemy.origin)< 0.1)
- if(IS_PLAYER(self.enemy))
- if(desirabledamage >= 0.1*coredamage)
- if(random()/distance*300 > frametime*bound(0,(10-skill)*0.2,1))
- self.BUTTON_ATCK2 = TRUE;
- // dprint(ftos(random()/distance*300),">");dprint(ftos(frametime*bound(0,(10-skill)*0.2,1)),"\n");
+ W_Mine_Attack();
+ weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_minelayer_animtime, w_ready);
}
+ }
- mine = find(mine, classname, "mine");
+ if (self.BUTTON_ATCK2)
+ {
+ if(W_PlacedMines(TRUE))
+ sound (self, CH_WEAPON_B, "weapons/mine_det.wav", VOL_BASE, ATTN_NORM);
}
- // if we would be doing at X percent of the core damage, detonate it
- // but don't fire a new shot at the same time!
- if (desirabledamage >= 0.75 * coredamage) //this should do group damage in rare fortunate events
- self.BUTTON_ATCK2 = TRUE;
- if ((skill > 6.5) && (selfdamage > self.health))
- self.BUTTON_ATCK2 = FALSE;
- //if(self.BUTTON_ATCK2 == TRUE)
- // dprint(ftos(desirabledamage),"\n");
- if (self.BUTTON_ATCK2 == TRUE) self.BUTTON_ATCK = FALSE;
+
+ return TRUE;
}
- }
- else if (req == WR_THINK)
- {
- if(autocvar_g_balance_minelayer_reload_ammo && self.clip_load < autocvar_g_balance_minelayer_ammo) // forced reload
+ case WR_PRECACHE:
{
- // not if we're holding the minelayer without enough ammo, but can detonate existing mines
- if not (W_PlacedMines(FALSE) && self.ammo_rockets < autocvar_g_balance_minelayer_ammo)
- weapon_action(self.weapon, WR_RELOAD);
+ precache_model ("models/flash.md3");
+ precache_model ("models/mine.md3");
+ precache_model ("models/weapons/g_minelayer.md3");
+ precache_model ("models/weapons/v_minelayer.md3");
+ precache_model ("models/weapons/h_minelayer.iqm");
+ precache_sound ("weapons/mine_det.wav");
+ precache_sound ("weapons/mine_fire.wav");
+ precache_sound ("weapons/mine_stick.wav");
+ precache_sound ("weapons/mine_trigger.wav");
+ return TRUE;
}
- else if (self.BUTTON_ATCK)
+ case WR_SETUP:
{
- if(weapon_prepareattack(0, autocvar_g_balance_minelayer_refire))
+ weapon_setup(WEP_MINE_LAYER);
+ self.current_ammo = ammo_rockets;
+ return TRUE;
+ }
+ case WR_CHECKAMMO1:
+ {
+ // don't switch while placing a mine
+ if (ATTACK_FINISHED(self) <= time || self.weapon != WEP_MINE_LAYER)
{
- W_Mine_Attack();
- weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_minelayer_animtime, w_ready);
+ ammo_amount = self.ammo_rockets >= autocvar_g_balance_minelayer_ammo;
+ ammo_amount += self.(weapon_load[WEP_MINE_LAYER]) >= autocvar_g_balance_minelayer_ammo;
+ return ammo_amount;
}
+ return TRUE;
}
-
- if (self.BUTTON_ATCK2)
+ case WR_CHECKAMMO2:
{
- if(W_PlacedMines(TRUE))
- sound (self, CH_WEAPON_B, "weapons/mine_det.wav", VOL_BASE, ATTN_NORM);
+ if (W_PlacedMines(FALSE))
+ return TRUE;
+ else
+ return FALSE;
}
- }
- else if (req == WR_PRECACHE)
- {
- precache_model ("models/flash.md3");
- precache_model ("models/mine.md3");
- precache_model ("models/weapons/g_minelayer.md3");
- precache_model ("models/weapons/v_minelayer.md3");
- precache_model ("models/weapons/h_minelayer.iqm");
- precache_sound ("weapons/mine_det.wav");
- precache_sound ("weapons/mine_fire.wav");
- precache_sound ("weapons/mine_stick.wav");
- precache_sound ("weapons/mine_trigger.wav");
- //precache_sound ("weapons/reload.wav"); // until weapons have individual reload sounds, precache the reload sound somewhere else
- }
- else if (req == WR_SETUP)
- {
- weapon_setup(WEP_MINE_LAYER);
- self.current_ammo = ammo_rockets;
- }
- else if (req == WR_CHECKAMMO1)
- {
- // don't switch while placing a mine
- if (ATTACK_FINISHED(self) <= time || self.weapon != WEP_MINE_LAYER)
+ case WR_RESETPLAYER:
{
- ammo_amount = self.ammo_rockets >= autocvar_g_balance_minelayer_ammo;
- ammo_amount += self.(weapon_load[WEP_MINE_LAYER]) >= autocvar_g_balance_minelayer_ammo;
- return ammo_amount;
+ self.minelayer_mines = 0;
+ return TRUE;
}
- }
- else if (req == WR_CHECKAMMO2)
- {
- if (W_PlacedMines(FALSE))
+ case WR_RELOAD:
+ {
+ W_Reload(autocvar_g_balance_minelayer_ammo, autocvar_g_balance_minelayer_reload_ammo, autocvar_g_balance_minelayer_reload_time, "weapons/reload.wav");
return TRUE;
- else
- return FALSE;
- }
- else if (req == WR_RESETPLAYER)
- {
- self.minelayer_mines = 0;
- }
- else if (req == WR_RELOAD)
- {
- W_Reload(autocvar_g_balance_minelayer_ammo, autocvar_g_balance_minelayer_reload_ammo, autocvar_g_balance_minelayer_reload_time, "weapons/reload.wav");
- }
- else if (req == WR_SUICIDEMESSAGE)
- {
- return WEAPON_MINELAYER_SUICIDE;
- }
- else if (req == WR_KILLMESSAGE)
- {
- return WEAPON_MINELAYER_MURDER;
+ }
+ case WR_SUICIDEMESSAGE:
+ {
+ return WEAPON_MINELAYER_SUICIDE;
+ }
+ case WR_KILLMESSAGE:
+ {
+ return WEAPON_MINELAYER_MURDER;
+ }
}
return TRUE;
}
#ifdef CSQC
float w_minelayer(float req)
{
- if(req == WR_IMPACTEFFECT)
- {
- vector org2;
- org2 = w_org + w_backoff * 12;
- pointparticles(particleeffectnum("rocket_explode"), org2, '0 0 0', 1);
- if(!w_issilent)
- sound(self, CH_SHOTS, "weapons/mine_exp.wav", VOL_BASE, ATTN_NORM);
- }
- else if(req == WR_PRECACHE)
+ switch(req)
{
- precache_sound("weapons/mine_exp.wav");
+ case WR_IMPACTEFFECT:
+ {
+ vector org2;
+ org2 = w_org + w_backoff * 12;
+ pointparticles(particleeffectnum("rocket_explode"), org2, '0 0 0', 1);
+ if(!w_issilent)
+ sound(self, CH_SHOTS, "weapons/mine_exp.wav", VOL_BASE, ATTN_NORM);
+
+ return TRUE;
+ }
+ case WR_PRECACHE:
+ {
+ precache_sound("weapons/mine_exp.wav");
+ return TRUE;
+ }
}
return TRUE;
}
// now multiple WR_s use this
minstanex_ammo = ((g_minstagib) ? 1 : autocvar_g_balance_minstanex_ammo);
- if (req == WR_AIM)
+ switch(req)
{
- if(self.ammo_cells > 0)
- self.BUTTON_ATCK = bot_aim(1000000, 0, 1, FALSE);
- else
- self.BUTTON_ATCK2 = bot_aim(autocvar_g_balance_laser_primary_speed, 0, autocvar_g_balance_laser_primary_lifetime, FALSE);
- }
- else if (req == WR_THINK)
- {
- // if the laser uses load, we also consider its ammo for reloading
- if(autocvar_g_balance_minstanex_reload_ammo && autocvar_g_balance_minstanex_laser_ammo && self.clip_load < min(minstanex_ammo, autocvar_g_balance_minstanex_laser_ammo)) // forced reload
- weapon_action(self.weapon, WR_RELOAD);
- else if(autocvar_g_balance_minstanex_reload_ammo && self.clip_load < minstanex_ammo) // forced reload
- weapon_action(self.weapon, WR_RELOAD);
- else if (self.BUTTON_ATCK)
+ case WR_AIM:
{
- if (weapon_prepareattack(0, autocvar_g_balance_minstanex_refire))
- {
- W_MinstaNex_Attack();
- weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_minstanex_animtime, w_ready);
- }
+ if(self.ammo_cells > 0)
+ self.BUTTON_ATCK = bot_aim(1000000, 0, 1, FALSE);
+ else
+ self.BUTTON_ATCK2 = bot_aim(autocvar_g_balance_laser_primary_speed, 0, autocvar_g_balance_laser_primary_lifetime, FALSE);
+
+ return TRUE;
}
- else if (self.BUTTON_ATCK2)
+ case WR_THINK:
{
- if (self.jump_interval <= time)
- if (weapon_prepareattack(1, -1))
+ // if the laser uses load, we also consider its ammo for reloading
+ if(autocvar_g_balance_minstanex_reload_ammo && autocvar_g_balance_minstanex_laser_ammo && self.clip_load < min(minstanex_ammo, autocvar_g_balance_minstanex_laser_ammo)) // forced reload
+ weapon_action(self.weapon, WR_RELOAD);
+ else if(autocvar_g_balance_minstanex_reload_ammo && self.clip_load < minstanex_ammo) // forced reload
+ weapon_action(self.weapon, WR_RELOAD);
+ else if (self.BUTTON_ATCK)
{
- // handle refire manually, so that primary and secondary can be fired without conflictions (important for minstagib)
- self.jump_interval = time + autocvar_g_balance_minstanex_laser_refire * W_WeaponRateFactor();
-
- // decrease ammo for the laser?
- if(autocvar_g_balance_minstanex_laser_ammo)
- W_DecreaseAmmo(ammo_cells, autocvar_g_balance_minstanex_laser_ammo, autocvar_g_balance_minstanex_reload_ammo);
+ if (weapon_prepareattack(0, autocvar_g_balance_minstanex_refire))
+ {
+ W_MinstaNex_Attack();
+ weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_minstanex_animtime, w_ready);
+ }
+ }
+ else if (self.BUTTON_ATCK2)
+ {
+ if (self.jump_interval <= time)
+ if (weapon_prepareattack(1, -1))
+ {
+ // handle refire manually, so that primary and secondary can be fired without conflictions (important for minstagib)
+ self.jump_interval = time + autocvar_g_balance_minstanex_laser_refire * W_WeaponRateFactor();
+
+ // decrease ammo for the laser?
+ if(autocvar_g_balance_minstanex_laser_ammo)
+ W_DecreaseAmmo(ammo_cells, autocvar_g_balance_minstanex_laser_ammo, autocvar_g_balance_minstanex_reload_ammo);
- // ugly minstagib hack to reuse the fire mode of the laser
- float w;
- w = self.weapon;
- self.weapon = WEP_LASER;
- W_Laser_Shockwave();
- self.weapon = w;
-
- // now do normal refire
- weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_minstanex_laser_animtime, w_ready);
+ // ugly minstagib hack to reuse the fire mode of the laser
+ float w;
+ w = self.weapon;
+ self.weapon = WEP_LASER;
+ W_Laser_Shockwave();
+ self.weapon = w;
+
+ // now do normal refire
+ weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_minstanex_laser_animtime, w_ready);
+ }
}
+
+ return TRUE;
}
- }
- else if (req == WR_PRECACHE)
- {
- precache_model ("models/nexflash.md3");
- precache_model ("models/weapons/g_minstanex.md3");
- precache_model ("models/weapons/v_minstanex.md3");
- precache_model ("models/weapons/h_minstanex.iqm");
- precache_sound ("weapons/minstanexfire.wav");
- precache_sound ("weapons/nexwhoosh1.wav");
- precache_sound ("weapons/nexwhoosh2.wav");
- precache_sound ("weapons/nexwhoosh3.wav");
- //precache_sound ("weapons/reload.wav"); // until weapons have individual reload sounds, precache the reload sound somewhere else
- W_Laser(WR_PRECACHE);
- }
- else if (req == WR_SETUP)
- {
- weapon_setup(WEP_MINSTANEX);
- self.current_ammo = ammo_cells;
- self.minstanex_lasthit = 0;
- }
- else if (req == WR_CHECKAMMO1)
- {
- ammo_amount = self.ammo_cells >= minstanex_ammo;
- ammo_amount += self.(weapon_load[WEP_MINSTANEX]) >= minstanex_ammo;
- return ammo_amount;
- }
- else if (req == WR_CHECKAMMO2)
- {
- if(!autocvar_g_balance_minstanex_laser_ammo)
+ case WR_PRECACHE:
+ {
+ precache_model ("models/nexflash.md3");
+ precache_model ("models/weapons/g_minstanex.md3");
+ precache_model ("models/weapons/v_minstanex.md3");
+ precache_model ("models/weapons/h_minstanex.iqm");
+ precache_sound ("weapons/minstanexfire.wav");
+ precache_sound ("weapons/nexwhoosh1.wav");
+ precache_sound ("weapons/nexwhoosh2.wav");
+ precache_sound ("weapons/nexwhoosh3.wav");
+ W_Laser(WR_PRECACHE);
return TRUE;
- ammo_amount = self.ammo_cells >= autocvar_g_balance_minstanex_laser_ammo;
- ammo_amount += self.(weapon_load[WEP_MINSTANEX]) >= autocvar_g_balance_minstanex_laser_ammo;
- return ammo_amount;
- }
- else if (req == WR_RESETPLAYER)
- {
- self.minstanex_lasthit = 0;
- }
- else if (req == WR_RELOAD)
- {
- float used_ammo;
- if(autocvar_g_balance_minstanex_laser_ammo)
- used_ammo = min(minstanex_ammo, autocvar_g_balance_minstanex_laser_ammo);
- else
- used_ammo = minstanex_ammo;
+ }
+ case WR_SETUP:
+ {
+ weapon_setup(WEP_MINSTANEX);
+ self.current_ammo = ammo_cells;
+ self.minstanex_lasthit = 0;
+ return TRUE;
+ }
+ case WR_CHECKAMMO1:
+ {
+ ammo_amount = self.ammo_cells >= minstanex_ammo;
+ ammo_amount += self.(weapon_load[WEP_MINSTANEX]) >= minstanex_ammo;
+ return ammo_amount;
+ }
+ case WR_CHECKAMMO2:
+ {
+ if(!autocvar_g_balance_minstanex_laser_ammo)
+ return TRUE;
+ ammo_amount = self.ammo_cells >= autocvar_g_balance_minstanex_laser_ammo;
+ ammo_amount += self.(weapon_load[WEP_MINSTANEX]) >= autocvar_g_balance_minstanex_laser_ammo;
+ return ammo_amount;
+ }
+ case WR_RESETPLAYER:
+ {
+ self.minstanex_lasthit = 0;
+ return TRUE;
+ }
+ case WR_RELOAD:
+ {
+ float used_ammo;
+ if(autocvar_g_balance_minstanex_laser_ammo)
+ used_ammo = min(minstanex_ammo, autocvar_g_balance_minstanex_laser_ammo);
+ else
+ used_ammo = minstanex_ammo;
- W_Reload(used_ammo, autocvar_g_balance_minstanex_reload_ammo, autocvar_g_balance_minstanex_reload_time, "weapons/reload.wav");
- }
- else if (req == WR_SUICIDEMESSAGE)
- {
- return WEAPON_THINKING_WITH_PORTALS;
- }
- else if (req == WR_KILLMESSAGE)
- {
- return WEAPON_MINSTANEX_MURDER;
+ W_Reload(used_ammo, autocvar_g_balance_minstanex_reload_ammo, autocvar_g_balance_minstanex_reload_time, "weapons/reload.wav");
+ return TRUE;
+ }
+ case WR_SUICIDEMESSAGE:
+ {
+ return WEAPON_THINKING_WITH_PORTALS;
+ }
+ case WR_KILLMESSAGE:
+ {
+ return WEAPON_MINSTANEX_MURDER;
+ }
}
return TRUE;
}
#ifdef CSQC
float w_minstanex(float req)
{
- if(req == WR_IMPACTEFFECT)
- {
- vector org2;
- org2 = w_org + w_backoff * 6;
- pointparticles(particleeffectnum("nex_impact"), org2, '0 0 0', 1);
- if(!w_issilent)
- sound(self, CH_SHOTS, "weapons/neximpact.wav", VOL_BASE, ATTN_NORM);
- }
- else if(req == WR_PRECACHE)
+ switch(req)
{
- precache_sound("weapons/neximpact.wav");
+ case WR_IMPACTEFFECT:
+ {
+ vector org2;
+ org2 = w_org + w_backoff * 6;
+ pointparticles(particleeffectnum("nex_impact"), org2, '0 0 0', 1);
+ if(!w_issilent)
+ sound(self, CH_SHOTS, "weapons/neximpact.wav", VOL_BASE, ATTN_NORM);
+
+ return TRUE;
+ }
+ case WR_PRECACHE:
+ {
+ precache_sound("weapons/neximpact.wav");
+ return TRUE;
+ }
}
return TRUE;
}
entity nade;
float nadefound;
float ammo_amount;
-
- if (req == WR_AIM)
+ switch(req)
{
- self.BUTTON_ATCK = FALSE;
- self.BUTTON_ATCK2 = FALSE;
- if (self.bot_secondary_grenademooth == 0)
+ case WR_AIM:
{
- if(bot_aim(autocvar_g_balance_grenadelauncher_primary_speed, autocvar_g_balance_grenadelauncher_primary_speed_up, autocvar_g_balance_grenadelauncher_primary_lifetime, TRUE))
+ self.BUTTON_ATCK = FALSE;
+ self.BUTTON_ATCK2 = FALSE;
+ if (self.bot_secondary_grenademooth == 0)
{
- self.BUTTON_ATCK = TRUE;
- if(random() < 0.01) self.bot_secondary_grenademooth = 1;
+ if(bot_aim(autocvar_g_balance_grenadelauncher_primary_speed, autocvar_g_balance_grenadelauncher_primary_speed_up, autocvar_g_balance_grenadelauncher_primary_lifetime, TRUE))
+ {
+ self.BUTTON_ATCK = TRUE;
+ if(random() < 0.01) self.bot_secondary_grenademooth = 1;
+ }
}
- }
- else
- {
- if(bot_aim(autocvar_g_balance_grenadelauncher_secondary_speed, autocvar_g_balance_grenadelauncher_secondary_speed_up, autocvar_g_balance_grenadelauncher_secondary_lifetime, TRUE))
+ else
{
- self.BUTTON_ATCK2 = TRUE;
- if(random() < 0.02) self.bot_secondary_grenademooth = 0;
+ if(bot_aim(autocvar_g_balance_grenadelauncher_secondary_speed, autocvar_g_balance_grenadelauncher_secondary_speed_up, autocvar_g_balance_grenadelauncher_secondary_lifetime, TRUE))
+ {
+ self.BUTTON_ATCK2 = TRUE;
+ if(random() < 0.02) self.bot_secondary_grenademooth = 0;
+ }
}
+
+ return TRUE;
}
- }
- else if (req == WR_THINK)
- {
- if(autocvar_g_balance_grenadelauncher_reload_ammo && self.clip_load < min(autocvar_g_balance_grenadelauncher_primary_ammo, autocvar_g_balance_grenadelauncher_secondary_ammo)) // forced reload
- weapon_action(self.weapon, WR_RELOAD);
- else if (self.BUTTON_ATCK)
+ case WR_THINK:
{
- if (weapon_prepareattack(0, autocvar_g_balance_grenadelauncher_primary_refire))
+ if(autocvar_g_balance_grenadelauncher_reload_ammo && self.clip_load < min(autocvar_g_balance_grenadelauncher_primary_ammo, autocvar_g_balance_grenadelauncher_secondary_ammo)) // forced reload
+ weapon_action(self.weapon, WR_RELOAD);
+ else if (self.BUTTON_ATCK)
{
- W_Grenade_Attack();
- weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_grenadelauncher_primary_animtime, w_ready);
+ if (weapon_prepareattack(0, autocvar_g_balance_grenadelauncher_primary_refire))
+ {
+ W_Grenade_Attack();
+ weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_grenadelauncher_primary_animtime, w_ready);
+ }
}
- }
- else if (self.BUTTON_ATCK2)
- {
- if (cvar("g_balance_grenadelauncher_secondary_remote_detonateprimary"))
+ else if (self.BUTTON_ATCK2)
{
- nadefound = 0;
- for(nade = world; (nade = find(nade, classname, "grenade")); ) if(nade.realowner == self)
+ if (cvar("g_balance_grenadelauncher_secondary_remote_detonateprimary"))
{
- if(!nade.gl_detonate_later)
+ nadefound = 0;
+ for(nade = world; (nade = find(nade, classname, "grenade")); ) if(nade.realowner == self)
{
- nade.gl_detonate_later = TRUE;
- nadefound = 1;
+ if(!nade.gl_detonate_later)
+ {
+ nade.gl_detonate_later = TRUE;
+ nadefound = 1;
+ }
}
+ if(nadefound)
+ sound (self, CH_WEAPON_B, "weapons/rocket_det.wav", VOL_BASE, ATTN_NORM);
+ }
+ else if (weapon_prepareattack(1, autocvar_g_balance_grenadelauncher_secondary_refire))
+ {
+ W_Grenade_Attack2();
+ weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_grenadelauncher_secondary_animtime, w_ready);
}
- if(nadefound)
- sound (self, CH_WEAPON_B, "weapons/rocket_det.wav", VOL_BASE, ATTN_NORM);
- }
- else if (weapon_prepareattack(1, autocvar_g_balance_grenadelauncher_secondary_refire))
- {
- W_Grenade_Attack2();
- weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_grenadelauncher_secondary_animtime, w_ready);
}
+
+ return TRUE;
+ }
+ case WR_PRECACHE:
+ {
+ precache_model ("models/weapons/g_gl.md3");
+ precache_model ("models/weapons/v_gl.md3");
+ precache_model ("models/weapons/h_gl.iqm");
+ precache_sound ("weapons/grenade_bounce1.wav");
+ precache_sound ("weapons/grenade_bounce2.wav");
+ precache_sound ("weapons/grenade_bounce3.wav");
+ precache_sound ("weapons/grenade_bounce4.wav");
+ precache_sound ("weapons/grenade_bounce5.wav");
+ precache_sound ("weapons/grenade_bounce6.wav");
+ precache_sound ("weapons/grenade_stick.wav");
+ precache_sound ("weapons/grenade_fire.wav");
+ return TRUE;
+ }
+ case WR_SETUP:
+ {
+ weapon_setup(WEP_GRENADE_LAUNCHER);
+ self.current_ammo = ammo_rockets;
+ return TRUE;
+ }
+ case WR_CHECKAMMO1:
+ {
+ ammo_amount = self.ammo_rockets >= autocvar_g_balance_grenadelauncher_primary_ammo;
+ ammo_amount += self.(weapon_load[WEP_GRENADE_LAUNCHER]) >= autocvar_g_balance_grenadelauncher_primary_ammo;
+ return ammo_amount;
+ }
+ case WR_CHECKAMMO2:
+ {
+ ammo_amount = self.ammo_rockets >= autocvar_g_balance_grenadelauncher_secondary_ammo;
+ ammo_amount += self.(weapon_load[WEP_GRENADE_LAUNCHER]) >= autocvar_g_balance_grenadelauncher_secondary_ammo;
+ return ammo_amount;
+ }
+ case WR_RELOAD:
+ {
+ W_Reload(min(autocvar_g_balance_grenadelauncher_primary_ammo, autocvar_g_balance_grenadelauncher_secondary_ammo), autocvar_g_balance_grenadelauncher_reload_ammo, autocvar_g_balance_grenadelauncher_reload_time, "weapons/reload.wav");
+ return TRUE;
+ }
+ case WR_SUICIDEMESSAGE:
+ {
+ if(w_deathtype & HITTYPE_SECONDARY)
+ return WEAPON_MORTAR_SUICIDE_BOUNCE;
+ else
+ return WEAPON_MORTAR_SUICIDE_EXPLODE;
+ }
+ case WR_KILLMESSAGE:
+ {
+ if(w_deathtype & HITTYPE_SECONDARY)
+ return WEAPON_MORTAR_MURDER_BOUNCE;
+ else
+ return WEAPON_MORTAR_MURDER_EXPLODE;
}
- }
- else if (req == WR_PRECACHE)
- {
- precache_model ("models/weapons/g_gl.md3");
- precache_model ("models/weapons/v_gl.md3");
- precache_model ("models/weapons/h_gl.iqm");
- precache_sound ("weapons/grenade_bounce1.wav");
- precache_sound ("weapons/grenade_bounce2.wav");
- precache_sound ("weapons/grenade_bounce3.wav");
- precache_sound ("weapons/grenade_bounce4.wav");
- precache_sound ("weapons/grenade_bounce5.wav");
- precache_sound ("weapons/grenade_bounce6.wav");
- precache_sound ("weapons/grenade_stick.wav");
- precache_sound ("weapons/grenade_fire.wav");
- //precache_sound ("weapons/reload.wav"); // until weapons have individual reload sounds, precache the reload sound somewhere else
- }
- else if (req == WR_SETUP)
- {
- weapon_setup(WEP_GRENADE_LAUNCHER);
- self.current_ammo = ammo_rockets;
- }
- else if (req == WR_CHECKAMMO1)
- {
- ammo_amount = self.ammo_rockets >= autocvar_g_balance_grenadelauncher_primary_ammo;
- ammo_amount += self.(weapon_load[WEP_GRENADE_LAUNCHER]) >= autocvar_g_balance_grenadelauncher_primary_ammo;
- return ammo_amount;
- }
- else if (req == WR_CHECKAMMO2)
- {
- ammo_amount = self.ammo_rockets >= autocvar_g_balance_grenadelauncher_secondary_ammo;
- ammo_amount += self.(weapon_load[WEP_GRENADE_LAUNCHER]) >= autocvar_g_balance_grenadelauncher_secondary_ammo;
- return ammo_amount;
- }
- else if (req == WR_RELOAD)
- {
- W_Reload(min(autocvar_g_balance_grenadelauncher_primary_ammo, autocvar_g_balance_grenadelauncher_secondary_ammo), autocvar_g_balance_grenadelauncher_reload_ammo, autocvar_g_balance_grenadelauncher_reload_time, "weapons/reload.wav");
- }
- else if (req == WR_SUICIDEMESSAGE)
- {
- if(w_deathtype & HITTYPE_SECONDARY)
- return WEAPON_MORTAR_SUICIDE_BOUNCE;
- else
- return WEAPON_MORTAR_SUICIDE_EXPLODE;
- }
- else if (req == WR_KILLMESSAGE)
- {
- if(w_deathtype & HITTYPE_SECONDARY)
- return WEAPON_MORTAR_MURDER_BOUNCE;
- else
- return WEAPON_MORTAR_MURDER_EXPLODE;
}
return TRUE;
}
#ifdef CSQC
float w_glauncher(float req)
{
- if(req == WR_IMPACTEFFECT)
- {
- vector org2;
- org2 = w_org + w_backoff * 12;
- pointparticles(particleeffectnum("grenade_explode"), org2, '0 0 0', 1);
- if(!w_issilent)
- sound(self, CH_SHOTS, "weapons/grenade_impact.wav", VOL_BASE, ATTN_NORM);
- }
- else if(req == WR_PRECACHE)
+ switch(req)
{
- precache_sound("weapons/grenade_impact.wav");
+ case WR_IMPACTEFFECT:
+ {
+ vector org2;
+ org2 = w_org + w_backoff * 12;
+ pointparticles(particleeffectnum("grenade_explode"), org2, '0 0 0', 1);
+ if(!w_issilent)
+ sound(self, CH_SHOTS, "weapons/grenade_impact.wav", VOL_BASE, ATTN_NORM);
+
+ return TRUE;
+ }
+ case WR_PRECACHE:
+ {
+ precache_sound("weapons/grenade_impact.wav");
+ return TRUE;
+ }
}
return TRUE;
}
{
float dt;
float ammo_amount;
- if (req == WR_AIM)
+ switch(req)
{
- if(bot_aim(1000000, 0, 1, FALSE))
- self.BUTTON_ATCK = TRUE;
- else
+ case WR_AIM:
{
- if(autocvar_g_balance_nex_charge)
- self.BUTTON_ATCK2 = TRUE;
- }
- }
- else if (req == WR_THINK)
- {
- if(autocvar_g_balance_nex_charge && self.nex_charge < autocvar_g_balance_nex_charge_limit)
- self.nex_charge = min(1, self.nex_charge + autocvar_g_balance_nex_charge_rate * frametime / W_TICSPERFRAME);
-
- if(autocvar_g_balance_nex_secondary_chargepool)
- if(self.nex_chargepool_ammo < 1)
+ if(bot_aim(1000000, 0, 1, FALSE))
+ self.BUTTON_ATCK = TRUE;
+ else
{
- if(self.nex_chargepool_pauseregen_finished < time)
- self.nex_chargepool_ammo = min(1, self.nex_chargepool_ammo + autocvar_g_balance_nex_secondary_chargepool_regen * frametime / W_TICSPERFRAME);
- self.pauseregen_finished = max(self.pauseregen_finished, time + autocvar_g_balance_nex_secondary_chargepool_pause_health_regen);
+ if(autocvar_g_balance_nex_charge)
+ self.BUTTON_ATCK2 = TRUE;
}
-
- if(autocvar_g_balance_nex_reload_ammo && self.clip_load < min(autocvar_g_balance_nex_primary_ammo, autocvar_g_balance_nex_secondary_ammo)) // forced reload
- weapon_action(self.weapon, WR_RELOAD);
- else
+ return TRUE;
+ }
+ case WR_THINK:
{
- if (self.BUTTON_ATCK)
- {
- if (weapon_prepareattack(0, autocvar_g_balance_nex_primary_refire))
+ if(autocvar_g_balance_nex_charge && self.nex_charge < autocvar_g_balance_nex_charge_limit)
+ self.nex_charge = min(1, self.nex_charge + autocvar_g_balance_nex_charge_rate * frametime / W_TICSPERFRAME);
+
+ if(autocvar_g_balance_nex_secondary_chargepool)
+ if(self.nex_chargepool_ammo < 1)
{
- W_Nex_Attack(0);
- weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_nex_primary_animtime, w_ready);
+ if(self.nex_chargepool_pauseregen_finished < time)
+ self.nex_chargepool_ammo = min(1, self.nex_chargepool_ammo + autocvar_g_balance_nex_secondary_chargepool_regen * frametime / W_TICSPERFRAME);
+ self.pauseregen_finished = max(self.pauseregen_finished, time + autocvar_g_balance_nex_secondary_chargepool_pause_health_regen);
}
- }
- if ((autocvar_g_balance_nex_secondary_charge && !autocvar_g_balance_nex_secondary) ? (self.BUTTON_ZOOM | self.BUTTON_ZOOMSCRIPT) : self.BUTTON_ATCK2)
+
+ if(autocvar_g_balance_nex_reload_ammo && self.clip_load < min(autocvar_g_balance_nex_primary_ammo, autocvar_g_balance_nex_secondary_ammo)) // forced reload
+ weapon_action(self.weapon, WR_RELOAD);
+ else
{
- if(autocvar_g_balance_nex_secondary_charge)
+ if (self.BUTTON_ATCK)
{
- self.nex_charge_rottime = time + autocvar_g_balance_nex_charge_rot_pause;
- dt = frametime / W_TICSPERFRAME;
-
- if(self.nex_charge < 1)
+ if (weapon_prepareattack(0, autocvar_g_balance_nex_primary_refire))
{
- if(autocvar_g_balance_nex_secondary_chargepool)
+ W_Nex_Attack(0);
+ weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_nex_primary_animtime, w_ready);
+ }
+ }
+ if ((autocvar_g_balance_nex_secondary_charge && !autocvar_g_balance_nex_secondary) ? (self.BUTTON_ZOOM | self.BUTTON_ZOOMSCRIPT) : self.BUTTON_ATCK2)
+ {
+ if(autocvar_g_balance_nex_secondary_charge)
+ {
+ self.nex_charge_rottime = time + autocvar_g_balance_nex_charge_rot_pause;
+ dt = frametime / W_TICSPERFRAME;
+
+ if(self.nex_charge < 1)
{
- if(autocvar_g_balance_nex_secondary_ammo)
+ if(autocvar_g_balance_nex_secondary_chargepool)
{
- // always deplete if secondary is held
- self.nex_chargepool_ammo = max(0, self.nex_chargepool_ammo - autocvar_g_balance_nex_secondary_ammo * dt);
+ if(autocvar_g_balance_nex_secondary_ammo)
+ {
+ // always deplete if secondary is held
+ self.nex_chargepool_ammo = max(0, self.nex_chargepool_ammo - autocvar_g_balance_nex_secondary_ammo * dt);
- dt = min(dt, (1 - self.nex_charge) / autocvar_g_balance_nex_secondary_charge_rate);
- self.nex_chargepool_pauseregen_finished = time + autocvar_g_balance_nex_secondary_chargepool_pause_regen;
- dt = min(dt, self.nex_chargepool_ammo);
- dt = max(0, dt);
+ dt = min(dt, (1 - self.nex_charge) / autocvar_g_balance_nex_secondary_charge_rate);
+ self.nex_chargepool_pauseregen_finished = time + autocvar_g_balance_nex_secondary_chargepool_pause_regen;
+ dt = min(dt, self.nex_chargepool_ammo);
+ dt = max(0, dt);
- self.nex_charge += dt * autocvar_g_balance_nex_secondary_charge_rate;
+ self.nex_charge += dt * autocvar_g_balance_nex_secondary_charge_rate;
+ }
}
- }
- else if(autocvar_g_balance_nex_secondary_ammo)
- {
- if(self.BUTTON_ATCK2) // only eat ammo when the button is pressed
+ else if(autocvar_g_balance_nex_secondary_ammo)
{
- dt = min(dt, (1 - self.nex_charge) / autocvar_g_balance_nex_secondary_charge_rate);
- if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
+ if(self.BUTTON_ATCK2) // only eat ammo when the button is pressed
{
- // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
- if(autocvar_g_balance_nex_reload_ammo)
+ dt = min(dt, (1 - self.nex_charge) / autocvar_g_balance_nex_secondary_charge_rate);
+ if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
{
- dt = min(dt, (self.clip_load - autocvar_g_balance_nex_primary_ammo) / autocvar_g_balance_nex_secondary_ammo);
- dt = max(0, dt);
- if(dt > 0)
+ // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
+ if(autocvar_g_balance_nex_reload_ammo)
{
- self.clip_load = max(autocvar_g_balance_nex_secondary_ammo, self.clip_load - autocvar_g_balance_nex_secondary_ammo * dt);
+ dt = min(dt, (self.clip_load - autocvar_g_balance_nex_primary_ammo) / autocvar_g_balance_nex_secondary_ammo);
+ dt = max(0, dt);
+ if(dt > 0)
+ {
+ self.clip_load = max(autocvar_g_balance_nex_secondary_ammo, self.clip_load - autocvar_g_balance_nex_secondary_ammo * dt);
+ }
+ self.(weapon_load[WEP_NEX]) = self.clip_load;
}
- self.(weapon_load[WEP_NEX]) = self.clip_load;
- }
- else
- {
- dt = min(dt, (self.ammo_cells - autocvar_g_balance_nex_primary_ammo) / autocvar_g_balance_nex_secondary_ammo);
- dt = max(0, dt);
- if(dt > 0)
+ else
{
- self.ammo_cells = max(autocvar_g_balance_nex_secondary_ammo, self.ammo_cells - autocvar_g_balance_nex_secondary_ammo * dt);
+ dt = min(dt, (self.ammo_cells - autocvar_g_balance_nex_primary_ammo) / autocvar_g_balance_nex_secondary_ammo);
+ dt = max(0, dt);
+ if(dt > 0)
+ {
+ self.ammo_cells = max(autocvar_g_balance_nex_secondary_ammo, self.ammo_cells - autocvar_g_balance_nex_secondary_ammo * dt);
+ }
}
}
+ self.nex_charge += dt * autocvar_g_balance_nex_secondary_charge_rate;
}
- self.nex_charge += dt * autocvar_g_balance_nex_secondary_charge_rate;
}
- }
- else
- {
- dt = min(dt, (1 - self.nex_charge) / autocvar_g_balance_nex_secondary_charge_rate);
- self.nex_charge += dt * autocvar_g_balance_nex_secondary_charge_rate;
+ else
+ {
+ dt = min(dt, (1 - self.nex_charge) / autocvar_g_balance_nex_secondary_charge_rate);
+ self.nex_charge += dt * autocvar_g_balance_nex_secondary_charge_rate;
+ }
}
}
- }
- else if(autocvar_g_balance_nex_secondary)
- {
- if (weapon_prepareattack(0, autocvar_g_balance_nex_secondary_refire))
+ else if(autocvar_g_balance_nex_secondary)
{
- W_Nex_Attack(1);
- weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_nex_secondary_animtime, w_ready);
+ if (weapon_prepareattack(0, autocvar_g_balance_nex_secondary_refire))
+ {
+ W_Nex_Attack(1);
+ weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_nex_secondary_animtime, w_ready);
+ }
}
}
}
+
+ return TRUE;
}
- }
- else if (req == WR_PRECACHE)
- {
- precache_model ("models/nexflash.md3");
- precache_model ("models/weapons/g_nex.md3");
- precache_model ("models/weapons/v_nex.md3");
- precache_model ("models/weapons/h_nex.iqm");
- precache_sound ("weapons/nexfire.wav");
- precache_sound ("weapons/nexcharge.wav");
- precache_sound ("weapons/nexwhoosh1.wav");
- precache_sound ("weapons/nexwhoosh2.wav");
- precache_sound ("weapons/nexwhoosh3.wav");
- //precache_sound ("weapons/reload.wav"); // until weapons have individual reload sounds, precache the reload sound somewhere else
- }
- else if (req == WR_SETUP)
- {
- weapon_setup(WEP_NEX);
- self.current_ammo = ammo_cells;
- }
- else if (req == WR_CHECKAMMO1)
- {
- ammo_amount = self.ammo_cells >= autocvar_g_balance_nex_primary_ammo;
- ammo_amount += (autocvar_g_balance_nex_reload_ammo && self.(weapon_load[WEP_NEX]) >= autocvar_g_balance_nex_primary_ammo);
- return ammo_amount;
- }
- else if (req == WR_CHECKAMMO2)
- {
- if(autocvar_g_balance_nex_secondary)
+ case WR_PRECACHE:
{
- // don't allow charging if we don't have enough ammo
- ammo_amount = self.ammo_cells >= autocvar_g_balance_nex_secondary_ammo;
- ammo_amount += self.(weapon_load[WEP_NEX]) >= autocvar_g_balance_nex_secondary_ammo;
+ precache_model ("models/nexflash.md3");
+ precache_model ("models/weapons/g_nex.md3");
+ precache_model ("models/weapons/v_nex.md3");
+ precache_model ("models/weapons/h_nex.iqm");
+ precache_sound ("weapons/nexfire.wav");
+ precache_sound ("weapons/nexcharge.wav");
+ precache_sound ("weapons/nexwhoosh1.wav");
+ precache_sound ("weapons/nexwhoosh2.wav");
+ precache_sound ("weapons/nexwhoosh3.wav");
+ return TRUE;
+ }
+ case WR_SETUP:
+ {
+ weapon_setup(WEP_NEX);
+ self.current_ammo = ammo_cells;
+ return TRUE;
+ }
+ case WR_CHECKAMMO1:
+ {
+ ammo_amount = self.ammo_cells >= autocvar_g_balance_nex_primary_ammo;
+ ammo_amount += (autocvar_g_balance_nex_reload_ammo && self.(weapon_load[WEP_NEX]) >= autocvar_g_balance_nex_primary_ammo);
return ammo_amount;
}
- else
+ case WR_CHECKAMMO2:
{
- return FALSE; // zoom is not a fire mode
+ if(autocvar_g_balance_nex_secondary)
+ {
+ // don't allow charging if we don't have enough ammo
+ ammo_amount = self.ammo_cells >= autocvar_g_balance_nex_secondary_ammo;
+ ammo_amount += self.(weapon_load[WEP_NEX]) >= autocvar_g_balance_nex_secondary_ammo;
+ return ammo_amount;
+ }
+ else
+ {
+ return FALSE; // zoom is not a fire mode
+ }
+ }
+ case WR_RELOAD:
+ {
+ W_Reload(min(autocvar_g_balance_nex_primary_ammo, autocvar_g_balance_nex_secondary_ammo), autocvar_g_balance_nex_reload_ammo, autocvar_g_balance_nex_reload_time, "weapons/reload.wav");
+ return TRUE;
+ }
+ case WR_SUICIDEMESSAGE:
+ {
+ return WEAPON_THINKING_WITH_PORTALS;
+ }
+ case WR_KILLMESSAGE:
+ {
+ return WEAPON_NEX_MURDER;
}
- }
- else if (req == WR_RELOAD)
- {
- W_Reload(min(autocvar_g_balance_nex_primary_ammo, autocvar_g_balance_nex_secondary_ammo), autocvar_g_balance_nex_reload_ammo, autocvar_g_balance_nex_reload_time, "weapons/reload.wav");
- }
- else if (req == WR_SUICIDEMESSAGE)
- {
- return WEAPON_THINKING_WITH_PORTALS;
- }
- else if (req == WR_KILLMESSAGE)
- {
- return WEAPON_NEX_MURDER;
}
return TRUE;
}
#ifdef CSQC
float w_nex(float req)
{
- if(req == WR_IMPACTEFFECT)
- {
- vector org2;
- org2 = w_org + w_backoff * 6;
- pointparticles(particleeffectnum("nex_impact"), org2, '0 0 0', 1);
- if(!w_issilent)
- sound(self, CH_SHOTS, "weapons/neximpact.wav", VOL_BASE, ATTN_NORM);
- }
- else if(req == WR_PRECACHE)
+ switch(req)
{
- precache_sound("weapons/neximpact.wav");
+ case WR_IMPACTEFFECT:
+ {
+ vector org2;
+ org2 = w_org + w_backoff * 6;
+ pointparticles(particleeffectnum("nex_impact"), org2, '0 0 0', 1);
+ if(!w_issilent)
+ sound(self, CH_SHOTS, "weapons/neximpact.wav", VOL_BASE, ATTN_NORM);
+
+ return TRUE;
+ }
+ case WR_PRECACHE:
+ {
+ precache_sound("weapons/neximpact.wav");
+ return TRUE;
+ }
}
return TRUE;
}
//vector v_angle_save;
if (g_nexball) { return w_nexball_weapon(req); }
- if (req == WR_AIM)
+
+ switch(req)
{
- self.BUTTON_ATCK = FALSE;
- self.BUTTON_ATCK2 = FALSE;
- if(!autocvar_g_balance_porto_secondary)
- if(bot_aim(autocvar_g_balance_porto_primary_speed, 0, autocvar_g_balance_grenadelauncher_primary_lifetime, FALSE))
- self.BUTTON_ATCK = TRUE;
- }
- else if (req == WR_THINK)
- {
- if(autocvar_g_balance_porto_secondary)
+ case WR_AIM:
{
- if (self.BUTTON_ATCK)
- if (!self.porto_current)
- if (!self.porto_forbidden)
- if (weapon_prepareattack(0, autocvar_g_balance_porto_primary_refire))
- {
- W_Porto_Attack(0);
- weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_porto_primary_animtime, w_ready);
- }
-
- if (self.BUTTON_ATCK2)
- if (!self.porto_current)
- if (!self.porto_forbidden)
- if (weapon_prepareattack(1, autocvar_g_balance_porto_secondary_refire))
- {
- W_Porto_Attack(1);
- weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_porto_secondary_animtime, w_ready);
- }
+ self.BUTTON_ATCK = FALSE;
+ self.BUTTON_ATCK2 = FALSE;
+ if(!autocvar_g_balance_porto_secondary)
+ if(bot_aim(autocvar_g_balance_porto_primary_speed, 0, autocvar_g_balance_grenadelauncher_primary_lifetime, FALSE))
+ self.BUTTON_ATCK = TRUE;
+
+ return TRUE;
}
- else
+ case WR_THINK:
{
- if(self.porto_v_angle_held)
+ if(autocvar_g_balance_porto_secondary)
{
- if(!self.BUTTON_ATCK2)
+ if (self.BUTTON_ATCK)
+ if (!self.porto_current)
+ if (!self.porto_forbidden)
+ if (weapon_prepareattack(0, autocvar_g_balance_porto_primary_refire))
{
- self.porto_v_angle_held = 0;
+ W_Porto_Attack(0);
+ weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_porto_primary_animtime, w_ready);
+ }
- ClientData_Touch(self);
+ if (self.BUTTON_ATCK2)
+ if (!self.porto_current)
+ if (!self.porto_forbidden)
+ if (weapon_prepareattack(1, autocvar_g_balance_porto_secondary_refire))
+ {
+ W_Porto_Attack(1);
+ weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_porto_secondary_animtime, w_ready);
}
}
else
{
- if(self.BUTTON_ATCK2)
+ if(self.porto_v_angle_held)
{
- self.porto_v_angle = self.v_angle;
- self.porto_v_angle_held = 1;
+ if(!self.BUTTON_ATCK2)
+ {
+ self.porto_v_angle_held = 0;
- ClientData_Touch(self);
+ ClientData_Touch(self);
+ }
}
- }
- if(self.porto_v_angle_held)
- makevectors(self.porto_v_angle); // override the previously set angles
+ else
+ {
+ if(self.BUTTON_ATCK2)
+ {
+ self.porto_v_angle = self.v_angle;
+ self.porto_v_angle_held = 1;
- if (self.BUTTON_ATCK)
- if (!self.porto_current)
- if (!self.porto_forbidden)
- if (weapon_prepareattack(0, autocvar_g_balance_porto_primary_refire))
- {
- W_Porto_Attack(-1);
- weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_porto_primary_animtime, w_ready);
+ ClientData_Touch(self);
+ }
+ }
+ if(self.porto_v_angle_held)
+ makevectors(self.porto_v_angle); // override the previously set angles
+
+ if (self.BUTTON_ATCK)
+ if (!self.porto_current)
+ if (!self.porto_forbidden)
+ if (weapon_prepareattack(0, autocvar_g_balance_porto_primary_refire))
+ {
+ W_Porto_Attack(-1);
+ weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_porto_primary_animtime, w_ready);
+ }
}
+
+ return TRUE;
+ }
+ case WR_PRECACHE:
+ {
+ precache_model ("models/weapons/g_porto.md3");
+ precache_model ("models/weapons/v_porto.md3");
+ precache_model ("models/weapons/h_porto.iqm");
+ precache_model ("models/portal.md3");
+ precache_sound ("porto/bounce.wav");
+ precache_sound ("porto/create.wav");
+ precache_sound ("porto/expire.wav");
+ precache_sound ("porto/explode.wav");
+ precache_sound ("porto/fire.wav");
+ precache_sound ("porto/unsupported.wav");
+ return TRUE;
+ }
+ case WR_SETUP:
+ {
+ weapon_setup(WEP_PORTO);
+ self.current_ammo = ammo_none;
+ return TRUE;
+ }
+ case WR_RESETPLAYER:
+ {
+ self.porto_current = world;
+ return TRUE;
}
- }
- else if (req == WR_PRECACHE)
- {
- precache_model ("models/weapons/g_porto.md3");
- precache_model ("models/weapons/v_porto.md3");
- precache_model ("models/weapons/h_porto.iqm");
- precache_model ("models/portal.md3");
- precache_sound ("porto/bounce.wav");
- precache_sound ("porto/create.wav");
- precache_sound ("porto/expire.wav");
- precache_sound ("porto/explode.wav");
- precache_sound ("porto/fire.wav");
- precache_sound ("porto/unsupported.wav");
- }
- else if (req == WR_SETUP)
- {
- weapon_setup(WEP_PORTO);
- self.current_ammo = ammo_none;
- }
- else if (req == WR_RESETPLAYER)
- {
- self.porto_current = world;
}
return TRUE;
}
#ifdef CSQC
float w_porto(float req)
{
- if(req == WR_IMPACTEFFECT)
- {
- print("Since when does Porto send DamageInfo?\n");
- }
- else if(req == WR_PRECACHE)
+ switch(req)
{
- // nothing to do
+ case WR_IMPACTEFFECT:
+ {
+ print("Since when does Porto send DamageInfo?\n");
+ return TRUE;
+ }
+ case WR_PRECACHE:
+ {
+ // nothing to do
+ return TRUE;
+ }
}
return TRUE;
}
float w_rifle(float req)
{
float ammo_amount;
-
- if (req == WR_AIM)
+
+ switch(req)
{
- self.BUTTON_ATCK=FALSE;
- self.BUTTON_ATCK2=FALSE;
- if(vlen(self.origin-self.enemy.origin) > 1000)
- self.bot_secondary_riflemooth = 0;
- if(self.bot_secondary_riflemooth == 0)
+ case WR_AIM:
{
- if(bot_aim(autocvar_g_balance_rifle_primary_speed, 0, autocvar_g_balance_rifle_primary_lifetime, FALSE))
+ self.BUTTON_ATCK=FALSE;
+ self.BUTTON_ATCK2=FALSE;
+ if(vlen(self.origin-self.enemy.origin) > 1000)
+ self.bot_secondary_riflemooth = 0;
+ if(self.bot_secondary_riflemooth == 0)
{
- self.BUTTON_ATCK = TRUE;
- if(random() < 0.01) self.bot_secondary_riflemooth = 1;
+ if(bot_aim(autocvar_g_balance_rifle_primary_speed, 0, autocvar_g_balance_rifle_primary_lifetime, FALSE))
+ {
+ self.BUTTON_ATCK = TRUE;
+ if(random() < 0.01) self.bot_secondary_riflemooth = 1;
+ }
}
- }
- else
- {
- if(bot_aim(autocvar_g_balance_rifle_secondary_speed, 0, autocvar_g_balance_rifle_secondary_lifetime, FALSE))
+ else
{
- self.BUTTON_ATCK2 = TRUE;
- if(random() < 0.03) self.bot_secondary_riflemooth = 0;
+ if(bot_aim(autocvar_g_balance_rifle_secondary_speed, 0, autocvar_g_balance_rifle_secondary_lifetime, FALSE))
+ {
+ self.BUTTON_ATCK2 = TRUE;
+ if(random() < 0.03) self.bot_secondary_riflemooth = 0;
+ }
}
+
+ return TRUE;
}
- }
- else if (req == WR_THINK)
- {
- if(autocvar_g_balance_rifle_reload_ammo && self.clip_load < min(autocvar_g_balance_rifle_primary_ammo, autocvar_g_balance_rifle_secondary_ammo)) // forced reload
- weapon_action(self.weapon, WR_RELOAD);
- else
+ case WR_THINK:
{
- self.rifle_accumulator = bound(time - autocvar_g_balance_rifle_bursttime, self.rifle_accumulator, time);
- if (self.BUTTON_ATCK)
- if (weapon_prepareattack_check(0, autocvar_g_balance_rifle_primary_refire))
- if (time >= self.rifle_accumulator + autocvar_g_balance_rifle_primary_burstcost)
- {
- weapon_prepareattack_do(0, autocvar_g_balance_rifle_primary_refire);
- W_Rifle_BulletHail(autocvar_g_balance_rifle_primary_bullethail, W_Rifle_Attack, WFRAME_FIRE1, autocvar_g_balance_rifle_primary_animtime, autocvar_g_balance_rifle_primary_refire);
- self.rifle_accumulator += autocvar_g_balance_rifle_primary_burstcost;
- }
- if (self.BUTTON_ATCK2)
+ if(autocvar_g_balance_rifle_reload_ammo && self.clip_load < min(autocvar_g_balance_rifle_primary_ammo, autocvar_g_balance_rifle_secondary_ammo)) // forced reload
+ weapon_action(self.weapon, WR_RELOAD);
+ else
{
- if (autocvar_g_balance_rifle_secondary)
+ self.rifle_accumulator = bound(time - autocvar_g_balance_rifle_bursttime, self.rifle_accumulator, time);
+ if (self.BUTTON_ATCK)
+ if (weapon_prepareattack_check(0, autocvar_g_balance_rifle_primary_refire))
+ if (time >= self.rifle_accumulator + autocvar_g_balance_rifle_primary_burstcost)
{
- if(autocvar_g_balance_rifle_secondary_reload)
- weapon_action(self.weapon, WR_RELOAD);
- else
- {
- if (weapon_prepareattack_check(1, autocvar_g_balance_rifle_secondary_refire))
- if (time >= self.rifle_accumulator + autocvar_g_balance_rifle_secondary_burstcost)
- {
- weapon_prepareattack_do(1, autocvar_g_balance_rifle_secondary_refire);
- W_Rifle_BulletHail(autocvar_g_balance_rifle_secondary_bullethail, W_Rifle_Attack2, WFRAME_FIRE2, autocvar_g_balance_rifle_secondary_animtime, autocvar_g_balance_rifle_primary_refire);
- self.rifle_accumulator += autocvar_g_balance_rifle_secondary_burstcost;
- }
- }
+ weapon_prepareattack_do(0, autocvar_g_balance_rifle_primary_refire);
+ W_Rifle_BulletHail(autocvar_g_balance_rifle_primary_bullethail, W_Rifle_Attack, WFRAME_FIRE1, autocvar_g_balance_rifle_primary_animtime, autocvar_g_balance_rifle_primary_refire);
+ self.rifle_accumulator += autocvar_g_balance_rifle_primary_burstcost;
+ }
+ if (self.BUTTON_ATCK2)
+ {
+ if (autocvar_g_balance_rifle_secondary)
+ {
+ if(autocvar_g_balance_rifle_secondary_reload)
+ weapon_action(self.weapon, WR_RELOAD);
+ else
+ {
+ if (weapon_prepareattack_check(1, autocvar_g_balance_rifle_secondary_refire))
+ if (time >= self.rifle_accumulator + autocvar_g_balance_rifle_secondary_burstcost)
+ {
+ weapon_prepareattack_do(1, autocvar_g_balance_rifle_secondary_refire);
+ W_Rifle_BulletHail(autocvar_g_balance_rifle_secondary_bullethail, W_Rifle_Attack2, WFRAME_FIRE2, autocvar_g_balance_rifle_secondary_animtime, autocvar_g_balance_rifle_primary_refire);
+ self.rifle_accumulator += autocvar_g_balance_rifle_secondary_burstcost;
+ }
+ }
+ }
}
}
+
+ return TRUE;
}
- }
- else if (req == WR_PRECACHE)
- {
- precache_model ("models/weapons/g_campingrifle.md3");
- precache_model ("models/weapons/v_campingrifle.md3");
- precache_model ("models/weapons/h_campingrifle.iqm");
- precache_sound ("weapons/campingrifle_fire.wav");
- precache_sound ("weapons/campingrifle_fire2.wav");
- //precache_sound ("weapons/reload.wav"); // until weapons have individual reload sounds, precache the reload sound somewhere else
- }
- else if (req == WR_SETUP)
- {
- weapon_setup(WEP_RIFLE);
- self.current_ammo = ammo_nails;
- }
- else if (req == WR_CHECKAMMO1)
- {
- ammo_amount = self.ammo_nails >= autocvar_g_balance_rifle_primary_ammo;
- ammo_amount += self.(weapon_load[WEP_RIFLE]) >= autocvar_g_balance_rifle_primary_ammo;
- return ammo_amount;
- }
- else if (req == WR_CHECKAMMO2)
- {
- ammo_amount = self.ammo_nails >= autocvar_g_balance_rifle_secondary_ammo;
- ammo_amount += self.(weapon_load[WEP_RIFLE]) >= autocvar_g_balance_rifle_secondary_ammo;
- return ammo_amount;
- }
- else if (req == WR_RESETPLAYER)
- {
- self.rifle_accumulator = time - autocvar_g_balance_rifle_bursttime;
- }
- else if (req == WR_RELOAD)
- {
- W_Reload(min(autocvar_g_balance_rifle_primary_ammo, autocvar_g_balance_rifle_secondary_ammo), autocvar_g_balance_rifle_reload_ammo, autocvar_g_balance_rifle_reload_time, "weapons/reload.wav");
- }
- else if (req == WR_SUICIDEMESSAGE)
- {
- return WEAPON_THINKING_WITH_PORTALS;
- }
- else if (req == WR_KILLMESSAGE)
- {
- if(w_deathtype & HITTYPE_SECONDARY)
+ case WR_PRECACHE:
{
- if(w_deathtype & HITTYPE_BOUNCE)
- return WEAPON_RIFLE_MURDER_HAIL_PIERCING;
- else
- return WEAPON_RIFLE_MURDER_HAIL;
+ precache_model ("models/weapons/g_campingrifle.md3");
+ precache_model ("models/weapons/v_campingrifle.md3");
+ precache_model ("models/weapons/h_campingrifle.iqm");
+ precache_sound ("weapons/campingrifle_fire.wav");
+ precache_sound ("weapons/campingrifle_fire2.wav");
+ return TRUE;
+ }
+ case WR_SETUP:
+ {
+ weapon_setup(WEP_RIFLE);
+ self.current_ammo = ammo_nails;
+ return TRUE;
}
- else
+ case WR_CHECKAMMO1:
{
- if(w_deathtype & HITTYPE_BOUNCE)
- return WEAPON_RIFLE_MURDER_PIERCING;
+ ammo_amount = self.ammo_nails >= autocvar_g_balance_rifle_primary_ammo;
+ ammo_amount += self.(weapon_load[WEP_RIFLE]) >= autocvar_g_balance_rifle_primary_ammo;
+ return ammo_amount;
+ }
+ case WR_CHECKAMMO2:
+ {
+ ammo_amount = self.ammo_nails >= autocvar_g_balance_rifle_secondary_ammo;
+ ammo_amount += self.(weapon_load[WEP_RIFLE]) >= autocvar_g_balance_rifle_secondary_ammo;
+ return ammo_amount;
+ }
+ case WR_RESETPLAYER:
+ {
+ self.rifle_accumulator = time - autocvar_g_balance_rifle_bursttime;
+ return TRUE;
+ }
+ case WR_RELOAD:
+ {
+ W_Reload(min(autocvar_g_balance_rifle_primary_ammo, autocvar_g_balance_rifle_secondary_ammo), autocvar_g_balance_rifle_reload_ammo, autocvar_g_balance_rifle_reload_time, "weapons/reload.wav");
+ return TRUE;
+ }
+ case WR_SUICIDEMESSAGE:
+ {
+ return WEAPON_THINKING_WITH_PORTALS;
+ }
+ case WR_KILLMESSAGE:
+ {
+ if(w_deathtype & HITTYPE_SECONDARY)
+ {
+ if(w_deathtype & HITTYPE_BOUNCE)
+ return WEAPON_RIFLE_MURDER_HAIL_PIERCING;
+ else
+ return WEAPON_RIFLE_MURDER_HAIL;
+ }
else
- return WEAPON_RIFLE_MURDER;
+ {
+ if(w_deathtype & HITTYPE_BOUNCE)
+ return WEAPON_RIFLE_MURDER_PIERCING;
+ else
+ return WEAPON_RIFLE_MURDER;
+ }
}
}
return TRUE;
#ifdef CSQC
float w_rifle(float req)
{
- if(req == WR_IMPACTEFFECT)
+ switch(req)
{
- vector org2;
- org2 = w_org + w_backoff * 2;
- pointparticles(particleeffectnum("machinegun_impact"), org2, w_backoff * 1000, 1);
- if(!w_issilent)
+ case WR_IMPACTEFFECT:
{
- if(w_random < 0.2)
- sound(self, CH_SHOTS, "weapons/ric1.wav", VOL_BASE, ATTN_NORM);
- else if(w_random < 0.4)
- sound(self, CH_SHOTS, "weapons/ric2.wav", VOL_BASE, ATTN_NORM);
- else if(w_random < 0.5)
- sound(self, CH_SHOTS, "weapons/ric3.wav", VOL_BASE, ATTN_NORM);
+ vector org2;
+ org2 = w_org + w_backoff * 2;
+ pointparticles(particleeffectnum("machinegun_impact"), org2, w_backoff * 1000, 1);
+ if(!w_issilent)
+ {
+ if(w_random < 0.2)
+ sound(self, CH_SHOTS, "weapons/ric1.wav", VOL_BASE, ATTN_NORM);
+ else if(w_random < 0.4)
+ sound(self, CH_SHOTS, "weapons/ric2.wav", VOL_BASE, ATTN_NORM);
+ else if(w_random < 0.5)
+ sound(self, CH_SHOTS, "weapons/ric3.wav", VOL_BASE, ATTN_NORM);
+ }
+
+ return TRUE;
+ }
+ case WR_PRECACHE:
+ {
+ precache_sound("weapons/ric1.wav");
+ precache_sound("weapons/ric2.wav");
+ precache_sound("weapons/ric3.wav");
+ return TRUE;
}
- }
- else if(req == WR_PRECACHE)
- {
- precache_sound("weapons/ric1.wav");
- precache_sound("weapons/ric2.wav");
- precache_sound("weapons/ric3.wav");
}
return TRUE;
{
float ammo_amount;
- if (req == WR_AIM)
+ switch(req)
{
- if (autocvar_g_balance_seeker_type == 1)
- if (Seeker_Tagged_Info(self, self.enemy) != world)
- self.BUTTON_ATCK = bot_aim(autocvar_g_balance_seeker_missile_speed_max, 0, autocvar_g_balance_seeker_missile_lifetime, FALSE);
- else
- self.BUTTON_ATCK2 = bot_aim(autocvar_g_balance_seeker_tag_speed, 0, autocvar_g_balance_seeker_tag_lifetime, FALSE);
- else
- self.BUTTON_ATCK = bot_aim(autocvar_g_balance_seeker_tag_speed, 0, autocvar_g_balance_seeker_tag_lifetime, FALSE);
- }
- else if (req == WR_THINK)
- {
- if(autocvar_g_balance_seeker_reload_ammo && self.clip_load < min(autocvar_g_balance_seeker_missile_ammo, autocvar_g_balance_seeker_tag_ammo)) // forced reload
- weapon_action(self.weapon, WR_RELOAD);
-
- else if (self.BUTTON_ATCK)
+ case WR_AIM:
{
if (autocvar_g_balance_seeker_type == 1)
+ if (Seeker_Tagged_Info(self, self.enemy) != world)
+ self.BUTTON_ATCK = bot_aim(autocvar_g_balance_seeker_missile_speed_max, 0, autocvar_g_balance_seeker_missile_lifetime, FALSE);
+ else
+ self.BUTTON_ATCK2 = bot_aim(autocvar_g_balance_seeker_tag_speed, 0, autocvar_g_balance_seeker_tag_lifetime, FALSE);
+ else
+ self.BUTTON_ATCK = bot_aim(autocvar_g_balance_seeker_tag_speed, 0, autocvar_g_balance_seeker_tag_lifetime, FALSE);
+
+ return TRUE;
+ }
+ case WR_THINK:
+ {
+ if(autocvar_g_balance_seeker_reload_ammo && self.clip_load < min(autocvar_g_balance_seeker_missile_ammo, autocvar_g_balance_seeker_tag_ammo)) // forced reload
+ weapon_action(self.weapon, WR_RELOAD);
+
+ else if (self.BUTTON_ATCK)
{
- if (weapon_prepareattack(0, autocvar_g_balance_seeker_missile_refire))
+ if (autocvar_g_balance_seeker_type == 1)
+ {
+ if (weapon_prepareattack(0, autocvar_g_balance_seeker_missile_refire))
+ {
+ Seeker_Attack();
+ weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_seeker_missile_animtime, w_ready);
+ }
+ }
+ else
{
- Seeker_Attack();
- weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_seeker_missile_animtime, w_ready);
+ if (weapon_prepareattack(0, autocvar_g_balance_seeker_tag_refire))
+ {
+ Seeker_Fire_Tag();
+ weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_seeker_tag_animtime, w_ready);
+ }
}
}
- else
+
+ else if (self.BUTTON_ATCK2)
{
- if (weapon_prepareattack(0, autocvar_g_balance_seeker_tag_refire))
+ if (autocvar_g_balance_seeker_type == 1)
{
- Seeker_Fire_Tag();
- weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_seeker_tag_animtime, w_ready);
+ if (weapon_prepareattack(0, autocvar_g_balance_seeker_tag_refire))
+ {
+ Seeker_Fire_Tag();
+ weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_seeker_tag_animtime, w_ready);
+ }
+ }
+ else
+ {
+ if (weapon_prepareattack(0, autocvar_g_balance_seeker_flac_refire))
+ {
+ Seeker_Fire_Flac();
+ weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_seeker_flac_animtime, w_ready);
+ }
}
}
+
+ return TRUE;
}
-
- else if (self.BUTTON_ATCK2)
+ case WR_PRECACHE:
+ {
+ precache_model ("models/weapons/g_seeker.md3");
+ precache_model ("models/weapons/v_seeker.md3");
+ precache_model ("models/weapons/h_seeker.iqm");
+ precache_sound ("weapons/tag_fire.wav");
+ precache_sound ("weapons/flac_fire.wav");
+ precache_sound ("weapons/seeker_fire.wav");
+ return TRUE;
+ }
+ case WR_SETUP:
+ {
+ weapon_setup(WEP_SEEKER);
+ self.current_ammo = ammo_rockets;
+ return TRUE;
+ }
+ case WR_CHECKAMMO1:
{
if (autocvar_g_balance_seeker_type == 1)
{
- if (weapon_prepareattack(0, autocvar_g_balance_seeker_tag_refire))
- {
- Seeker_Fire_Tag();
- weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_seeker_tag_animtime, w_ready);
- }
+ ammo_amount = self.ammo_rockets >= autocvar_g_balance_seeker_missile_ammo;
+ ammo_amount += self.(weapon_load[WEP_SEEKER]) >= autocvar_g_balance_seeker_missile_ammo;
}
- else
+ else
{
- if (weapon_prepareattack(0, autocvar_g_balance_seeker_flac_refire))
- {
- Seeker_Fire_Flac();
- weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_seeker_flac_animtime, w_ready);
- }
+ ammo_amount = self.ammo_rockets >= autocvar_g_balance_seeker_tag_ammo;
+ ammo_amount += self.(weapon_load[WEP_SEEKER]) >= autocvar_g_balance_seeker_tag_ammo;
}
+
+ return ammo_amount;
}
- }
- else if (req == WR_PRECACHE)
- {
- precache_model ("models/weapons/g_seeker.md3");
- precache_model ("models/weapons/v_seeker.md3");
- precache_model ("models/weapons/h_seeker.iqm");
- precache_sound ("weapons/tag_fire.wav");
- precache_sound ("weapons/flac_fire.wav");
- precache_sound ("weapons/seeker_fire.wav");
- //precache_sound ("weapons/reload.wav"); // until weapons have individual reload sounds, precache the reload sound somewhere else
- }
- else if (req == WR_SETUP)
- {
- weapon_setup(WEP_SEEKER);
- self.current_ammo = ammo_rockets;
- }
- else if (req == WR_CHECKAMMO1)
- {
- if (autocvar_g_balance_seeker_type == 1)
+ case WR_CHECKAMMO2:
{
- ammo_amount = self.ammo_rockets >= autocvar_g_balance_seeker_missile_ammo;
- ammo_amount += self.(weapon_load[WEP_SEEKER]) >= autocvar_g_balance_seeker_missile_ammo;
+ if (autocvar_g_balance_seeker_type == 1)
+ {
+ ammo_amount = self.ammo_rockets >= autocvar_g_balance_seeker_tag_ammo;
+ ammo_amount += self.(weapon_load[WEP_SEEKER]) >= autocvar_g_balance_seeker_tag_ammo;
+ }
+ else
+ {
+ ammo_amount = self.ammo_rockets >= autocvar_g_balance_seeker_flac_ammo;
+ ammo_amount += self.(weapon_load[WEP_SEEKER]) >= autocvar_g_balance_seeker_flac_ammo;
+ }
+
+ return ammo_amount;
}
- else
+ case WR_RELOAD:
{
- ammo_amount = self.ammo_rockets >= autocvar_g_balance_seeker_tag_ammo;
- ammo_amount += self.(weapon_load[WEP_SEEKER]) >= autocvar_g_balance_seeker_tag_ammo;
+ W_Reload(min(autocvar_g_balance_seeker_missile_ammo, autocvar_g_balance_seeker_tag_ammo), autocvar_g_balance_seeker_reload_ammo, autocvar_g_balance_seeker_reload_time, "weapons/reload.wav");
+ return TRUE;
}
-
- return ammo_amount;
- }
- else if (req == WR_CHECKAMMO2)
- {
- if (autocvar_g_balance_seeker_type == 1)
+ case WR_SUICIDEMESSAGE:
{
- ammo_amount = self.ammo_rockets >= autocvar_g_balance_seeker_tag_ammo;
- ammo_amount += self.(weapon_load[WEP_SEEKER]) >= autocvar_g_balance_seeker_tag_ammo;
+ return WEAPON_SEEKER_SUICIDE;
}
- else
+ case WR_KILLMESSAGE:
{
- ammo_amount = self.ammo_rockets >= autocvar_g_balance_seeker_flac_ammo;
- ammo_amount += self.(weapon_load[WEP_SEEKER]) >= autocvar_g_balance_seeker_flac_ammo;
+ if(w_deathtype & HITTYPE_SECONDARY)
+ return WEAPON_SEEKER_MURDER_TAG;
+ else
+ return WEAPON_SEEKER_MURDER_SPRAY;
}
-
- return ammo_amount;
- }
- else if (req == WR_RELOAD)
- {
- W_Reload(min(autocvar_g_balance_seeker_missile_ammo, autocvar_g_balance_seeker_tag_ammo), autocvar_g_balance_seeker_reload_ammo, autocvar_g_balance_seeker_reload_time, "weapons/reload.wav");
- }
- else if (req == WR_SUICIDEMESSAGE)
- {
- return WEAPON_SEEKER_SUICIDE;
- }
- else if (req == WR_KILLMESSAGE)
- {
- if(w_deathtype & HITTYPE_SECONDARY)
- return WEAPON_SEEKER_MURDER_TAG;
- else
- return WEAPON_SEEKER_MURDER_SPRAY;
}
return TRUE;
}
#ifdef CSQC
float w_seeker(float req)
{
- if(req == WR_IMPACTEFFECT)
+ switch(req)
{
- vector org2;
- org2 = w_org + w_backoff * 6;
- if(w_deathtype & HITTYPE_BOUNCE)
+ case WR_IMPACTEFFECT:
{
- if(w_deathtype & HITTYPE_SECONDARY)
+ vector org2;
+ org2 = w_org + w_backoff * 6;
+ if(w_deathtype & HITTYPE_BOUNCE)
{
- if(!w_issilent)
- sound(self, CH_SHOTS, "weapons/tag_impact.wav", 1, ATTN_NORM);
+ if(w_deathtype & HITTYPE_SECONDARY)
+ {
+ if(!w_issilent)
+ sound(self, CH_SHOTS, "weapons/tag_impact.wav", 1, ATTN_NORM);
+ }
+ else
+ {
+ pointparticles(particleeffectnum("hagar_explode"), org2, '0 0 0', 1);
+ if(!w_issilent)
+ {
+ if (w_random<0.15)
+ sound(self, CH_SHOTS, "weapons/tagexp1.wav", 1, ATTN_NORM);
+ else if (w_random<0.7)
+ sound(self, CH_SHOTS, "weapons/tagexp2.wav", 1, ATTN_NORM);
+ else
+ sound(self, CH_SHOTS, "weapons/tagexp3.wav", 1, ATTN_NORM);
+ }
+ }
}
else
{
if(!w_issilent)
{
if (w_random<0.15)
- sound(self, CH_SHOTS, "weapons/tagexp1.wav", 1, ATTN_NORM);
+ sound(self, CH_SHOTS, "weapons/seekerexp1.wav", 1, ATTN_NORM);
else if (w_random<0.7)
- sound(self, CH_SHOTS, "weapons/tagexp2.wav", 1, ATTN_NORM);
+ sound(self, CH_SHOTS, "weapons/seekerexp2.wav", 1, ATTN_NORM);
else
- sound(self, CH_SHOTS, "weapons/tagexp3.wav", 1, ATTN_NORM);
+ sound(self, CH_SHOTS, "weapons/seekerexp3.wav", 1, ATTN_NORM);
}
}
+
+ return TRUE;
}
- else
+ case WR_PRECACHE:
{
- pointparticles(particleeffectnum("hagar_explode"), org2, '0 0 0', 1);
- if(!w_issilent)
- {
- if (w_random<0.15)
- sound(self, CH_SHOTS, "weapons/seekerexp1.wav", 1, ATTN_NORM);
- else if (w_random<0.7)
- sound(self, CH_SHOTS, "weapons/seekerexp2.wav", 1, ATTN_NORM);
- else
- sound(self, CH_SHOTS, "weapons/seekerexp3.wav", 1, ATTN_NORM);
- }
+ precache_sound("weapons/seekerexp1.wav");
+ precache_sound("weapons/seekerexp2.wav");
+ precache_sound("weapons/seekerexp3.wav");
+ precache_sound("weapons/tagexp1.wav");
+ precache_sound("weapons/tagexp2.wav");
+ precache_sound("weapons/tagexp3.wav");
+ precache_sound("weapons/tag_impact.wav");
+ return TRUE;
}
}
- else if(req == WR_PRECACHE)
- {
- precache_sound("weapons/seekerexp1.wav");
- precache_sound("weapons/seekerexp2.wav");
- precache_sound("weapons/seekerexp3.wav");
- precache_sound("weapons/tagexp1.wav");
- precache_sound("weapons/tagexp2.wav");
- precache_sound("weapons/tagexp3.wav");
- precache_sound("weapons/tag_impact.wav");
- }
+
return TRUE;
}
#endif
float w_shotgun(float req)
{
float ammo_amount;
- if (req == WR_AIM)
- if(vlen(self.origin-self.enemy.origin) <= autocvar_g_balance_shotgun_secondary_melee_range)
- self.BUTTON_ATCK2 = bot_aim(1000000, 0, 0.001, FALSE);
- else
- {
- if(autocvar_g_antilag_bullets)
- self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, FALSE);
- else
- self.BUTTON_ATCK = bot_aim(autocvar_g_balance_shotgun_primary_speed, 0, 0.001, FALSE);
- }
-
- else if (req == WR_THINK)
+
+ switch(req)
{
- if(autocvar_g_balance_shotgun_reload_ammo && self.clip_load < autocvar_g_balance_shotgun_primary_ammo) // forced reload
+ case WR_AIM:
{
- // don't force reload an empty shotgun if its melee attack is active
- if not(autocvar_g_balance_shotgun_secondary && self.ammo_shells < autocvar_g_balance_shotgun_primary_ammo)
- weapon_action(self.weapon, WR_RELOAD);
+ if(vlen(self.origin-self.enemy.origin) <= autocvar_g_balance_shotgun_secondary_melee_range)
+ self.BUTTON_ATCK2 = bot_aim(1000000, 0, 0.001, FALSE);
+ else
+ {
+ if(autocvar_g_antilag_bullets)
+ self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, FALSE);
+ else
+ self.BUTTON_ATCK = bot_aim(autocvar_g_balance_shotgun_primary_speed, 0, 0.001, FALSE);
+ }
+
+ return TRUE;
}
- else
+ case WR_THINK:
{
- if (self.BUTTON_ATCK)
+ if(autocvar_g_balance_shotgun_reload_ammo && self.clip_load < autocvar_g_balance_shotgun_primary_ammo) // forced reload
+ {
+ // don't force reload an empty shotgun if its melee attack is active
+ if not(autocvar_g_balance_shotgun_secondary && self.ammo_shells < autocvar_g_balance_shotgun_primary_ammo)
+ weapon_action(self.weapon, WR_RELOAD);
+ }
+ else
{
- if (time >= self.shotgun_primarytime) // handle refire separately so the secondary can be fired straight after a primary
+ if (self.BUTTON_ATCK)
{
- if(weapon_prepareattack(0, autocvar_g_balance_shotgun_primary_animtime))
+ if (time >= self.shotgun_primarytime) // handle refire separately so the secondary can be fired straight after a primary
{
- W_Shotgun_Attack();
- self.shotgun_primarytime = time + autocvar_g_balance_shotgun_primary_refire * W_WeaponRateFactor();
- weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_shotgun_primary_animtime, w_ready);
+ if(weapon_prepareattack(0, autocvar_g_balance_shotgun_primary_animtime))
+ {
+ W_Shotgun_Attack();
+ self.shotgun_primarytime = time + autocvar_g_balance_shotgun_primary_refire * W_WeaponRateFactor();
+ weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_shotgun_primary_animtime, w_ready);
+ }
}
}
}
+ if (self.clip_load >= 0) // we are not currently reloading
+ if (!self.crouch) // no crouchmelee please
+ if (self.BUTTON_ATCK2 && autocvar_g_balance_shotgun_secondary)
+ if (weapon_prepareattack(1, autocvar_g_balance_shotgun_secondary_refire))
+ {
+ // attempt forcing playback of the anim by switching to another anim (that we never play) here...
+ weapon_thinkf(WFRAME_FIRE1, 0, W_Shotgun_Attack2);
+ }
+
+ return TRUE;
}
- if (self.clip_load >= 0) // we are not currently reloading
- if (!self.crouch) // no crouchmelee please
- if (self.BUTTON_ATCK2 && autocvar_g_balance_shotgun_secondary)
- if (weapon_prepareattack(1, autocvar_g_balance_shotgun_secondary_refire))
+ case WR_PRECACHE:
{
- // attempt forcing playback of the anim by switching to another anim (that we never play) here...
- weapon_thinkf(WFRAME_FIRE1, 0, W_Shotgun_Attack2);
+ precache_model ("models/uziflash.md3");
+ precache_model ("models/weapons/g_shotgun.md3");
+ precache_model ("models/weapons/v_shotgun.md3");
+ precache_model ("models/weapons/h_shotgun.iqm");
+ precache_sound ("misc/itempickup.wav");
+ precache_sound ("weapons/shotgun_fire.wav");
+ precache_sound ("weapons/shotgun_melee.wav");
+ return TRUE;
+ }
+ case WR_SETUP:
+ {
+ weapon_setup(WEP_SHOTGUN);
+ self.current_ammo = ammo_shells;
+ return TRUE;
+ }
+ case WR_CHECKAMMO1:
+ {
+ ammo_amount = self.ammo_shells >= autocvar_g_balance_shotgun_primary_ammo;
+ ammo_amount += self.(weapon_load[WEP_SHOTGUN]) >= autocvar_g_balance_shotgun_primary_ammo;
+ return ammo_amount;
+ }
+ case WR_CHECKAMMO2:
+ {
+ // melee attack is always available
+ return TRUE;
+ }
+ case WR_RELOAD:
+ {
+ W_Reload(autocvar_g_balance_shotgun_primary_ammo, autocvar_g_balance_shotgun_reload_ammo, autocvar_g_balance_shotgun_reload_time, "weapons/reload.wav");
+ return TRUE;
+ }
+ case WR_SUICIDEMESSAGE:
+ {
+ return WEAPON_THINKING_WITH_PORTALS;
+ }
+ case WR_KILLMESSAGE:
+ {
+ if(w_deathtype & HITTYPE_SECONDARY)
+ return WEAPON_SHOTGUN_MURDER_SLAP;
+ else
+ return WEAPON_SHOTGUN_MURDER;
}
- }
- else if (req == WR_PRECACHE)
- {
- precache_model ("models/uziflash.md3");
- precache_model ("models/weapons/g_shotgun.md3");
- precache_model ("models/weapons/v_shotgun.md3");
- precache_model ("models/weapons/h_shotgun.iqm");
- precache_sound ("misc/itempickup.wav");
- precache_sound ("weapons/shotgun_fire.wav");
- precache_sound ("weapons/shotgun_melee.wav");
- //precache_sound ("weapons/reload.wav"); // until weapons have individual reload sounds, precache the reload sound somewhere else
- }
- else if (req == WR_SETUP)
- {
- weapon_setup(WEP_SHOTGUN);
- self.current_ammo = ammo_shells;
- }
- else if (req == WR_CHECKAMMO1)
- {
- ammo_amount = self.ammo_shells >= autocvar_g_balance_shotgun_primary_ammo;
- ammo_amount += self.(weapon_load[WEP_SHOTGUN]) >= autocvar_g_balance_shotgun_primary_ammo;
- return ammo_amount;
- }
- else if (req == WR_CHECKAMMO2)
- {
- // melee attack is always available
- return TRUE;
- }
- else if (req == WR_RELOAD)
- {
- W_Reload(autocvar_g_balance_shotgun_primary_ammo, autocvar_g_balance_shotgun_reload_ammo, autocvar_g_balance_shotgun_reload_time, "weapons/reload.wav");
- }
- else if (req == WR_SUICIDEMESSAGE)
- {
- return WEAPON_THINKING_WITH_PORTALS;
- }
- else if (req == WR_KILLMESSAGE)
- {
- if(w_deathtype & HITTYPE_SECONDARY)
- return WEAPON_SHOTGUN_MURDER_SLAP;
- else
- return WEAPON_SHOTGUN_MURDER;
}
return TRUE;
}
.float prevric;
float w_shotgun(float req)
{
- if(req == WR_IMPACTEFFECT)
+ switch(req)
{
- vector org2;
- org2 = w_org + w_backoff * 2;
- pointparticles(particleeffectnum("shotgun_impact"), org2, w_backoff * 1000, 1);
- if(!w_issilent && time - self.prevric > 0.25)
+ case WR_IMPACTEFFECT:
{
- if(w_random < 0.0165)
- sound(self, CH_SHOTS, "weapons/ric1.wav", VOL_BASE, ATTN_NORM);
- else if(w_random < 0.033)
- sound(self, CH_SHOTS, "weapons/ric2.wav", VOL_BASE, ATTN_NORM);
- else if(w_random < 0.05)
- sound(self, CH_SHOTS, "weapons/ric3.wav", VOL_BASE, ATTN_NORM);
- self.prevric = time;
+ vector org2;
+ org2 = w_org + w_backoff * 2;
+ pointparticles(particleeffectnum("shotgun_impact"), org2, w_backoff * 1000, 1);
+ if(!w_issilent && time - self.prevric > 0.25)
+ {
+ if(w_random < 0.0165)
+ sound(self, CH_SHOTS, "weapons/ric1.wav", VOL_BASE, ATTN_NORM);
+ else if(w_random < 0.033)
+ sound(self, CH_SHOTS, "weapons/ric2.wav", VOL_BASE, ATTN_NORM);
+ else if(w_random < 0.05)
+ sound(self, CH_SHOTS, "weapons/ric3.wav", VOL_BASE, ATTN_NORM);
+ self.prevric = time;
+ }
+ return TRUE;
+ }
+ case WR_PRECACHE:
+ {
+ precache_sound("weapons/ric1.wav");
+ precache_sound("weapons/ric2.wav");
+ precache_sound("weapons/ric3.wav");
+ return TRUE;
}
- }
- else if(req == WR_PRECACHE)
- {
- precache_sound("weapons/ric1.wav");
- precache_sound("weapons/ric2.wav");
- precache_sound("weapons/ric3.wav");
}
return TRUE;
}
float w_tuba(float req)
{
- if (req == WR_AIM)
+ switch(req)
{
- // bots cannot play the Tuba well yet
- // I think they should start with the recorder first
- if(vlen(self.origin - self.enemy.origin) < autocvar_g_balance_tuba_radius)
+ case WR_AIM:
{
- if(random() > 0.5)
- self.BUTTON_ATCK = 1;
- else
- self.BUTTON_ATCK2 = 1;
+ // bots cannot play the Tuba well yet
+ // I think they should start with the recorder first
+ if(vlen(self.origin - self.enemy.origin) < autocvar_g_balance_tuba_radius)
+ {
+ if(random() > 0.5)
+ self.BUTTON_ATCK = 1;
+ else
+ self.BUTTON_ATCK2 = 1;
+ }
+
+ return TRUE;
}
- }
- else if (req == WR_THINK)
- {
- if (self.BUTTON_ATCK)
- if (weapon_prepareattack(0, autocvar_g_balance_tuba_refire))
+ case WR_THINK:
{
- W_Tuba_NoteOn(0);
- //weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_tuba_animtime, w_ready);
- weapon_thinkf(WFRAME_IDLE, autocvar_g_balance_tuba_animtime, w_ready);
+ if (self.BUTTON_ATCK)
+ if (weapon_prepareattack(0, autocvar_g_balance_tuba_refire))
+ {
+ W_Tuba_NoteOn(0);
+ //weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_tuba_animtime, w_ready);
+ weapon_thinkf(WFRAME_IDLE, autocvar_g_balance_tuba_animtime, w_ready);
+ }
+ if (self.BUTTON_ATCK2)
+ if (weapon_prepareattack(1, autocvar_g_balance_tuba_refire))
+ {
+ W_Tuba_NoteOn(HITTYPE_SECONDARY);
+ //weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_tuba_animtime, w_ready);
+ weapon_thinkf(WFRAME_IDLE, autocvar_g_balance_tuba_animtime, w_ready);
+ }
+ if(self.tuba_note)
+ {
+ if(!self.BUTTON_ATCK && !self.BUTTON_ATCK2)
+ {
+ entity oldself = self;
+ self = self.tuba_note;
+ W_Tuba_NoteOff();
+ self = oldself;
+ }
+ }
+
+ return TRUE;
}
- if (self.BUTTON_ATCK2)
- if (weapon_prepareattack(1, autocvar_g_balance_tuba_refire))
+ case WR_PRECACHE:
{
- W_Tuba_NoteOn(HITTYPE_SECONDARY);
- //weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_tuba_animtime, w_ready);
- weapon_thinkf(WFRAME_IDLE, autocvar_g_balance_tuba_animtime, w_ready);
+ precache_model ("models/weapons/g_tuba.md3");
+ precache_model ("models/weapons/v_tuba.md3");
+ precache_model ("models/weapons/h_tuba.iqm");
+ precache_model ("models/weapons/v_akordeon.md3");
+ precache_model ("models/weapons/h_akordeon.iqm");
+ precache_model ("models/weapons/v_kleinbottle.md3");
+ precache_model ("models/weapons/h_kleinbottle.iqm");
+
+ return TRUE;
}
- if(self.tuba_note)
+ case WR_SETUP:
{
- if(!self.BUTTON_ATCK && !self.BUTTON_ATCK2)
- {
- entity oldself = self;
- self = self.tuba_note;
- W_Tuba_NoteOff();
- self = oldself;
- }
+ weapon_setup(WEP_TUBA);
+ self.current_ammo = ammo_none;
+ self.tuba_instrument = 0;
+ return TRUE;
}
- }
- else if (req == WR_PRECACHE)
- {
- precache_model ("models/weapons/g_tuba.md3");
- precache_model ("models/weapons/v_tuba.md3");
- precache_model ("models/weapons/h_tuba.iqm");
- precache_model ("models/weapons/v_akordeon.md3");
- precache_model ("models/weapons/h_akordeon.iqm");
- precache_model ("models/weapons/v_kleinbottle.md3");
- precache_model ("models/weapons/h_kleinbottle.iqm");
-
- //float i;
- //for(i = -18; i <= +27; ++i)
- // precache_sound(TUBA_NOTE(i));
- }
- else if (req == WR_SETUP)
- {
- weapon_setup(WEP_TUBA);
- self.current_ammo = ammo_none;
- self.tuba_instrument = 0;
- }
- else if (req == WR_RELOAD)
- {
- // switch to alternate instruments :)
- if(self.weaponentity.state == WS_READY)
+ case WR_RELOAD:
{
- switch(self.tuba_instrument)
+ // switch to alternate instruments :)
+ if(self.weaponentity.state == WS_READY)
{
- case 0:
- self.tuba_instrument = 1;
- self.weaponname = "akordeon";
- break;
- case 1:
- self.tuba_instrument = 2;
- self.weaponname = "kleinbottle";
- break;
- case 2:
- self.tuba_instrument = 0;
- self.weaponname = "tuba";
- break;
+ switch(self.tuba_instrument)
+ {
+ case 0:
+ self.tuba_instrument = 1;
+ self.weaponname = "akordeon";
+ break;
+ case 1:
+ self.tuba_instrument = 2;
+ self.weaponname = "kleinbottle";
+ break;
+ case 2:
+ self.tuba_instrument = 0;
+ self.weaponname = "tuba";
+ break;
+ }
+ W_SetupShot(self, FALSE, 0, "", 0, 0);
+ pointparticles(particleeffectnum("teleport"), w_shotorg, '0 0 0', 1);
+ self.weaponentity.state = WS_INUSE;
+ weapon_thinkf(WFRAME_RELOAD, 0.5, w_ready);
}
- W_SetupShot(self, FALSE, 0, "", 0, 0);
- pointparticles(particleeffectnum("teleport"), w_shotorg, '0 0 0', 1);
- self.weaponentity.state = WS_INUSE;
- weapon_thinkf(WFRAME_RELOAD, 0.5, w_ready);
+
+ return TRUE;
+ }
+ case WR_CHECKAMMO1:
+ case WR_CHECKAMMO2:
+ {
+ return TRUE; // tuba has infinite ammo
+ }
+ case WR_SUICIDEMESSAGE:
+ {
+ if(w_deathtype & HITTYPE_BOUNCE)
+ return WEAPON_KLEINBOTTLE_SUICIDE;
+ else if(w_deathtype & HITTYPE_SECONDARY)
+ return WEAPON_ACCORDEON_SUICIDE;
+ else
+ return WEAPON_TUBA_SUICIDE;
+ }
+ case WR_KILLMESSAGE:
+ {
+ if(w_deathtype & HITTYPE_BOUNCE)
+ return WEAPON_KLEINBOTTLE_MURDER;
+ else if(w_deathtype & HITTYPE_SECONDARY)
+ return WEAPON_ACCORDEON_MURDER;
+ else
+ return WEAPON_TUBA_MURDER;
}
- }
- else if (req == WR_CHECKAMMO1)
- return TRUE; // TODO use fuel?
- else if (req == WR_CHECKAMMO2)
- return TRUE; // TODO use fuel?
- else if (req == WR_SUICIDEMESSAGE)
- {
- if(w_deathtype & HITTYPE_BOUNCE)
- return WEAPON_KLEINBOTTLE_SUICIDE;
- else if(w_deathtype & HITTYPE_SECONDARY)
- return WEAPON_ACCORDEON_SUICIDE;
- else
- return WEAPON_TUBA_SUICIDE;
- }
- else if (req == WR_KILLMESSAGE)
- {
- if(w_deathtype & HITTYPE_BOUNCE)
- return WEAPON_KLEINBOTTLE_MURDER;
- else if(w_deathtype & HITTYPE_SECONDARY)
- return WEAPON_ACCORDEON_MURDER;
- else
- return WEAPON_TUBA_MURDER;
}
return TRUE;
}