#ifndef CONSTANTS_H
#define CONSTANTS_H
- // COMMIT-TODO: Update if necessary before committing
- // Revision 1: additional statistics sent (flag caps, returns, deaths)
- // Revision 2: Mapvote preview pictures
- // Revision 3: optimized map vote protocol
- // Revision 4: CSQC config var system
- // Revision 5: mapvote time fix
- // Revision 6: more robust against packet loss/delays, also show not yet connected clients
- // Revision 7: packet loss column
- // Revision 8: race
- // Revision 9: race delta
- // Revision 10: scoreboard force
- // Revision 11: scoreboard unforce; spectator support beginning
- // Revision 12: smaller scores updates (SERVER: requires new engine)
- // Revision 13: pointparticles
- // Revision 14: laser
- // Revision 15: zoom
- // Revision 16: multi-weapons
- // Revision 17: multi-weaponimpulses
- // Revision 18: warmup
- // Revision 19: fog
- // Revision 20: naggers
- // Revision 21: entcs for players optimized (position data down from 12 to 7 bytes); waypointsprites in csqc for team radar
- // Revision 22: hook shot origin
- #define CSQC_REVISION 22
-
REGISTER_NET_TEMP(TE_CSQC_PICTURE)
REGISTER_NET_TEMP(TE_CSQC_RACE)
REGISTER_NET_TEMP(TE_CSQC_TEAMNAGGER)
REGISTER_NET_LINKED(_ENT_CLIENT_INIT)
#ifdef CSQC
-NET_HANDLE(_ENT_CLIENT_INIT, bool isnew) { return true; }
+NET_HANDLE(_ENT_CLIENT_INIT, bool isnew) { make_pure(this); return true; }
#endif
/** Sent as a temp entity from a persistent linked entity */
REGISTER_NET_TEMP(ENT_CLIENT_INIT)
MUTATOR_HOOKFUNCTION(campcheck, PlayerDies)
{
- Kill_Notification(NOTIF_ONE, frag_target, MSG_CENTER_CPID, CPID_CAMPCHECK);
+ Kill_Notification(NOTIF_ONE, frag_target, MSG_CENTER, CPID_CAMPCHECK);
return false;
}
if(IS_REAL_CLIENT(self)) // bots may camp, but that's no reason to constantly kill them
if(!IS_DEAD(self))
if(!STAT(FROZEN, self))
- if(!self.BUTTON_CHAT)
+ if(!PHYS_INPUT_BUTTON_CHAT(self))
if(autocvar_g_campcheck_interval)
{
vector dist;
{
if (!e.instagib_needammo)
return;
- Kill_Notification(NOTIF_ONE_ONLY, e, MSG_CENTER_CPID, CPID_INSTAGIB_FINDAMMO);
+ Kill_Notification(NOTIF_ONE_ONLY, e, MSG_CENTER, CPID_INSTAGIB_FINDAMMO);
e.instagib_needammo = false;
}
void instagib_ammocheck()
frag_target.armorvalue -= 1;
frag_damage = 0;
frag_target.damage_dealt += 1;
- frag_attacker.damage_dealt += 1; // TODO: change this to a specific hitsound for armor hit
+ frag_attacker.damage_dealt += 1;
Send_Notification(NOTIF_ONE, frag_target, MSG_CENTER, CENTER_INSTAGIB_LIVES_REMAINING, frag_target.armorvalue);
}
}
W_SetupShot(e, false, false, "", CH_WEAPON_A, 0);
- Kill_Notification(NOTIF_ONE_ONLY, e, MSG_CENTER_CPID, CPID_NADES);
+ Kill_Notification(NOTIF_ONE_ONLY, e, MSG_CENTER, CPID_NADES);
vector offset = (v_forward * autocvar_g_nades_throw_offset.x)
+ (v_right * autocvar_g_nades_throw_offset.y)
if (trace_startsolid)
setorigin(_nade, e.origin);
- if(self.v_angle.x >= 70 && self.v_angle.x <= 110 && self.BUTTON_CROUCH)
+ if(self.v_angle.x >= 70 && self.v_angle.x <= 110 && PHYS_INPUT_BUTTON_CROUCH(self))
_nade.velocity = '0 0 100';
else if(autocvar_g_nades_nade_newton_style == 1)
_nade.velocity = e.velocity + _velocity;
return false;
}
- MUTATOR_HOOKFUNCTION(nades, GetCvars)
- {
- GetCvars_handleFloat(get_cvars_s, get_cvars_f, cvar_cl_nade_type, "cl_nade_type");
- GetCvars_handleString(get_cvars_s, get_cvars_f, cvar_cl_pokenade_type, "cl_pokenade_type");
-
- return false;
- }
+ REPLICATE(cvar_cl_nade_type, int, "cl_nade_type");
+ REPLICATE(cvar_cl_pokenade_type, string, "cl_pokenade_type");
MUTATOR_HOOKFUNCTION(nades, BuildMutatorsString)
{
void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity, int fire)
{
- if (!actor.BUTTON_ATCK)
+ if (!PHYS_INPUT_BUTTON_ATCK(actor))
{
w_ready(thiswep, actor, weaponentity, fire);
return;
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(hmg, refire), W_HeavyMachineGun_Attack_Auto);
}
- METHOD(HeavyMachineGun, wr_aim, void(entity thiswep))
- {
- if(vdist(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);
- }
- METHOD(HeavyMachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
- {
- if(WEP_CVAR(hmg, reload_ammo) && actor.clip_load < WEP_CVAR(hmg, ammo)) { // forced reload
- thiswep.wr_reload(thiswep, actor, weaponentity);
- } else
- {
- if (fire & 1)
- if (weapon_prepareattack(thiswep, actor, weaponentity, false, 0))
- {
- actor.misc_bulletcounter = 0;
- W_HeavyMachineGun_Attack_Auto(thiswep, actor, weaponentity, fire);
- }
- }
- }
- METHOD(HeavyMachineGun, wr_checkammo1, bool(entity thiswep))
- {
- float ammo_amount = self.ammo_nails >= WEP_CVAR(hmg, ammo);
-
- if(autocvar_g_balance_hmg_reload_ammo)
- ammo_amount += self.(weapon_load[WEP_HMG.m_id]) >= WEP_CVAR(hmg, ammo);
-
- return ammo_amount;
- }
- METHOD(HeavyMachineGun, wr_checkammo2, bool(entity thiswep))
- {
- float ammo_amount = self.ammo_nails >= WEP_CVAR(hmg, ammo);
-
- if(autocvar_g_balance_hmg_reload_ammo)
- ammo_amount += self.(weapon_load[WEP_HMG.m_id]) >= WEP_CVAR(hmg, ammo);
-
- return ammo_amount;
- }
- METHOD(HeavyMachineGun, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
- {
- W_Reload(self, WEP_CVAR(hmg, ammo), SND(RELOAD));
- }
- METHOD(HeavyMachineGun, wr_suicidemessage, Notification(entity thiswep))
- {
- return WEAPON_THINKING_WITH_PORTALS;
- }
- METHOD(HeavyMachineGun, wr_killmessage, Notification(entity thiswep))
- {
- if(w_deathtype & HITTYPE_SECONDARY)
- return WEAPON_HMG_MURDER_SNIPE;
- else
- return WEAPON_HMG_MURDER_SPRAY;
- }
+ METHOD(HeavyMachineGun, wr_aim, void(entity thiswep))
+ {
+ if(vdist(self.origin - self.enemy.origin, <, 3000 - bound(0, skill, 10) * 200))
+ PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(1000000, 0, 0.001, false);
+ else
+ PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(1000000, 0, 0.001, false);
+ }
+
+ METHOD(HeavyMachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+ {
+ if(WEP_CVAR(hmg, reload_ammo) && actor.clip_load < WEP_CVAR(hmg, ammo)) { // forced reload
+ thiswep.wr_reload(thiswep, actor, weaponentity);
+ } else
+ {
+ if (fire & 1)
+ if (weapon_prepareattack(thiswep, actor, weaponentity, false, 0))
+ {
+ actor.misc_bulletcounter = 0;
+ W_HeavyMachineGun_Attack_Auto(thiswep, actor, weaponentity, fire);
+ }
+ }
+ }
+
+ METHOD(HeavyMachineGun, wr_checkammo1, bool(entity thiswep))
+ {
+ float ammo_amount = self.ammo_nails >= WEP_CVAR(hmg, ammo);
+
+ if(autocvar_g_balance_hmg_reload_ammo)
+ ammo_amount += self.(weapon_load[WEP_HMG.m_id]) >= WEP_CVAR(hmg, ammo);
+
+ return ammo_amount;
+ }
+
+ METHOD(HeavyMachineGun, wr_checkammo2, bool(entity thiswep))
+ {
+ float ammo_amount = self.ammo_nails >= WEP_CVAR(hmg, ammo);
+
+ if(autocvar_g_balance_hmg_reload_ammo)
+ ammo_amount += self.(weapon_load[WEP_HMG.m_id]) >= WEP_CVAR(hmg, ammo);
+
+ return ammo_amount;
+ }
+
+ METHOD(HeavyMachineGun, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+ {
+ W_Reload(self, WEP_CVAR(hmg, ammo), SND(RELOAD));
+ }
+
-METHOD(HeavyMachineGun, wr_suicidemessage, int(entity thiswep))
++METHOD(HeavyMachineGun, wr_suicidemessage, Notification(entity thiswep))
+ {
+ return WEAPON_THINKING_WITH_PORTALS;
+ }
+
-METHOD(HeavyMachineGun, wr_killmessage, int(entity thiswep))
++METHOD(HeavyMachineGun, wr_killmessage, Notification(entity thiswep))
+ {
+ if(w_deathtype & HITTYPE_SECONDARY)
+ return WEAPON_HMG_MURDER_SNIPE;
+ else
+ return WEAPON_HMG_MURDER_SPRAY;
+ }
#endif
#ifdef CSQC
- METHOD(HeavyMachineGun, wr_impacteffect, void(entity thiswep))
- {
- vector org2;
- org2 = w_org + w_backoff * 2;
- pointparticles(EFFECT_MACHINEGUN_IMPACT, org2, w_backoff * 1000, 1);
- if(!w_issilent)
- sound(self, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_NORM);
- }
+ METHOD(HeavyMachineGun, wr_impacteffect, void(entity thiswep))
+ {
+ vector org2;
+ org2 = w_org + w_backoff * 2;
+ pointparticles(EFFECT_MACHINEGUN_IMPACT, org2, w_backoff * 1000, 1);
+ if(!w_issilent)
+ sound(self, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_NORM);
+ }
#endif
#endif
MUTATOR_CALLHOOK(EditProjectile, self, missile);
}
- METHOD(RocketPropelledChainsaw, wr_aim, void(entity thiswep))
- {
- self.BUTTON_ATCK = bot_aim(WEP_CVAR(rpc, speed), 0, WEP_CVAR(rpc, lifetime), false);
- }
- METHOD(RocketPropelledChainsaw, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
- {
- if(WEP_CVAR(rpc, reload_ammo) && actor.clip_load < WEP_CVAR(rpc, ammo)) {
- thiswep.wr_reload(thiswep, actor, weaponentity);
- } else
- {
- if (fire & 1)
- {
- if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(rpc, refire)))
- {
- W_RocketPropelledChainsaw_Attack(thiswep);
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(rpc, animtime), w_ready);
- }
- }
-
- if (fire & 2)
- {
- // to-do
- }
- }
- }
- METHOD(RocketPropelledChainsaw, wr_checkammo1, bool(entity thiswep))
- {
- float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(rpc, ammo);
- ammo_amount += self.(weapon_load[WEP_RPC.m_id]) >= WEP_CVAR(rpc, ammo);
- return ammo_amount;
- }
- METHOD(RocketPropelledChainsaw, wr_checkammo2, bool(entity thiswep))
- {
- return false;
- }
- METHOD(RocketPropelledChainsaw, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
- {
- W_Reload(self, WEP_CVAR(rpc, ammo), SND(RELOAD));
- }
- METHOD(RocketPropelledChainsaw, wr_suicidemessage, Notification(entity thiswep))
- {
- if((w_deathtype & HITTYPE_BOUNCE) || (w_deathtype & HITTYPE_SPLASH))
- return WEAPON_RPC_SUICIDE_SPLASH;
- else
- return WEAPON_RPC_SUICIDE_DIRECT;
- }
- METHOD(RocketPropelledChainsaw, wr_killmessage, Notification(entity thiswep))
- {
- if(w_deathtype & HITTYPE_SECONDARY)
- return WEAPON_BLASTER_MURDER;
- else if((w_deathtype & HITTYPE_BOUNCE) || (w_deathtype & HITTYPE_SPLASH))
- return WEAPON_RPC_MURDER_SPLASH;
- else
- return WEAPON_RPC_MURDER_DIRECT;
- }
+ METHOD(RocketPropelledChainsaw, wr_aim, void(entity thiswep))
+ {
+ PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR(rpc, speed), 0, WEP_CVAR(rpc, lifetime), false);
+ }
+
+ METHOD(RocketPropelledChainsaw, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+ {
+ if(WEP_CVAR(rpc, reload_ammo) && actor.clip_load < WEP_CVAR(rpc, ammo)) {
+ thiswep.wr_reload(thiswep, actor, weaponentity);
+ } else
+ {
+ if (fire & 1)
+ {
+ if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(rpc, refire)))
+ {
+ W_RocketPropelledChainsaw_Attack(thiswep);
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(rpc, animtime), w_ready);
+ }
+ }
+
+ if (fire & 2)
+ {
+ // to-do
+ }
+ }
+ }
+
+ METHOD(RocketPropelledChainsaw, wr_checkammo1, bool(entity thiswep))
+ {
+ float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(rpc, ammo);
+ ammo_amount += self.(weapon_load[WEP_RPC.m_id]) >= WEP_CVAR(rpc, ammo);
+ return ammo_amount;
+ }
+
+ METHOD(RocketPropelledChainsaw, wr_checkammo2, bool(entity thiswep))
+ {
+ return false;
+ }
+
+ METHOD(RocketPropelledChainsaw, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+ {
+ W_Reload(self, WEP_CVAR(rpc, ammo), SND(RELOAD));
+ }
+
-METHOD(RocketPropelledChainsaw, wr_suicidemessage, int(entity thiswep))
++METHOD(RocketPropelledChainsaw, wr_suicidemessage, Notification(entity thiswep))
+ {
+ if((w_deathtype & HITTYPE_BOUNCE) || (w_deathtype & HITTYPE_SPLASH))
+ return WEAPON_RPC_SUICIDE_SPLASH;
+ else
+ return WEAPON_RPC_SUICIDE_DIRECT;
+ }
+
-METHOD(RocketPropelledChainsaw, wr_killmessage, int(entity thiswep))
++METHOD(RocketPropelledChainsaw, wr_killmessage, Notification(entity thiswep))
+ {
+ if(w_deathtype & HITTYPE_SECONDARY)
+ return WEAPON_BLASTER_MURDER;
+ else if((w_deathtype & HITTYPE_BOUNCE) || (w_deathtype & HITTYPE_SPLASH))
+ return WEAPON_RPC_MURDER_SPLASH;
+ else
+ return WEAPON_RPC_MURDER_DIRECT;
+ }
#endif
#ifdef CSQC
- METHOD(RocketPropelledChainsaw, wr_impacteffect, void(entity thiswep))
- {
- vector org2;
- org2 = w_org + w_backoff * 12;
- pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1);
- if(!w_issilent)
- sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
- }
+ METHOD(RocketPropelledChainsaw, wr_impacteffect, void(entity thiswep))
+ {
+ vector org2;
+ org2 = w_org + w_backoff * 12;
+ pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1);
+ if(!w_issilent)
+ sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
+ }
#endif
#endif
#include "constants.qh"
#include <common/deathtypes/all.qh>
- #include <common/notifications.qh>
+ #include <common/notifications/all.qh>
#include "triggers/subs.qh"
#include "util.qh"
void Item_ScheduleRespawnIn(entity e, float t)
{
- if (Item_ItemsTime_Allow(e.itemdef) || e.weapons & WEPSET_SUPERWEAPONS)
+ // if the respawn time is longer than 10 seconds, show a waypoint, otherwise, just respawn normally
+ if ((Item_ItemsTime_Allow(e.itemdef) || e.weapons & WEPSET_SUPERWEAPONS) && (t - ITEM_RESPAWN_TICKS) > 0)
{
e.think = Item_RespawnCountdown;
e.nextthink = time + max(0, t - ITEM_RESPAWN_TICKS);
void Item_ScheduleInitialRespawn(entity e)
{
Item_Show(e, 0);
- Item_ScheduleRespawnIn(e, game_starttime - time + ITEM_RESPAWNTIME_INITIAL(e));
+ Item_ScheduleRespawnIn(e, game_starttime - time + ((e.respawntimestart) ? e.respawntimestart : ITEM_RESPAWNTIME_INITIAL(e)));
}
float Item_GiveAmmoTo(entity item, entity player, .float ammotype, float ammomax, float mode)
}
// Savage: used for item garbage-collection
- // TODO: perhaps nice special effect?
void RemoveItem()
{SELFPARAM();
if(wasfreed(self) || !self) { return; }
#ifndef MENUQC
#ifdef CSQC
int ReadInt24_t();
- vector ReadInt48_t();
- vector ReadInt72_t();
#else
void WriteInt24_t(float dest, float val);
void WriteInt48_t(float dest, vector val);
const float CNT_KILL = 4;
const float CNT_RESPAWN = 5;
const float CNT_ROUNDSTART = 6;
-float Announcer_PickNumber(float type, float num);
+entity Announcer_PickNumber(float type, float num);
#endif
#ifndef MENUQC
float burst = 0;
- if( (self.owner.BUTTON_ATCK2 && !WEP_CVAR(arc, bolt)) || self.beam_bursting)
+ if( (PHYS_INPUT_BUTTON_ATCK2(self.owner) && !WEP_CVAR(arc, bolt)) || self.beam_bursting)
{
if(!self.beam_bursting)
self.beam_bursting = true;
||
gameover
||
- (!self.owner.BUTTON_ATCK && !burst )
+ (!PHYS_INPUT_BUTTON_ATCK(self.owner) && !burst )
||
STAT(FROZEN, self.owner)
||
{
if ( random() < self.arc_heat_percent )
Send_Effect(EFFECT_ARC_SMOKE, smoke_origin, '0 0 0', 1 );
- if ( self.BUTTON_ATCK || self.BUTTON_ATCK2 )
+ if ( PHYS_INPUT_BUTTON_ATCK(self) || PHYS_INPUT_BUTTON_ATCK2(self) )
{
Send_Effect(EFFECT_ARC_OVERHEAT_FIRE, smoke_origin, w_shotdir, 1 );
if ( !self.arc_smoke_sound )
}
if ( self.arc_smoke_sound && ( self.arc_overheat <= time ||
- !( self.BUTTON_ATCK || self.BUTTON_ATCK2 ) ) || PS(self).m_switchweapon != WEP_ARC )
+ !( PHYS_INPUT_BUTTON_ATCK(self) || PHYS_INPUT_BUTTON_ATCK2(self) ) ) || PS(self).m_switchweapon != WEP_ARC )
{
self.arc_smoke_sound = 0;
sound(self, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM);
}
}
- METHOD(Arc, wr_aim, void(entity thiswep))
- {
- SELFPARAM();
- if(WEP_CVAR(arc, beam_botaimspeed))
- {
- self.BUTTON_ATCK = bot_aim(
- WEP_CVAR(arc, beam_botaimspeed),
- 0,
- WEP_CVAR(arc, beam_botaimlifetime),
- false
- );
- }
- else
- {
- self.BUTTON_ATCK = bot_aim(
- 1000000,
- 0,
- 0.001,
- false
- );
- }
- }
- METHOD(Arc, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
- {
- Arc_Player_SetHeat(actor);
- Arc_Smoke();
-
- bool beam_fire2 = ((fire & 2) && !WEP_CVAR(arc, bolt));
-
- if (time >= actor.arc_overheat)
- if ((fire & 1) || beam_fire2 || actor.arc_beam.beam_bursting)
- {
-
- if(actor.arc_BUTTON_ATCK_prev)
- {
- #if 0
- if(actor.animstate_startframe == actor.anim_shoot.x && actor.animstate_numframes == actor.anim_shoot.y)
- weapon_thinkf(actor, weaponentity, WFRAME_DONTCHANGE, autocvar_g_balance_arc_primary_animtime, w_ready);
- else
- #endif
- weapon_thinkf(actor, weaponentity, WFRAME_DONTCHANGE, WEP_CVAR(arc, beam_animtime), w_ready);
- }
-
- if((!actor.arc_beam) || wasfreed(actor.arc_beam))
- {
- if(weapon_prepareattack(thiswep, actor, weaponentity, boolean(beam_fire2), 0))
- {
- W_Arc_Beam(boolean(beam_fire2));
-
- if(!actor.arc_BUTTON_ATCK_prev)
- {
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
- actor.arc_BUTTON_ATCK_prev = true;
- }
- }
- }
-
- return;
- }
- else if(fire & 2)
- {
- if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(arc, bolt_refire)))
- {
- W_Arc_Attack_Bolt(thiswep);
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, bolt_refire), w_ready);
- }
- }
-
- if(actor.arc_BUTTON_ATCK_prev)
- {
- sound(actor, CH_WEAPON_A, SND_ARC_STOP, VOL_BASE, ATTN_NORM);
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
- int slot = weaponslot(weaponentity);
- ATTACK_FINISHED(actor, slot) = time + WEP_CVAR(arc, beam_refire) * W_WeaponRateFactor();
- }
- actor.arc_BUTTON_ATCK_prev = false;
-
- #if 0
- if(fire & 2)
- if(weapon_prepareattack(thiswep, actor, weaponentity, true, autocvar_g_balance_arc_secondary_refire))
- {
- W_Arc_Attack2();
- actor.arc_count = autocvar_g_balance_arc_secondary_count;
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, autocvar_g_balance_arc_secondary_animtime, w_arc_checkattack);
- actor.arc_secondarytime = time + autocvar_g_balance_arc_secondary_refire2 * W_WeaponRateFactor();
- }
- #endif
- }
- METHOD(Arc, wr_init, void(entity thiswep))
- {
- if(!arc_shotorigin[0])
- {
- arc_shotorigin[0] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 1);
- arc_shotorigin[1] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 2);
- arc_shotorigin[2] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 3);
- arc_shotorigin[3] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 4);
- }
- }
- METHOD(Arc, wr_checkammo1, bool(entity thiswep))
- {
- SELFPARAM();
- return ((!WEP_CVAR(arc, beam_ammo)) || (self.(thiswep.ammo_field) > 0));
- }
- METHOD(Arc, wr_checkammo2, bool(entity thiswep))
- {
- SELFPARAM();
- if(WEP_CVAR(arc, bolt))
- {
- float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(arc, bolt_ammo);
- ammo_amount += self.(weapon_load[WEP_ARC.m_id]) >= WEP_CVAR(arc, bolt_ammo);
- return ammo_amount;
- }
- else
- return WEP_CVAR(arc, overheat_max) > 0 &&
- ((!WEP_CVAR(arc, burst_ammo)) || (self.(thiswep.ammo_field) > 0));
- }
- METHOD(Arc, wr_killmessage, Notification(entity thiswep))
- {
- if(w_deathtype & HITTYPE_SECONDARY)
- return WEAPON_ARC_MURDER_SPRAY;
- else
- return WEAPON_ARC_MURDER;
- }
- METHOD(Arc, wr_drop, void(entity thiswep))
- {
- weapon_dropevent_item.arc_overheat = self.arc_overheat;
- weapon_dropevent_item.arc_cooldown = self.arc_cooldown;
- self.arc_overheat = 0;
- self.arc_cooldown = 0;
- }
- METHOD(Arc, wr_pickup, void(entity thiswep))
- {
- if ( !client_hasweapon(self, thiswep, false, false) &&
- weapon_dropevent_item.arc_overheat > time )
- {
- self.arc_overheat = weapon_dropevent_item.arc_overheat;
- self.arc_cooldown = weapon_dropevent_item.arc_cooldown;
- }
- }
+ METHOD(Arc, wr_aim, void(entity thiswep))
+ {
+ SELFPARAM();
+ if(WEP_CVAR(arc, beam_botaimspeed))
+ {
+ PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(
+ WEP_CVAR(arc, beam_botaimspeed),
+ 0,
+ WEP_CVAR(arc, beam_botaimlifetime),
+ false
+ );
+ }
+ else
+ {
+ PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(
+ 1000000,
+ 0,
+ 0.001,
+ false
+ );
+ }
+ }
+ METHOD(Arc, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+ {
+ Arc_Player_SetHeat(actor);
+ Arc_Smoke();
+
+ bool beam_fire2 = ((fire & 2) && !WEP_CVAR(arc, bolt));
+
+ if (time >= actor.arc_overheat)
+ if ((fire & 1) || beam_fire2 || actor.arc_beam.beam_bursting)
+ {
+
+ if(actor.arc_BUTTON_ATCK_prev)
+ {
+ #if 0
+ if(actor.animstate_startframe == actor.anim_shoot.x && actor.animstate_numframes == actor.anim_shoot.y)
+ weapon_thinkf(actor, weaponentity, WFRAME_DONTCHANGE, autocvar_g_balance_arc_primary_animtime, w_ready);
+ else
+ #endif
+ weapon_thinkf(actor, weaponentity, WFRAME_DONTCHANGE, WEP_CVAR(arc, beam_animtime), w_ready);
+ }
+
+ if((!actor.arc_beam) || wasfreed(actor.arc_beam))
+ {
+ if(weapon_prepareattack(thiswep, actor, weaponentity, boolean(beam_fire2), 0))
+ {
+ W_Arc_Beam(boolean(beam_fire2));
+
+ if(!actor.arc_BUTTON_ATCK_prev)
+ {
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
+ actor.arc_BUTTON_ATCK_prev = true;
+ }
+ }
+ }
+
+ return;
+ }
+ else if(fire & 2)
+ {
+ if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(arc, bolt_refire)))
+ {
+ W_Arc_Attack_Bolt(thiswep);
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, bolt_refire), w_ready);
+ }
+ }
+
+ if(actor.arc_BUTTON_ATCK_prev)
+ {
+ sound(actor, CH_WEAPON_A, SND_ARC_STOP, VOL_BASE, ATTN_NORM);
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
+ int slot = weaponslot(weaponentity);
+ ATTACK_FINISHED(actor, slot) = time + WEP_CVAR(arc, beam_refire) * W_WeaponRateFactor();
+ }
+ actor.arc_BUTTON_ATCK_prev = false;
+
+ #if 0
+ if(fire & 2)
+ if(weapon_prepareattack(thiswep, actor, weaponentity, true, autocvar_g_balance_arc_secondary_refire))
+ {
+ W_Arc_Attack2();
+ actor.arc_count = autocvar_g_balance_arc_secondary_count;
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, autocvar_g_balance_arc_secondary_animtime, w_arc_checkattack);
+ actor.arc_secondarytime = time + autocvar_g_balance_arc_secondary_refire2 * W_WeaponRateFactor();
+ }
+ #endif
+ }
+ METHOD(Arc, wr_init, void(entity thiswep))
+ {
+ if(!arc_shotorigin[0])
+ {
+ arc_shotorigin[0] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 1);
+ arc_shotorigin[1] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 2);
+ arc_shotorigin[2] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 3);
+ arc_shotorigin[3] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 4);
+ }
+ }
+ METHOD(Arc, wr_checkammo1, bool(entity thiswep))
+ {
+ SELFPARAM();
+ return ((!WEP_CVAR(arc, beam_ammo)) || (self.(thiswep.ammo_field) > 0));
+ }
+ METHOD(Arc, wr_checkammo2, bool(entity thiswep))
+ {
+ SELFPARAM();
+ if(WEP_CVAR(arc, bolt))
+ {
+ float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(arc, bolt_ammo);
+ ammo_amount += self.(weapon_load[WEP_ARC.m_id]) >= WEP_CVAR(arc, bolt_ammo);
+ return ammo_amount;
+ }
+ else
+ return WEP_CVAR(arc, overheat_max) > 0 &&
+ ((!WEP_CVAR(arc, burst_ammo)) || (self.(thiswep.ammo_field) > 0));
+ }
-METHOD(Arc, wr_killmessage, int(entity thiswep))
++METHOD(Arc, wr_killmessage, Notification(entity thiswep))
+ {
+ if(w_deathtype & HITTYPE_SECONDARY)
+ return WEAPON_ARC_MURDER_SPRAY;
+ else
+ return WEAPON_ARC_MURDER;
+ }
+ METHOD(Arc, wr_drop, void(entity thiswep))
+ {
+ weapon_dropevent_item.arc_overheat = self.arc_overheat;
+ weapon_dropevent_item.arc_cooldown = self.arc_cooldown;
+ self.arc_overheat = 0;
+ self.arc_cooldown = 0;
+ }
+ METHOD(Arc, wr_pickup, void(entity thiswep))
+ {
+ if ( !client_hasweapon(self, thiswep, false, false) &&
+ weapon_dropevent_item.arc_overheat > time )
+ {
+ self.arc_overheat = weapon_dropevent_item.arc_overheat;
+ self.arc_cooldown = weapon_dropevent_item.arc_cooldown;
+ }
+ }
#endif
#ifdef CSQC
bool autocvar_cl_arcbeam_teamcolor = true;
- METHOD(Arc, wr_impacteffect, void(entity thiswep))
- {
- if(w_deathtype & HITTYPE_SECONDARY)
- {
- vector org2;
- org2 = w_org + w_backoff * 6;
- pointparticles(EFFECT_ARC_BOLT_EXPLODE, org2, w_backoff * 1000, 1);
- if(!w_issilent) { sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); }
- }
- }
+ METHOD(Arc, wr_impacteffect, void(entity thiswep))
+ {
+ if(w_deathtype & HITTYPE_SECONDARY)
+ {
+ vector org2;
+ org2 = w_org + w_backoff * 6;
+ pointparticles(EFFECT_ARC_BOLT_EXPLODE, org2, w_backoff * 1000, 1);
+ if(!w_issilent) { sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); }
+ }
+ }
void Draw_ArcBeam_callback(vector start, vector hit, vector end)
{
}
}
- METHOD(Blaster, wr_aim, void(entity thiswep))
- {
- if(WEP_CVAR(blaster, secondary))
- {
- if((random() * (WEP_CVAR_PRI(blaster, damage) + WEP_CVAR_SEC(blaster, damage))) > WEP_CVAR_PRI(blaster, damage))
- { self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_SEC(blaster, speed), 0, WEP_CVAR_SEC(blaster, lifetime), false); }
- else
- { self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), false); }
- }
- else
- { self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), false); }
- }
+ METHOD(Blaster, wr_aim, void(entity thiswep))
+ {
+ if(WEP_CVAR(blaster, secondary))
+ {
+ if((random() * (WEP_CVAR_PRI(blaster, damage) + WEP_CVAR_SEC(blaster, damage))) > WEP_CVAR_PRI(blaster, damage))
+ { PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(WEP_CVAR_SEC(blaster, speed), 0, WEP_CVAR_SEC(blaster, lifetime), false); }
+ else
+ { PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), false); }
+ }
+ else
+ { PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), false); }
+ }
- METHOD(Blaster, wr_think, void(Blaster thiswep, entity actor, .entity weaponentity, int fire))
- {
- if(fire & 1)
- {
- if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(blaster, refire)))
- {
- W_Blaster_Attack(
- actor,
- WEP_BLASTER.m_id,
- WEP_CVAR_PRI(blaster, shotangle),
- WEP_CVAR_PRI(blaster, damage),
- WEP_CVAR_PRI(blaster, edgedamage),
- WEP_CVAR_PRI(blaster, radius),
- WEP_CVAR_PRI(blaster, force),
- WEP_CVAR_PRI(blaster, speed),
- WEP_CVAR_PRI(blaster, spread),
- WEP_CVAR_PRI(blaster, delay),
- WEP_CVAR_PRI(blaster, lifetime)
- );
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(blaster, animtime), w_ready);
- }
- }
- else if(fire & 2)
- {
- switch(WEP_CVAR(blaster, secondary))
- {
- case 0: // switch to last used weapon
- {
- if(PS(actor).m_switchweapon == WEP_BLASTER) // don't do this if already switching
- W_LastWeapon(actor);
- break;
- }
+ METHOD(Blaster, wr_think, void(Blaster thiswep, entity actor, .entity weaponentity, int fire))
+ {
+ if(fire & 1)
+ {
+ if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(blaster, refire)))
+ {
+ W_Blaster_Attack(
+ actor,
+ WEP_BLASTER.m_id,
+ WEP_CVAR_PRI(blaster, shotangle),
+ WEP_CVAR_PRI(blaster, damage),
+ WEP_CVAR_PRI(blaster, edgedamage),
+ WEP_CVAR_PRI(blaster, radius),
+ WEP_CVAR_PRI(blaster, force),
+ WEP_CVAR_PRI(blaster, speed),
+ WEP_CVAR_PRI(blaster, spread),
+ WEP_CVAR_PRI(blaster, delay),
+ WEP_CVAR_PRI(blaster, lifetime)
+ );
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(blaster, animtime), w_ready);
+ }
+ }
+ else if(fire & 2)
+ {
+ switch(WEP_CVAR(blaster, secondary))
+ {
+ case 0: // switch to last used weapon
+ {
+ if(PS(actor).m_switchweapon == WEP_BLASTER) // don't do this if already switching
+ W_LastWeapon(actor);
+ break;
+ }
- case 1: // normal projectile secondary
- {
- if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(blaster, refire)))
- {
- W_Blaster_Attack(
- actor,
- WEP_BLASTER.m_id | HITTYPE_SECONDARY,
- WEP_CVAR_SEC(blaster, shotangle),
- WEP_CVAR_SEC(blaster, damage),
- WEP_CVAR_SEC(blaster, edgedamage),
- WEP_CVAR_SEC(blaster, radius),
- WEP_CVAR_SEC(blaster, force),
- WEP_CVAR_SEC(blaster, speed),
- WEP_CVAR_SEC(blaster, spread),
- WEP_CVAR_SEC(blaster, delay),
- WEP_CVAR_SEC(blaster, lifetime)
- );
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(blaster, animtime), w_ready);
- }
+ case 1: // normal projectile secondary
+ {
+ if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(blaster, refire)))
+ {
+ W_Blaster_Attack(
+ actor,
+ WEP_BLASTER.m_id | HITTYPE_SECONDARY,
+ WEP_CVAR_SEC(blaster, shotangle),
+ WEP_CVAR_SEC(blaster, damage),
+ WEP_CVAR_SEC(blaster, edgedamage),
+ WEP_CVAR_SEC(blaster, radius),
+ WEP_CVAR_SEC(blaster, force),
+ WEP_CVAR_SEC(blaster, speed),
+ WEP_CVAR_SEC(blaster, spread),
+ WEP_CVAR_SEC(blaster, delay),
+ WEP_CVAR_SEC(blaster, lifetime)
+ );
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(blaster, animtime), w_ready);
+ }
- break;
- }
- }
- }
- }
+ break;
+ }
+ }
+ }
+ }
- METHOD(Blaster, wr_setup, void(entity thiswep))
- {
- self.ammo_field = ammo_none;
- }
+ METHOD(Blaster, wr_setup, void(entity thiswep))
+ {
+ self.ammo_field = ammo_none;
+ }
- METHOD(Blaster, wr_checkammo1, bool(entity thiswep))
- {
- return true; // infinite ammo
- }
+ METHOD(Blaster, wr_checkammo1, bool(entity thiswep))
+ {
+ return true; // infinite ammo
+ }
- METHOD(Blaster, wr_checkammo2, bool(entity thiswep))
- {
- return true; // blaster has infinite ammo
- }
+ METHOD(Blaster, wr_checkammo2, bool(entity thiswep))
+ {
+ return true; // blaster has infinite ammo
+ }
- METHOD(Blaster, wr_suicidemessage, Notification(entity thiswep))
- {
- return WEAPON_BLASTER_SUICIDE;
- }
-METHOD(Blaster, wr_suicidemessage, int(entity thiswep))
++METHOD(Blaster, wr_suicidemessage, Notification(entity thiswep))
+ {
+ return WEAPON_BLASTER_SUICIDE;
+ }
- METHOD(Blaster, wr_killmessage, Notification(entity thiswep))
- {
- return WEAPON_BLASTER_MURDER;
- }
-METHOD(Blaster, wr_killmessage, int(entity thiswep))
++METHOD(Blaster, wr_killmessage, Notification(entity thiswep))
+ {
+ return WEAPON_BLASTER_MURDER;
+ }
#endif
#ifdef CSQC
- METHOD(Blaster, wr_impacteffect, void(entity thiswep))
- {
- vector org2;
- org2 = w_org + w_backoff * 6;
- pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);
- if(!w_issilent) { sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); }
- }
+ METHOD(Blaster, wr_impacteffect, void(entity thiswep))
+ {
+ vector org2;
+ org2 = w_org + w_backoff * 6;
+ pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);
+ if(!w_issilent) { sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); }
+ }
#endif
#endif
}
}
- METHOD(Crylink, wr_aim, void(entity thiswep))
- {
- SELFPARAM();
- if(random() < 0.10)
- self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(crylink, speed), 0, WEP_CVAR_PRI(crylink, middle_lifetime), false);
- else
- self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_SEC(crylink, speed), 0, WEP_CVAR_SEC(crylink, middle_lifetime), false);
- }
- METHOD(Crylink, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
- {
- if(autocvar_g_balance_crylink_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo))) { // forced reload
- thiswep.wr_reload(thiswep, actor, weaponentity);
- }
-
- if(fire & 1)
- {
- if(actor.crylink_waitrelease != 1)
- if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(crylink, refire)))
- {
- W_Crylink_Attack(thiswep);
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(crylink, animtime), w_ready);
- }
- }
-
- if((fire & 2) && autocvar_g_balance_crylink_secondary)
- {
- if(actor.crylink_waitrelease != 2)
- if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(crylink, refire)))
- {
- W_Crylink_Attack2(thiswep);
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(crylink, animtime), w_ready);
- }
- }
-
- if((actor.crylink_waitrelease == 1 && !(fire & 1)) || (actor.crylink_waitrelease == 2 && !(fire & 2)))
- {
- if(!actor.crylink_lastgroup || time > actor.crylink_lastgroup.teleport_time)
- {
- // fired and released now!
- if(actor.crylink_lastgroup)
- {
- vector pos;
- entity linkjoineffect;
- float isprimary = (actor.crylink_waitrelease == 1);
-
- pos = W_Crylink_LinkJoin(actor.crylink_lastgroup, WEP_CVAR_BOTH(crylink, isprimary, joinspread) * WEP_CVAR_BOTH(crylink, isprimary, speed));
-
- linkjoineffect = new(linkjoineffect);
- linkjoineffect.think = W_Crylink_LinkJoinEffect_Think;
- linkjoineffect.nextthink = time + w_crylink_linkjoin_time;
- linkjoineffect.owner = actor;
- setorigin(linkjoineffect, pos);
- }
- actor.crylink_waitrelease = 0;
- if(!thiswep.wr_checkammo1(thiswep) && !thiswep.wr_checkammo2(thiswep))
- if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
- {
- // ran out of ammo!
- actor.cnt = WEP_CRYLINK.m_id;
- PS(actor).m_switchweapon = w_getbestweapon(actor);
- }
- }
- }
- }
- METHOD(Crylink, wr_checkammo1, bool(entity thiswep))
- {
- SELFPARAM();
- // don't "run out of ammo" and switch weapons while waiting for release
- if(self.crylink_lastgroup && self.crylink_waitrelease)
- return true;
-
- float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(crylink, ammo);
- ammo_amount += self.(weapon_load[WEP_CRYLINK.m_id]) >= WEP_CVAR_PRI(crylink, ammo);
- return ammo_amount;
- }
- METHOD(Crylink, wr_checkammo2, bool(entity thiswep))
- {
- SELFPARAM();
- // don't "run out of ammo" and switch weapons while waiting for release
- if(self.crylink_lastgroup && self.crylink_waitrelease)
- return true;
-
- float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(crylink, ammo);
- ammo_amount += self.(weapon_load[WEP_CRYLINK.m_id]) >= WEP_CVAR_SEC(crylink, ammo);
- return ammo_amount;
- }
- METHOD(Crylink, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
- {
- W_Reload(self, min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo)), SND(RELOAD));
- }
- METHOD(Crylink, wr_suicidemessage, Notification(entity thiswep))
- {
- return WEAPON_CRYLINK_SUICIDE;
- }
- METHOD(Crylink, wr_killmessage, Notification(entity thiswep))
- {
- return WEAPON_CRYLINK_MURDER;
- }
+ METHOD(Crylink, wr_aim, void(entity thiswep))
+ {
+ SELFPARAM();
+ if(random() < 0.10)
+ PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR_PRI(crylink, speed), 0, WEP_CVAR_PRI(crylink, middle_lifetime), false);
+ else
+ PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(WEP_CVAR_SEC(crylink, speed), 0, WEP_CVAR_SEC(crylink, middle_lifetime), false);
+ }
+ METHOD(Crylink, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+ {
+ if(autocvar_g_balance_crylink_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo))) { // forced reload
+ thiswep.wr_reload(thiswep, actor, weaponentity);
+ }
+
+ if(fire & 1)
+ {
+ if(actor.crylink_waitrelease != 1)
+ if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(crylink, refire)))
+ {
+ W_Crylink_Attack(thiswep);
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(crylink, animtime), w_ready);
+ }
+ }
+
+ if((fire & 2) && autocvar_g_balance_crylink_secondary)
+ {
+ if(actor.crylink_waitrelease != 2)
+ if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(crylink, refire)))
+ {
+ W_Crylink_Attack2(thiswep);
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(crylink, animtime), w_ready);
+ }
+ }
+
+ if((actor.crylink_waitrelease == 1 && !(fire & 1)) || (actor.crylink_waitrelease == 2 && !(fire & 2)))
+ {
+ if(!actor.crylink_lastgroup || time > actor.crylink_lastgroup.teleport_time)
+ {
+ // fired and released now!
+ if(actor.crylink_lastgroup)
+ {
+ vector pos;
+ entity linkjoineffect;
+ float isprimary = (actor.crylink_waitrelease == 1);
+
+ pos = W_Crylink_LinkJoin(actor.crylink_lastgroup, WEP_CVAR_BOTH(crylink, isprimary, joinspread) * WEP_CVAR_BOTH(crylink, isprimary, speed));
+
+ linkjoineffect = new(linkjoineffect);
+ linkjoineffect.think = W_Crylink_LinkJoinEffect_Think;
+ linkjoineffect.nextthink = time + w_crylink_linkjoin_time;
+ linkjoineffect.owner = actor;
+ setorigin(linkjoineffect, pos);
+ }
+ actor.crylink_waitrelease = 0;
+ if(!thiswep.wr_checkammo1(thiswep) && !thiswep.wr_checkammo2(thiswep))
+ if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
+ {
+ // ran out of ammo!
+ actor.cnt = WEP_CRYLINK.m_id;
+ PS(actor).m_switchweapon = w_getbestweapon(actor);
+ }
+ }
+ }
+ }
+ METHOD(Crylink, wr_checkammo1, bool(entity thiswep))
+ {
+ SELFPARAM();
+ // don't "run out of ammo" and switch weapons while waiting for release
+ if(self.crylink_lastgroup && self.crylink_waitrelease)
+ return true;
+
+ float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(crylink, ammo);
+ ammo_amount += self.(weapon_load[WEP_CRYLINK.m_id]) >= WEP_CVAR_PRI(crylink, ammo);
+ return ammo_amount;
+ }
+ METHOD(Crylink, wr_checkammo2, bool(entity thiswep))
+ {
+ SELFPARAM();
+ // don't "run out of ammo" and switch weapons while waiting for release
+ if(self.crylink_lastgroup && self.crylink_waitrelease)
+ return true;
+
+ float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(crylink, ammo);
+ ammo_amount += self.(weapon_load[WEP_CRYLINK.m_id]) >= WEP_CVAR_SEC(crylink, ammo);
+ return ammo_amount;
+ }
+ METHOD(Crylink, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+ {
+ W_Reload(self, min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo)), SND(RELOAD));
+ }
-METHOD(Crylink, wr_suicidemessage, int(entity thiswep))
++METHOD(Crylink, wr_suicidemessage, Notification(entity thiswep))
+ {
+ return WEAPON_CRYLINK_SUICIDE;
+ }
-METHOD(Crylink, wr_killmessage, int(entity thiswep))
++METHOD(Crylink, wr_killmessage, Notification(entity thiswep))
+ {
+ return WEAPON_CRYLINK_MURDER;
+ }
#endif
#ifdef CSQC
- METHOD(Crylink, wr_impacteffect, void(entity thiswep))
- {
- SELFPARAM();
- vector org2;
- org2 = w_org + w_backoff * 2;
- if(w_deathtype & HITTYPE_SECONDARY)
- {
- pointparticles(EFFECT_CRYLINK_IMPACT2, org2, '0 0 0', 1);
- if(!w_issilent)
- sound(self, CH_SHOTS, SND_CRYLINK_IMPACT2, VOL_BASE, ATTN_NORM);
- }
- else
- {
- pointparticles(EFFECT_CRYLINK_IMPACT, org2, '0 0 0', 1);
- if(!w_issilent)
- sound(self, CH_SHOTS, SND_CRYLINK_IMPACT, VOL_BASE, ATTN_NORM);
- }
- }
+ METHOD(Crylink, wr_impacteffect, void(entity thiswep))
+ {
+ SELFPARAM();
+ vector org2;
+ org2 = w_org + w_backoff * 2;
+ if(w_deathtype & HITTYPE_SECONDARY)
+ {
+ pointparticles(EFFECT_CRYLINK_IMPACT2, org2, '0 0 0', 1);
+ if(!w_issilent)
+ sound(self, CH_SHOTS, SND_CRYLINK_IMPACT2, VOL_BASE, ATTN_NORM);
+ }
+ else
+ {
+ pointparticles(EFFECT_CRYLINK_IMPACT, org2, '0 0 0', 1);
+ if(!w_issilent)
+ sound(self, CH_SHOTS, SND_CRYLINK_IMPACT, VOL_BASE, ATTN_NORM);
+ }
+ }
#endif
#endif
{
if(self == self.realowner.lastrocket)
if(!self.realowner.rl_release)
- if(!self.BUTTON_ATCK2)
+ if(!PHYS_INPUT_BUTTON_ATCK2(self))
if(WEP_CVAR(devastator, guiderate))
if(time > self.pushltime)
if(!IS_DEAD(self.realowner))
MUTATOR_CALLHOOK(EditProjectile, self, missile);
}
- #if 0
- METHOD(Devastator, wr_aim, void(entity thiswep))
- {
- // 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!
- {
- // decide whether to detonate rockets
- entity missile, targetlist, targ;
- targetlist = findchainfloat(bot_attack, true);
- for(missile = world; (missile = find(missile, classname, "rocket")); ) if(missile.realowner == self)
- {
- targ = targetlist;
- while(targ)
- {
- if(targ != missile.realowner && vlen(targ.origin - missile.origin) < WEP_CVAR(devastator, radius))
- {
- self.BUTTON_ATCK2 = true;
- break;
- }
- targ = targ.chain;
- }
- }
-
- if(self.BUTTON_ATCK2) self.BUTTON_ATCK = false;
- }
- }
- #else
- METHOD(Devastator, wr_aim, void(entity thiswep))
- {
- // 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!
- {
- // decide whether to detonate rockets
- entity 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);
- FOREACH_ENTITY_ENT(realowner, self,
- {
- if(it.classname != "rocket") continue;
-
- targ = targetlist;
- while(targ)
- {
- d = vlen(targ.origin + (targ.mins + targ.maxs) * 0.5 - it.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;
- }
- });
- 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;
-
- FOREACH_ENTITY_ENT(realowner, self,
- {
- if(it.classname != "rocket") continue;
-
- makevectors(it.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(it.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(it.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");
- }
- });
- // 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;
- }
- }
- #endif
- METHOD(Devastator, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
- {
- if(WEP_CVAR(devastator, reload_ammo) && actor.clip_load < WEP_CVAR(devastator, ammo)) { // forced reload
- thiswep.wr_reload(thiswep, actor, weaponentity);
- } else {
- if(fire & 1)
- {
- if(actor.rl_release || WEP_CVAR(devastator, guidestop))
- if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(devastator, refire)))
- {
- W_Devastator_Attack(thiswep);
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(devastator, animtime), w_ready);
- actor.rl_release = 0;
- }
- }
- else
- actor.rl_release = 1;
-
- if(fire & 2)
- if(PS(actor).m_switchweapon == WEP_DEVASTATOR)
- {
- entity rock;
- bool rockfound = false;
- for(rock = world; (rock = find(rock, classname, "rocket")); ) if(rock.realowner == actor)
- {
- if(!rock.rl_detonate_later)
- {
- rock.rl_detonate_later = true;
- rockfound = true;
- }
- }
- if(rockfound)
- sound(actor, CH_WEAPON_B, SND_ROCKET_DET, VOL_BASE, ATTN_NORM);
- }
- }
- }
- METHOD(Devastator, wr_setup, void(entity thiswep))
- {
- self.rl_release = 1;
- }
- METHOD(Devastator, wr_checkammo1, bool(entity thiswep))
- {
- #if 0
- // don't switch while guiding a missile
- if(ATTACK_FINISHED(self, slot) <= time || PS(self).m_weapon != WEP_DEVASTATOR)
- {
- ammo_amount = false;
- if(WEP_CVAR(devastator, reload_ammo))
- {
- if(self.(thiswep.ammo_field) < WEP_CVAR(devastator, ammo) && self.(weapon_load[WEP_DEVASTATOR.m_id]) < WEP_CVAR(devastator, ammo))
- ammo_amount = true;
- }
- else if(self.(thiswep.ammo_field) < WEP_CVAR(devastator, ammo))
- ammo_amount = true;
- return !ammo_amount;
- }
- #endif
- #if 0
- if(self.rl_release == 0)
- {
- LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: TRUE\n", self.rl_release, self.(thiswep.ammo_field), WEP_CVAR(devastator, ammo));
- return true;
- }
- else
- {
- ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(devastator, ammo);
- ammo_amount += self.(weapon_load[WEP_DEVASTATOR.m_id]) >= WEP_CVAR(devastator, ammo);
- LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: %s\n", self.rl_release, self.(thiswep.ammo_field), WEP_CVAR(devastator, ammo), (ammo_amount ? "TRUE" : "FALSE"));
- return ammo_amount;
- }
- #else
- float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(devastator, ammo);
- ammo_amount += self.(weapon_load[WEP_DEVASTATOR.m_id]) >= WEP_CVAR(devastator, ammo);
- return ammo_amount;
- #endif
- }
- METHOD(Devastator, wr_checkammo2, bool(entity thiswep))
- {
- return false;
- }
- METHOD(Devastator, wr_resetplayer, void(entity thiswep))
- {
- self.lastrocket = NULL; // stop rocket guiding, no revenge from the grave!
- self.rl_release = 0;
- }
- METHOD(Devastator, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
- {
- W_Reload(self, WEP_CVAR(devastator, ammo), SND(RELOAD));
- }
- METHOD(Devastator, wr_suicidemessage, Notification(entity thiswep))
- {
- return WEAPON_DEVASTATOR_SUICIDE;
- }
- METHOD(Devastator, wr_killmessage, Notification(entity thiswep))
- {
- if((w_deathtype & HITTYPE_BOUNCE) || (w_deathtype & HITTYPE_SPLASH))
- return WEAPON_DEVASTATOR_MURDER_SPLASH;
- else
- return WEAPON_DEVASTATOR_MURDER_DIRECT;
- }
+ #if 0
+ METHOD(Devastator, wr_aim, void(entity thiswep))
+ {
+ // aim and decide to fire if appropriate
+ PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR(devastator, speed), 0, WEP_CVAR(devastator, lifetime), false);
+ if(skill >= 2) // skill 0 and 1 bots won't detonate rockets!
+ {
+ // decide whether to detonate rockets
+ entity missile, targetlist, targ;
+ targetlist = findchainfloat(bot_attack, true);
+ for(missile = world; (missile = find(missile, classname, "rocket")); ) if(missile.realowner == self)
+ {
+ targ = targetlist;
+ while(targ)
+ {
+ if(targ != missile.realowner && vlen(targ.origin - missile.origin) < WEP_CVAR(devastator, radius))
+ {
+ PHYS_INPUT_BUTTON_ATCK2(self) = true;
+ break;
+ }
+ targ = targ.chain;
+ }
+ }
+
+ if(PHYS_INPUT_BUTTON_ATCK2(self)) PHYS_INPUT_BUTTON_ATCK(self) = false;
+ }
+ }
+ #else
+ METHOD(Devastator, wr_aim, void(entity thiswep))
+ {
+ // aim and decide to fire if appropriate
+ PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR(devastator, speed), 0, WEP_CVAR(devastator, lifetime), false);
+ if(skill >= 2) // skill 0 and 1 bots won't detonate rockets!
+ {
+ // decide whether to detonate rockets
+ entity 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);
+ FOREACH_ENTITY_ENT(realowner, self,
+ {
+ if(it.classname != "rocket") continue;
+
+ targ = targetlist;
+ while(targ)
+ {
+ d = vlen(targ.origin + (targ.mins + targ.maxs) * 0.5 - it.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;
+ }
+ });
+ 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;
+
+ FOREACH_ENTITY_ENT(realowner, self,
+ {
+ if(it.classname != "rocket") continue;
+
+ makevectors(it.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(it.origin - targ.origin)< 0.1)
+ && desirabledamage > 0.1*coredamage
+ ) PHYS_INPUT_BUTTON_ATCK2(self) = 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(it.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))
+ PHYS_INPUT_BUTTON_ATCK2(self) = true;
+ // dprint(ftos(random()/distance*300),">");dprint(ftos(frametime*bound(0,(10-skill)*0.2,1)),"\n");
+ }
+ });
+ // 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
+ PHYS_INPUT_BUTTON_ATCK2(self) = true;
+ if((skill > 6.5) && (selfdamage > self.health))
+ PHYS_INPUT_BUTTON_ATCK2(self) = false;
+ //if(PHYS_INPUT_BUTTON_ATCK2(self) == true)
+ // dprint(ftos(desirabledamage),"\n");
+ if(PHYS_INPUT_BUTTON_ATCK2(self)) PHYS_INPUT_BUTTON_ATCK(self) = false;
+ }
+ }
+ #endif
+ METHOD(Devastator, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+ {
+ if(WEP_CVAR(devastator, reload_ammo) && actor.clip_load < WEP_CVAR(devastator, ammo)) { // forced reload
+ thiswep.wr_reload(thiswep, actor, weaponentity);
+ } else {
+ if(fire & 1)
+ {
+ if(actor.rl_release || WEP_CVAR(devastator, guidestop))
+ if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(devastator, refire)))
+ {
+ W_Devastator_Attack(thiswep);
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(devastator, animtime), w_ready);
+ actor.rl_release = 0;
+ }
+ }
+ else
+ actor.rl_release = 1;
+
+ if(fire & 2)
+ if(PS(actor).m_switchweapon == WEP_DEVASTATOR)
+ {
+ entity rock;
+ bool rockfound = false;
+ for(rock = world; (rock = find(rock, classname, "rocket")); ) if(rock.realowner == actor)
+ {
+ if(!rock.rl_detonate_later)
+ {
+ rock.rl_detonate_later = true;
+ rockfound = true;
+ }
+ }
+ if(rockfound)
+ sound(actor, CH_WEAPON_B, SND_ROCKET_DET, VOL_BASE, ATTN_NORM);
+ }
+ }
+ }
+ METHOD(Devastator, wr_setup, void(entity thiswep))
+ {
+ self.rl_release = 1;
+ }
+ METHOD(Devastator, wr_checkammo1, bool(entity thiswep))
+ {
+ #if 0
+ // don't switch while guiding a missile
+ if(ATTACK_FINISHED(self, slot) <= time || PS(self).m_weapon != WEP_DEVASTATOR)
+ {
+ ammo_amount = false;
+ if(WEP_CVAR(devastator, reload_ammo))
+ {
+ if(self.(thiswep.ammo_field) < WEP_CVAR(devastator, ammo) && self.(weapon_load[WEP_DEVASTATOR.m_id]) < WEP_CVAR(devastator, ammo))
+ ammo_amount = true;
+ }
+ else if(self.(thiswep.ammo_field) < WEP_CVAR(devastator, ammo))
+ ammo_amount = true;
+ return !ammo_amount;
+ }
+ #endif
+ #if 0
+ if(self.rl_release == 0)
+ {
+ LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: TRUE\n", self.rl_release, self.(thiswep.ammo_field), WEP_CVAR(devastator, ammo));
+ return true;
+ }
+ else
+ {
+ ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(devastator, ammo);
+ ammo_amount += self.(weapon_load[WEP_DEVASTATOR.m_id]) >= WEP_CVAR(devastator, ammo);
+ LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: %s\n", self.rl_release, self.(thiswep.ammo_field), WEP_CVAR(devastator, ammo), (ammo_amount ? "TRUE" : "FALSE"));
+ return ammo_amount;
+ }
+ #else
+ float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(devastator, ammo);
+ ammo_amount += self.(weapon_load[WEP_DEVASTATOR.m_id]) >= WEP_CVAR(devastator, ammo);
+ return ammo_amount;
+ #endif
+ }
+ METHOD(Devastator, wr_checkammo2, bool(entity thiswep))
+ {
+ return false;
+ }
+ METHOD(Devastator, wr_resetplayer, void(entity thiswep))
+ {
+ self.lastrocket = NULL; // stop rocket guiding, no revenge from the grave!
+ self.rl_release = 0;
+ }
+ METHOD(Devastator, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+ {
+ W_Reload(self, WEP_CVAR(devastator, ammo), SND(RELOAD));
+ }
-METHOD(Devastator, wr_suicidemessage, int(entity thiswep))
++METHOD(Devastator, wr_suicidemessage, Notification(entity thiswep))
+ {
+ return WEAPON_DEVASTATOR_SUICIDE;
+ }
-METHOD(Devastator, wr_killmessage, int(entity thiswep))
++METHOD(Devastator, wr_killmessage, Notification(entity thiswep))
+ {
+ if((w_deathtype & HITTYPE_BOUNCE) || (w_deathtype & HITTYPE_SPLASH))
+ return WEAPON_DEVASTATOR_MURDER_SPLASH;
+ else
+ return WEAPON_DEVASTATOR_MURDER_DIRECT;
+ }
#endif
#ifdef CSQC
- METHOD(Devastator, wr_impacteffect, void(entity thiswep))
- {
- vector org2;
- org2 = w_org + w_backoff * 12;
- pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1);
- if(!w_issilent)
- sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTN_NORM);
- }
+ METHOD(Devastator, wr_impacteffect, void(entity thiswep))
+ {
+ vector org2;
+ org2 = w_org + w_backoff * 12;
+ pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1);
+ if(!w_issilent)
+ sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTN_NORM);
+ }
#endif
#endif
void W_Electro_CheckAttack(Weapon thiswep, entity actor, .entity weaponentity, int fire)
{SELFPARAM();
if(self.electro_count > 1)
- if(self.BUTTON_ATCK2)
+ if(PHYS_INPUT_BUTTON_ATCK2(self))
if(weapon_prepareattack(thiswep, actor, weaponentity, true, -1))
{
W_Electro_Attack_Orb(WEP_ELECTRO);
.float bot_secondary_electromooth;
- METHOD(Electro, wr_aim, void(entity thiswep))
- {
- self.BUTTON_ATCK = self.BUTTON_ATCK2 = false;
- if(vdist(self.origin - self.enemy.origin, >, 1000)) { self.bot_secondary_electromooth = 0; }
- if(self.bot_secondary_electromooth == 0)
- {
- float shoot;
-
- if(WEP_CVAR_PRI(electro, speed))
- shoot = bot_aim(WEP_CVAR_PRI(electro, speed), 0, WEP_CVAR_PRI(electro, 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;
- }
- }
- else
- {
- if(bot_aim(WEP_CVAR_SEC(electro, speed), WEP_CVAR_SEC(electro, speed_up), WEP_CVAR_SEC(electro, lifetime), true))
- {
- self.BUTTON_ATCK2 = true;
- if(random() < 0.03) self.bot_secondary_electromooth = 0;
- }
- }
- }
- METHOD(Electro, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
- {
- if(autocvar_g_balance_electro_reload_ammo) // forced reload // WEAPONTODO
- {
- float ammo_amount = 0;
- if(actor.clip_load >= WEP_CVAR_PRI(electro, ammo))
- ammo_amount = 1;
- if(actor.clip_load >= WEP_CVAR_SEC(electro, ammo))
- ammo_amount += 1;
-
- if(!ammo_amount)
- {
- thiswep.wr_reload(thiswep, actor, weaponentity);
- return;
- }
- }
-
- if(fire & 1)
- {
- if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(electro, refire)))
- {
- W_Electro_Attack_Bolt(thiswep);
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
- }
- }
- else if(fire & 2)
- {
- if(time >= actor.electro_secondarytime)
- if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(electro, refire)))
- {
- W_Electro_Attack_Orb(thiswep);
- actor.electro_count = WEP_CVAR_SEC(electro, count);
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(electro, animtime), W_Electro_CheckAttack);
- actor.electro_secondarytime = time + WEP_CVAR_SEC(electro, refire2) * W_WeaponRateFactor();
- }
- }
- }
- METHOD(Electro, wr_checkammo1, bool(entity thiswep))
- {
- float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(electro, ammo);
- ammo_amount += self.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_PRI(electro, ammo);
- return ammo_amount;
- }
- METHOD(Electro, wr_checkammo2, bool(entity thiswep))
- {
- float ammo_amount;
- if(WEP_CVAR(electro, combo_safeammocheck)) // true if you can fire at least one secondary blob AND one primary shot after it, otherwise false.
- {
- ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo);
- ammo_amount += self.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo);
- }
- else
- {
- ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(electro, ammo);
- ammo_amount += self.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_SEC(electro, ammo);
- }
- return ammo_amount;
- }
- METHOD(Electro, wr_resetplayer, void(entity thiswep))
- {
- self.electro_secondarytime = time;
- }
- METHOD(Electro, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
- {
- W_Reload(self, min(WEP_CVAR_PRI(electro, ammo), WEP_CVAR_SEC(electro, ammo)), SND(RELOAD));
- }
- METHOD(Electro, wr_suicidemessage, Notification(entity thiswep))
- {
- if(w_deathtype & HITTYPE_SECONDARY)
- return WEAPON_ELECTRO_SUICIDE_ORBS;
- else
- return WEAPON_ELECTRO_SUICIDE_BOLT;
- }
- METHOD(Electro, wr_killmessage, Notification(entity thiswep))
- {
- if(w_deathtype & HITTYPE_SECONDARY)
- {
- return WEAPON_ELECTRO_MURDER_ORBS;
- }
- else
- {
- if(w_deathtype & HITTYPE_BOUNCE)
- return WEAPON_ELECTRO_MURDER_COMBO;
- else
- return WEAPON_ELECTRO_MURDER_BOLT;
- }
- }
+ METHOD(Electro, wr_aim, void(entity thiswep))
+ {
+ PHYS_INPUT_BUTTON_ATCK(self) = PHYS_INPUT_BUTTON_ATCK2(self) = false;
+ if(vdist(self.origin - self.enemy.origin, >, 1000)) { self.bot_secondary_electromooth = 0; }
+ if(self.bot_secondary_electromooth == 0)
+ {
+ float shoot;
+
+ if(WEP_CVAR_PRI(electro, speed))
+ shoot = bot_aim(WEP_CVAR_PRI(electro, speed), 0, WEP_CVAR_PRI(electro, lifetime), false);
+ else
+ shoot = bot_aim(1000000, 0, 0.001, false);
+
+ if(shoot)
+ {
+ PHYS_INPUT_BUTTON_ATCK(self) = true;
+ if(random() < 0.01) self.bot_secondary_electromooth = 1;
+ }
+ }
+ else
+ {
+ if(bot_aim(WEP_CVAR_SEC(electro, speed), WEP_CVAR_SEC(electro, speed_up), WEP_CVAR_SEC(electro, lifetime), true))
+ {
+ PHYS_INPUT_BUTTON_ATCK2(self) = true;
+ if(random() < 0.03) self.bot_secondary_electromooth = 0;
+ }
+ }
+ }
+ METHOD(Electro, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+ {
+ if(autocvar_g_balance_electro_reload_ammo) // forced reload // WEAPONTODO
+ {
+ float ammo_amount = 0;
+ if(actor.clip_load >= WEP_CVAR_PRI(electro, ammo))
+ ammo_amount = 1;
+ if(actor.clip_load >= WEP_CVAR_SEC(electro, ammo))
+ ammo_amount += 1;
+
+ if(!ammo_amount)
+ {
+ thiswep.wr_reload(thiswep, actor, weaponentity);
+ return;
+ }
+ }
+
+ if(fire & 1)
+ {
+ if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(electro, refire)))
+ {
+ W_Electro_Attack_Bolt(thiswep);
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
+ }
+ }
+ else if(fire & 2)
+ {
+ if(time >= actor.electro_secondarytime)
+ if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(electro, refire)))
+ {
+ W_Electro_Attack_Orb(thiswep);
+ actor.electro_count = WEP_CVAR_SEC(electro, count);
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(electro, animtime), W_Electro_CheckAttack);
+ actor.electro_secondarytime = time + WEP_CVAR_SEC(electro, refire2) * W_WeaponRateFactor();
+ }
+ }
+ }
+ METHOD(Electro, wr_checkammo1, bool(entity thiswep))
+ {
+ float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(electro, ammo);
+ ammo_amount += self.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_PRI(electro, ammo);
+ return ammo_amount;
+ }
+ METHOD(Electro, wr_checkammo2, bool(entity thiswep))
+ {
+ float ammo_amount;
+ if(WEP_CVAR(electro, combo_safeammocheck)) // true if you can fire at least one secondary blob AND one primary shot after it, otherwise false.
+ {
+ ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo);
+ ammo_amount += self.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo);
+ }
+ else
+ {
+ ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(electro, ammo);
+ ammo_amount += self.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_SEC(electro, ammo);
+ }
+ return ammo_amount;
+ }
+ METHOD(Electro, wr_resetplayer, void(entity thiswep))
+ {
+ self.electro_secondarytime = time;
+ }
+ METHOD(Electro, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+ {
+ W_Reload(self, min(WEP_CVAR_PRI(electro, ammo), WEP_CVAR_SEC(electro, ammo)), SND(RELOAD));
+ }
-METHOD(Electro, wr_suicidemessage, int(entity thiswep))
++METHOD(Electro, wr_suicidemessage, Notification(entity thiswep))
+ {
+ if(w_deathtype & HITTYPE_SECONDARY)
+ return WEAPON_ELECTRO_SUICIDE_ORBS;
+ else
+ return WEAPON_ELECTRO_SUICIDE_BOLT;
+ }
-METHOD(Electro, wr_killmessage, int(entity thiswep))
++METHOD(Electro, wr_killmessage, Notification(entity thiswep))
+ {
+ if(w_deathtype & HITTYPE_SECONDARY)
+ {
+ return WEAPON_ELECTRO_MURDER_ORBS;
+ }
+ else
+ {
+ if(w_deathtype & HITTYPE_BOUNCE)
+ return WEAPON_ELECTRO_MURDER_COMBO;
+ else
+ return WEAPON_ELECTRO_MURDER_BOLT;
+ }
+ }
#endif
#ifdef CSQC
- METHOD(Electro, wr_impacteffect, void(entity thiswep))
- {
- vector org2;
- org2 = w_org + w_backoff * 6;
- if(w_deathtype & HITTYPE_SECONDARY)
- {
- pointparticles(EFFECT_ELECTRO_BALLEXPLODE, org2, '0 0 0', 1);
- if(!w_issilent)
- sound(self, CH_SHOTS, SND_ELECTRO_IMPACT, VOL_BASE, ATTEN_NORM);
- }
- else
- {
- 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(EFFECT_ELECTRO_COMBO, org2, '0 0 0', 1);
- if(!w_issilent)
- sound(self, CH_SHOTS, SND_ELECTRO_IMPACT_COMBO, VOL_BASE, ATTEN_NORM);
- }
- else
- {
- pointparticles(EFFECT_ELECTRO_IMPACT, org2, '0 0 0', 1);
- if(!w_issilent)
- sound(self, CH_SHOTS, SND_ELECTRO_IMPACT, VOL_BASE, ATTEN_NORM);
- }
- }
- }
+ METHOD(Electro, wr_impacteffect, void(entity thiswep))
+ {
+ vector org2;
+ org2 = w_org + w_backoff * 6;
+ if(w_deathtype & HITTYPE_SECONDARY)
+ {
+ pointparticles(EFFECT_ELECTRO_BALLEXPLODE, org2, '0 0 0', 1);
+ if(!w_issilent)
+ sound(self, CH_SHOTS, SND_ELECTRO_IMPACT, VOL_BASE, ATTEN_NORM);
+ }
+ else
+ {
+ 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(EFFECT_ELECTRO_COMBO, org2, '0 0 0', 1);
+ if(!w_issilent)
+ sound(self, CH_SHOTS, SND_ELECTRO_IMPACT_COMBO, VOL_BASE, ATTEN_NORM);
+ }
+ else
+ {
+ pointparticles(EFFECT_ELECTRO_IMPACT, org2, '0 0 0', 1);
+ if(!w_issilent)
+ sound(self, CH_SHOTS, SND_ELECTRO_IMPACT, VOL_BASE, ATTEN_NORM);
+ }
+ }
+ }
#endif
#endif
MUTATOR_CALLHOOK(EditProjectile, self, proj);
}
- METHOD(Fireball, wr_aim, void(entity thiswep))
- {
- self.BUTTON_ATCK = false;
- self.BUTTON_ATCK2 = false;
- if(self.bot_primary_fireballmooth == 0)
- {
- if(bot_aim(WEP_CVAR_PRI(fireball, speed), 0, WEP_CVAR_PRI(fireball, lifetime), false))
- {
- self.BUTTON_ATCK = true;
- if(random() < 0.02) self.bot_primary_fireballmooth = 0;
- }
- }
- else
- {
- if(bot_aim(WEP_CVAR_SEC(fireball, speed), WEP_CVAR_SEC(fireball, speed_up), WEP_CVAR_SEC(fireball, lifetime), true))
- {
- self.BUTTON_ATCK2 = true;
- if(random() < 0.01) self.bot_primary_fireballmooth = 1;
- }
- }
- }
- METHOD(Fireball, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
- {
- if(fire & 1)
- {
- if(time >= actor.fireball_primarytime)
- if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(fireball, refire)))
- {
- W_Fireball_Attack1_Frame0(thiswep, actor, weaponentity, fire);
- actor.fireball_primarytime = time + WEP_CVAR_PRI(fireball, refire2) * W_WeaponRateFactor();
- }
- }
- else if(fire & 2)
- {
- if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(fireball, refire)))
- {
- W_Fireball_Attack2();
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(fireball, animtime), w_ready);
- }
- }
- }
- METHOD(Fireball, wr_setup, void(entity thiswep))
- {
- self.ammo_field = ammo_none;
- }
- METHOD(Fireball, wr_checkammo1, bool(entity thiswep))
- {
- return true; // infinite ammo
- }
- METHOD(Fireball, wr_checkammo2, bool(entity thiswep))
- {
- return true; // fireball has infinite ammo
- }
- METHOD(Fireball, wr_resetplayer, void(entity thiswep))
- {
- self.fireball_primarytime = time;
- }
- METHOD(Fireball, wr_suicidemessage, Notification(entity thiswep))
- {
- if(w_deathtype & HITTYPE_SECONDARY)
- return WEAPON_FIREBALL_SUICIDE_FIREMINE;
- else
- return WEAPON_FIREBALL_SUICIDE_BLAST;
- }
- METHOD(Fireball, wr_killmessage, Notification(entity thiswep))
- {
- if(w_deathtype & HITTYPE_SECONDARY)
- return WEAPON_FIREBALL_MURDER_FIREMINE;
- else
- return WEAPON_FIREBALL_MURDER_BLAST;
- }
+ METHOD(Fireball, wr_aim, void(entity thiswep))
+ {
+ PHYS_INPUT_BUTTON_ATCK(self) = false;
+ PHYS_INPUT_BUTTON_ATCK2(self) = false;
+ if(self.bot_primary_fireballmooth == 0)
+ {
+ if(bot_aim(WEP_CVAR_PRI(fireball, speed), 0, WEP_CVAR_PRI(fireball, lifetime), false))
+ {
+ PHYS_INPUT_BUTTON_ATCK(self) = true;
+ if(random() < 0.02) self.bot_primary_fireballmooth = 0;
+ }
+ }
+ else
+ {
+ if(bot_aim(WEP_CVAR_SEC(fireball, speed), WEP_CVAR_SEC(fireball, speed_up), WEP_CVAR_SEC(fireball, lifetime), true))
+ {
+ PHYS_INPUT_BUTTON_ATCK2(self) = true;
+ if(random() < 0.01) self.bot_primary_fireballmooth = 1;
+ }
+ }
+ }
+ METHOD(Fireball, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+ {
+ if(fire & 1)
+ {
+ if(time >= actor.fireball_primarytime)
+ if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(fireball, refire)))
+ {
+ W_Fireball_Attack1_Frame0(thiswep, actor, weaponentity, fire);
+ actor.fireball_primarytime = time + WEP_CVAR_PRI(fireball, refire2) * W_WeaponRateFactor();
+ }
+ }
+ else if(fire & 2)
+ {
+ if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(fireball, refire)))
+ {
+ W_Fireball_Attack2();
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(fireball, animtime), w_ready);
+ }
+ }
+ }
+ METHOD(Fireball, wr_setup, void(entity thiswep))
+ {
+ self.ammo_field = ammo_none;
+ }
+ METHOD(Fireball, wr_checkammo1, bool(entity thiswep))
+ {
+ return true; // infinite ammo
+ }
+ METHOD(Fireball, wr_checkammo2, bool(entity thiswep))
+ {
+ return true; // fireball has infinite ammo
+ }
+ METHOD(Fireball, wr_resetplayer, void(entity thiswep))
+ {
+ self.fireball_primarytime = time;
+ }
-METHOD(Fireball, wr_suicidemessage, int(entity thiswep))
++METHOD(Fireball, wr_suicidemessage, Notification(entity thiswep))
+ {
+ if(w_deathtype & HITTYPE_SECONDARY)
+ return WEAPON_FIREBALL_SUICIDE_FIREMINE;
+ else
+ return WEAPON_FIREBALL_SUICIDE_BLAST;
+ }
-METHOD(Fireball, wr_killmessage, int(entity thiswep))
++METHOD(Fireball, wr_killmessage, Notification(entity thiswep))
+ {
+ if(w_deathtype & HITTYPE_SECONDARY)
+ return WEAPON_FIREBALL_MURDER_FIREMINE;
+ else
+ return WEAPON_FIREBALL_MURDER_BLAST;
+ }
#endif
#ifdef CSQC
- METHOD(Fireball, wr_impacteffect, void(entity thiswep))
- {
- vector org2;
- if(w_deathtype & HITTYPE_SECONDARY)
- {
- // firemine goes out silently
- }
- else
- {
- org2 = w_org + w_backoff * 16;
- pointparticles(EFFECT_FIREBALL_EXPLODE, org2, '0 0 0', 1);
- if(!w_issilent)
- sound(self, CH_SHOTS, SND_FIREBALL_IMPACT2, VOL_BASE, ATTEN_NORM * 0.25); // long range boom
- }
- }
+ METHOD(Fireball, wr_impacteffect, void(entity thiswep))
+ {
+ vector org2;
+ if(w_deathtype & HITTYPE_SECONDARY)
+ {
+ // firemine goes out silently
+ }
+ else
+ {
+ org2 = w_org + w_backoff * 16;
+ pointparticles(EFFECT_FIREBALL_EXPLODE, org2, '0 0 0', 1);
+ if(!w_issilent)
+ sound(self, CH_SHOTS, SND_FIREBALL_IMPACT2, VOL_BASE, ATTEN_NORM * 0.25); // long range boom
+ }
+ }
#endif
#endif
bool stopped = loaded || !enough_ammo;
- if(self.BUTTON_ATCK2)
+ if(PHYS_INPUT_BUTTON_ATCK2(self))
{
- if(self.BUTTON_ATCK && WEP_CVAR_SEC(hagar, load_abort))
+ if(PHYS_INPUT_BUTTON_ATCK(self) && WEP_CVAR_SEC(hagar, load_abort))
{
if(self.hagar_load)
{
}
// release if player let go of button or if they've held it in too long
- if(!self.BUTTON_ATCK2 || (stopped && self.hagar_loadstep < time && WEP_CVAR_SEC(hagar, load_hold) >= 0))
+ if(!PHYS_INPUT_BUTTON_ATCK2(self) || (stopped && self.hagar_loadstep < time && WEP_CVAR_SEC(hagar, load_hold) >= 0))
{
self.(weaponentity).state = WS_READY;
W_Hagar_Attack2_Load_Release(weaponentity);
}
}
- METHOD(Hagar, wr_aim, void(entity thiswep))
- {
- if(random()>0.15)
- self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(hagar, speed), 0, WEP_CVAR_PRI(hagar, 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(WEP_CVAR_PRI(hagar, speed), 0, WEP_CVAR_PRI(hagar, lifetime), false);
- }
- METHOD(Hagar, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
- {
- float loadable_secondary;
- loadable_secondary = (WEP_CVAR_SEC(hagar, load) && WEP_CVAR(hagar, secondary));
-
- if(loadable_secondary)
- W_Hagar_Attack2_Load(thiswep, weaponentity); // must always run each frame
- if(autocvar_g_balance_hagar_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo))) { // forced reload
- thiswep.wr_reload(thiswep, actor, weaponentity);
- } else if((fire & 1) && !actor.hagar_load && !actor.hagar_loadblock) // not while secondary is loaded or awaiting reset
- {
- if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(hagar, refire)))
- {
- W_Hagar_Attack(thiswep);
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hagar, refire), w_ready);
- }
- }
- else if((fire & 2) && !loadable_secondary && WEP_CVAR(hagar, secondary))
- {
- if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(hagar, refire)))
- {
- W_Hagar_Attack2(thiswep);
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(hagar, refire), w_ready);
- }
- }
- }
- METHOD(Hagar, wr_gonethink, void(entity thiswep))
- {
- // we lost the weapon and want to prepare switching away
- if(self.hagar_load)
- {
- .entity weaponentity = weaponentities[0]; // TODO: unhardcode
- self.(weaponentity).state = WS_READY;
- W_Hagar_Attack2_Load_Release(weaponentity);
- }
- }
- METHOD(Hagar, wr_setup, void(entity thiswep))
- {
- self.hagar_loadblock = false;
+ METHOD(Hagar, wr_aim, void(entity thiswep))
+ {
+ if(random()>0.15)
+ PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR_PRI(hagar, speed), 0, WEP_CVAR_PRI(hagar, lifetime), false);
+ else // not using secondary_speed since these are only 15% and should cause some ricochets without re-aiming
+ PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(WEP_CVAR_PRI(hagar, speed), 0, WEP_CVAR_PRI(hagar, lifetime), false);
+ }
+ METHOD(Hagar, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+ {
+ float loadable_secondary;
+ loadable_secondary = (WEP_CVAR_SEC(hagar, load) && WEP_CVAR(hagar, secondary));
+
+ if(loadable_secondary)
+ W_Hagar_Attack2_Load(thiswep, weaponentity); // must always run each frame
+ if(autocvar_g_balance_hagar_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo))) { // forced reload
+ thiswep.wr_reload(thiswep, actor, weaponentity);
+ } else if((fire & 1) && !actor.hagar_load && !actor.hagar_loadblock) // not while secondary is loaded or awaiting reset
+ {
+ if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(hagar, refire)))
+ {
+ W_Hagar_Attack(thiswep);
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hagar, refire), w_ready);
+ }
+ }
+ else if((fire & 2) && !loadable_secondary && WEP_CVAR(hagar, secondary))
+ {
+ if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(hagar, refire)))
+ {
+ W_Hagar_Attack2(thiswep);
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(hagar, refire), w_ready);
+ }
+ }
+ }
+ METHOD(Hagar, wr_gonethink, void(entity thiswep))
+ {
+ // we lost the weapon and want to prepare switching away
+ if(self.hagar_load)
+ {
+ .entity weaponentity = weaponentities[0]; // TODO: unhardcode
+ self.(weaponentity).state = WS_READY;
+ W_Hagar_Attack2_Load_Release(weaponentity);
+ }
+ }
+ METHOD(Hagar, wr_setup, void(entity thiswep))
+ {
+ self.hagar_loadblock = false;
- if(self.hagar_load)
- {
- W_DecreaseAmmo(thiswep, self, WEP_CVAR_SEC(hagar, ammo) * self.hagar_load * -1); // give back ammo if necessary
- self.hagar_load = 0;
- }
- }
- METHOD(Hagar, wr_checkammo1, bool(entity thiswep))
- {
- float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(hagar, ammo);
- ammo_amount += self.(weapon_load[WEP_HAGAR.m_id]) >= WEP_CVAR_PRI(hagar, ammo);
- return ammo_amount;
- }
- METHOD(Hagar, wr_checkammo2, bool(entity thiswep))
- {
- float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(hagar, ammo);
- ammo_amount += self.(weapon_load[WEP_HAGAR.m_id]) >= WEP_CVAR_SEC(hagar, ammo);
- return ammo_amount;
- }
- METHOD(Hagar, wr_resetplayer, void(entity thiswep))
- {
- self.hagar_load = 0;
- }
- METHOD(Hagar, wr_playerdeath, void(entity thiswep))
- {
- .entity weaponentity = weaponentities[0]; // TODO: unhardcode
- // if we have any rockets loaded when we die, release them
- if(self.hagar_load && WEP_CVAR_SEC(hagar, load_releasedeath))
- W_Hagar_Attack2_Load_Release(weaponentity);
- }
- METHOD(Hagar, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
- {
- if(!self.hagar_load) // require releasing loaded rockets first
- W_Reload(self, min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo)), SND(RELOAD));
- }
- METHOD(Hagar, wr_suicidemessage, Notification(entity thiswep))
- {
- return WEAPON_HAGAR_SUICIDE;
- }
- METHOD(Hagar, wr_killmessage, Notification(entity thiswep))
- {
- if(w_deathtype & HITTYPE_SECONDARY)
- return WEAPON_HAGAR_MURDER_BURST;
- else
- return WEAPON_HAGAR_MURDER_SPRAY;
- }
+ if(self.hagar_load)
+ {
+ W_DecreaseAmmo(thiswep, self, WEP_CVAR_SEC(hagar, ammo) * self.hagar_load * -1); // give back ammo if necessary
+ self.hagar_load = 0;
+ }
+ }
+ METHOD(Hagar, wr_checkammo1, bool(entity thiswep))
+ {
+ float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(hagar, ammo);
+ ammo_amount += self.(weapon_load[WEP_HAGAR.m_id]) >= WEP_CVAR_PRI(hagar, ammo);
+ return ammo_amount;
+ }
+ METHOD(Hagar, wr_checkammo2, bool(entity thiswep))
+ {
+ float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(hagar, ammo);
+ ammo_amount += self.(weapon_load[WEP_HAGAR.m_id]) >= WEP_CVAR_SEC(hagar, ammo);
+ return ammo_amount;
+ }
+ METHOD(Hagar, wr_resetplayer, void(entity thiswep))
+ {
+ self.hagar_load = 0;
+ }
+ METHOD(Hagar, wr_playerdeath, void(entity thiswep))
+ {
+ .entity weaponentity = weaponentities[0]; // TODO: unhardcode
+ // if we have any rockets loaded when we die, release them
+ if(self.hagar_load && WEP_CVAR_SEC(hagar, load_releasedeath))
+ W_Hagar_Attack2_Load_Release(weaponentity);
+ }
+ METHOD(Hagar, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+ {
+ if(!self.hagar_load) // require releasing loaded rockets first
+ W_Reload(self, min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo)), SND(RELOAD));
+ }
-METHOD(Hagar, wr_suicidemessage, int(entity thiswep))
++METHOD(Hagar, wr_suicidemessage, Notification(entity thiswep))
+ {
+ return WEAPON_HAGAR_SUICIDE;
+ }
-METHOD(Hagar, wr_killmessage, int(entity thiswep))
++METHOD(Hagar, wr_killmessage, Notification(entity thiswep))
+ {
+ if(w_deathtype & HITTYPE_SECONDARY)
+ return WEAPON_HAGAR_MURDER_BURST;
+ else
+ return WEAPON_HAGAR_MURDER_SPRAY;
+ }
#endif
#ifdef CSQC
- METHOD(Hagar, wr_impacteffect, void(entity thiswep))
- {
- vector org2;
- org2 = w_org + w_backoff * 6;
- pointparticles(EFFECT_HAGAR_EXPLODE, org2, '0 0 0', 1);
- if(!w_issilent)
- {
- if(w_random<0.15)
- sound(self, CH_SHOTS, SND_HAGEXP1, VOL_BASE, ATTN_NORM);
- else if(w_random<0.7)
- sound(self, CH_SHOTS, SND_HAGEXP2, VOL_BASE, ATTN_NORM);
- else
- sound(self, CH_SHOTS, SND_HAGEXP3, VOL_BASE, ATTN_NORM);
- }
- }
+ METHOD(Hagar, wr_impacteffect, void(entity thiswep))
+ {
+ vector org2;
+ org2 = w_org + w_backoff * 6;
+ pointparticles(EFFECT_HAGAR_EXPLODE, org2, '0 0 0', 1);
+ if(!w_issilent)
+ {
+ if(w_random<0.15)
+ sound(self, CH_SHOTS, SND_HAGEXP1, VOL_BASE, ATTN_NORM);
+ else if(w_random<0.7)
+ sound(self, CH_SHOTS, SND_HAGEXP2, VOL_BASE, ATTN_NORM);
+ else
+ sound(self, CH_SHOTS, SND_HAGEXP3, VOL_BASE, ATTN_NORM);
+ }
+ }
#endif
#endif
return;
}
- if(actor.BUTTON_ATCK)
+ if(PHYS_INPUT_BUTTON_ATCK(actor))
{
if(!thiswep.wr_checkammo1(thiswep))
if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
}
}
- METHOD(HLAC, wr_aim, void(entity thiswep))
- {
- self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(hlac, speed), 0, WEP_CVAR_PRI(hlac, lifetime), false);
- }
- METHOD(HLAC, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
- {
- if(autocvar_g_balance_hlac_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo))) { // forced reload
- thiswep.wr_reload(thiswep, actor, weaponentity);
- } else if(fire & 1)
- {
- if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(hlac, refire)))
- {
- actor.misc_bulletcounter = 0;
- W_HLAC_Attack(thiswep);
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), W_HLAC_Attack_Frame);
- }
- }
-
- else if((fire & 2) && WEP_CVAR(hlac, secondary))
- {
- if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(hlac, refire)))
- {
- W_HLAC_Attack2_Frame(thiswep);
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(hlac, animtime), w_ready);
- }
- }
- }
- METHOD(HLAC, wr_checkammo1, bool(entity thiswep))
- {
- float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(hlac, ammo);
- ammo_amount += self.(weapon_load[WEP_HLAC.m_id]) >= WEP_CVAR_PRI(hlac, ammo);
- return ammo_amount;
- }
- METHOD(HLAC, wr_checkammo2, bool(entity thiswep))
- {
- float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(hlac, ammo);
- ammo_amount += self.(weapon_load[WEP_HLAC.m_id]) >= WEP_CVAR_SEC(hlac, ammo);
- return ammo_amount;
- }
- METHOD(HLAC, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
- {
- W_Reload(self, min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo)), SND(RELOAD));
- }
- METHOD(HLAC, wr_suicidemessage, Notification(entity thiswep))
- {
- return WEAPON_HLAC_SUICIDE;
- }
- METHOD(HLAC, wr_killmessage, Notification(entity thiswep))
- {
- return WEAPON_HLAC_MURDER;
- }
+ METHOD(HLAC, wr_aim, void(entity thiswep))
+ {
+ PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR_PRI(hlac, speed), 0, WEP_CVAR_PRI(hlac, lifetime), false);
+ }
+ METHOD(HLAC, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+ {
+ if(autocvar_g_balance_hlac_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo))) { // forced reload
+ thiswep.wr_reload(thiswep, actor, weaponentity);
+ } else if(fire & 1)
+ {
+ if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(hlac, refire)))
+ {
+ actor.misc_bulletcounter = 0;
+ W_HLAC_Attack(thiswep);
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), W_HLAC_Attack_Frame);
+ }
+ }
+
+ else if((fire & 2) && WEP_CVAR(hlac, secondary))
+ {
+ if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(hlac, refire)))
+ {
+ W_HLAC_Attack2_Frame(thiswep);
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(hlac, animtime), w_ready);
+ }
+ }
+ }
+ METHOD(HLAC, wr_checkammo1, bool(entity thiswep))
+ {
+ float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(hlac, ammo);
+ ammo_amount += self.(weapon_load[WEP_HLAC.m_id]) >= WEP_CVAR_PRI(hlac, ammo);
+ return ammo_amount;
+ }
+ METHOD(HLAC, wr_checkammo2, bool(entity thiswep))
+ {
+ float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(hlac, ammo);
+ ammo_amount += self.(weapon_load[WEP_HLAC.m_id]) >= WEP_CVAR_SEC(hlac, ammo);
+ return ammo_amount;
+ }
+ METHOD(HLAC, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+ {
+ W_Reload(self, min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo)), SND(RELOAD));
+ }
-METHOD(HLAC, wr_suicidemessage, int(entity thiswep))
++METHOD(HLAC, wr_suicidemessage, Notification(entity thiswep))
+ {
+ return WEAPON_HLAC_SUICIDE;
+ }
-METHOD(HLAC, wr_killmessage, int(entity thiswep))
++METHOD(HLAC, wr_killmessage, Notification(entity thiswep))
+ {
+ return WEAPON_HLAC_MURDER;
+ }
#endif
#ifdef CSQC
- METHOD(HLAC, wr_impacteffect, void(entity thiswep))
- {
- vector org2;
- org2 = w_org + w_backoff * 6;
- pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);
- if(!w_issilent)
- sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM);
- }
+ METHOD(HLAC, wr_impacteffect, void(entity thiswep))
+ {
+ vector org2;
+ org2 = w_org + w_backoff * 6;
+ pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);
+ if(!w_issilent)
+ sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM);
+ }
#endif
#endif
MUTATOR_CALLHOOK(EditProjectile, actor, gren);
}
- METHOD(Hook, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
- {
- if (fire & 1) {
- if(!actor.hook)
- if(!(actor.hook_state & HOOK_WAITING_FOR_RELEASE))
- if(time > actor.hook_refire)
- if(weapon_prepareattack(thiswep, actor, weaponentity, false, -1))
- {
- W_DecreaseAmmo(thiswep, actor, thiswep.ammo_factor * WEP_CVAR_PRI(hook, ammo));
- actor.hook_state |= HOOK_FIRING;
- actor.hook_state |= HOOK_WAITING_FOR_RELEASE;
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hook, animtime), w_ready);
- }
- } else {
- actor.hook_state |= HOOK_REMOVING;
- actor.hook_state &= ~HOOK_WAITING_FOR_RELEASE;
- }
-
- if(fire & 2)
- {
- if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(hook, refire)))
- {
- W_Hook_Attack2(thiswep, actor);
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(hook, animtime), w_ready);
- }
- }
-
- if(actor.hook)
- {
- // if hooked, no bombs, and increase the timer
- actor.hook_refire = max(actor.hook_refire, time + WEP_CVAR_PRI(hook, refire) * W_WeaponRateFactor());
-
- // hook also inhibits health regeneration, but only for 1 second
- if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
- actor.pauseregen_finished = max(actor.pauseregen_finished, time + autocvar_g_balance_pause_fuel_regen);
- }
-
- if(actor.hook && actor.hook.state == 1)
- {
- float hooked_time_max = WEP_CVAR_PRI(hook, hooked_time_max);
- if(hooked_time_max > 0)
- {
- if( time > actor.hook_time_hooked + hooked_time_max )
- actor.hook_state |= HOOK_REMOVING;
- }
-
- float hooked_fuel = thiswep.ammo_factor * WEP_CVAR_PRI(hook, hooked_ammo);
- if(hooked_fuel > 0)
- {
- if( time > actor.hook_time_fueldecrease )
- {
- if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
- {
- if( actor.ammo_fuel >= (time - actor.hook_time_fueldecrease) * hooked_fuel )
- {
- W_DecreaseAmmo(thiswep, actor, (time - actor.hook_time_fueldecrease) * hooked_fuel);
- actor.hook_time_fueldecrease = time;
- // decrease next frame again
- }
- else
- {
- actor.ammo_fuel = 0;
- actor.hook_state |= HOOK_REMOVING;
- W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
- }
- }
- }
- }
- }
- else
- {
- actor.hook_time_hooked = time;
- actor.hook_time_fueldecrease = time + WEP_CVAR_PRI(hook, hooked_time_free);
- }
-
- actor.hook_state = BITSET(actor.hook_state, HOOK_PULLING, (!actor.BUTTON_CROUCH || !autocvar_g_balance_grapplehook_crouchslide));
-
- if (actor.hook_state & HOOK_FIRING)
- {
- if (actor.hook)
- RemoveGrapplingHook(actor);
- WITH(entity, self, actor, FireGrapplingHook());
- actor.hook_state &= ~HOOK_FIRING;
- actor.hook_refire = max(actor.hook_refire, time + autocvar_g_balance_grapplehook_refire * W_WeaponRateFactor());
- }
- else if (actor.hook_state & HOOK_REMOVING)
- {
- if (actor.hook)
- RemoveGrapplingHook(actor);
- actor.hook_state &= ~HOOK_REMOVING;
- }
- }
- METHOD(Hook, wr_setup, void(entity thiswep))
- {
- self.hook_state &= ~HOOK_WAITING_FOR_RELEASE;
- }
- METHOD(Hook, wr_checkammo1, bool(Hook thiswep))
- {
- if (!thiswep.ammo_factor) return true;
- if(self.hook)
- return self.ammo_fuel > 0;
- else
- return self.ammo_fuel >= WEP_CVAR_PRI(hook, ammo);
- }
- METHOD(Hook, wr_checkammo2, bool(Hook thiswep))
- {
- // infinite ammo for now
- return true; // self.ammo_cells >= WEP_CVAR_SEC(hook, ammo); // WEAPONTODO: see above
- }
- METHOD(Hook, wr_resetplayer, void(entity thiswep))
- {
- RemoveGrapplingHook(self);
- self.hook_time = 0;
- self.hook_refire = time;
- }
- METHOD(Hook, wr_suicidemessage, Notification(entity thiswep))
- {
- return NULL;
- }
- METHOD(Hook, wr_killmessage, Notification(entity thiswep))
- {
- return WEAPON_HOOK_MURDER;
- }
+ METHOD(Hook, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+ {
+ if (fire & 1) {
+ if(!actor.hook)
+ if(!(actor.hook_state & HOOK_WAITING_FOR_RELEASE))
+ if(time > actor.hook_refire)
+ if(weapon_prepareattack(thiswep, actor, weaponentity, false, -1))
+ {
+ W_DecreaseAmmo(thiswep, actor, thiswep.ammo_factor * WEP_CVAR_PRI(hook, ammo));
+ actor.hook_state |= HOOK_FIRING;
+ actor.hook_state |= HOOK_WAITING_FOR_RELEASE;
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hook, animtime), w_ready);
+ }
+ } else {
+ actor.hook_state |= HOOK_REMOVING;
+ actor.hook_state &= ~HOOK_WAITING_FOR_RELEASE;
+ }
+
+ if(fire & 2)
+ {
+ if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(hook, refire)))
+ {
+ W_Hook_Attack2(thiswep, actor);
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(hook, animtime), w_ready);
+ }
+ }
+
+ if(actor.hook)
+ {
+ // if hooked, no bombs, and increase the timer
+ actor.hook_refire = max(actor.hook_refire, time + WEP_CVAR_PRI(hook, refire) * W_WeaponRateFactor());
+
+ // hook also inhibits health regeneration, but only for 1 second
+ if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
+ actor.pauseregen_finished = max(actor.pauseregen_finished, time + autocvar_g_balance_pause_fuel_regen);
+ }
+
+ if(actor.hook && actor.hook.state == 1)
+ {
+ float hooked_time_max = WEP_CVAR_PRI(hook, hooked_time_max);
+ if(hooked_time_max > 0)
+ {
+ if( time > actor.hook_time_hooked + hooked_time_max )
+ actor.hook_state |= HOOK_REMOVING;
+ }
+
+ float hooked_fuel = thiswep.ammo_factor * WEP_CVAR_PRI(hook, hooked_ammo);
+ if(hooked_fuel > 0)
+ {
+ if( time > actor.hook_time_fueldecrease )
+ {
+ if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
+ {
+ if( actor.ammo_fuel >= (time - actor.hook_time_fueldecrease) * hooked_fuel )
+ {
+ W_DecreaseAmmo(thiswep, actor, (time - actor.hook_time_fueldecrease) * hooked_fuel);
+ actor.hook_time_fueldecrease = time;
+ // decrease next frame again
+ }
+ else
+ {
+ actor.ammo_fuel = 0;
+ actor.hook_state |= HOOK_REMOVING;
+ W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ actor.hook_time_hooked = time;
+ actor.hook_time_fueldecrease = time + WEP_CVAR_PRI(hook, hooked_time_free);
+ }
+
+ actor.hook_state = BITSET(actor.hook_state, HOOK_PULLING, (!PHYS_INPUT_BUTTON_CROUCH(actor) || !autocvar_g_balance_grapplehook_crouchslide));
+
+ if (actor.hook_state & HOOK_FIRING)
+ {
+ if (actor.hook)
+ RemoveGrapplingHook(actor);
+ WITH(entity, self, actor, FireGrapplingHook());
+ actor.hook_state &= ~HOOK_FIRING;
+ actor.hook_refire = max(actor.hook_refire, time + autocvar_g_balance_grapplehook_refire * W_WeaponRateFactor());
+ }
+ else if (actor.hook_state & HOOK_REMOVING)
+ {
+ if (actor.hook)
+ RemoveGrapplingHook(actor);
+ actor.hook_state &= ~HOOK_REMOVING;
+ }
+ }
+ METHOD(Hook, wr_setup, void(entity thiswep))
+ {
+ self.hook_state &= ~HOOK_WAITING_FOR_RELEASE;
+ }
+ METHOD(Hook, wr_checkammo1, bool(Hook thiswep))
+ {
+ if (!thiswep.ammo_factor) return true;
+ if(self.hook)
+ return self.ammo_fuel > 0;
+ else
+ return self.ammo_fuel >= WEP_CVAR_PRI(hook, ammo);
+ }
+ METHOD(Hook, wr_checkammo2, bool(Hook thiswep))
+ {
+ // infinite ammo for now
+ return true; // self.ammo_cells >= WEP_CVAR_SEC(hook, ammo); // WEAPONTODO: see above
+ }
+ METHOD(Hook, wr_resetplayer, void(entity thiswep))
+ {
+ RemoveGrapplingHook(self);
+ self.hook_time = 0;
+ self.hook_refire = time;
+ }
-METHOD(Hook, wr_suicidemessage, int(entity thiswep))
-{
- return false;
-}
-METHOD(Hook, wr_killmessage, int(entity thiswep))
++METHOD(Hook, wr_killmessage, Notification(entity thiswep))
+ {
+ return WEAPON_HOOK_MURDER;
+ }
#endif
#ifdef CSQC
- METHOD(Hook, wr_impacteffect, void(entity thiswep))
- {
- vector org2;
- org2 = w_org + w_backoff * 2;
- pointparticles(EFFECT_HOOK_EXPLODE, org2, '0 0 0', 1);
- if(!w_issilent)
- sound(self, CH_SHOTS, SND_HOOKBOMB_IMPACT, VOL_BASE, ATTN_NORM);
- }
+ METHOD(Hook, wr_impacteffect, void(entity thiswep))
+ {
+ vector org2;
+ org2 = w_org + w_backoff * 2;
+ pointparticles(EFFECT_HOOK_EXPLODE, org2, '0 0 0', 1);
+ if(!w_issilent)
+ sound(self, CH_SHOTS, SND_HOOKBOMB_IMPACT, VOL_BASE, ATTN_NORM);
+ }
#endif
w_ready(thiswep, actor, weaponentity, fire);
return;
}
- if(actor.BUTTON_ATCK)
+ if(PHYS_INPUT_BUTTON_ATCK(actor))
{
if(!thiswep.wr_checkammo2(thiswep))
if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
}
- METHOD(MachineGun, wr_aim, void(entity thiswep))
- {
- if(vdist(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);
- }
- METHOD(MachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
- {
- if(WEP_CVAR(machinegun, reload_ammo) && actor.clip_load < min(max(WEP_CVAR(machinegun, sustained_ammo), WEP_CVAR(machinegun, first_ammo)), WEP_CVAR(machinegun, burst_ammo))) { // forced reload
- thiswep.wr_reload(thiswep, actor, weaponentity);
- } else
- if(WEP_CVAR(machinegun, mode) == 1)
- {
- if(fire & 1)
- if(weapon_prepareattack(thiswep, actor, weaponentity, false, 0))
- {
- actor.misc_bulletcounter = 0;
- W_MachineGun_Attack_Auto(thiswep, actor, weaponentity, fire);
- }
-
- if(fire & 2)
- if(weapon_prepareattack(thiswep, actor, weaponentity, true, 0))
- {
- if(!thiswep.wr_checkammo2(thiswep))
- if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
- {
- W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
- w_ready(thiswep, actor, weaponentity, fire);
- return;
- }
-
- W_DecreaseAmmo(thiswep, actor, WEP_CVAR(machinegun, burst_ammo));
-
- actor.misc_bulletcounter = WEP_CVAR(machinegun, burst) * -1;
- W_MachineGun_Attack_Burst(thiswep, actor, weaponentity, fire);
- }
- }
- else
- {
-
- if(fire & 1)
- if(weapon_prepareattack(thiswep, actor, weaponentity, false, 0))
- {
- actor.misc_bulletcounter = 1;
- W_MachineGun_Attack(WEP_MACHINEGUN, WEP_MACHINEGUN.m_id, weaponentity); // sets attack_finished
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(machinegun, sustained_refire), W_MachineGun_Attack_Frame);
- }
-
- if((fire & 2) && WEP_CVAR(machinegun, first))
- if(weapon_prepareattack(thiswep, actor, weaponentity, true, 0))
- {
- actor.misc_bulletcounter = 1;
- W_MachineGun_Attack(WEP_MACHINEGUN, WEP_MACHINEGUN.m_id | HITTYPE_SECONDARY, weaponentity); // sets attack_finished
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(machinegun, first_refire), w_ready);
- }
- }
- }
- METHOD(MachineGun, wr_checkammo1, bool(entity thiswep))
- {
- float ammo_amount;
- if(WEP_CVAR(machinegun, mode) == 1)
- ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(machinegun, sustained_ammo);
- else
- ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(machinegun, first_ammo);
-
- if(WEP_CVAR(machinegun, reload_ammo))
- {
- if(WEP_CVAR(machinegun, mode) == 1)
- ammo_amount += self.(weapon_load[WEP_MACHINEGUN.m_id]) >= WEP_CVAR(machinegun, sustained_ammo);
- else
- ammo_amount += self.(weapon_load[WEP_MACHINEGUN.m_id]) >= WEP_CVAR(machinegun, first_ammo);
- }
- return ammo_amount;
- }
- METHOD(MachineGun, wr_checkammo2, bool(entity thiswep))
- {
- float ammo_amount;
- if(WEP_CVAR(machinegun, mode) == 1)
- ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(machinegun, burst_ammo);
- else
- ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(machinegun, first_ammo);
-
- if(WEP_CVAR(machinegun, reload_ammo))
- {
- if(WEP_CVAR(machinegun, mode) == 1)
- ammo_amount += self.(weapon_load[WEP_MACHINEGUN.m_id]) >= WEP_CVAR(machinegun, burst_ammo);
- else
- ammo_amount += self.(weapon_load[WEP_MACHINEGUN.m_id]) >= WEP_CVAR(machinegun, first_ammo);
- }
- return ammo_amount;
- }
- METHOD(MachineGun, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
- {
- W_Reload(self, min(max(WEP_CVAR(machinegun, sustained_ammo), WEP_CVAR(machinegun, first_ammo)), WEP_CVAR(machinegun, burst_ammo)), SND(RELOAD));
- }
- METHOD(MachineGun, wr_suicidemessage, Notification(entity thiswep))
- {
- return WEAPON_THINKING_WITH_PORTALS;
- }
- METHOD(MachineGun, wr_killmessage, Notification(entity thiswep))
- {
- if(w_deathtype & HITTYPE_SECONDARY)
- return WEAPON_MACHINEGUN_MURDER_SNIPE;
- else
- return WEAPON_MACHINEGUN_MURDER_SPRAY;
- }
+ METHOD(MachineGun, wr_aim, void(entity thiswep))
+ {
+ if(vdist(self.origin - self.enemy.origin, <, 3000 - bound(0, skill, 10) * 200))
+ PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(1000000, 0, 0.001, false);
+ else
+ PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(1000000, 0, 0.001, false);
+ }
+ METHOD(MachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+ {
+ if(WEP_CVAR(machinegun, reload_ammo) && actor.clip_load < min(max(WEP_CVAR(machinegun, sustained_ammo), WEP_CVAR(machinegun, first_ammo)), WEP_CVAR(machinegun, burst_ammo))) { // forced reload
+ thiswep.wr_reload(thiswep, actor, weaponentity);
+ } else
+ if(WEP_CVAR(machinegun, mode) == 1)
+ {
+ if(fire & 1)
+ if(weapon_prepareattack(thiswep, actor, weaponentity, false, 0))
+ {
+ actor.misc_bulletcounter = 0;
+ W_MachineGun_Attack_Auto(thiswep, actor, weaponentity, fire);
+ }
+
+ if(fire & 2)
+ if(weapon_prepareattack(thiswep, actor, weaponentity, true, 0))
+ {
+ if(!thiswep.wr_checkammo2(thiswep))
+ if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
+ {
+ W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
+ w_ready(thiswep, actor, weaponentity, fire);
+ return;
+ }
+
+ W_DecreaseAmmo(thiswep, actor, WEP_CVAR(machinegun, burst_ammo));
+
+ actor.misc_bulletcounter = WEP_CVAR(machinegun, burst) * -1;
+ W_MachineGun_Attack_Burst(thiswep, actor, weaponentity, fire);
+ }
+ }
+ else
+ {
+
+ if(fire & 1)
+ if(weapon_prepareattack(thiswep, actor, weaponentity, false, 0))
+ {
+ actor.misc_bulletcounter = 1;
+ W_MachineGun_Attack(WEP_MACHINEGUN, WEP_MACHINEGUN.m_id, weaponentity); // sets attack_finished
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(machinegun, sustained_refire), W_MachineGun_Attack_Frame);
+ }
+
+ if((fire & 2) && WEP_CVAR(machinegun, first))
+ if(weapon_prepareattack(thiswep, actor, weaponentity, true, 0))
+ {
+ actor.misc_bulletcounter = 1;
+ W_MachineGun_Attack(WEP_MACHINEGUN, WEP_MACHINEGUN.m_id | HITTYPE_SECONDARY, weaponentity); // sets attack_finished
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(machinegun, first_refire), w_ready);
+ }
+ }
+ }
+ METHOD(MachineGun, wr_checkammo1, bool(entity thiswep))
+ {
+ float ammo_amount;
+ if(WEP_CVAR(machinegun, mode) == 1)
+ ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(machinegun, sustained_ammo);
+ else
+ ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(machinegun, first_ammo);
+
+ if(WEP_CVAR(machinegun, reload_ammo))
+ {
+ if(WEP_CVAR(machinegun, mode) == 1)
+ ammo_amount += self.(weapon_load[WEP_MACHINEGUN.m_id]) >= WEP_CVAR(machinegun, sustained_ammo);
+ else
+ ammo_amount += self.(weapon_load[WEP_MACHINEGUN.m_id]) >= WEP_CVAR(machinegun, first_ammo);
+ }
+ return ammo_amount;
+ }
+ METHOD(MachineGun, wr_checkammo2, bool(entity thiswep))
+ {
+ float ammo_amount;
+ if(WEP_CVAR(machinegun, mode) == 1)
+ ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(machinegun, burst_ammo);
+ else
+ ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(machinegun, first_ammo);
+
+ if(WEP_CVAR(machinegun, reload_ammo))
+ {
+ if(WEP_CVAR(machinegun, mode) == 1)
+ ammo_amount += self.(weapon_load[WEP_MACHINEGUN.m_id]) >= WEP_CVAR(machinegun, burst_ammo);
+ else
+ ammo_amount += self.(weapon_load[WEP_MACHINEGUN.m_id]) >= WEP_CVAR(machinegun, first_ammo);
+ }
+ return ammo_amount;
+ }
+ METHOD(MachineGun, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+ {
+ W_Reload(self, min(max(WEP_CVAR(machinegun, sustained_ammo), WEP_CVAR(machinegun, first_ammo)), WEP_CVAR(machinegun, burst_ammo)), SND(RELOAD));
+ }
-METHOD(MachineGun, wr_suicidemessage, int(entity thiswep))
++METHOD(MachineGun, wr_suicidemessage, Notification(entity thiswep))
+ {
+ return WEAPON_THINKING_WITH_PORTALS;
+ }
-METHOD(MachineGun, wr_killmessage, int(entity thiswep))
++METHOD(MachineGun, wr_killmessage, Notification(entity thiswep))
+ {
+ if(w_deathtype & HITTYPE_SECONDARY)
+ return WEAPON_MACHINEGUN_MURDER_SNIPE;
+ else
+ return WEAPON_MACHINEGUN_MURDER_SPRAY;
+ }
#endif
#ifdef CSQC
- METHOD(MachineGun, wr_impacteffect, void(entity thiswep))
- {
- vector org2;
- org2 = w_org + w_backoff * 2;
- pointparticles(EFFECT_MACHINEGUN_IMPACT, org2, w_backoff * 1000, 1);
- if(!w_issilent)
- sound(self, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTN_NORM);
- }
+ METHOD(MachineGun, wr_impacteffect, void(entity thiswep))
+ {
+ vector org2;
+ org2 = w_org + w_backoff * 2;
+ pointparticles(EFFECT_MACHINEGUN_IMPACT, org2, w_backoff * 1000, 1);
+ if(!w_issilent)
+ sound(self, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTN_NORM);
+ }
#endif
#endif
return minfound;
}
- METHOD(MineLayer, wr_aim, void(entity thiswep))
- {
- // aim and decide to fire if appropriate
- if(self.minelayer_mines >= WEP_CVAR(minelayer, limit))
- self.BUTTON_ATCK = false;
- else
- self.BUTTON_ATCK = bot_aim(WEP_CVAR(minelayer, speed), 0, WEP_CVAR(minelayer, lifetime), false);
- if(skill >= 2) // skill 0 and 1 bots won't detonate mines!
- {
- // decide whether to detonate mines
- entity targetlist, targ;
- float edgedamage, coredamage, edgeradius, recipricoledgeradius, d;
- float selfdamage, teamdamage, enemydamage;
- edgedamage = WEP_CVAR(minelayer, edgedamage);
- coredamage = WEP_CVAR(minelayer, damage);
- edgeradius = WEP_CVAR(minelayer, radius);
- recipricoledgeradius = 1 / edgeradius;
- selfdamage = 0;
- teamdamage = 0;
- enemydamage = 0;
- targetlist = findchainfloat(bot_attack, true);
- entity 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");
- }
- 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)
- {
- 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");
- }
- // 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;
- }
- }
- METHOD(MineLayer, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
- {
- if(autocvar_g_balance_minelayer_reload_ammo && actor.clip_load < WEP_CVAR(minelayer, ammo)) // forced reload
- {
- // not if we're holding the minelayer without enough ammo, but can detonate existing mines
- if(!(W_MineLayer_PlacedMines(false) && actor.(thiswep.ammo_field) < WEP_CVAR(minelayer, ammo))) {
- thiswep.wr_reload(thiswep, actor, weaponentity);
- }
- }
- else if(fire & 1)
- {
- if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(minelayer, refire)))
- {
- W_MineLayer_Attack(thiswep);
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(minelayer, animtime), w_ready);
- }
- }
-
- if(fire & 2)
- {
- if(W_MineLayer_PlacedMines(true))
- sound(actor, CH_WEAPON_B, SND_MINE_DET, VOL_BASE, ATTN_NORM);
- }
- }
- METHOD(MineLayer, wr_checkammo1, bool(entity thiswep))
- {
- int slot = 0; // TODO: unhardcode
- // don't switch while placing a mine
- if(ATTACK_FINISHED(self, slot) <= time || PS(self).m_weapon != WEP_MINE_LAYER)
- {
- float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(minelayer, ammo);
- ammo_amount += self.(weapon_load[WEP_MINE_LAYER.m_id]) >= WEP_CVAR(minelayer, ammo);
- return ammo_amount;
- }
- return true;
- }
- METHOD(MineLayer, wr_checkammo2, bool(entity thiswep))
- {
- if(W_MineLayer_PlacedMines(false))
- return true;
- else
- return false;
- }
- METHOD(MineLayer, wr_resetplayers, void(entity thiswep))
- {
- self.minelayer_mines = 0;
- }
- METHOD(MineLayer, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
- {
- W_Reload(self, WEP_CVAR(minelayer, ammo), SND(RELOAD));
- }
- METHOD(MineLayer, wr_suicidemessage, Notification(entity thiswep))
- {
- return WEAPON_MINELAYER_SUICIDE;
- }
- METHOD(MineLayer, wr_killmessage, Notification(entity thiswep))
- {
- return WEAPON_MINELAYER_MURDER;
- }
+ METHOD(MineLayer, wr_aim, void(entity thiswep))
+ {
+ // aim and decide to fire if appropriate
+ if(self.minelayer_mines >= WEP_CVAR(minelayer, limit))
+ PHYS_INPUT_BUTTON_ATCK(self) = false;
+ else
+ PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR(minelayer, speed), 0, WEP_CVAR(minelayer, lifetime), false);
+ if(skill >= 2) // skill 0 and 1 bots won't detonate mines!
+ {
+ // decide whether to detonate mines
+ entity targetlist, targ;
+ float edgedamage, coredamage, edgeradius, recipricoledgeradius, d;
+ float selfdamage, teamdamage, enemydamage;
+ edgedamage = WEP_CVAR(minelayer, edgedamage);
+ coredamage = WEP_CVAR(minelayer, damage);
+ edgeradius = WEP_CVAR(minelayer, radius);
+ recipricoledgeradius = 1 / edgeradius;
+ selfdamage = 0;
+ teamdamage = 0;
+ enemydamage = 0;
+ targetlist = findchainfloat(bot_attack, true);
+ entity 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");
+ }
+ 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)
+ {
+ 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
+ ) PHYS_INPUT_BUTTON_ATCK2(self) = 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))
+ PHYS_INPUT_BUTTON_ATCK2(self) = true;
+ // dprint(ftos(random()/distance*300),">");dprint(ftos(frametime*bound(0,(10-skill)*0.2,1)),"\n");
+ }
+
+ 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
+ PHYS_INPUT_BUTTON_ATCK2(self) = true;
+ if((skill > 6.5) && (selfdamage > self.health))
+ PHYS_INPUT_BUTTON_ATCK2(self) = false;
+ //if(PHYS_INPUT_BUTTON_ATCK2(self) == true)
+ // dprint(ftos(desirabledamage),"\n");
+ if(PHYS_INPUT_BUTTON_ATCK2(self)) PHYS_INPUT_BUTTON_ATCK(self) = false;
+ }
+ }
+ METHOD(MineLayer, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+ {
+ if(autocvar_g_balance_minelayer_reload_ammo && actor.clip_load < WEP_CVAR(minelayer, ammo)) // forced reload
+ {
+ // not if we're holding the minelayer without enough ammo, but can detonate existing mines
+ if(!(W_MineLayer_PlacedMines(false) && actor.(thiswep.ammo_field) < WEP_CVAR(minelayer, ammo))) {
+ thiswep.wr_reload(thiswep, actor, weaponentity);
+ }
+ }
+ else if(fire & 1)
+ {
+ if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(minelayer, refire)))
+ {
+ W_MineLayer_Attack(thiswep);
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(minelayer, animtime), w_ready);
+ }
+ }
+
+ if(fire & 2)
+ {
+ if(W_MineLayer_PlacedMines(true))
+ sound(actor, CH_WEAPON_B, SND_MINE_DET, VOL_BASE, ATTN_NORM);
+ }
+ }
+ METHOD(MineLayer, wr_checkammo1, bool(entity thiswep))
+ {
+ int slot = 0; // TODO: unhardcode
+ // don't switch while placing a mine
+ if(ATTACK_FINISHED(self, slot) <= time || PS(self).m_weapon != WEP_MINE_LAYER)
+ {
+ float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(minelayer, ammo);
+ ammo_amount += self.(weapon_load[WEP_MINE_LAYER.m_id]) >= WEP_CVAR(minelayer, ammo);
+ return ammo_amount;
+ }
+ return true;
+ }
+ METHOD(MineLayer, wr_checkammo2, bool(entity thiswep))
+ {
+ if(W_MineLayer_PlacedMines(false))
+ return true;
+ else
+ return false;
+ }
+ METHOD(MineLayer, wr_resetplayers, void(entity thiswep))
+ {
+ self.minelayer_mines = 0;
+ }
+ METHOD(MineLayer, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+ {
+ W_Reload(self, WEP_CVAR(minelayer, ammo), SND(RELOAD));
+ }
-METHOD(MineLayer, wr_suicidemessage, int(entity thiswep))
++METHOD(MineLayer, wr_suicidemessage, Notification(entity thiswep))
+ {
+ return WEAPON_MINELAYER_SUICIDE;
+ }
-METHOD(MineLayer, wr_killmessage, int(entity thiswep))
++METHOD(MineLayer, wr_killmessage, Notification(entity thiswep))
+ {
+ return WEAPON_MINELAYER_MURDER;
+ }
#endif
#ifdef CSQC
- METHOD(MineLayer, wr_impacteffect, void(entity thiswep))
- {
- vector org2;
- org2 = w_org + w_backoff * 12;
- pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1);
- if(!w_issilent)
- sound(self, CH_SHOTS, SND_MINE_EXP, VOL_BASE, ATTN_NORM);
- }
+ METHOD(MineLayer, wr_impacteffect, void(entity thiswep))
+ {
+ vector org2;
+ org2 = w_org + w_backoff * 12;
+ pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1);
+ if(!w_issilent)
+ sound(self, CH_SHOTS, SND_MINE_EXP, VOL_BASE, ATTN_NORM);
+ }
#endif
#endif
.float bot_secondary_grenademooth;
- METHOD(Mortar, wr_aim, void(entity thiswep))
- {
- self.BUTTON_ATCK = false;
- self.BUTTON_ATCK2 = false;
- if(self.bot_secondary_grenademooth == 0) // WEAPONTODO: merge this into using WEP_CVAR_BOTH
- {
- if(bot_aim(WEP_CVAR_PRI(mortar, speed), WEP_CVAR_PRI(mortar, speed_up), WEP_CVAR_PRI(mortar, lifetime), true))
- {
- self.BUTTON_ATCK = true;
- if(random() < 0.01) self.bot_secondary_grenademooth = 1;
- }
- }
- else
- {
- if(bot_aim(WEP_CVAR_SEC(mortar, speed), WEP_CVAR_SEC(mortar, speed_up), WEP_CVAR_SEC(mortar, lifetime), true))
- {
- self.BUTTON_ATCK2 = true;
- if(random() < 0.02) self.bot_secondary_grenademooth = 0;
- }
- }
- }
- /*case WR_CALCINFO:
- {
- wepinfo_pri_refire = max3(sys_frametime, WEP_CVAR_PRI(mortar, refire), WEP_CVAR_PRI(mortar, animtime));
- wepinfo_pri_dps = (WEP_CVAR_PRI(mortar, damage) * (1 / wepinfo_pri_refire));
- wepinfo_pri_speed = (1 / max(1, (10000 / max(1, WEP_CVAR_PRI(mortar, speed)))));
-
- // for the range calculation, closer to 1 is better
- wepinfo_pri_range_max = 2000 * wepinfo_pri_speed;
- wepinfo_pri_range = wepinfo_pri_speed * WEP_CVAR_PRI(mortar,
-
- wepinfo_sec_refire = max3(sys_frametime, WEP_CVAR_SEC(mortar, refire), WEP_CVAR_SEC(mortar, animtime));
- wepinfo_sec_dps = (WEP_CVAR_SEC(mortar, damage) * (1 / wepinfo_sec_refire));
-
- wepinfo_sec_dps = (WEP_CVAR_SEC(mortar, damage) * (1 / max3(sys_frametime, WEP_CVAR_SEC(mortar, refire), WEP_CVAR_SEC(mortar, animtime))));
- wepinfo_ter_dps = 0;
- */
- METHOD(Mortar, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
- {
- if(autocvar_g_balance_mortar_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(mortar, ammo), WEP_CVAR_SEC(mortar, ammo))) { // forced reload
- thiswep.wr_reload(thiswep, actor, weaponentity);
- } else if(fire & 1)
- {
- if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(mortar, refire)))
- {
- W_Mortar_Attack(thiswep);
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(mortar, animtime), w_ready);
- }
- }
- else if(fire & 2)
- {
- if(WEP_CVAR_SEC(mortar, remote_detonateprimary))
- {
- bool nadefound = false;
- entity nade;
- for(nade = world; (nade = find(nade, classname, "grenade")); ) if(nade.realowner == actor)
- {
- if(!nade.gl_detonate_later)
- {
- nade.gl_detonate_later = true;
- nadefound = true;
- }
- }
- if(nadefound)
- sound(actor, CH_WEAPON_B, SND_ROCKET_DET, VOL_BASE, ATTN_NORM);
- }
- else if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(mortar, refire)))
- {
- W_Mortar_Attack2(thiswep);
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(mortar, animtime), w_ready);
- }
- }
- }
- METHOD(Mortar, wr_checkammo1, bool(entity thiswep))
- {
- float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(mortar, ammo);
- ammo_amount += self.(weapon_load[WEP_MORTAR.m_id]) >= WEP_CVAR_PRI(mortar, ammo);
- return ammo_amount;
- }
- METHOD(Mortar, wr_checkammo2, bool(entity thiswep))
- {
- float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(mortar, ammo);
- ammo_amount += self.(weapon_load[WEP_MORTAR.m_id]) >= WEP_CVAR_SEC(mortar, ammo);
- return ammo_amount;
- }
- METHOD(Mortar, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
- {
- W_Reload(self, min(WEP_CVAR_PRI(mortar, ammo), WEP_CVAR_SEC(mortar, ammo)), SND(RELOAD)); // WEAPONTODO
- }
- METHOD(Mortar, wr_suicidemessage, Notification(entity thiswep))
- {
- if(w_deathtype & HITTYPE_SECONDARY)
- return WEAPON_MORTAR_SUICIDE_BOUNCE;
- else
- return WEAPON_MORTAR_SUICIDE_EXPLODE;
- }
- METHOD(Mortar, wr_killmessage, Notification(entity thiswep))
- {
- if(w_deathtype & HITTYPE_SECONDARY)
- return WEAPON_MORTAR_MURDER_BOUNCE;
- else
- return WEAPON_MORTAR_MURDER_EXPLODE;
- }
+ METHOD(Mortar, wr_aim, void(entity thiswep))
+ {
+ PHYS_INPUT_BUTTON_ATCK(self) = false;
+ PHYS_INPUT_BUTTON_ATCK2(self) = false;
+ if(self.bot_secondary_grenademooth == 0) // WEAPONTODO: merge this into using WEP_CVAR_BOTH
+ {
+ if(bot_aim(WEP_CVAR_PRI(mortar, speed), WEP_CVAR_PRI(mortar, speed_up), WEP_CVAR_PRI(mortar, lifetime), true))
+ {
+ PHYS_INPUT_BUTTON_ATCK(self) = true;
+ if(random() < 0.01) self.bot_secondary_grenademooth = 1;
+ }
+ }
+ else
+ {
+ if(bot_aim(WEP_CVAR_SEC(mortar, speed), WEP_CVAR_SEC(mortar, speed_up), WEP_CVAR_SEC(mortar, lifetime), true))
+ {
+ PHYS_INPUT_BUTTON_ATCK2(self) = true;
+ if(random() < 0.02) self.bot_secondary_grenademooth = 0;
+ }
+ }
+ }
+ /*case WR_CALCINFO:
+ {
+ wepinfo_pri_refire = max3(sys_frametime, WEP_CVAR_PRI(mortar, refire), WEP_CVAR_PRI(mortar, animtime));
+ wepinfo_pri_dps = (WEP_CVAR_PRI(mortar, damage) * (1 / wepinfo_pri_refire));
+ wepinfo_pri_speed = (1 / max(1, (10000 / max(1, WEP_CVAR_PRI(mortar, speed)))));
+
+ // for the range calculation, closer to 1 is better
+ wepinfo_pri_range_max = 2000 * wepinfo_pri_speed;
+ wepinfo_pri_range = wepinfo_pri_speed * WEP_CVAR_PRI(mortar,
+
+ wepinfo_sec_refire = max3(sys_frametime, WEP_CVAR_SEC(mortar, refire), WEP_CVAR_SEC(mortar, animtime));
+ wepinfo_sec_dps = (WEP_CVAR_SEC(mortar, damage) * (1 / wepinfo_sec_refire));
+
+ wepinfo_sec_dps = (WEP_CVAR_SEC(mortar, damage) * (1 / max3(sys_frametime, WEP_CVAR_SEC(mortar, refire), WEP_CVAR_SEC(mortar, animtime))));
+ wepinfo_ter_dps = 0;
+ */
+ METHOD(Mortar, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+ {
+ if(autocvar_g_balance_mortar_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(mortar, ammo), WEP_CVAR_SEC(mortar, ammo))) { // forced reload
+ thiswep.wr_reload(thiswep, actor, weaponentity);
+ } else if(fire & 1)
+ {
+ if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(mortar, refire)))
+ {
+ W_Mortar_Attack(thiswep);
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(mortar, animtime), w_ready);
+ }
+ }
+ else if(fire & 2)
+ {
+ if(WEP_CVAR_SEC(mortar, remote_detonateprimary))
+ {
+ bool nadefound = false;
+ entity nade;
+ for(nade = world; (nade = find(nade, classname, "grenade")); ) if(nade.realowner == actor)
+ {
+ if(!nade.gl_detonate_later)
+ {
+ nade.gl_detonate_later = true;
+ nadefound = true;
+ }
+ }
+ if(nadefound)
+ sound(actor, CH_WEAPON_B, SND_ROCKET_DET, VOL_BASE, ATTN_NORM);
+ }
+ else if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(mortar, refire)))
+ {
+ W_Mortar_Attack2(thiswep);
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(mortar, animtime), w_ready);
+ }
+ }
+ }
+ METHOD(Mortar, wr_checkammo1, bool(entity thiswep))
+ {
+ float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(mortar, ammo);
+ ammo_amount += self.(weapon_load[WEP_MORTAR.m_id]) >= WEP_CVAR_PRI(mortar, ammo);
+ return ammo_amount;
+ }
+ METHOD(Mortar, wr_checkammo2, bool(entity thiswep))
+ {
+ float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(mortar, ammo);
+ ammo_amount += self.(weapon_load[WEP_MORTAR.m_id]) >= WEP_CVAR_SEC(mortar, ammo);
+ return ammo_amount;
+ }
+ METHOD(Mortar, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+ {
+ W_Reload(self, min(WEP_CVAR_PRI(mortar, ammo), WEP_CVAR_SEC(mortar, ammo)), SND(RELOAD)); // WEAPONTODO
+ }
-METHOD(Mortar, wr_suicidemessage, int(entity thiswep))
++METHOD(Mortar, wr_suicidemessage, Notification(entity thiswep))
+ {
+ if(w_deathtype & HITTYPE_SECONDARY)
+ return WEAPON_MORTAR_SUICIDE_BOUNCE;
+ else
+ return WEAPON_MORTAR_SUICIDE_EXPLODE;
+ }
-METHOD(Mortar, wr_killmessage, int(entity thiswep))
++METHOD(Mortar, wr_killmessage, Notification(entity thiswep))
+ {
+ if(w_deathtype & HITTYPE_SECONDARY)
+ return WEAPON_MORTAR_MURDER_BOUNCE;
+ else
+ return WEAPON_MORTAR_MURDER_EXPLODE;
+ }
#endif
#ifdef CSQC
- METHOD(Mortar, wr_impacteffect, void(entity thiswep))
- {
- vector org2;
- org2 = w_org + w_backoff * 12;
- pointparticles(EFFECT_GRENADE_EXPLODE, org2, '0 0 0', 1);
- if(!w_issilent)
- sound(self, CH_SHOTS, SND_GRENADE_IMPACT, VOL_BASE, ATTN_NORM);
- }
+ METHOD(Mortar, wr_impacteffect, void(entity thiswep))
+ {
+ vector org2;
+ org2 = w_org + w_backoff * 12;
+ pointparticles(EFFECT_GRENADE_EXPLODE, org2, '0 0 0', 1);
+ if(!w_issilent)
+ sound(self, CH_SHOTS, SND_GRENADE_IMPACT, VOL_BASE, ATTN_NORM);
+ }
#endif
#endif
Send_Effect(EFFECT_RIFLE_MUZZLEFLASH, w_shotorg, w_shotdir * 2000, 1);
- if(self.BUTTON_ZOOM | self.BUTTON_ZOOMSCRIPT) // if zoomed, shoot from the eye
+ if(PHYS_INPUT_BUTTON_ZOOM(self) | PHYS_INPUT_BUTTON_ZOOMSCRIPT(self)) // if zoomed, shoot from the eye
{
w_shotdir = v_forward;
w_shotorg = self.origin + self.view_ofs + ((w_shotorg - self.origin - self.view_ofs) * v_forward) * v_forward;
.float bot_secondary_riflemooth;
- METHOD(Rifle, wr_aim, void(entity thiswep))
- {
- self.BUTTON_ATCK=false;
- self.BUTTON_ATCK2=false;
- if(vdist(self.origin - self.enemy.origin, >, 1000))
- self.bot_secondary_riflemooth = 0;
- if(self.bot_secondary_riflemooth == 0)
- {
- if(bot_aim(1000000, 0, 0.001, false))
- {
- self.BUTTON_ATCK = true;
- if(random() < 0.01) self.bot_secondary_riflemooth = 1;
- }
- }
- else
- {
- if(bot_aim(1000000, 0, 0.001, false))
- {
- self.BUTTON_ATCK2 = true;
- if(random() < 0.03) self.bot_secondary_riflemooth = 0;
- }
- }
- }
- METHOD(Rifle, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
- {
- if(autocvar_g_balance_rifle_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(rifle, ammo), WEP_CVAR_SEC(rifle, ammo))) { // forced reload
- thiswep.wr_reload(thiswep, actor, weaponentity);
- } else
- {
- actor.rifle_accumulator = bound(time - WEP_CVAR(rifle, bursttime), actor.rifle_accumulator, time);
- if(fire & 1)
- if(weapon_prepareattack_check(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(rifle, refire)))
- if(time >= actor.rifle_accumulator + WEP_CVAR_PRI(rifle, burstcost))
- {
- weapon_prepareattack_do(actor, weaponentity, false, WEP_CVAR_PRI(rifle, refire));
- W_Rifle_BulletHail(weaponentity, WEP_CVAR_PRI(rifle, bullethail), W_Rifle_Attack, WFRAME_FIRE1, WEP_CVAR_PRI(rifle, animtime), WEP_CVAR_PRI(rifle, refire));
- actor.rifle_accumulator += WEP_CVAR_PRI(rifle, burstcost);
- }
- if(fire & 2)
- {
- if(WEP_CVAR(rifle, secondary))
- {
- if(WEP_CVAR_SEC(rifle, reload)) {
- thiswep.wr_reload(thiswep, actor, weaponentity);
- } else
- {
- if(weapon_prepareattack_check(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(rifle, refire)))
- if(time >= actor.rifle_accumulator + WEP_CVAR_SEC(rifle, burstcost))
- {
- weapon_prepareattack_do(actor, weaponentity, true, WEP_CVAR_SEC(rifle, refire));
- W_Rifle_BulletHail(weaponentity, WEP_CVAR_SEC(rifle, bullethail), W_Rifle_Attack2, WFRAME_FIRE2, WEP_CVAR_SEC(rifle, animtime), WEP_CVAR_PRI(rifle, refire));
- actor.rifle_accumulator += WEP_CVAR_SEC(rifle, burstcost);
- }
- }
- }
- }
- }
- }
- METHOD(Rifle, wr_checkammo1, bool(entity thiswep))
- {
- float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(rifle, ammo);
- ammo_amount += self.(weapon_load[WEP_RIFLE.m_id]) >= WEP_CVAR_PRI(rifle, ammo);
- return ammo_amount;
- }
- METHOD(Rifle, wr_checkammo2, bool(entity thiswep))
- {
- float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(rifle, ammo);
- ammo_amount += self.(weapon_load[WEP_RIFLE.m_id]) >= WEP_CVAR_SEC(rifle, ammo);
- return ammo_amount;
- }
- METHOD(Rifle, wr_resetplayer, void(entity thiswep))
- {
- self.rifle_accumulator = time - WEP_CVAR(rifle, bursttime);
- }
- METHOD(Rifle, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
- {
- W_Reload(self, min(WEP_CVAR_PRI(rifle, ammo), WEP_CVAR_SEC(rifle, ammo)), SND(RELOAD));
- }
- METHOD(Rifle, wr_suicidemessage, Notification(entity thiswep))
- {
- return WEAPON_THINKING_WITH_PORTALS;
- }
- METHOD(Rifle, wr_killmessage, Notification(entity thiswep))
- {
- if(w_deathtype & HITTYPE_SECONDARY)
- {
- if(w_deathtype & HITTYPE_BOUNCE)
- return WEAPON_RIFLE_MURDER_HAIL_PIERCING;
- else
- return WEAPON_RIFLE_MURDER_HAIL;
- }
- else
- {
- if(w_deathtype & HITTYPE_BOUNCE)
- return WEAPON_RIFLE_MURDER_PIERCING;
- else
- return WEAPON_RIFLE_MURDER;
- }
- }
+ METHOD(Rifle, wr_aim, void(entity thiswep))
+ {
+ PHYS_INPUT_BUTTON_ATCK(self) = false;
+ PHYS_INPUT_BUTTON_ATCK2(self) = false;
+ if(vdist(self.origin - self.enemy.origin, >, 1000))
+ self.bot_secondary_riflemooth = 0;
+ if(self.bot_secondary_riflemooth == 0)
+ {
+ if(bot_aim(1000000, 0, 0.001, false))
+ {
+ PHYS_INPUT_BUTTON_ATCK(self) = true;
+ if(random() < 0.01) self.bot_secondary_riflemooth = 1;
+ }
+ }
+ else
+ {
+ if(bot_aim(1000000, 0, 0.001, false))
+ {
+ PHYS_INPUT_BUTTON_ATCK2(self) = true;
+ if(random() < 0.03) self.bot_secondary_riflemooth = 0;
+ }
+ }
+ }
+ METHOD(Rifle, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+ {
+ if(autocvar_g_balance_rifle_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(rifle, ammo), WEP_CVAR_SEC(rifle, ammo))) { // forced reload
+ thiswep.wr_reload(thiswep, actor, weaponentity);
+ } else
+ {
+ actor.rifle_accumulator = bound(time - WEP_CVAR(rifle, bursttime), actor.rifle_accumulator, time);
+ if(fire & 1)
+ if(weapon_prepareattack_check(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(rifle, refire)))
+ if(time >= actor.rifle_accumulator + WEP_CVAR_PRI(rifle, burstcost))
+ {
+ weapon_prepareattack_do(actor, weaponentity, false, WEP_CVAR_PRI(rifle, refire));
+ W_Rifle_BulletHail(weaponentity, WEP_CVAR_PRI(rifle, bullethail), W_Rifle_Attack, WFRAME_FIRE1, WEP_CVAR_PRI(rifle, animtime), WEP_CVAR_PRI(rifle, refire));
+ actor.rifle_accumulator += WEP_CVAR_PRI(rifle, burstcost);
+ }
+ if(fire & 2)
+ {
+ if(WEP_CVAR(rifle, secondary))
+ {
+ if(WEP_CVAR_SEC(rifle, reload)) {
+ thiswep.wr_reload(thiswep, actor, weaponentity);
+ } else
+ {
+ if(weapon_prepareattack_check(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(rifle, refire)))
+ if(time >= actor.rifle_accumulator + WEP_CVAR_SEC(rifle, burstcost))
+ {
+ weapon_prepareattack_do(actor, weaponentity, true, WEP_CVAR_SEC(rifle, refire));
+ W_Rifle_BulletHail(weaponentity, WEP_CVAR_SEC(rifle, bullethail), W_Rifle_Attack2, WFRAME_FIRE2, WEP_CVAR_SEC(rifle, animtime), WEP_CVAR_PRI(rifle, refire));
+ actor.rifle_accumulator += WEP_CVAR_SEC(rifle, burstcost);
+ }
+ }
+ }
+ }
+ }
+ }
+ METHOD(Rifle, wr_checkammo1, bool(entity thiswep))
+ {
+ float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(rifle, ammo);
+ ammo_amount += self.(weapon_load[WEP_RIFLE.m_id]) >= WEP_CVAR_PRI(rifle, ammo);
+ return ammo_amount;
+ }
+ METHOD(Rifle, wr_checkammo2, bool(entity thiswep))
+ {
+ float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(rifle, ammo);
+ ammo_amount += self.(weapon_load[WEP_RIFLE.m_id]) >= WEP_CVAR_SEC(rifle, ammo);
+ return ammo_amount;
+ }
+ METHOD(Rifle, wr_resetplayer, void(entity thiswep))
+ {
+ self.rifle_accumulator = time - WEP_CVAR(rifle, bursttime);
+ }
+ METHOD(Rifle, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+ {
+ W_Reload(self, min(WEP_CVAR_PRI(rifle, ammo), WEP_CVAR_SEC(rifle, ammo)), SND(RELOAD));
+ }
-METHOD(Rifle, wr_suicidemessage, int(entity thiswep))
++METHOD(Rifle, wr_suicidemessage, Notification(entity thiswep))
+ {
+ return WEAPON_THINKING_WITH_PORTALS;
+ }
-METHOD(Rifle, wr_killmessage, int(entity thiswep))
++METHOD(Rifle, wr_killmessage, Notification(entity thiswep))
+ {
+ if(w_deathtype & HITTYPE_SECONDARY)
+ {
+ if(w_deathtype & HITTYPE_BOUNCE)
+ return WEAPON_RIFLE_MURDER_HAIL_PIERCING;
+ else
+ return WEAPON_RIFLE_MURDER_HAIL;
+ }
+ else
+ {
+ if(w_deathtype & HITTYPE_BOUNCE)
+ return WEAPON_RIFLE_MURDER_PIERCING;
+ else
+ return WEAPON_RIFLE_MURDER;
+ }
+ }
#endif
#ifdef CSQC
- METHOD(Rifle, wr_impacteffect, void(entity thiswep))
- {
- vector org2;
- org2 = w_org + w_backoff * 2;
- pointparticles(EFFECT_RIFLE_IMPACT, org2, w_backoff * 1000, 1);
- if(!w_issilent)
- {
- sound(self, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTN_NORM);
- }
- }
- METHOD(Rifle, wr_init, void(entity thiswep))
- {
- if(autocvar_cl_reticle && autocvar_cl_reticle_weapon)
- {
- precache_pic("gfx/reticle_nex");
- }
- }
- METHOD(Rifle, wr_zoomreticle, bool(entity thiswep))
- {
- if(button_zoom || zoomscript_caught)
- {
- reticle_image = "gfx/reticle_nex";
- return true;
- }
- else
- {
- // no weapon specific image for this weapon
- return false;
- }
- }
+ METHOD(Rifle, wr_impacteffect, void(entity thiswep))
+ {
+ vector org2;
+ org2 = w_org + w_backoff * 2;
+ pointparticles(EFFECT_RIFLE_IMPACT, org2, w_backoff * 1000, 1);
+ if(!w_issilent)
+ {
+ sound(self, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTN_NORM);
+ }
+ }
+ METHOD(Rifle, wr_init, void(entity thiswep))
+ {
+ if(autocvar_cl_reticle && autocvar_cl_reticle_weapon)
+ {
+ precache_pic("gfx/reticle_nex");
+ }
+ }
+ METHOD(Rifle, wr_zoomreticle, bool(entity thiswep))
+ {
+ if(button_zoom || zoomscript_caught)
+ {
+ reticle_image = "gfx/reticle_nex";
+ return true;
+ }
+ else
+ {
+ // no weapon specific image for this weapon
+ return false;
+ }
+ }
#endif
#endif
// Begin: Genereal weapon functions
// ============================
- METHOD(Seeker, wr_aim, void(entity thiswep))
- {
- if(WEP_CVAR(seeker, type) == 1)
- if(W_Seeker_Tagged_Info(self, self.enemy) != world)
- self.BUTTON_ATCK = bot_aim(WEP_CVAR(seeker, missile_speed_max), 0, WEP_CVAR(seeker, missile_lifetime), false);
- else
- self.BUTTON_ATCK2 = bot_aim(WEP_CVAR(seeker, tag_speed), 0, WEP_CVAR(seeker, tag_lifetime), false);
- else
- self.BUTTON_ATCK = bot_aim(WEP_CVAR(seeker, tag_speed), 0, WEP_CVAR(seeker, tag_lifetime), false);
- }
- METHOD(Seeker, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
- {
- if(autocvar_g_balance_seeker_reload_ammo && actor.clip_load < min(WEP_CVAR(seeker, missile_ammo), WEP_CVAR(seeker, tag_ammo))) { // forced reload
- thiswep.wr_reload(thiswep, actor, weaponentity);
- } else if(fire & 1)
- {
- if(WEP_CVAR(seeker, type) == 1)
- {
- if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(seeker, missile_refire)))
- {
- W_Seeker_Attack();
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(seeker, missile_animtime), w_ready);
- }
- }
- else
- {
- if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(seeker, tag_refire)))
- {
- W_Seeker_Fire_Tag(thiswep);
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(seeker, tag_animtime), w_ready);
- }
- }
- }
-
- else if(fire & 2)
- {
- if(WEP_CVAR(seeker, type) == 1)
- {
- if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(seeker, tag_refire)))
- {
- W_Seeker_Fire_Tag(thiswep);
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(seeker, tag_animtime), w_ready);
- }
- }
- else
- {
- if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(seeker, flac_refire)))
- {
- W_Seeker_Fire_Flac(thiswep);
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(seeker, flac_animtime), w_ready);
- }
- }
- }
- }
- METHOD(Seeker, wr_checkammo1, bool(entity thiswep))
- {
- float ammo_amount;
- if(WEP_CVAR(seeker, type) == 1)
- {
- ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(seeker, missile_ammo);
- ammo_amount += self.(weapon_load[WEP_SEEKER.m_id]) >= WEP_CVAR(seeker, missile_ammo);
- }
- else
- {
- ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(seeker, tag_ammo);
- ammo_amount += self.(weapon_load[WEP_SEEKER.m_id]) >= WEP_CVAR(seeker, tag_ammo);
- }
- return ammo_amount;
- }
- METHOD(Seeker, wr_checkammo2, bool(entity thiswep))
- {
- float ammo_amount;
- if(WEP_CVAR(seeker, type) == 1)
- {
- ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(seeker, tag_ammo);
- ammo_amount += self.(weapon_load[WEP_SEEKER.m_id]) >= WEP_CVAR(seeker, tag_ammo);
- }
- else
- {
- ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(seeker, flac_ammo);
- ammo_amount += self.(weapon_load[WEP_SEEKER.m_id]) >= WEP_CVAR(seeker, flac_ammo);
- }
- return ammo_amount;
- }
- METHOD(Seeker, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
- {
- W_Reload(self, min(WEP_CVAR(seeker, missile_ammo), WEP_CVAR(seeker, tag_ammo)), SND(RELOAD));
- }
- METHOD(Seeker, wr_suicidemessage, Notification(entity thiswep))
- {
- return WEAPON_SEEKER_SUICIDE;
- }
- METHOD(Seeker, wr_killmessage, Notification(entity thiswep))
- {
- if(w_deathtype & HITTYPE_SECONDARY)
- return WEAPON_SEEKER_MURDER_TAG;
- else
- return WEAPON_SEEKER_MURDER_SPRAY;
- }
+ METHOD(Seeker, wr_aim, void(entity thiswep))
+ {
+ if(WEP_CVAR(seeker, type) == 1)
+ if(W_Seeker_Tagged_Info(self, self.enemy) != world)
+ PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR(seeker, missile_speed_max), 0, WEP_CVAR(seeker, missile_lifetime), false);
+ else
+ PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(WEP_CVAR(seeker, tag_speed), 0, WEP_CVAR(seeker, tag_lifetime), false);
+ else
+ PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR(seeker, tag_speed), 0, WEP_CVAR(seeker, tag_lifetime), false);
+ }
+ METHOD(Seeker, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+ {
+ if(autocvar_g_balance_seeker_reload_ammo && actor.clip_load < min(WEP_CVAR(seeker, missile_ammo), WEP_CVAR(seeker, tag_ammo))) { // forced reload
+ thiswep.wr_reload(thiswep, actor, weaponentity);
+ } else if(fire & 1)
+ {
+ if(WEP_CVAR(seeker, type) == 1)
+ {
+ if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(seeker, missile_refire)))
+ {
+ W_Seeker_Attack();
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(seeker, missile_animtime), w_ready);
+ }
+ }
+ else
+ {
+ if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(seeker, tag_refire)))
+ {
+ W_Seeker_Fire_Tag(thiswep);
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(seeker, tag_animtime), w_ready);
+ }
+ }
+ }
+
+ else if(fire & 2)
+ {
+ if(WEP_CVAR(seeker, type) == 1)
+ {
+ if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(seeker, tag_refire)))
+ {
+ W_Seeker_Fire_Tag(thiswep);
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(seeker, tag_animtime), w_ready);
+ }
+ }
+ else
+ {
+ if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(seeker, flac_refire)))
+ {
+ W_Seeker_Fire_Flac(thiswep);
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(seeker, flac_animtime), w_ready);
+ }
+ }
+ }
+ }
+ METHOD(Seeker, wr_checkammo1, bool(entity thiswep))
+ {
+ float ammo_amount;
+ if(WEP_CVAR(seeker, type) == 1)
+ {
+ ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(seeker, missile_ammo);
+ ammo_amount += self.(weapon_load[WEP_SEEKER.m_id]) >= WEP_CVAR(seeker, missile_ammo);
+ }
+ else
+ {
+ ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(seeker, tag_ammo);
+ ammo_amount += self.(weapon_load[WEP_SEEKER.m_id]) >= WEP_CVAR(seeker, tag_ammo);
+ }
+ return ammo_amount;
+ }
+ METHOD(Seeker, wr_checkammo2, bool(entity thiswep))
+ {
+ float ammo_amount;
+ if(WEP_CVAR(seeker, type) == 1)
+ {
+ ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(seeker, tag_ammo);
+ ammo_amount += self.(weapon_load[WEP_SEEKER.m_id]) >= WEP_CVAR(seeker, tag_ammo);
+ }
+ else
+ {
+ ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(seeker, flac_ammo);
+ ammo_amount += self.(weapon_load[WEP_SEEKER.m_id]) >= WEP_CVAR(seeker, flac_ammo);
+ }
+ return ammo_amount;
+ }
+ METHOD(Seeker, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+ {
+ W_Reload(self, min(WEP_CVAR(seeker, missile_ammo), WEP_CVAR(seeker, tag_ammo)), SND(RELOAD));
+ }
-METHOD(Seeker, wr_suicidemessage, int(entity thiswep))
++METHOD(Seeker, wr_suicidemessage, Notification(entity thiswep))
+ {
+ return WEAPON_SEEKER_SUICIDE;
+ }
-METHOD(Seeker, wr_killmessage, int(entity thiswep))
++METHOD(Seeker, wr_killmessage, Notification(entity thiswep))
+ {
+ if(w_deathtype & HITTYPE_SECONDARY)
+ return WEAPON_SEEKER_MURDER_TAG;
+ else
+ return WEAPON_SEEKER_MURDER_SPRAY;
+ }
#endif
#ifdef CSQC
- METHOD(Seeker, wr_impacteffect, void(entity thiswep))
- {
- vector org2;
- org2 = w_org + w_backoff * 6;
- if(w_deathtype & HITTYPE_BOUNCE)
- {
- if(w_deathtype & HITTYPE_SECONDARY)
- {
- if(!w_issilent)
- sound(self, CH_SHOTS, SND_TAG_IMPACT, 1, ATTEN_NORM);
- }
- else
- {
- pointparticles(EFFECT_HAGAR_EXPLODE, org2, '0 0 0', 1);
- if(!w_issilent)
- {
- if(w_random<0.15)
- sound(self, CH_SHOTS, SND_TAGEXP1, 1, ATTEN_NORM);
- else if(w_random<0.7)
- sound(self, CH_SHOTS, SND_TAGEXP2, 1, ATTEN_NORM);
- else
- sound(self, CH_SHOTS, SND_TAGEXP3, 1, ATTEN_NORM);
- }
- }
- }
- else
- {
- pointparticles(EFFECT_HAGAR_EXPLODE, org2, '0 0 0', 1);
- if(!w_issilent)
- {
- if(w_random<0.15)
- sound(self, CH_SHOTS, SND_SEEKEREXP1, 1, ATTEN_NORM);
- else if(w_random<0.7)
- sound(self, CH_SHOTS, SND_SEEKEREXP2, 1, ATTEN_NORM);
- else
- sound(self, CH_SHOTS, SND_SEEKEREXP3, 1, ATTEN_NORM);
- }
- }
- }
+ METHOD(Seeker, wr_impacteffect, void(entity thiswep))
+ {
+ vector org2;
+ org2 = w_org + w_backoff * 6;
+ if(w_deathtype & HITTYPE_BOUNCE)
+ {
+ if(w_deathtype & HITTYPE_SECONDARY)
+ {
+ if(!w_issilent)
+ sound(self, CH_SHOTS, SND_TAG_IMPACT, 1, ATTEN_NORM);
+ }
+ else
+ {
+ pointparticles(EFFECT_HAGAR_EXPLODE, org2, '0 0 0', 1);
+ if(!w_issilent)
+ {
+ if(w_random<0.15)
+ sound(self, CH_SHOTS, SND_TAGEXP1, 1, ATTEN_NORM);
+ else if(w_random<0.7)
+ sound(self, CH_SHOTS, SND_TAGEXP2, 1, ATTEN_NORM);
+ else
+ sound(self, CH_SHOTS, SND_TAGEXP3, 1, ATTEN_NORM);
+ }
+ }
+ }
+ else
+ {
+ pointparticles(EFFECT_HAGAR_EXPLODE, org2, '0 0 0', 1);
+ if(!w_issilent)
+ {
+ if(w_random<0.15)
+ sound(self, CH_SHOTS, SND_SEEKEREXP1, 1, ATTEN_NORM);
+ else if(w_random<0.7)
+ sound(self, CH_SHOTS, SND_SEEKEREXP2, 1, ATTEN_NORM);
+ else
+ sound(self, CH_SHOTS, SND_SEEKEREXP3, 1, ATTEN_NORM);
+ }
+ }
+ }
#endif
#endif
}
}
- METHOD(Shockwave, wr_aim, void(entity thiswep))
- {
- if(vlen(self.origin - self.enemy.origin) <= WEP_CVAR(shockwave, melee_range))
- { self.BUTTON_ATCK2 = bot_aim(1000000, 0, 0.001, false); }
- else
- { self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, false); }
- }
- METHOD(Shockwave, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
- {
- if(fire & 1)
- {
- if(time >= actor.shockwave_blasttime) // handle refire separately so the secondary can be fired straight after a primary
- {
- if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(shockwave, blast_animtime)))
- {
- W_Shockwave_Attack();
- actor.shockwave_blasttime = time + WEP_CVAR(shockwave, blast_refire) * W_WeaponRateFactor();
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(shockwave, blast_animtime), w_ready);
- }
- }
- }
- else if(fire & 2)
- {
- //if(actor.clip_load >= 0) // we are not currently reloading
- if(!actor.crouch) // no crouchmelee please
- if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR(shockwave, melee_refire)))
- {
- // attempt forcing playback of the anim by switching to another anim (that we never play) here...
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, W_Shockwave_Melee);
- }
- }
- }
- METHOD(Shockwave, wr_checkammo1, bool(entity thiswep))
- {
- return true; // infinite ammo
- }
- METHOD(Shockwave, wr_checkammo2, bool(entity thiswep))
- {
- // shockwave has infinite ammo
- return true;
- }
- METHOD(Shockwave, wr_suicidemessage, Notification(entity thiswep))
- {
- return WEAPON_THINKING_WITH_PORTALS;
- }
- METHOD(Shockwave, wr_killmessage, Notification(entity thiswep))
- {
- if(w_deathtype & HITTYPE_SECONDARY)
- return WEAPON_SHOCKWAVE_MURDER_SLAP;
- else
- return WEAPON_SHOCKWAVE_MURDER;
- }
+ METHOD(Shockwave, wr_aim, void(entity thiswep))
+ {
+ if(vlen(self.origin - self.enemy.origin) <= WEP_CVAR(shockwave, melee_range))
+ { PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(1000000, 0, 0.001, false); }
+ else
+ { PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(1000000, 0, 0.001, false); }
+ }
+ METHOD(Shockwave, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+ {
+ if(fire & 1)
+ {
+ if(time >= actor.shockwave_blasttime) // handle refire separately so the secondary can be fired straight after a primary
+ {
+ if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(shockwave, blast_animtime)))
+ {
+ W_Shockwave_Attack();
+ actor.shockwave_blasttime = time + WEP_CVAR(shockwave, blast_refire) * W_WeaponRateFactor();
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(shockwave, blast_animtime), w_ready);
+ }
+ }
+ }
+ else if(fire & 2)
+ {
+ //if(actor.clip_load >= 0) // we are not currently reloading
+ if(!actor.crouch) // no crouchmelee please
+ if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR(shockwave, melee_refire)))
+ {
+ // attempt forcing playback of the anim by switching to another anim (that we never play) here...
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, W_Shockwave_Melee);
+ }
+ }
+ }
+ METHOD(Shockwave, wr_checkammo1, bool(entity thiswep))
+ {
+ return true; // infinite ammo
+ }
+ METHOD(Shockwave, wr_checkammo2, bool(entity thiswep))
+ {
+ // shockwave has infinite ammo
+ return true;
+ }
-METHOD(Shockwave, wr_suicidemessage, int(entity thiswep))
++METHOD(Shockwave, wr_suicidemessage, Notification(entity thiswep))
+ {
+ return WEAPON_THINKING_WITH_PORTALS;
+ }
-METHOD(Shockwave, wr_killmessage, int(entity thiswep))
++METHOD(Shockwave, wr_killmessage, Notification(entity thiswep))
+ {
+ if(w_deathtype & HITTYPE_SECONDARY)
+ return WEAPON_SHOCKWAVE_MURDER_SLAP;
+ else
+ return WEAPON_SHOCKWAVE_MURDER;
+ }
#endif
#ifdef CSQC
shockwave.sw_time = time;
}
- METHOD(Shockwave, wr_impacteffect, void(entity thiswep))
- {
- // handled by Net_ReadShockwaveParticle
- //vector org2;
- //org2 = w_org + w_backoff * 2;
- //pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);
- }
+ METHOD(Shockwave, wr_impacteffect, void(entity thiswep))
+ {
+ // handled by Net_ReadShockwaveParticle
+ //vector org2;
+ //org2 = w_org + w_backoff * 2;
+ //pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);
+ }
#endif
#endif
.float shotgun_primarytime;
- METHOD(Shotgun, wr_aim, void(entity thiswep))
- {
- if(vdist(self.origin - self.enemy.origin, <=, WEP_CVAR_SEC(shotgun, melee_range)))
- self.BUTTON_ATCK2 = bot_aim(1000000, 0, 0.001, false);
- else
- self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, false);
- }
- METHOD(Shotgun, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
- {
- if(WEP_CVAR(shotgun, reload_ammo) && actor.clip_load < WEP_CVAR_PRI(shotgun, ammo)) // forced reload
- {
- // don't force reload an empty shotgun if its melee attack is active
- if(WEP_CVAR(shotgun, secondary) < 2) {
- thiswep.wr_reload(thiswep, actor, weaponentity);
- }
- }
- else
- {
- if(fire & 1)
- {
- if(time >= actor.shotgun_primarytime) // handle refire separately so the secondary can be fired straight after a primary
- {
- if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(shotgun, animtime)))
- {
- W_Shotgun_Attack(thiswep, true);
- actor.shotgun_primarytime = time + WEP_CVAR_PRI(shotgun, refire) * W_WeaponRateFactor();
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(shotgun, animtime), w_ready);
- }
- }
- }
- else if((fire & 2) && WEP_CVAR(shotgun, secondary) == 2)
- {
- if(time >= actor.shotgun_primarytime) // handle refire separately so the secondary can be fired straight after a primary
- {
- if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(shotgun, alt_animtime)))
- {
- W_Shotgun_Attack(thiswep, false);
- actor.shotgun_primarytime = time + WEP_CVAR_SEC(shotgun, alt_refire) * W_WeaponRateFactor();
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), W_Shotgun_Attack3_Frame1);
- }
- }
- }
- }
- if(actor.clip_load >= 0) // we are not currently reloading
- if(!actor.crouch) // no crouchmelee please
- if(WEP_CVAR(shotgun, secondary) == 1)
- if(((fire & 1) && actor.(thiswep.ammo_field) <= 0 && !(actor.items & IT_UNLIMITED_WEAPON_AMMO)) || (fire & 2))
- if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(shotgun, refire)))
- {
- // attempt forcing playback of the anim by switching to another anim (that we never play) here...
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, W_Shotgun_Attack2);
- }
- }
- METHOD(Shotgun, wr_setup, void(entity thiswep))
- {
- self.ammo_field = ammo_none;
- }
- METHOD(Shotgun, wr_checkammo1, bool(entity thiswep))
- {
- float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(shotgun, ammo);
- ammo_amount += self.(weapon_load[WEP_SHOTGUN.m_id]) >= WEP_CVAR_PRI(shotgun, ammo);
- return ammo_amount;
- }
- METHOD(Shotgun, wr_checkammo2, bool(entity thiswep))
- {
- if(IS_BOT_CLIENT(self))
- if(vdist(self.origin - self.enemy.origin, >, WEP_CVAR_SEC(shotgun, melee_range)))
- return false; // bots cannot use secondary out of range (fixes constant melee when out of ammo)
- switch(WEP_CVAR(shotgun, secondary))
- {
- case 1: return true; // melee does not use ammo
- case 2: // secondary triple shot
- {
- float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(shotgun, ammo);
- ammo_amount += self.(weapon_load[WEP_SHOTGUN.m_id]) >= WEP_CVAR_PRI(shotgun, ammo);
- return ammo_amount;
- }
- default: return false; // secondary unavailable
- }
- }
- METHOD(Shotgun, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
- {
- W_Reload(self, WEP_CVAR_PRI(shotgun, ammo), SND(RELOAD)); // WEAPONTODO
- }
- METHOD(Shotgun, wr_suicidemessage, Notification(entity thiswep))
- {
- return WEAPON_THINKING_WITH_PORTALS;
- }
- METHOD(Shotgun, wr_killmessage, Notification(entity thiswep))
- {
- if(w_deathtype & HITTYPE_SECONDARY)
- return WEAPON_SHOTGUN_MURDER_SLAP;
- else
- return WEAPON_SHOTGUN_MURDER;
- }
+ METHOD(Shotgun, wr_aim, void(entity thiswep))
+ {
+ if(vdist(self.origin - self.enemy.origin, <=, WEP_CVAR_SEC(shotgun, melee_range)))
+ PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(1000000, 0, 0.001, false);
+ else
+ PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(1000000, 0, 0.001, false);
+ }
+ METHOD(Shotgun, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+ {
+ if(WEP_CVAR(shotgun, reload_ammo) && actor.clip_load < WEP_CVAR_PRI(shotgun, ammo)) // forced reload
+ {
+ // don't force reload an empty shotgun if its melee attack is active
+ if(WEP_CVAR(shotgun, secondary) < 2) {
+ thiswep.wr_reload(thiswep, actor, weaponentity);
+ }
+ }
+ else
+ {
+ if(fire & 1)
+ {
+ if(time >= actor.shotgun_primarytime) // handle refire separately so the secondary can be fired straight after a primary
+ {
+ if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(shotgun, animtime)))
+ {
+ W_Shotgun_Attack(thiswep, true);
+ actor.shotgun_primarytime = time + WEP_CVAR_PRI(shotgun, refire) * W_WeaponRateFactor();
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(shotgun, animtime), w_ready);
+ }
+ }
+ }
+ else if((fire & 2) && WEP_CVAR(shotgun, secondary) == 2)
+ {
+ if(time >= actor.shotgun_primarytime) // handle refire separately so the secondary can be fired straight after a primary
+ {
+ if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(shotgun, alt_animtime)))
+ {
+ W_Shotgun_Attack(thiswep, false);
+ actor.shotgun_primarytime = time + WEP_CVAR_SEC(shotgun, alt_refire) * W_WeaponRateFactor();
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), W_Shotgun_Attack3_Frame1);
+ }
+ }
+ }
+ }
+ if(actor.clip_load >= 0) // we are not currently reloading
+ if(!actor.crouch) // no crouchmelee please
+ if(WEP_CVAR(shotgun, secondary) == 1)
+ if(((fire & 1) && actor.(thiswep.ammo_field) <= 0 && !(actor.items & IT_UNLIMITED_WEAPON_AMMO)) || (fire & 2))
+ if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(shotgun, refire)))
+ {
+ // attempt forcing playback of the anim by switching to another anim (that we never play) here...
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, W_Shotgun_Attack2);
+ }
+ }
+ METHOD(Shotgun, wr_setup, void(entity thiswep))
+ {
+ self.ammo_field = ammo_none;
+ }
+ METHOD(Shotgun, wr_checkammo1, bool(entity thiswep))
+ {
+ float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(shotgun, ammo);
+ ammo_amount += self.(weapon_load[WEP_SHOTGUN.m_id]) >= WEP_CVAR_PRI(shotgun, ammo);
+ return ammo_amount;
+ }
+ METHOD(Shotgun, wr_checkammo2, bool(entity thiswep))
+ {
+ if(IS_BOT_CLIENT(self))
+ if(vdist(self.origin - self.enemy.origin, >, WEP_CVAR_SEC(shotgun, melee_range)))
+ return false; // bots cannot use secondary out of range (fixes constant melee when out of ammo)
+ switch(WEP_CVAR(shotgun, secondary))
+ {
+ case 1: return true; // melee does not use ammo
+ case 2: // secondary triple shot
+ {
+ float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(shotgun, ammo);
+ ammo_amount += self.(weapon_load[WEP_SHOTGUN.m_id]) >= WEP_CVAR_PRI(shotgun, ammo);
+ return ammo_amount;
+ }
+ default: return false; // secondary unavailable
+ }
+ }
+ METHOD(Shotgun, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+ {
+ W_Reload(self, WEP_CVAR_PRI(shotgun, ammo), SND(RELOAD)); // WEAPONTODO
+ }
-METHOD(Shotgun, wr_suicidemessage, int(entity thiswep))
++METHOD(Shotgun, wr_suicidemessage, Notification(entity thiswep))
+ {
+ return WEAPON_THINKING_WITH_PORTALS;
+ }
-METHOD(Shotgun, wr_killmessage, int(entity thiswep))
++METHOD(Shotgun, wr_killmessage, Notification(entity thiswep))
+ {
+ if(w_deathtype & HITTYPE_SECONDARY)
+ return WEAPON_SHOTGUN_MURDER_SLAP;
+ else
+ return WEAPON_SHOTGUN_MURDER;
+ }
#endif
#ifdef CSQC
.float prevric;
- METHOD(Shotgun, wr_impacteffect, void(entity thiswep))
- {
- vector org2 = w_org + w_backoff * 2;
- pointparticles(EFFECT_SHOTGUN_IMPACT, org2, w_backoff * 1000, 1);
- if(!w_issilent && time - self.prevric > 0.25)
- {
- if(w_random < 0.05)
- sound(self, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_NORM);
- self.prevric = time;
- }
- }
+ METHOD(Shotgun, wr_impacteffect, void(entity thiswep))
+ {
+ vector org2 = w_org + w_backoff * 2;
+ pointparticles(EFFECT_SHOTGUN_IMPACT, org2, w_backoff * 1000, 1);
+ if(!w_issilent && time - self.prevric > 0.25)
+ {
+ if(w_random < 0.05)
+ sound(self, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_NORM);
+ self.prevric = time;
+ }
+ }
#endif
#endif
case 8: note = +4; break; // e
case 9: note = -1; break; // B
}
- if(pl.BUTTON_CROUCH)
+ if(PHYS_INPUT_BUTTON_CROUCH(pl))
note -= 12;
- if(pl.BUTTON_JUMP)
+ if(PHYS_INPUT_BUTTON_JUMP(pl))
note += 12;
if(hittype & HITTYPE_SECONDARY)
note += 7;
if (vdist((actor.origin - actor.enemy.origin), <, WEP_CVAR(tuba, radius)))
{
if (random() > 0.5)
- actor.BUTTON_ATCK = 1;
+ PHYS_INPUT_BUTTON_ATCK(actor) = true;
else
- actor.BUTTON_ATCK2 = 1;
+ PHYS_INPUT_BUTTON_ATCK2(actor) = true;
}
}
METHOD(Tuba, wr_checkammo1, bool(Tuba this)) { return true; }
METHOD(Tuba, wr_checkammo2, bool(Tuba this)) { return true; }
-METHOD(Tuba, wr_suicidemessage, int(Tuba this))
+METHOD(Tuba, wr_suicidemessage, Notification(Tuba this))
{
if (w_deathtype & HITTYPE_BOUNCE)
return WEAPON_KLEINBOTTLE_SUICIDE;
else
return WEAPON_TUBA_SUICIDE;
}
-METHOD(Tuba, wr_killmessage, int(Tuba this))
+METHOD(Tuba, wr_killmessage, Notification(Tuba this))
{
if (w_deathtype & HITTYPE_BOUNCE)
return WEAPON_KLEINBOTTLE_MURDER;
}
}
- METHOD(Vaporizer, wr_aim, void(entity thiswep))
- {
- if(self.(thiswep.ammo_field) > 0)
- self.BUTTON_ATCK = bot_aim(1000000, 0, 1, false);
- else
- self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_SEC(vaporizer, speed), 0, WEP_CVAR_SEC(vaporizer, lifetime), false); // WEAPONTODO: replace with proper vaporizer cvars
- }
- METHOD(Vaporizer, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
- {
- float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
- // if the laser uses load, we also consider its ammo for reloading
- if(WEP_CVAR(vaporizer, reload_ammo) && WEP_CVAR_SEC(vaporizer, ammo) && actor.clip_load < min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo))) { // forced reload
- thiswep.wr_reload(thiswep, actor, weaponentity);
- } else if(WEP_CVAR(vaporizer, reload_ammo) && actor.clip_load < vaporizer_ammo) { // forced reload
- thiswep.wr_reload(thiswep, actor, weaponentity);
- }
- if((fire & 1) && (actor.ammo_cells || !autocvar_g_rm) && !forbidWeaponUse(actor))
- {
- if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(vaporizer, refire)))
- {
- W_Vaporizer_Attack(thiswep);
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(vaporizer, animtime), w_ready);
- }
- }
- if((fire & 2) || ((fire & 1) && !actor.ammo_cells && autocvar_g_rm))
- {
- if((autocvar_g_rm && autocvar_g_rm_laser) || autocvar_g_rm_laser == 2)
- {
- bool rapid = autocvar_g_rm_laser_rapid;
- if(actor.jump_interval <= time && !actor.held_down)
- {
- if(rapid)
- actor.held_down = true;
- actor.jump_interval = time + autocvar_g_rm_laser_refire;
- actor.jump_interval2 = time + autocvar_g_rm_laser_rapid_delay;
- damage_goodhits = 0;
- W_RocketMinsta_Attack2();
- }
- else if(rapid && actor.jump_interval2 <= time && actor.held_down)
- {
- actor.jump_interval2 = time + autocvar_g_rm_laser_rapid_refire;
- damage_goodhits = 0;
- W_RocketMinsta_Attack3();
- //weapon_thinkf(actor, WFRAME_FIRE2, autocvar_g_rm_laser_rapid_animtime, w_ready);
- }
- }
- else if (actor.jump_interval <= time)
- {
- // handle refire manually, so that primary and secondary can be fired without conflictions (important for instagib)
- actor.jump_interval = time + WEP_CVAR_SEC(vaporizer, refire) * W_WeaponRateFactor();
-
- // decrease ammo for the laser?
- if(WEP_CVAR_SEC(vaporizer, ammo))
- W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(vaporizer, ammo));
-
- // ugly instagib hack to reuse the fire mode of the laser
- makevectors(actor.v_angle);
- Weapon oldwep = PS(actor).m_weapon; // we can't avoid this hack
- PS(actor).m_weapon = WEP_BLASTER;
- W_Blaster_Attack(
- actor,
- WEP_BLASTER.m_id | HITTYPE_SECONDARY,
- WEP_CVAR_SEC(vaporizer, shotangle),
- WEP_CVAR_SEC(vaporizer, damage),
- WEP_CVAR_SEC(vaporizer, edgedamage),
- WEP_CVAR_SEC(vaporizer, radius),
- WEP_CVAR_SEC(vaporizer, force),
- WEP_CVAR_SEC(vaporizer, speed),
- WEP_CVAR_SEC(vaporizer, spread),
- WEP_CVAR_SEC(vaporizer, delay),
- WEP_CVAR_SEC(vaporizer, lifetime)
- );
- PS(actor).m_weapon = oldwep;
-
- // now do normal refire
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(vaporizer, animtime), w_ready);
- }
- }
- else
- actor.held_down = false;
- }
- METHOD(Vaporizer, wr_setup, void(entity thiswep))
- {
- self.ammo_field = (thiswep.ammo_field);
- self.vaporizer_lasthit = 0;
- }
- METHOD(Vaporizer, wr_checkammo1, bool(entity thiswep))
- {
- float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
- float ammo_amount = self.(thiswep.ammo_field) >= vaporizer_ammo;
- ammo_amount += self.(weapon_load[WEP_VAPORIZER.m_id]) >= vaporizer_ammo;
- return ammo_amount;
- }
- METHOD(Vaporizer, wr_checkammo2, bool(entity thiswep))
- {
- if(!WEP_CVAR_SEC(vaporizer, ammo))
- return true;
- float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(vaporizer, ammo);
- ammo_amount += self.(weapon_load[WEP_VAPORIZER.m_id]) >= WEP_CVAR_SEC(vaporizer, ammo);
- return ammo_amount;
- }
- METHOD(Vaporizer, wr_resetplayer, void(entity thiswep))
- {
- self.vaporizer_lasthit = 0;
- }
- METHOD(Vaporizer, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
- {
- float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
- float used_ammo;
- if(WEP_CVAR_SEC(vaporizer, ammo))
- used_ammo = min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo));
- else
- used_ammo = vaporizer_ammo;
-
- W_Reload(self, used_ammo, SND(RELOAD));
- }
- METHOD(Vaporizer, wr_suicidemessage, Notification(entity thiswep))
- {
- return WEAPON_THINKING_WITH_PORTALS;
- }
- METHOD(Vaporizer, wr_killmessage, Notification(entity thiswep))
- {
- return WEAPON_VAPORIZER_MURDER;
- }
+ METHOD(Vaporizer, wr_aim, void(entity thiswep))
+ {
+ if(self.(thiswep.ammo_field) > 0)
+ PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(1000000, 0, 1, false);
+ else
+ PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(WEP_CVAR_SEC(vaporizer, speed), 0, WEP_CVAR_SEC(vaporizer, lifetime), false); // WEAPONTODO: replace with proper vaporizer cvars
+ }
+ METHOD(Vaporizer, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+ {
+ float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
+ // if the laser uses load, we also consider its ammo for reloading
+ if(WEP_CVAR(vaporizer, reload_ammo) && WEP_CVAR_SEC(vaporizer, ammo) && actor.clip_load < min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo))) { // forced reload
+ thiswep.wr_reload(thiswep, actor, weaponentity);
+ } else if(WEP_CVAR(vaporizer, reload_ammo) && actor.clip_load < vaporizer_ammo) { // forced reload
+ thiswep.wr_reload(thiswep, actor, weaponentity);
+ }
+ if((fire & 1) && (actor.ammo_cells || !autocvar_g_rm) && !forbidWeaponUse(actor))
+ {
+ if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(vaporizer, refire)))
+ {
+ W_Vaporizer_Attack(thiswep);
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(vaporizer, animtime), w_ready);
+ }
+ }
+ if((fire & 2) || ((fire & 1) && !actor.ammo_cells && autocvar_g_rm))
+ {
+ if((autocvar_g_rm && autocvar_g_rm_laser) || autocvar_g_rm_laser == 2)
+ {
+ bool rapid = autocvar_g_rm_laser_rapid;
+ if(actor.jump_interval <= time && !actor.held_down)
+ {
+ if(rapid)
+ actor.held_down = true;
+ actor.jump_interval = time + autocvar_g_rm_laser_refire;
+ actor.jump_interval2 = time + autocvar_g_rm_laser_rapid_delay;
+ damage_goodhits = 0;
+ W_RocketMinsta_Attack2();
+ }
+ else if(rapid && actor.jump_interval2 <= time && actor.held_down)
+ {
+ actor.jump_interval2 = time + autocvar_g_rm_laser_rapid_refire;
+ damage_goodhits = 0;
+ W_RocketMinsta_Attack3();
+ //weapon_thinkf(actor, WFRAME_FIRE2, autocvar_g_rm_laser_rapid_animtime, w_ready);
+ }
+ }
+ else if (actor.jump_interval <= time)
+ {
+ // handle refire manually, so that primary and secondary can be fired without conflictions (important for instagib)
+ actor.jump_interval = time + WEP_CVAR_SEC(vaporizer, refire) * W_WeaponRateFactor();
+
+ // decrease ammo for the laser?
+ if(WEP_CVAR_SEC(vaporizer, ammo))
+ W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(vaporizer, ammo));
+
+ // ugly instagib hack to reuse the fire mode of the laser
+ makevectors(actor.v_angle);
+ Weapon oldwep = PS(actor).m_weapon; // we can't avoid this hack
+ PS(actor).m_weapon = WEP_BLASTER;
+ W_Blaster_Attack(
+ actor,
+ WEP_BLASTER.m_id | HITTYPE_SECONDARY,
+ WEP_CVAR_SEC(vaporizer, shotangle),
+ WEP_CVAR_SEC(vaporizer, damage),
+ WEP_CVAR_SEC(vaporizer, edgedamage),
+ WEP_CVAR_SEC(vaporizer, radius),
+ WEP_CVAR_SEC(vaporizer, force),
+ WEP_CVAR_SEC(vaporizer, speed),
+ WEP_CVAR_SEC(vaporizer, spread),
+ WEP_CVAR_SEC(vaporizer, delay),
+ WEP_CVAR_SEC(vaporizer, lifetime)
+ );
+ PS(actor).m_weapon = oldwep;
+
+ // now do normal refire
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(vaporizer, animtime), w_ready);
+ }
+ }
+ else
+ actor.held_down = false;
+ }
+ METHOD(Vaporizer, wr_setup, void(entity thiswep))
+ {
+ self.ammo_field = (thiswep.ammo_field);
+ self.vaporizer_lasthit = 0;
+ }
+ METHOD(Vaporizer, wr_checkammo1, bool(entity thiswep))
+ {
+ float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
+ float ammo_amount = self.(thiswep.ammo_field) >= vaporizer_ammo;
+ ammo_amount += self.(weapon_load[WEP_VAPORIZER.m_id]) >= vaporizer_ammo;
+ return ammo_amount;
+ }
+ METHOD(Vaporizer, wr_checkammo2, bool(entity thiswep))
+ {
+ if(!WEP_CVAR_SEC(vaporizer, ammo))
+ return true;
+ float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(vaporizer, ammo);
+ ammo_amount += self.(weapon_load[WEP_VAPORIZER.m_id]) >= WEP_CVAR_SEC(vaporizer, ammo);
+ return ammo_amount;
+ }
+ METHOD(Vaporizer, wr_resetplayer, void(entity thiswep))
+ {
+ self.vaporizer_lasthit = 0;
+ }
+ METHOD(Vaporizer, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+ {
+ float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
+ float used_ammo;
+ if(WEP_CVAR_SEC(vaporizer, ammo))
+ used_ammo = min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo));
+ else
+ used_ammo = vaporizer_ammo;
+
+ W_Reload(self, used_ammo, SND(RELOAD));
+ }
-METHOD(Vaporizer, wr_suicidemessage, int(entity thiswep))
++METHOD(Vaporizer, wr_suicidemessage, Notification(entity thiswep))
+ {
+ return WEAPON_THINKING_WITH_PORTALS;
+ }
-METHOD(Vaporizer, wr_killmessage, int(entity thiswep))
++METHOD(Vaporizer, wr_killmessage, Notification(entity thiswep))
+ {
+ return WEAPON_VAPORIZER_MURDER;
+ }
#endif
#ifdef CSQC
- METHOD(Vaporizer, wr_impacteffect, void(entity thiswep))
- {
- vector org2 = w_org + w_backoff * 6;
- if(w_deathtype & HITTYPE_SECONDARY)
- {
- pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);
- if(!w_issilent) { sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); }
- }
- else
- {
- pointparticles(EFFECT_VORTEX_IMPACT, org2, '0 0 0', 1);
- if(!w_issilent) { sound(self, CH_SHOTS, SND_NEXIMPACT, VOL_BASE, ATTN_NORM); }
- }
- }
- METHOD(Vaporizer, wr_init, void(entity thiswep))
- {
- if(autocvar_cl_reticle && autocvar_cl_reticle_weapon)
- {
- precache_pic("gfx/reticle_nex");
- }
- }
- METHOD(Vaporizer, wr_zoomreticle, bool(entity thiswep))
- {
- if(button_zoom || zoomscript_caught)
- {
- reticle_image = "gfx/reticle_nex";
- return true;
- }
- else
- {
- // no weapon specific image for this weapon
- return false;
- }
- }
+ METHOD(Vaporizer, wr_impacteffect, void(entity thiswep))
+ {
+ vector org2 = w_org + w_backoff * 6;
+ if(w_deathtype & HITTYPE_SECONDARY)
+ {
+ pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);
+ if(!w_issilent) { sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); }
+ }
+ else
+ {
+ pointparticles(EFFECT_VORTEX_IMPACT, org2, '0 0 0', 1);
+ if(!w_issilent) { sound(self, CH_SHOTS, SND_NEXIMPACT, VOL_BASE, ATTN_NORM); }
+ }
+ }
+ METHOD(Vaporizer, wr_init, void(entity thiswep))
+ {
+ if(autocvar_cl_reticle && autocvar_cl_reticle_weapon)
+ {
+ precache_pic("gfx/reticle_nex");
+ }
+ }
+ METHOD(Vaporizer, wr_zoomreticle, bool(entity thiswep))
+ {
+ if(button_zoom || zoomscript_caught)
+ {
+ reticle_image = "gfx/reticle_nex";
+ return true;
+ }
+ else
+ {
+ // no weapon specific image for this weapon
+ return false;
+ }
+ }
#endif
#endif
.float vortex_chargepool_pauseregen_finished;
- METHOD(Vortex, wr_aim, void(entity thiswep))
- {
- if(bot_aim(1000000, 0, 1, false))
- self.BUTTON_ATCK = true;
- else
- {
- if(WEP_CVAR(vortex, charge))
- self.BUTTON_ATCK2 = true;
- }
- }
- METHOD(Vortex, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
- {
- if(WEP_CVAR(vortex, charge) && actor.vortex_charge < WEP_CVAR(vortex, charge_limit))
- actor.vortex_charge = min(1, actor.vortex_charge + WEP_CVAR(vortex, charge_rate) * frametime / W_TICSPERFRAME);
-
- if(WEP_CVAR_SEC(vortex, chargepool))
- if(actor.vortex_chargepool_ammo < 1)
- {
- if(actor.vortex_chargepool_pauseregen_finished < time)
- actor.vortex_chargepool_ammo = min(1, actor.vortex_chargepool_ammo + WEP_CVAR_SEC(vortex, chargepool_regen) * frametime / W_TICSPERFRAME);
- actor.pauseregen_finished = max(actor.pauseregen_finished, time + WEP_CVAR_SEC(vortex, chargepool_pause_regen));
- }
-
- if(autocvar_g_balance_vortex_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(vortex, ammo), WEP_CVAR_SEC(vortex, ammo))) { // forced reload
- thiswep.wr_reload(thiswep, actor, weaponentity);
- } else
- {
- if(fire & 1)
- {
- if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(vortex, refire)))
- {
- W_Vortex_Attack(thiswep, 0);
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(vortex, animtime), w_ready);
- }
- }
- if((WEP_CVAR(vortex, charge) && !WEP_CVAR(vortex, secondary)) ? (actor.BUTTON_ZOOM | actor.BUTTON_ZOOMSCRIPT) : (fire & 2))
- {
- if(WEP_CVAR(vortex, charge))
- {
- actor.vortex_charge_rottime = time + WEP_CVAR(vortex, charge_rot_pause);
- float dt = frametime / W_TICSPERFRAME;
-
- if(actor.vortex_charge < 1)
- {
- if(WEP_CVAR_SEC(vortex, chargepool))
- {
- if(WEP_CVAR_SEC(vortex, ammo))
- {
- // always deplete if secondary is held
- actor.vortex_chargepool_ammo = max(0, actor.vortex_chargepool_ammo - WEP_CVAR_SEC(vortex, ammo) * dt);
-
- dt = min(dt, (1 - actor.vortex_charge) / WEP_CVAR(vortex, charge_rate));
- actor.vortex_chargepool_pauseregen_finished = time + WEP_CVAR_SEC(vortex, chargepool_pause_regen);
- dt = min(dt, actor.vortex_chargepool_ammo);
- dt = max(0, dt);
-
- actor.vortex_charge += dt * WEP_CVAR(vortex, charge_rate);
- }
- }
-
- else if(WEP_CVAR_SEC(vortex, ammo))
- {
- if(fire & 2) // only eat ammo when the button is pressed
- {
- dt = min(dt, (1 - actor.vortex_charge) / WEP_CVAR(vortex, charge_rate));
- if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
- {
- // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
- if(autocvar_g_balance_vortex_reload_ammo)
- {
- dt = min(dt, (actor.clip_load - WEP_CVAR_PRI(vortex, ammo)) / WEP_CVAR_SEC(vortex, ammo));
- dt = max(0, dt);
- if(dt > 0)
- {
- actor.clip_load = max(WEP_CVAR_SEC(vortex, ammo), actor.clip_load - WEP_CVAR_SEC(vortex, ammo) * dt);
- }
- actor.(weapon_load[WEP_VORTEX.m_id]) = actor.clip_load;
- }
- else
- {
- dt = min(dt, (actor.(thiswep.ammo_field) - WEP_CVAR_PRI(vortex, ammo)) / WEP_CVAR_SEC(vortex, ammo));
- dt = max(0, dt);
- if(dt > 0)
- {
- actor.(thiswep.ammo_field) = max(WEP_CVAR_SEC(vortex, ammo), actor.(thiswep.ammo_field) - WEP_CVAR_SEC(vortex, ammo) * dt);
- }
- }
- }
- actor.vortex_charge += dt * WEP_CVAR(vortex, charge_rate);
- }
- }
-
- else
- {
- dt = min(dt, (1 - actor.vortex_charge) / WEP_CVAR(vortex, charge_rate));
- actor.vortex_charge += dt * WEP_CVAR(vortex, charge_rate);
- }
- }
- }
- else if(WEP_CVAR(vortex, secondary))
- {
- if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(vortex, refire)))
- {
- W_Vortex_Attack(thiswep, 1);
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(vortex, animtime), w_ready);
- }
- }
- }
- }
- }
- METHOD(Vortex, wr_setup, void(entity thiswep))
- {
- self.vortex_lasthit = 0;
- }
- METHOD(Vortex, wr_checkammo1, bool(entity thiswep))
- {
- float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(vortex, ammo);
- ammo_amount += (autocvar_g_balance_vortex_reload_ammo && self.(weapon_load[WEP_VORTEX.m_id]) >= WEP_CVAR_PRI(vortex, ammo));
- return ammo_amount;
- }
- METHOD(Vortex, wr_checkammo2, bool(entity thiswep))
- {
- if(WEP_CVAR(vortex, secondary))
- {
- // don't allow charging if we don't have enough ammo
- float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(vortex, ammo);
- ammo_amount += self.(weapon_load[WEP_VORTEX.m_id]) >= WEP_CVAR_SEC(vortex, ammo);
- return ammo_amount;
- }
- else
- {
- return false; // zoom is not a fire mode
- }
- }
- METHOD(Vortex, wr_resetplayer, void(entity thiswep))
- {
- if (WEP_CVAR(vortex, charge)) {
- if (WEP_CVAR_SEC(vortex, chargepool)) {
- self.vortex_chargepool_ammo = 1;
- }
- self.vortex_charge = WEP_CVAR(vortex, charge_start);
- }
- self.vortex_lasthit = 0;
- }
- METHOD(Vortex, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
- {
- W_Reload(self, min(WEP_CVAR_PRI(vortex, ammo), WEP_CVAR_SEC(vortex, ammo)), SND(RELOAD));
- }
- METHOD(Vortex, wr_suicidemessage, Notification(entity thiswep))
- {
- return WEAPON_THINKING_WITH_PORTALS;
- }
- METHOD(Vortex, wr_killmessage, Notification(entity thiswep))
- {
- return WEAPON_VORTEX_MURDER;
- }
+ METHOD(Vortex, wr_aim, void(entity thiswep))
+ {
+ if(bot_aim(1000000, 0, 1, false))
+ PHYS_INPUT_BUTTON_ATCK(self) = true;
+ else
+ {
+ if(WEP_CVAR(vortex, charge))
+ PHYS_INPUT_BUTTON_ATCK2(self) = true;
+ }
+ }
+ METHOD(Vortex, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+ {
+ if(WEP_CVAR(vortex, charge) && actor.vortex_charge < WEP_CVAR(vortex, charge_limit))
+ actor.vortex_charge = min(1, actor.vortex_charge + WEP_CVAR(vortex, charge_rate) * frametime / W_TICSPERFRAME);
+
+ if(WEP_CVAR_SEC(vortex, chargepool))
+ if(actor.vortex_chargepool_ammo < 1)
+ {
+ if(actor.vortex_chargepool_pauseregen_finished < time)
+ actor.vortex_chargepool_ammo = min(1, actor.vortex_chargepool_ammo + WEP_CVAR_SEC(vortex, chargepool_regen) * frametime / W_TICSPERFRAME);
+ actor.pauseregen_finished = max(actor.pauseregen_finished, time + WEP_CVAR_SEC(vortex, chargepool_pause_regen));
+ }
+
+ if(autocvar_g_balance_vortex_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(vortex, ammo), WEP_CVAR_SEC(vortex, ammo))) { // forced reload
+ thiswep.wr_reload(thiswep, actor, weaponentity);
+ } else
+ {
+ if(fire & 1)
+ {
+ if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(vortex, refire)))
+ {
+ W_Vortex_Attack(thiswep, 0);
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(vortex, animtime), w_ready);
+ }
+ }
+ if((WEP_CVAR(vortex, charge) && !WEP_CVAR(vortex, secondary)) ? (PHYS_INPUT_BUTTON_ZOOM(actor) | PHYS_INPUT_BUTTON_ZOOMSCRIPT(actor)) : (fire & 2))
+ {
+ if(WEP_CVAR(vortex, charge))
+ {
+ actor.vortex_charge_rottime = time + WEP_CVAR(vortex, charge_rot_pause);
+ float dt = frametime / W_TICSPERFRAME;
+
+ if(actor.vortex_charge < 1)
+ {
+ if(WEP_CVAR_SEC(vortex, chargepool))
+ {
+ if(WEP_CVAR_SEC(vortex, ammo))
+ {
+ // always deplete if secondary is held
+ actor.vortex_chargepool_ammo = max(0, actor.vortex_chargepool_ammo - WEP_CVAR_SEC(vortex, ammo) * dt);
+
+ dt = min(dt, (1 - actor.vortex_charge) / WEP_CVAR(vortex, charge_rate));
+ actor.vortex_chargepool_pauseregen_finished = time + WEP_CVAR_SEC(vortex, chargepool_pause_regen);
+ dt = min(dt, actor.vortex_chargepool_ammo);
+ dt = max(0, dt);
+
+ actor.vortex_charge += dt * WEP_CVAR(vortex, charge_rate);
+ }
+ }
+
+ else if(WEP_CVAR_SEC(vortex, ammo))
+ {
+ if(fire & 2) // only eat ammo when the button is pressed
+ {
+ dt = min(dt, (1 - actor.vortex_charge) / WEP_CVAR(vortex, charge_rate));
+ if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
+ {
+ // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
+ if(autocvar_g_balance_vortex_reload_ammo)
+ {
+ dt = min(dt, (actor.clip_load - WEP_CVAR_PRI(vortex, ammo)) / WEP_CVAR_SEC(vortex, ammo));
+ dt = max(0, dt);
+ if(dt > 0)
+ {
+ actor.clip_load = max(WEP_CVAR_SEC(vortex, ammo), actor.clip_load - WEP_CVAR_SEC(vortex, ammo) * dt);
+ }
+ actor.(weapon_load[WEP_VORTEX.m_id]) = actor.clip_load;
+ }
+ else
+ {
+ dt = min(dt, (actor.(thiswep.ammo_field) - WEP_CVAR_PRI(vortex, ammo)) / WEP_CVAR_SEC(vortex, ammo));
+ dt = max(0, dt);
+ if(dt > 0)
+ {
+ actor.(thiswep.ammo_field) = max(WEP_CVAR_SEC(vortex, ammo), actor.(thiswep.ammo_field) - WEP_CVAR_SEC(vortex, ammo) * dt);
+ }
+ }
+ }
+ actor.vortex_charge += dt * WEP_CVAR(vortex, charge_rate);
+ }
+ }
+
+ else
+ {
+ dt = min(dt, (1 - actor.vortex_charge) / WEP_CVAR(vortex, charge_rate));
+ actor.vortex_charge += dt * WEP_CVAR(vortex, charge_rate);
+ }
+ }
+ }
+ else if(WEP_CVAR(vortex, secondary))
+ {
+ if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(vortex, refire)))
+ {
+ W_Vortex_Attack(thiswep, 1);
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(vortex, animtime), w_ready);
+ }
+ }
+ }
+ }
+ }
+ METHOD(Vortex, wr_setup, void(entity thiswep))
+ {
+ self.vortex_lasthit = 0;
+ }
+ METHOD(Vortex, wr_checkammo1, bool(entity thiswep))
+ {
+ float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(vortex, ammo);
+ ammo_amount += (autocvar_g_balance_vortex_reload_ammo && self.(weapon_load[WEP_VORTEX.m_id]) >= WEP_CVAR_PRI(vortex, ammo));
+ return ammo_amount;
+ }
+ METHOD(Vortex, wr_checkammo2, bool(entity thiswep))
+ {
+ if(WEP_CVAR(vortex, secondary))
+ {
+ // don't allow charging if we don't have enough ammo
+ float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(vortex, ammo);
+ ammo_amount += self.(weapon_load[WEP_VORTEX.m_id]) >= WEP_CVAR_SEC(vortex, ammo);
+ return ammo_amount;
+ }
+ else
+ {
+ return false; // zoom is not a fire mode
+ }
+ }
+ METHOD(Vortex, wr_resetplayer, void(entity thiswep))
+ {
+ if (WEP_CVAR(vortex, charge)) {
+ if (WEP_CVAR_SEC(vortex, chargepool)) {
+ self.vortex_chargepool_ammo = 1;
+ }
+ self.vortex_charge = WEP_CVAR(vortex, charge_start);
+ }
+ self.vortex_lasthit = 0;
+ }
+ METHOD(Vortex, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+ {
+ W_Reload(self, min(WEP_CVAR_PRI(vortex, ammo), WEP_CVAR_SEC(vortex, ammo)), SND(RELOAD));
+ }
-METHOD(Vortex, wr_suicidemessage, int(entity thiswep))
++METHOD(Vortex, wr_suicidemessage, Notification(entity thiswep))
+ {
+ return WEAPON_THINKING_WITH_PORTALS;
+ }
-METHOD(Vortex, wr_killmessage, int(entity thiswep))
++METHOD(Vortex, wr_killmessage, Notification(entity thiswep))
+ {
+ return WEAPON_VORTEX_MURDER;
+ }
#endif
#ifdef CSQC
- METHOD(Vortex, wr_impacteffect, void(entity thiswep))
- {
- vector org2 = w_org + w_backoff * 6;
- pointparticles(EFFECT_VORTEX_IMPACT, org2, '0 0 0', 1);
- if(!w_issilent)
- sound(self, CH_SHOTS, SND_NEXIMPACT, VOL_BASE, ATTN_NORM);
- }
- METHOD(Vortex, wr_init, void(entity thiswep))
- {
- if(autocvar_cl_reticle && autocvar_cl_reticle_weapon)
- {
- precache_pic("gfx/reticle_nex");
- }
- }
- METHOD(Vortex, wr_zoomreticle, bool(entity thiswep))
- {
- if(button_zoom || zoomscript_caught || (!WEP_CVAR(vortex, secondary) && button_attack2))
- {
- reticle_image = "gfx/reticle_nex";
- return true;
- }
- else
- {
- // no weapon specific image for this weapon
- return false;
- }
- }
+ METHOD(Vortex, wr_impacteffect, void(entity thiswep))
+ {
+ vector org2 = w_org + w_backoff * 6;
+ pointparticles(EFFECT_VORTEX_IMPACT, org2, '0 0 0', 1);
+ if(!w_issilent)
+ sound(self, CH_SHOTS, SND_NEXIMPACT, VOL_BASE, ATTN_NORM);
+ }
+ METHOD(Vortex, wr_init, void(entity thiswep))
+ {
+ if(autocvar_cl_reticle && autocvar_cl_reticle_weapon)
+ {
+ precache_pic("gfx/reticle_nex");
+ }
+ }
+ METHOD(Vortex, wr_zoomreticle, bool(entity thiswep))
+ {
+ if(button_zoom || zoomscript_caught || (!WEP_CVAR(vortex, secondary) && button_attack2))
+ {
+ reticle_image = "gfx/reticle_nex";
+ return true;
+ }
+ else
+ {
+ // no weapon specific image for this weapon
+ return false;
+ }
+ }
#endif
#endif
player_setupanimsformodel();
}
- /*
- =============
- PutObserverInServer
-
- putting a client as observer in the server
- =============
- */
void FixPlayermodel(entity player);
+ /** putting a client as observer in the server */
void PutObserverInServer()
{
SELFPARAM();
+ bool mutator_returnvalue = MUTATOR_CALLHOOK(MakePlayerObserver);
PlayerState_detach(this);
- entity spot;
- self.hud = HUD_NORMAL;
-
- if(IS_PLAYER(self)) { Send_Effect(EFFECT_SPAWN_NEUTRAL, self.origin, '0 0 0', 1); }
-
- spot = SelectSpawnPoint (true);
- if(!spot)
- error("No spawnpoints for observers?!?\n");
- RemoveGrapplingHook(self); // Wazat's Grappling Hook
-
- if(IS_REAL_CLIENT(self))
- {
- msg_entity = self;
- WriteByte(MSG_ONE, SVC_SETVIEW);
- WriteEntity(MSG_ONE, self);
- }
- self.frags = FRAGS_SPECTATOR;
- self.bot_attack = false;
+ if (IS_PLAYER(this)) Send_Effect(EFFECT_SPAWN_NEUTRAL, this.origin, '0 0 0', 1);
- bool mutator_returnvalue = MUTATOR_CALLHOOK(MakePlayerObserver);
-
- Portal_ClearAll(self);
+ {
+ entity spot = SelectSpawnPoint(true);
+ if (!spot) LOG_FATAL("No spawnpoints for observers?!?");
+ this.angles = spot.angles;
+ this.angles_z = 0;
+ this.fixangle = true;
+ // offset it so that the spectator spawns higher off the ground, looks better this way
+ setorigin(this, spot.origin + STAT(PL_VIEW_OFS, NULL));
+ this.prevorigin = this.origin;
+ if (IS_REAL_CLIENT(this))
+ {
+ msg_entity = this;
+ WriteByte(MSG_ONE, SVC_SETVIEW);
+ WriteEntity(MSG_ONE, this);
+ }
+ // give the spectator some space between walls for MOVETYPE_FLY_WORLDONLY
+ // so that your view doesn't go into the ceiling with MOVETYPE_FLY_WORLDONLY, previously "PL_VIEW_OFS"
+ setsize(this, STAT(PL_CROUCH_MIN, NULL), STAT(PL_CROUCH_MAX, NULL));
+ this.view_ofs = '0 0 0';
+ }
- Unfreeze(self);
+ RemoveGrapplingHook(this);
+ Portal_ClearAll(this);
+ Unfreeze(this);
- if(self.alivetime)
+ if (this.alivetime)
{
- if(!warmup_stage)
- PS_GR_P_ADDVAL(self, PLAYERSTATS_ALIVETIME, time - self.alivetime);
- self.alivetime = 0;
+ if (!warmup_stage)
+ PS_GR_P_ADDVAL(this, PLAYERSTATS_ALIVETIME, time - this.alivetime);
+ this.alivetime = 0;
}
- if(self.vehicle)
- vehicles_exit(VHEF_RELEASE);
+ if (this.vehicle) vehicles_exit(VHEF_RELEASE);
- WaypointSprite_PlayerDead(self);
+ WaypointSprite_PlayerDead(this);
- if(!mutator_returnvalue) // mutator prevents resetting teams
- self.team = -1; // move this as it is needed to log the player spectating in eventlog
+ if (!mutator_returnvalue) // mutator prevents resetting teams
+ this.team = -1; // move this as it is needed to log the player spectating in eventlog
- if(self.killcount != FRAGS_SPECTATOR)
+ if (this.killcount != FRAGS_SPECTATOR)
{
- Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_QUIT_SPECTATE, self.netname);
+ Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_QUIT_SPECTATE, this.netname);
if(!intermission_running)
if(autocvar_g_chat_nospectators == 1 || (!(warmup_stage || gameover) && autocvar_g_chat_nospectators == 2))
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_CHAT_NOSPECTATORS);
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_CHAT_NOSPECTATORS);
- if(self.just_joined == false) {
- LogTeamchange(self.playerid, -1, 4);
+ if(this.just_joined == false) {
+ LogTeamchange(this.playerid, -1, 4);
} else
- self.just_joined = false;
+ this.just_joined = false;
}
- PlayerScore_Clear(self); // clear scores when needed
+ PlayerScore_Clear(this); // clear scores when needed
- accuracy_resend(self);
+ accuracy_resend(this);
- self.spectatortime = time;
-
- self.classname = STR_OBSERVER;
- self.iscreature = false;
- self.teleportable = TELEPORT_SIMPLE;
- self.damagedbycontents = false;
- self.health = FRAGS_SPECTATOR;
- self.takedamage = DAMAGE_NO;
- self.solid = SOLID_NOT;
- self.movetype = MOVETYPE_FLY_WORLDONLY; // user preference is controlled by playerprethink
- self.flags = FL_CLIENT | FL_NOTARGET;
- self.armorvalue = 666;
- self.effects = 0;
- self.armorvalue = autocvar_g_balance_armor_start;
- self.pauserotarmor_finished = 0;
- self.pauserothealth_finished = 0;
- self.pauseregen_finished = 0;
- self.damageforcescale = 0;
- self.death_time = 0;
- self.respawn_flags = 0;
- self.respawn_time = 0;
- self.stat_respawn_time = 0;
- self.alpha = 0;
- self.scale = 0;
- self.fade_time = 0;
- self.pain_frame = 0;
- self.pain_finished = 0;
- self.strength_finished = 0;
- self.invincible_finished = 0;
- self.superweapons_finished = 0;
- self.pushltime = 0;
- self.istypefrag = 0;
- self.think = func_null;
- self.nextthink = 0;
- self.hook_time = 0;
- self.deadflag = DEAD_NO;
- self.angles = spot.angles;
- self.angles_z = 0;
- self.fixangle = true;
- self.crouch = false;
- self.revival_time = 0;
-
- setorigin (self, (spot.origin + STAT(PL_VIEW_OFS, NULL))); // offset it so that the spectator spawns higher off the ground, looks better this way
- self.prevorigin = self.origin;
- self.items = 0;
- self.weapons = '0 0 0';
- self.model = "";
- FixPlayermodel(self);
- setmodel(self, MDL_Null);
- self.drawonlytoclient = self;
-
- setsize (self, STAT(PL_CROUCH_MIN, NULL), STAT(PL_CROUCH_MAX, NULL)); // give the spectator some space between walls for MOVETYPE_FLY_WORLDONLY
- self.view_ofs = '0 0 0'; // so that your view doesn't go into the ceiling with MOVETYPE_FLY_WORLDONLY, previously "PL_VIEW_OFS"
-
- PS(self).m_weapon = WEP_Null;
- self.weaponname = "";
- PS(self).m_switchingweapon = WEP_Null;
- self.weaponmodel = "";
+ this.spectatortime = time;
+ this.frags = FRAGS_SPECTATOR;
+ this.bot_attack = false;
+ this.hud = HUD_NORMAL;
+ this.classname = STR_OBSERVER;
+ this.iscreature = false;
+ this.teleportable = TELEPORT_SIMPLE;
+ this.damagedbycontents = false;
+ this.health = FRAGS_SPECTATOR;
+ this.takedamage = DAMAGE_NO;
+ this.solid = SOLID_NOT;
+ this.movetype = MOVETYPE_FLY_WORLDONLY; // user preference is controlled by playerprethink
+ this.flags = FL_CLIENT | FL_NOTARGET;
+ this.armorvalue = 666;
+ this.effects = 0;
+ this.armorvalue = autocvar_g_balance_armor_start;
+ this.pauserotarmor_finished = 0;
+ this.pauserothealth_finished = 0;
+ this.pauseregen_finished = 0;
+ this.damageforcescale = 0;
+ this.death_time = 0;
+ this.respawn_flags = 0;
+ this.respawn_time = 0;
+ this.stat_respawn_time = 0;
+ this.alpha = 0;
+ this.scale = 0;
+ this.fade_time = 0;
+ this.pain_frame = 0;
+ this.pain_finished = 0;
+ this.strength_finished = 0;
+ this.invincible_finished = 0;
+ this.superweapons_finished = 0;
+ this.pushltime = 0;
+ this.istypefrag = 0;
+ this.think = func_null;
+ this.nextthink = 0;
+ this.hook_time = 0;
+ this.deadflag = DEAD_NO;
+ this.crouch = false;
+ this.revival_time = 0;
+
+ this.items = 0;
+ this.weapons = '0 0 0';
+ this.model = "";
+ FixPlayermodel(this);
+ setmodel(this, MDL_Null);
+ this.drawonlytoclient = this;
+
+ this.weaponname = "";
+ this.weaponmodel = "";
for (int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
- self.weaponentities[slot] = NULL;
- }
- self.exteriorweaponentity = world;
- self.killcount = FRAGS_SPECTATOR;
- self.velocity = '0 0 0';
- self.avelocity = '0 0 0';
- self.punchangle = '0 0 0';
- self.punchvector = '0 0 0';
- self.oldvelocity = self.velocity;
- self.fire_endtime = -1;
- self.event_damage = func_null;
+ this.weaponentities[slot] = NULL;
+ }
+ this.exteriorweaponentity = NULL;
+ this.killcount = FRAGS_SPECTATOR;
+ this.velocity = '0 0 0';
+ this.avelocity = '0 0 0';
+ this.punchangle = '0 0 0';
+ this.punchvector = '0 0 0';
+ this.oldvelocity = this.velocity;
+ this.fire_endtime = -1;
+ this.event_damage = func_null;
}
int player_getspecies(entity this)
this.bot_attack = true;
this.monster_attack = true;
- this.BUTTON_ATCK = this.BUTTON_JUMP = this.BUTTON_ATCK2 = false;
+ PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_JUMP(this) = PHYS_INPUT_BUTTON_ATCK2(this) = false;
if (this.killcount == FRAGS_SPECTATOR) {
PlayerScore_Clear(this);
self.killindicator.colormod = Team_ColorRGB(targetteam);
if(IS_REAL_CLIENT(self))
if(self.killindicator.cnt > 0)
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, APP_TEAM_NUM_4(targetteam, CENTER_TEAMCHANGE_), self.killindicator.cnt);
+ Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, APP_TEAM_NUM(targetteam, CENTER_TEAMCHANGE), self.killindicator.cnt);
}
}
#endif
this.version_nagtime = time + 10 + random() * 10;
- // TODO: xonstat elo.txt support, until then just 404s
- if (false && IS_REAL_CLIENT(this)) { PlayerStats_PlayerBasic_CheckUpdate(this); }
-
ClientState_attach(this);
- // TODO: fold all of these into ClientState
- DecodeLevelParms(this);
- PlayerScore_Attach(this);
- ClientData_Attach(this);
- accuracy_init(this);
- Inventory_new(this);
- playerdemo_init(this);
- anticheat_init(this);
- entcs_attach(this);
- W_HitPlotOpen(this);
-
- bot_clientconnect(this);
// identify the right forced team
if (autocvar_g_campaign)
this.netname_previous = strzone(this.netname);
- Send_Notification(NOTIF_ALL, NULL, MSG_INFO, ((teamplay && IS_PLAYER(this)) ? APP_TEAM_ENT_4(this, INFO_JOIN_CONNECT_TEAM_) : INFO_JOIN_CONNECT), this.netname);
+ Send_Notification(NOTIF_ALL, NULL, MSG_INFO, ((teamplay && IS_PLAYER(this)) ? APP_TEAM_ENT(this, INFO_JOIN_CONNECT_TEAM) : INFO_JOIN_CONNECT), this.netname);
stuffcmd(this, clientstuff, "\n");
stuffcmd(this, "cl_particles_reloadeffects\n"); // TODO do we still need this?
FixClientCvars(this);
- // Grappling hook
- stuffcmd(this, "alias +hook +button6\n");
- stuffcmd(this, "alias -hook -button6\n");
-
- // Jetpack binds
- stuffcmd(this, "alias +jetpack +button10\n");
- stuffcmd(this, "alias -jetpack -button10\n");
-
// get version info from player
stuffcmd(this, "cmd clientversion $gameversion\n");
- // get other cvars from player
- GetCvars(0);
-
// notify about available teams
if (teamplay)
{
*/
.entity chatbubbleentity;
void ReadyCount();
- void ClientDisconnect ()
+ void ClientDisconnect()
{
SELFPARAM();
- ClientState_detach(this);
- if(self.vehicle)
- vehicles_exit(VHEF_RELEASE);
-
- if (!IS_CLIENT(self))
- {
- LOG_INFO("Warning: ClientDisconnect without ClientConnect\n");
- return;
- }
-
- PlayerStats_GameReport_FinalizePlayer(self);
-
- if ( self.active_minigame )
- part_minigame(self);
-
- if(IS_PLAYER(self)) { Send_Effect(EFFECT_SPAWN_NEUTRAL, self.origin, '0 0 0', 1); }
+ assert(IS_CLIENT(this), return);
- CheatShutdownClient();
+ PlayerStats_GameReport_FinalizePlayer(this);
+ if (this.vehicle) vehicles_exit(VHEF_RELEASE);
+ if (this.active_minigame) part_minigame(this);
+ if (IS_PLAYER(this)) Send_Effect(EFFECT_SPAWN_NEUTRAL, this.origin, '0 0 0', 1);
- W_HitPlotClose(self);
-
- anticheat_report();
- anticheat_shutdown();
-
- playerdemo_shutdown();
-
- bot_clientdisconnect();
-
- entcs_detach(self);
+ if (autocvar_sv_eventlog)
+ GameLogEcho(strcat(":part:", ftos(this.playerid)));
- if(autocvar_sv_eventlog)
- GameLogEcho(strcat(":part:", ftos(self.playerid)));
+ Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_QUIT_DISCONNECT, this.netname);
- Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_QUIT_DISCONNECT, self.netname);
+ MUTATOR_CALLHOOK(ClientDisconnect);
- MUTATOR_CALLHOOK(ClientDisconnect);
+ ClientState_detach(this);
Portal_ClearAll(self);
self.flags &= ~FL_CLIENT;
- if (self.chatbubbleentity)
- remove (self.chatbubbleentity);
-
- if (self.killindicator)
- remove (self.killindicator);
+ if (this.chatbubbleentity) remove(this.chatbubbleentity);
+ if (this.killindicator) remove(this.killindicator);
WaypointSprite_PlayerGone();
bot_relinkplayerlist();
- accuracy_free(self);
- Inventory_delete(self);
- ClientData_Detach(this);
- PlayerScore_Detach(self);
-
- if(self.netname_previous)
- strunzone(self.netname_previous);
- if(self.clientstatus)
- strunzone(self.clientstatus);
- if(self.weaponorder_byimpulse)
- strunzone(self.weaponorder_byimpulse);
+ if (self.netname_previous) strunzone(self.netname_previous);
+ if (self.clientstatus) strunzone(self.clientstatus);
+ if (self.weaponorder_byimpulse) strunzone(self.weaponorder_byimpulse);
+ if (self.personal) remove(self.personal);
- if(self.personal)
- remove(self.personal);
-
- self.playerid = 0;
+ this.playerid = 0;
ReadyCount();
- VoteCount(false);
-
- // free cvars
- GetCvars(-1);
+ if (vote_called && IS_REAL_CLIENT(this)) VoteCount(false);
}
- .float BUTTON_CHAT;
void ChatBubbleThink()
{SELFPARAM();
self.nextthink = time;
{
if ( self.owner.active_minigame )
self.mdl = "models/sprites/minigame_busy.iqm";
- else if ( self.owner.BUTTON_CHAT )
+ else if (PHYS_INPUT_BUTTON_CHAT(self.owner))
self.mdl = "models/misc/chatbubble.spr";
}
self.angles = spectatee.v_angle;
STAT(FROZEN, self) = STAT(FROZEN, spectatee);
self.revive_progress = spectatee.revive_progress;
- if(!self.BUTTON_USE)
+ if(!PHYS_INPUT_BUTTON_USE(self))
self.fixangle = true;
setorigin(self, spectatee.origin);
setsize(self, spectatee.mins, spectatee.maxs);
if(autocvar_g_campaign)
{ campaign_bots_may_start = 1; }
- Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER_CPID, CPID_PREVENT_JOIN);
+ Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CPID_PREVENT_JOIN);
PutClientInServer();
- if(IS_PLAYER(self)) { Send_Notification(NOTIF_ALL, world, MSG_INFO, ((teamplay && this.team != -1) ? APP_TEAM_ENT_4(this, INFO_JOIN_PLAY_TEAM_) : INFO_JOIN_PLAY), self.netname); }
+ if(IS_PLAYER(self)) { Send_Notification(NOTIF_ALL, world, MSG_INFO, ((teamplay && this.team != -1) ? APP_TEAM_ENT(this, INFO_JOIN_PLAY_TEAM) : INFO_JOIN_PLAY), self.netname); }
}
else
stuffcmd(self, "menu_showteamselect\n");
if(self.motd_actived_time == 0)
{
if (autocvar_g_campaign) {
- if ((IS_PLAYER(self) && self.BUTTON_INFO) || (!IS_PLAYER(self))) {
+ if ((IS_PLAYER(self) && PHYS_INPUT_BUTTON_INFO(self)) || (!IS_PLAYER(self))) {
self.motd_actived_time = time;
Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_MOTD, campaign_message);
}
} else {
- if (self.BUTTON_INFO) {
+ if (PHYS_INPUT_BUTTON_INFO(self)) {
self.motd_actived_time = time;
Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_MOTD, getwelcomemessage());
}
else if(self.motd_actived_time > 0) // showing MOTD or campaign message
{
if (autocvar_g_campaign) {
- if (self.BUTTON_INFO)
+ if (PHYS_INPUT_BUTTON_INFO(self))
self.motd_actived_time = time;
else if ((time - self.motd_actived_time > 2) && IS_PLAYER(self)) { // hide it some seconds after BUTTON_INFO has been released
self.motd_actived_time = 0;
- Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER_CPID, CPID_MOTD);
+ Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CPID_MOTD);
}
} else {
- if (self.BUTTON_INFO)
+ if (PHYS_INPUT_BUTTON_INFO(self))
self.motd_actived_time = time;
else if (time - self.motd_actived_time > 2) { // hide it some seconds after BUTTON_INFO has been released
self.motd_actived_time = 0;
- Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER_CPID, CPID_MOTD);
+ Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CPID_MOTD);
}
}
}
else //if(self.motd_actived_time < 0) // just connected, motd is active
{
- if(self.BUTTON_INFO) // BUTTON_INFO hides initial MOTD
+ if(PHYS_INPUT_BUTTON_INFO(self)) // BUTTON_INFO hides initial MOTD
self.motd_actived_time = -2; // wait until BUTTON_INFO gets released
else if(self.motd_actived_time == -2 || IS_PLAYER(self) || IS_SPEC(self))
{
// instanctly hide MOTD
self.motd_actived_time = 0;
- Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER_CPID, CPID_MOTD);
+ Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CPID_MOTD);
}
}
}
}
float prefered_movetype;
if (self.flags & FL_JUMPRELEASED) {
- if (self.BUTTON_JUMP && !self.version_mismatch) {
+ if (PHYS_INPUT_BUTTON_JUMP(self) && !self.version_mismatch) {
self.flags &= ~FL_JUMPRELEASED;
self.flags |= FL_SPAWNING;
- } else if(self.BUTTON_ATCK && !self.version_mismatch) {
+ } else if(PHYS_INPUT_BUTTON_ATCK(self) && !self.version_mismatch) {
self.flags &= ~FL_JUMPRELEASED;
if(SpectateNext()) {
self.classname = STR_SPECTATOR;
}
} else {
- prefered_movetype = ((!self.BUTTON_USE ? self.cvar_cl_clippedspectating : !self.cvar_cl_clippedspectating) ? MOVETYPE_FLY_WORLDONLY : MOVETYPE_NOCLIP);
+ prefered_movetype = ((!PHYS_INPUT_BUTTON_USE(self) ? self.cvar_cl_clippedspectating : !self.cvar_cl_clippedspectating) ? MOVETYPE_FLY_WORLDONLY : MOVETYPE_NOCLIP);
if (self.movetype != prefered_movetype)
self.movetype = prefered_movetype;
}
} else {
- if (!(self.BUTTON_ATCK || self.BUTTON_JUMP)) {
+ if (!(PHYS_INPUT_BUTTON_ATCK(self) || PHYS_INPUT_BUTTON_JUMP(self))) {
self.flags |= FL_JUMPRELEASED;
if(self.flags & FL_SPAWNING)
{
self.impulse = 0;
}
if (self.flags & FL_JUMPRELEASED) {
- if (self.BUTTON_JUMP && !self.version_mismatch) {
+ if (PHYS_INPUT_BUTTON_JUMP(self) && !self.version_mismatch) {
self.flags &= ~FL_JUMPRELEASED;
self.flags |= FL_SPAWNING;
- } else if(self.BUTTON_ATCK || self.impulse == 10 || self.impulse == 15 || self.impulse == 18 || (self.impulse >= 200 && self.impulse <= 209)) {
+ } else if(PHYS_INPUT_BUTTON_ATCK(self) || self.impulse == 10 || self.impulse == 15 || self.impulse == 18 || (self.impulse >= 200 && self.impulse <= 209)) {
self.flags &= ~FL_JUMPRELEASED;
if(SpectateNext()) {
self.classname = STR_SPECTATOR;
PutClientInServer();
}
self.impulse = 0;
- } else if (self.BUTTON_ATCK2) {
+ } else if (PHYS_INPUT_BUTTON_ATCK2(self)) {
self.flags &= ~FL_JUMPRELEASED;
self.classname = STR_OBSERVER;
PutClientInServer();
PutObserverInServer();
}
} else {
- if (!(self.BUTTON_ATCK || self.BUTTON_ATCK2)) {
+ if (!(PHYS_INPUT_BUTTON_ATCK(self) || PHYS_INPUT_BUTTON_ATCK2(self))) {
self.flags |= FL_JUMPRELEASED;
if(self.flags & FL_SPAWNING)
{
if(!self.cvar_cl_newusekeysupported) // FIXME remove this - it was a stupid idea to begin with, we can JUST use the button
{
- if(self.BUTTON_USE && !self.usekeypressed)
+ if(PHYS_INPUT_BUTTON_USE(self) && !self.usekeypressed)
PlayerUseKey();
- self.usekeypressed = self.BUTTON_USE;
+ self.usekeypressed = PHYS_INPUT_BUTTON_USE(self);
}
if(IS_REAL_CLIENT(self))
float button_pressed;
if(frametime)
player_anim();
- button_pressed = (self.BUTTON_ATCK || self.BUTTON_JUMP || self.BUTTON_ATCK2 || self.BUTTON_HOOK || self.BUTTON_USE);
+ button_pressed = (PHYS_INPUT_BUTTON_ATCK(self) || PHYS_INPUT_BUTTON_JUMP(self) || PHYS_INPUT_BUTTON_ATCK2(self) || PHYS_INPUT_BUTTON_HOOK(self) || PHYS_INPUT_BUTTON_USE(self));
if (self.deadflag == DEAD_DYING)
{
self.prevorigin = self.origin;
- float do_crouch = self.BUTTON_CROUCH;
+ float do_crouch = PHYS_INPUT_BUTTON_CROUCH(self);
if(self.hook.state)
do_crouch = 0;
if(self.vehicle)
// WEAPONTODO: Add weapon request for this
if(!zoomstate_set)
SetZoomState(
- self.BUTTON_ZOOM
- || self.BUTTON_ZOOMSCRIPT
- || (self.BUTTON_ATCK2 && PS(self).m_weapon == WEP_VORTEX)
- || (self.BUTTON_ATCK2 && PS(self).m_weapon == WEP_RIFLE && WEP_CVAR(rifle, secondary) == 0)
+ PHYS_INPUT_BUTTON_ZOOM(self)
+ || PHYS_INPUT_BUTTON_ZOOMSCRIPT(self)
+ || (PHYS_INPUT_BUTTON_ATCK2(self) && PS(self).m_weapon == WEP_VORTEX)
+ || (PHYS_INPUT_BUTTON_ATCK2(self) && PS(self).m_weapon == WEP_RIFLE && WEP_CVAR(rifle, secondary) == 0)
); // WEAPONTODO
float oldspectatee_status;
if(self.idlekick_lasttimeleft)
{
self.idlekick_lasttimeleft = 0;
- Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER_CPID, CPID_IDLING);
+ Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CPID_IDLING);
}
}
else
#include "weapons/selection.qh"
#include "../common/constants.qh"
#include "../common/deathtypes/all.qh"
-#include "../common/notifications.qh"
+#include "../common/notifications/all.qh"
#include "../common/physics/movetypes/movetypes.qh"
#include "../common/playerstats.qh"
#include "../common/teams.qh"
s = strcat(s, "I");
if(player.flagcarried != world)
s = strcat(s, "F");
- if(player.BUTTON_CHAT)
+ if(PHYS_INPUT_BUTTON_CHAT(player))
s = strcat(s, "T");
if(player.kh_next)
s = strcat(s, "K");
NOTIF_ONE,
notif_target,
MSG_MULTI,
- deathent.death_msgmurder.nent_id,
+ deathent.death_msgmurder,
s1, s2, s3, "",
f1, f2, f3, 0
);
NOTIF_ALL_EXCEPT,
notif_target,
MSG_INFO,
- deathent.death_msgmurder.nent_msginfo.nent_id,
+ deathent.death_msgmurder.nent_msginfo,
s1, s2, s3, "",
f1, f2, f3, 0
);
NOTIF_ONE,
notif_target,
MSG_MULTI,
- deathent.death_msgself.nent_id,
+ deathent.death_msgself,
s1, s2, s3, "",
f1, f2, f3, 0
);
NOTIF_ALL_EXCEPT,
notif_target,
MSG_INFO,
- deathent.death_msgself.nent_msginfo.nent_id,
+ deathent.death_msgself.nent_msginfo,
s1, s2, s3, "",
f1, f2, f3, 0
);
if (death_weapon != WEP_Null)
{
w_deathtype = deathtype;
- int death_message = ((murder) ? death_weapon.wr_killmessage(death_weapon) : death_weapon.wr_suicidemessage(death_weapon));
+ Notification death_message = ((murder) ? death_weapon.wr_killmessage(death_weapon) : death_weapon.wr_suicidemessage(death_weapon));
w_deathtype = false;
if (death_message)
s1, s2, s3, "",
f1, f2, 0, 0
);
+ // send the info part to everyone
Send_Notification_WOCOVA(
NOTIF_ALL_EXCEPT,
notif_target,
MSG_INFO,
- msg_multi_notifs[death_message - 1].nent_msginfo.nent_id,
+ death_message.nent_msginfo,
s1, s2, s3, "",
f1, f2, 0, 0
);
Send_Notification(NOTIF_ONE, attacker, MSG_CENTER, CENTER_DEATH_TEAMKILL_FRAG, targ.netname);
Send_Notification(NOTIF_ONE, targ, MSG_CENTER, CENTER_DEATH_TEAMKILL_FRAGGED, attacker.netname);
- Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM_4(targ.team, INFO_DEATH_TEAMKILL_), targ.netname, attacker.netname, deathlocation, targ.killcount);
+ Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM(targ.team, INFO_DEATH_TEAMKILL), targ.netname, attacker.netname, deathlocation, targ.killcount);
// In this case, the death message will ALWAYS be "foo was betrayed by bar"
// No need for specific death/weapon messages...
CHOICE_TYPEFRAG,
targ.netname,
kill_count_to_attacker,
- (IS_BOT_CLIENT(targ) ? NO_MSG : targ.ping)
+ (IS_BOT_CLIENT(targ) ? -1 : targ.ping)
);
Send_Notification(
NOTIF_ONE,
kill_count_to_target,
attacker.health,
attacker.armorvalue,
- (IS_BOT_CLIENT(attacker) ? NO_MSG : attacker.ping)
+ (IS_BOT_CLIENT(attacker) ? -1 : attacker.ping)
);
}
else
CHOICE_FRAG,
targ.netname,
kill_count_to_attacker,
- (IS_BOT_CLIENT(targ) ? NO_MSG : targ.ping)
+ (IS_BOT_CLIENT(targ) ? -1 : targ.ping)
);
Send_Notification(
NOTIF_ONE,
kill_count_to_target,
attacker.health,
attacker.armorvalue,
- (IS_BOT_CLIENT(attacker) ? NO_MSG : attacker.ping)
+ (IS_BOT_CLIENT(attacker) ? -1 : attacker.ping)
);
}
{
if(deathtype != DEATH_FIRE.m_id)
{
- if(victim.BUTTON_CHAT)
+ if(PHYS_INPUT_BUTTON_CHAT(victim))
attacker.typehitsound += 1;
else
attacker.damage_dealt += damage;
#include "../common/monsters/all.qh"
#include "../common/monsters/sv_monsters.qh"
#include "../common/vehicles/all.qh"
-#include "../common/notifications.qh"
+#include "../common/notifications/all.qh"
#include "../common/physics/player.qh"
#include "../common/playerstats.qh"
#include "../common/stats.qh"
BADCVAR("g_nexball");
BADCVAR("g_onslaught");
BADCVAR("g_race");
+ BADCVAR("g_race_laps_limit");
BADCVAR("g_race_qualifying_timelimit");
+ BADCVAR("g_race_qualifying_timelimit_override");
BADCVAR("g_tdm");
BADCVAR("g_tdm_teams");
BADCVAR("leadlimit");
// now check if the changes are actually gameplay relevant
- // does nothing visible
+ // does nothing gameplay relevant
BADCVAR("captureleadlimit_override");
+ BADCVAR("gameversion");
+ BADCVAR("g_allow_oldvortexbeam");
BADCVAR("g_balance_kill_delay");
- BADCVAR("g_ca_point_limit");
+ BADCVAR("g_campcheck_distance");
BADCVAR("g_ca_point_leadlimit");
+ BADCVAR("g_ca_point_limit");
BADCVAR("g_ctf_captimerecord_always");
BADCVAR("g_ctf_flag_glowtrails");
BADCVAR("g_ctf_flag_pickup_verbosename");
BADCVAR("g_domination_point_leadlimit");
BADCVAR("g_forced_respawn");
- BADCVAR("g_freezetag_point_limit");
BADCVAR("g_freezetag_point_leadlimit");
- BADCVAR("g_keyhunt_point_leadlimit");
- BADPREFIX("g_mod_");
+ BADCVAR("g_freezetag_point_limit");
+ BADCVAR("g_hats");
BADCVAR("g_invasion_point_limit");
+ BADCVAR("g_keyhunt_point_leadlimit");
BADCVAR("g_nexball_goalleadlimit");
- BADCVAR("g_tdm_point_limit");
BADCVAR("g_tdm_point_leadlimit");
+ BADCVAR("g_tdm_point_limit");
BADCVAR("leadlimit_and_fraglimit");
BADCVAR("leadlimit_override");
BADCVAR("pausable");
BADCVAR("sv_allow_fullbright");
BADCVAR("sv_checkforpacketsduringsleep");
+ BADCVAR("sv_intermission_cdtrack");
+ BADCVAR("sv_minigames");
+ BADCVAR("sv_namechangetimer");
+ BADCVAR("sv_precacheplayermodels");
BADCVAR("sv_timeout");
- BADPREFIX("sv_timeout_");
BADPREFIX("crypto_");
+ BADPREFIX("gameversion_");
BADPREFIX("g_chat_");
BADPREFIX("g_ctf_captimerecord_");
BADPREFIX("g_maplist_votable_");
+ BADPREFIX("g_mod_");
BADPREFIX("net_");
BADPREFIX("prvm_");
BADPREFIX("skill_");
BADPREFIX("sv_cullentities_");
BADPREFIX("sv_maxidle_");
+ BADPREFIX("sv_minigames_");
+ BADPREFIX("sv_timeout_");
BADPREFIX("sv_vote_");
BADPREFIX("timelimit_");
- BADCVAR("gameversion");
- BADPREFIX("gameversion_");
- BADCVAR("sv_minigames");
- BADPREFIX("sv_minigames_");
- BADCVAR("sv_namechangetimer");
// allowed changes to server admins (please sync this to server.cfg)
// vi commands:
BADCVAR("g_mirrordamage");
BADCVAR("g_nexball_goallimit");
BADCVAR("g_powerups");
+ BADCVAR("g_spawnshieldtime");
BADCVAR("g_start_delay");
+ BADCVAR("g_superspectate");
BADCVAR("g_tdm_teams_override");
BADCVAR("g_warmup");
BADCVAR("g_weapon_stay"); BADPRESUFFIX("g_", "_weapon_stay");
BADCVAR("sv_vote_simple_majority_factor");
BADCVAR("teamplay_mode");
BADCVAR("timelimit_override");
- BADCVAR("g_spawnshieldtime");
BADPREFIX("g_warmup_");
BADPREFIX("sv_ready_restart_");
return;
if(!mapvote_initialized)
- if (time < intermission_exittime + 10 && !(self.BUTTON_ATCK || self.BUTTON_JUMP || self.BUTTON_ATCK2 || self.BUTTON_HOOK || self.BUTTON_USE))
+ if (time < intermission_exittime + 10 && !(PHYS_INPUT_BUTTON_ATCK(self) || PHYS_INPUT_BUTTON_JUMP(self) || PHYS_INPUT_BUTTON_ATCK2(self) || PHYS_INPUT_BUTTON_HOOK(self) || PHYS_INPUT_BUTTON_USE(self)))
return;
MapVote_Start();
PlayerStats_GameReport(true);
WeaponStats_Shutdown();
- Kill_Notification(NOTIF_ALL, world, MSG_CENTER, 0); // kill all centerprints now
+ Kill_Notification(NOTIF_ALL, world, MSG_CENTER, CPID_Null); // kill all centerprints now
if(autocvar_sv_eventlog)
GameLogEcho(":gameover");
#include "../common/constants.qh"
#include "../common/deathtypes/all.qh"
#include "../common/mapinfo.qh"
-#include "../common/notifications.qh"
+#include "../common/notifications/all.qh"
#include "../common/playerstats.qh"
#include "../common/teams.qh"
#include "../common/triggers/subs.qh"
return o;
}
+ REPLICATE(autoswitch, bool, "cl_autoswitch");
+
+ REPLICATE(cvar_cl_allow_uid2name, bool, "cl_allow_uid2name");
+
+ REPLICATE(cvar_cl_autoscreenshot, int, "cl_autoscreenshot");
+
+ REPLICATE(cvar_cl_autotaunt, float, "cl_autotaunt");
+
+ REPLICATE(cvar_cl_clippedspectating, bool, "cl_clippedspectating");
+
+ REPLICATE(cvar_cl_handicap, float, "cl_handicap");
+
+ REPLICATE(cvar_cl_jetpack_jump, bool, "cl_jetpack_jump");
+
+ REPLICATE(cvar_cl_movement_track_canjump, bool, "cl_movement_track_canjump");
+
+ REPLICATE(cvar_cl_newusekeysupported, bool, "cl_newusekeysupported");
+
+ REPLICATE(cvar_cl_noantilag, bool, "cl_noantilag");
+
+ REPLICATE(cvar_cl_physics, string, "cl_physics");
+
+ REPLICATE(cvar_cl_voice_directional, int, "cl_voice_directional");
+
+ REPLICATE(cvar_cl_voice_directional_taunt_attenuation, float, "cl_voice_directional_taunt_attenuation");
+
+ REPLICATE(cvar_cl_weaponimpulsemode, int, "cl_weaponimpulsemode");
+
+ REPLICATE(cvar_g_xonoticversion, string, "g_xonoticversion");
+
/**
* @param f -1: cleanup, 0: request, 1: receive
*/
ReplicateVars(this, s, f);
- GetCvars_handleFloat(s, f, autoswitch, "cl_autoswitch");
- GetCvars_handleFloat(s, f, cvar_cl_autoscreenshot, "cl_autoscreenshot");
- GetCvars_handleFloat(s, f, cvar_cl_jetpack_jump, "cl_jetpack_jump");
- GetCvars_handleString(s, f, cvar_g_xonoticversion, "g_xonoticversion");
- GetCvars_handleString(s, f, cvar_cl_physics, "cl_physics");
- GetCvars_handleFloat(s, f, cvar_cl_handicap, "cl_handicap");
- GetCvars_handleFloat(s, f, cvar_cl_clippedspectating, "cl_clippedspectating");
GetCvars_handleString_Fixup(s, f, cvar_cl_weaponpriority, "cl_weaponpriority", W_FixWeaponOrder_ForceComplete_AndBuildImpulseList);
GetCvars_handleString_Fixup(s, f, cvar_cl_weaponpriorities[0], "cl_weaponpriority0", W_FixWeaponOrder_AllowIncomplete);
GetCvars_handleString_Fixup(s, f, cvar_cl_weaponpriorities[1], "cl_weaponpriority1", W_FixWeaponOrder_AllowIncomplete);
GetCvars_handleString_Fixup(s, f, cvar_cl_weaponpriorities[7], "cl_weaponpriority7", W_FixWeaponOrder_AllowIncomplete);
GetCvars_handleString_Fixup(s, f, cvar_cl_weaponpriorities[8], "cl_weaponpriority8", W_FixWeaponOrder_AllowIncomplete);
GetCvars_handleString_Fixup(s, f, cvar_cl_weaponpriorities[9], "cl_weaponpriority9", W_FixWeaponOrder_AllowIncomplete);
- GetCvars_handleFloat(s, f, cvar_cl_weaponimpulsemode, "cl_weaponimpulsemode");
- GetCvars_handleFloat(s, f, cvar_cl_autotaunt, "cl_autotaunt");
- GetCvars_handleFloat(s, f, cvar_cl_noantilag, "cl_noantilag");
- GetCvars_handleFloat(s, f, cvar_cl_voice_directional, "cl_voice_directional");
- GetCvars_handleFloat(s, f, cvar_cl_voice_directional_taunt_attenuation, "cl_voice_directional_taunt_attenuation");
- GetCvars_handleFloat(s, f, cvar_cl_allow_uid2name, "cl_allow_uid2name");
GetCvars_handleFloat(s, f, cvar_cl_allow_uidtracking, "cl_allow_uidtracking");
- GetCvars_handleFloat(s, f, cvar_cl_movement_track_canjump, "cl_movement_track_canjump");
- GetCvars_handleFloat(s, f, cvar_cl_newusekeysupported, "cl_newusekeysupported");
// fixup of switchweapon (needed for LMS or when spectating is disabled, as PutClientInServer comes too early)
if (f > 0)
// notify about shit
if(ctf_oneflag) { Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_CTF_CAPTURE_NEUTRAL, player.netname); }
- else if(!ctf_captimerecord) { Send_Notification(NOTIF_ALL, world, MSG_CHOICE, APP_TEAM_ENT_4(flag, CHOICE_CTF_CAPTURE_TIME_), player.netname, (cap_time * 100)); }
- else if(cap_time < cap_record) { Send_Notification(NOTIF_ALL, world, MSG_CHOICE, APP_TEAM_ENT_4(flag, CHOICE_CTF_CAPTURE_BROKEN_), player.netname, refername, (cap_time * 100), (cap_record * 100)); }
- else { Send_Notification(NOTIF_ALL, world, MSG_CHOICE, APP_TEAM_ENT_4(flag, CHOICE_CTF_CAPTURE_UNBROKEN_), player.netname, refername, (cap_time * 100), (cap_record * 100)); }
+ else if(!ctf_captimerecord) { Send_Notification(NOTIF_ALL, world, MSG_CHOICE, APP_TEAM_ENT(flag, CHOICE_CTF_CAPTURE_TIME), player.netname, (cap_time * 100)); }
+ else if(cap_time < cap_record) { Send_Notification(NOTIF_ALL, world, MSG_CHOICE, APP_TEAM_ENT(flag, CHOICE_CTF_CAPTURE_BROKEN), player.netname, refername, (cap_time * 100), (cap_record * 100)); }
+ else { Send_Notification(NOTIF_ALL, world, MSG_CHOICE, APP_TEAM_ENT(flag, CHOICE_CTF_CAPTURE_UNBROKEN), player.netname, refername, (cap_time * 100), (cap_record * 100)); }
// write that shit in the database
if(!ctf_oneflag) // but not in 1-flag mode
flag.ctf_status = FLAG_DROPPED;
// messages and sounds
- Send_Notification(NOTIF_ALL, world, MSG_INFO, ((flag.team) ? APP_TEAM_ENT_4(flag, INFO_CTF_LOST_) : INFO_CTF_LOST_NEUTRAL), player.netname);
+ Send_Notification(NOTIF_ALL, world, MSG_INFO, ((flag.team) ? APP_TEAM_ENT(flag, INFO_CTF_LOST) : INFO_CTF_LOST_NEUTRAL), player.netname);
_sound(flag, CH_TRIGGER, flag.snd_flag_dropped, VOL_BASE, ATTEN_NONE);
ctf_EventLog("dropped", player.team, player);
FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), LAMBDA(
if(it == sender)
- Send_Notification(NOTIF_ONE, it, MSG_CENTER, ((flag.team) ? APP_TEAM_ENT_4(flag, CENTER_CTF_PASS_SENT_) : CENTER_CTF_PASS_SENT_NEUTRAL), player.netname);
+ Send_Notification(NOTIF_ONE, it, MSG_CENTER, ((flag.team) ? APP_TEAM_ENT(flag, CENTER_CTF_PASS_SENT) : CENTER_CTF_PASS_SENT_NEUTRAL), player.netname);
else if(it == player)
- Send_Notification(NOTIF_ONE, it, MSG_CENTER, ((flag.team) ? APP_TEAM_ENT_4(flag, CENTER_CTF_PASS_RECEIVED_) : CENTER_CTF_PASS_RECEIVED_NEUTRAL), sender.netname);
+ Send_Notification(NOTIF_ONE, it, MSG_CENTER, ((flag.team) ? APP_TEAM_ENT(flag, CENTER_CTF_PASS_RECEIVED) : CENTER_CTF_PASS_RECEIVED_NEUTRAL), sender.netname);
else if(SAME_TEAM(it, sender))
- Send_Notification(NOTIF_ONE, it, MSG_CENTER, ((flag.team) ? APP_TEAM_ENT_4(flag, CENTER_CTF_PASS_OTHER_) : CENTER_CTF_PASS_OTHER_NEUTRAL), sender.netname, player.netname);
+ Send_Notification(NOTIF_ONE, it, MSG_CENTER, ((flag.team) ? APP_TEAM_ENT(flag, CENTER_CTF_PASS_OTHER) : CENTER_CTF_PASS_OTHER_NEUTRAL), sender.netname, player.netname);
));
// create new waypoint
player.throw_count = 0;
// messages and sounds
- Send_Notification(NOTIF_ONE, player, MSG_CENTER, ((enemy_flag.team) ? APP_TEAM_ENT_4(enemy_flag, CENTER_CTF_CAPTURE_) : CENTER_CTF_CAPTURE_NEUTRAL));
+ Send_Notification(NOTIF_ONE, player, MSG_CENTER, ((enemy_flag.team) ? APP_TEAM_ENT(enemy_flag, CENTER_CTF_CAPTURE) : CENTER_CTF_CAPTURE_NEUTRAL));
ctf_CaptureRecord(enemy_flag, player);
_sound(player, CH_TRIGGER, ((ctf_oneflag) ? player_team_flag.snd_flag_capture : ((DIFF_TEAM(player, flag)) ? enemy_flag.snd_flag_capture : flag.snd_flag_capture)), VOL_BASE, ATTEN_NONE);
// messages and sounds
if(IS_MONSTER(player))
{
- Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_4(flag, INFO_CTF_RETURN_MONSTER_), player.monster_name);
+ Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT(flag, INFO_CTF_RETURN_MONSTER), player.monster_name);
}
else if(flag.team)
{
- Send_Notification(NOTIF_ONE, player, MSG_CENTER, APP_TEAM_ENT_4(flag, CENTER_CTF_RETURN_));
- Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_4(flag, INFO_CTF_RETURN_), player.netname);
+ Send_Notification(NOTIF_ONE, player, MSG_CENTER, APP_TEAM_ENT(flag, CENTER_CTF_RETURN));
+ Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT(flag, INFO_CTF_RETURN), player.netname);
}
_sound(player, CH_TRIGGER, flag.snd_flag_returned, VOL_BASE, ATTEN_NONE);
ctf_EventLog("return", flag.team, player);
}
// messages and sounds
- Send_Notification(NOTIF_ALL, world, MSG_INFO, ((flag.team) ? APP_TEAM_ENT_4(flag, INFO_CTF_PICKUP_) : INFO_CTF_PICKUP_NEUTRAL), player.netname);
+ Send_Notification(NOTIF_ALL, world, MSG_INFO, ((flag.team) ? APP_TEAM_ENT(flag, INFO_CTF_PICKUP) : INFO_CTF_PICKUP_NEUTRAL), player.netname);
if(ctf_stalemate) { Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_CTF_STALEMATE_CARRIER); }
if(!flag.team) { Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_CTF_PICKUP_NEUTRAL); }
- else if(CTF_DIFFTEAM(player, flag)) { Send_Notification(NOTIF_ONE, player, MSG_CENTER, APP_TEAM_ENT_4(flag, CENTER_CTF_PICKUP_)); }
+ else if(CTF_DIFFTEAM(player, flag)) { Send_Notification(NOTIF_ONE, player, MSG_CENTER, APP_TEAM_ENT(flag, CENTER_CTF_PICKUP)); }
else { Send_Notification(NOTIF_ONE, player, MSG_CENTER, ((SAME_TEAM(player, flag)) ? CENTER_CTF_PICKUP_TEAM : CENTER_CTF_PICKUP_TEAM_ENEMY), Team_ColorCode(flag.team)); }
- Send_Notification(NOTIF_TEAM_EXCEPT, player, MSG_CHOICE, ((flag.team) ? APP_TEAM_ENT_4(flag, CHOICE_CTF_PICKUP_TEAM_) : CHOICE_CTF_PICKUP_TEAM_NEUTRAL), Team_ColorCode(player.team), player.netname);
+ Send_Notification(NOTIF_TEAM_EXCEPT, player, MSG_CHOICE, ((flag.team) ? APP_TEAM_ENT(flag, CHOICE_CTF_PICKUP_TEAM) : CHOICE_CTF_PICKUP_TEAM_NEUTRAL), Team_ColorCode(player.team), player.netname);
if(!flag.team)
FOREACH_CLIENT(IS_PLAYER(it) && it != player && DIFF_TEAM(it, player), LAMBDA(Send_Notification(NOTIF_ONE, it, MSG_CHOICE, CHOICE_CTF_PICKUP_ENEMY_NEUTRAL, Team_ColorCode(player.team), player.netname)));
FOREACH_CLIENT(IS_PLAYER(it) && it != player, LAMBDA(
if(CTF_SAMETEAM(flag, it))
if(SAME_TEAM(player, it))
- Send_Notification(NOTIF_ONE, it, MSG_CHOICE, APP_TEAM_ENT_4(flag, CHOICE_CTF_PICKUP_TEAM_), Team_ColorCode(player.team), player.netname);
+ Send_Notification(NOTIF_ONE, it, MSG_CHOICE, APP_TEAM_ENT(flag, CHOICE_CTF_PICKUP_TEAM), Team_ColorCode(player.team), player.netname);
else
Send_Notification(NOTIF_ONE, it, MSG_CHOICE, ((SAME_TEAM(flag, player)) ? CHOICE_CTF_PICKUP_ENEMY_TEAM : CHOICE_CTF_PICKUP_ENEMY), Team_ColorCode(player.team), player.netname);
));
{
switch(returntype)
{
- case RETURN_DROPPED: Send_Notification(NOTIF_ALL, world, MSG_INFO, ((flag.team) ? APP_TEAM_ENT_4(flag, INFO_CTF_FLAGRETURN_DROPPED_) : INFO_CTF_FLAGRETURN_DROPPED_NEUTRAL)); break;
- case RETURN_DAMAGE: Send_Notification(NOTIF_ALL, world, MSG_INFO, ((flag.team) ? APP_TEAM_ENT_4(flag, INFO_CTF_FLAGRETURN_DAMAGED_) : INFO_CTF_FLAGRETURN_DAMAGED_NEUTRAL)); break;
- case RETURN_SPEEDRUN: Send_Notification(NOTIF_ALL, world, MSG_INFO, ((flag.team) ? APP_TEAM_ENT_4(flag, INFO_CTF_FLAGRETURN_SPEEDRUN_) : INFO_CTF_FLAGRETURN_SPEEDRUN_NEUTRAL), ctf_captimerecord); break;
- case RETURN_NEEDKILL: Send_Notification(NOTIF_ALL, world, MSG_INFO, ((flag.team) ? APP_TEAM_ENT_4(flag, INFO_CTF_FLAGRETURN_NEEDKILL_) : INFO_CTF_FLAGRETURN_NEEDKILL_NEUTRAL)); break;
+ case RETURN_DROPPED: Send_Notification(NOTIF_ALL, world, MSG_INFO, ((flag.team) ? APP_TEAM_ENT(flag, INFO_CTF_FLAGRETURN_DROPPED) : INFO_CTF_FLAGRETURN_DROPPED_NEUTRAL)); break;
+ case RETURN_DAMAGE: Send_Notification(NOTIF_ALL, world, MSG_INFO, ((flag.team) ? APP_TEAM_ENT(flag, INFO_CTF_FLAGRETURN_DAMAGED) : INFO_CTF_FLAGRETURN_DAMAGED_NEUTRAL)); break;
+ case RETURN_SPEEDRUN: Send_Notification(NOTIF_ALL, world, MSG_INFO, ((flag.team) ? APP_TEAM_ENT(flag, INFO_CTF_FLAGRETURN_SPEEDRUN) : INFO_CTF_FLAGRETURN_SPEEDRUN_NEUTRAL), ctf_captimerecord); break;
+ case RETURN_NEEDKILL: Send_Notification(NOTIF_ALL, world, MSG_INFO, ((flag.team) ? APP_TEAM_ENT(flag, INFO_CTF_FLAGRETURN_NEEDKILL) : INFO_CTF_FLAGRETURN_NEEDKILL_NEUTRAL)); break;
default:
case RETURN_TIMEOUT:
- { Send_Notification(NOTIF_ALL, world, MSG_INFO, ((flag.team) ? APP_TEAM_ENT_4(flag, INFO_CTF_FLAGRETURN_TIMEOUT_) : INFO_CTF_FLAGRETURN_TIMEOUT_NEUTRAL)); break; }
+ { Send_Notification(NOTIF_ALL, world, MSG_INFO, ((flag.team) ? APP_TEAM_ENT(flag, INFO_CTF_FLAGRETURN_TIMEOUT) : INFO_CTF_FLAGRETURN_TIMEOUT_NEUTRAL)); break; }
}
_sound(flag, CH_TRIGGER, flag.snd_flag_respawn, VOL_BASE, ATTEN_NONE);
ctf_EventLog("returned", flag.team, world);
{SELFPARAM();
if(self.flagcarried)
{
- Send_Notification(NOTIF_ALL, world, MSG_INFO, ((self.flagcarried.team) ? APP_TEAM_ENT_4(self.flagcarried, INFO_CTF_FLAGRETURN_ABORTRUN_) : INFO_CTF_FLAGRETURN_ABORTRUN_NEUTRAL));
+ Send_Notification(NOTIF_ALL, world, MSG_INFO, ((self.flagcarried.team) ? APP_TEAM_ENT(self.flagcarried, INFO_CTF_FLAGRETURN_ABORTRUN) : INFO_CTF_FLAGRETURN_ABORTRUN_NEUTRAL));
ctf_RespawnFlag(self.flagcarried);
return true;
}
// code from here on is just to support maps that don't have flag and team entities
void ctf_SpawnTeam (string teamname, int teamcolor)
{
- entity this = new(ctf_team);
+ entity this = new_pure(ctf_team);
this.netname = teamname;
this.cnt = teamcolor;
this.spawnfunc_checked = true;
PlayerScore_Add(player, SP_KH_PICKUPS, 1);
}
key.kh_dropperteam = 0;
- Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_4(key, INFO_KEYHUNT_PICKUP_), player.netname);
+ Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT(key, INFO_KEYHUNT_PICKUP), player.netname);
kh_Key_AssignTo(key, player); // this also updates .kh_state
}
first = false;
}
- Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM_4(teem, INFO_KEYHUNT_CAPTURE_), keyowner);
+ Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM(teem, INFO_KEYHUNT_CAPTURE), keyowner);
first = true;
midpoint = '0 0 0';
}
}
- Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_4(lostkey, INFO_KEYHUNT_LOST_), lostkey.kh_previous_owner.netname);
+ Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT(lostkey, INFO_KEYHUNT_LOST), lostkey.kh_previous_owner.netname);
play2all(SND(KH_DESTROY));
te_tarexplosion(lostkey.origin);
else
Send_Notification(NOTIF_ONE, it, MSG_CENTER, CENTER_KEYHUNT_HELP);
else
- Send_Notification(NOTIF_ONE, it, MSG_CENTER, APP_TEAM_NUM_4(kh_interferemsg_team, CENTER_KEYHUNT_INTERFERE_));
+ Send_Notification(NOTIF_ONE, it, MSG_CENTER, APP_TEAM_NUM(kh_interferemsg_team, CENTER_KEYHUNT_INTERFERE));
));
}
key.kh_worldkeynext = kh_worldkeylist;
kh_worldkeylist = key;
- Send_Notification(NOTIF_ONE, initial_owner, MSG_CENTER, APP_TEAM_NUM_4(initial_owner.team, CENTER_KEYHUNT_START_));
+ Send_Notification(NOTIF_ONE, initial_owner, MSG_CENTER, APP_TEAM_NUM(initial_owner.team, CENTER_KEYHUNT_START));
WaypointSprite_Spawn(WP_KeyDropped, 0, 0, key, '0 0 1' * KH_KEY_WP_ZSHIFT, world, key.team, key, waypointsprite_attachedforcarrier, false, RADARICON_FLAG);
key.waypointsprite_attachedforcarrier.waypointsprite_visible_for_player = kh_Key_waypointsprite_visible_for_player;
kh_Scores_Event(player, key, "dropkey", 0, 0);
PlayerScore_Add(player, SP_KH_LOSSES, 1);
- Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_4(key, INFO_KEYHUNT_DROP_), player.netname);
+ Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT(key, INFO_KEYHUNT_DROP), player.netname);
kh_Key_AssignTo(key, world);
makevectors(player.v_angle);
{
kh_Scores_Event(player, key, "losekey", 0, 0);
PlayerScore_Add(player, SP_KH_LOSSES, 1);
- Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_4(key, INFO_KEYHUNT_LOST_), player.netname);
+ Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT(key, INFO_KEYHUNT_LOST), player.netname);
kh_Key_AssignTo(key, world);
makevectors('-1 0 0' * (45 + 45 * random()) + '0 360 0' * random());
key.velocity = W_CalculateProjectileVelocity(player.velocity, autocvar_g_balance_keyhunt_dropvelocity * v_forward, false);
float t_team = kh_Team_ByID(num);
float players = 0;
FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
- if(!IS_DEAD(it) && !it.BUTTON_CHAT && it.team == t_team)
+ if(!IS_DEAD(it) && !PHYS_INPUT_BUTTON_CHAT(it) && it.team == t_team)
++players;
));
if(KH_READY_TEAMS_OK())
{
if(prev_missing_teams_mask > 0)
- Kill_Notification(NOTIF_ALL, world, MSG_CENTER_CPID, CPID_MISSING_TEAMS);
+ Kill_Notification(NOTIF_ALL, world, MSG_CENTER, CPID_MISSING_TEAMS);
prev_missing_teams_mask = -1;
Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_KEYHUNT_ROUNDSTART, autocvar_g_balance_keyhunt_delay_round);
kh_Controller_SetThink(autocvar_g_balance_keyhunt_delay_round, kh_StartRound);
if(player_count == 0)
{
if(prev_missing_teams_mask > 0)
- Kill_Notification(NOTIF_ALL, world, MSG_CENTER_CPID, CPID_MISSING_TEAMS);
+ Kill_Notification(NOTIF_ALL, world, MSG_CENTER, CPID_MISSING_TEAMS);
prev_missing_teams_mask = -1;
}
else
void kh_EnableTrackingDevice() // runs after each round
{
- Kill_Notification(NOTIF_ALL, world, MSG_CENTER_CPID, CPID_KEYHUNT);
- Kill_Notification(NOTIF_ALL, world, MSG_CENTER_CPID, CPID_KEYHUNT_OTHER);
+ Kill_Notification(NOTIF_ALL, world, MSG_CENTER, CPID_KEYHUNT);
+ Kill_Notification(NOTIF_ALL, world, MSG_CENTER, CPID_KEYHUNT_OTHER);
kh_tracking_enabled = true;
}
return;
}
- Kill_Notification(NOTIF_ALL, world, MSG_CENTER_CPID, CPID_KEYHUNT);
- Kill_Notification(NOTIF_ALL, world, MSG_CENTER_CPID, CPID_KEYHUNT_OTHER);
+ Kill_Notification(NOTIF_ALL, world, MSG_CENTER, CPID_KEYHUNT);
+ Kill_Notification(NOTIF_ALL, world, MSG_CENTER, CPID_KEYHUNT_OTHER);
for(i = 0; i < kh_teams; ++i)
{
players = 0;
entity my_player = world;
FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
- if(!IS_DEAD(it) && !it.BUTTON_CHAT && it.team == teem)
+ if(!IS_DEAD(it) && !PHYS_INPUT_BUTTON_CHAT(it) && it.team == teem)
{
++players;
if(random() * players <= 1)
#include <common/animdecide.qh>
#include <common/constants.qh>
#include <common/monsters/all.qh>
-#include <common/notifications.qh>
+#include <common/notifications/all.qh>
#include <common/util.qh>
#include <common/weapons/all.qh>
#include <lib/csqcmodel/sv_model.qh>
if (actor.(weaponentity).state != WS_CLEAR)
{
Weapon wpn = PS(actor).m_weapon;
- w_ready(wpn, actor, weaponentity, (actor.BUTTON_ATCK ? 1 : 0) | (actor.BUTTON_ATCK2 ? 2 : 0));
+ w_ready(wpn, actor, weaponentity, PHYS_INPUT_BUTTON_ATCK(actor) | (PHYS_INPUT_BUTTON_ATCK2(actor) << 1));
return;
}
}
bool block_weapon = false;
{
- bool key_pressed = actor.BUTTON_HOOK && !actor.vehicle;
+ bool key_pressed = PHYS_INPUT_BUTTON_HOOK(actor) && !actor.vehicle;
Weapon off = actor.offhand;
if (off && !(actor.weapons & WEPSET(HOOK)))
{
W_SwitchWeapon(WEP_HOOK);
actor.hook_switchweapon = key_pressed;
Weapon h = WEP_HOOK;
- block_weapon = (PS(actor).m_weapon == h && (actor.BUTTON_ATCK || key_pressed));
+ block_weapon = (PS(actor).m_weapon == h && (PHYS_INPUT_BUTTON_ATCK(actor) || key_pressed));
h.wr_think(h, actor, weaponentity, block_weapon ? 1 : 0);
}
}
if (w)
{
Weapon e = PS(actor).m_weapon;
- e.wr_think(e, actor, weaponentity, (actor.BUTTON_ATCK ? 1 : 0) | (actor.BUTTON_ATCK2 ? 2 : 0));
+ e.wr_think(e, actor, weaponentity, PHYS_INPUT_BUTTON_ATCK(actor) | (PHYS_INPUT_BUTTON_ATCK2(actor) << 1));
}
else
{
v_up = up;
Weapon wpn = PS(actor).m_weapon;
this.weapon_think(wpn, actor, weaponentity,
- (actor.BUTTON_ATCK ? 1 : 0) | (actor.BUTTON_ATCK2 ? 2 : 0));
+ PHYS_INPUT_BUTTON_ATCK(actor) | (PHYS_INPUT_BUTTON_ATCK2(actor) << 1));
}
else
{
// ATTACK_FINISHED(actor, slot) -= actor.reload_time - 1;
Weapon wpn = Weapons_from(PS(actor).m_weapon.m_id);
- w_ready(wpn, actor, weaponentity, (actor.BUTTON_ATCK ? 1 : 0) | (actor.BUTTON_ATCK2 ? 2 : 0));
+ w_ready(wpn, actor, weaponentity, PHYS_INPUT_BUTTON_ATCK(actor) | (PHYS_INPUT_BUTTON_ATCK2(actor) << 1));
}
void W_Reload(entity actor, float sent_ammo_min, string sent_sound)