void M_Mage_Attack_Spike(vector dir);
void M_Mage_Attack_Push();
-METHOD(MageSpike, wr_think, void(MageSpike thiswep, bool fire1, bool fire2)) {
- SELFPARAM();
+METHOD(MageSpike, wr_think, void(MageSpike thiswep, entity actor, bool fire1, bool fire2)) {
if (fire1)
- if (!IS_PLAYER(self) || weapon_prepareattack(false, 0.2)) {
- if (!self.target_range) self.target_range = autocvar_g_monsters_target_range;
- self.enemy = Monster_FindTarget(self);
- W_SetupShot_Dir(self, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
- if (!IS_PLAYER(self)) w_shotdir = normalize((self.enemy.origin + '0 0 10') - self.origin);
+ if (!IS_PLAYER(actor) || weapon_prepareattack(actor, false, 0.2)) {
+ if (!actor.target_range) actor.target_range = autocvar_g_monsters_target_range;
+ actor.enemy = Monster_FindTarget(actor);
+ W_SetupShot_Dir(actor, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
+ if (!IS_PLAYER(actor)) w_shotdir = normalize((actor.enemy.origin + '0 0 10') - actor.origin);
M_Mage_Attack_Spike(w_shotdir);
- weapon_thinkf(WFRAME_FIRE1, 0, w_ready);
+ weapon_thinkf(actor, WFRAME_FIRE1, 0, w_ready);
}
if (fire2)
- if (!IS_PLAYER(self) || weapon_prepareattack(true, 0.5)) {
+ if (!IS_PLAYER(actor) || weapon_prepareattack(actor, true, 0.5)) {
M_Mage_Attack_Push();
- weapon_thinkf(WFRAME_FIRE2, 0, w_ready);
+ weapon_thinkf(actor, WFRAME_FIRE2, 0, w_ready);
}
}
if(random() <= 0.7)
{
Weapon wep = WEP_MAGE_SPIKE;
- wep.wr_think(wep, false, true);
+ wep.wr_think(wep, self, false, true);
return true;
}
self.attack_finished_single = time + (autocvar_g_monster_mage_attack_spike_delay);
self.anim_finished = time + 1;
Weapon wep = WEP_MAGE_SPIKE;
- wep.wr_think(wep, true, false);
+ wep.wr_think(wep, self, true, false);
return true;
}
}
void M_Spider_Attack_Web();
-METHOD(SpiderAttack, wr_think, void(SpiderAttack thiswep, bool fire1, bool fire2)) {
- SELFPARAM();
- bool isPlayer = IS_PLAYER(self);
+METHOD(SpiderAttack, wr_think, void(SpiderAttack thiswep, entity actor, bool fire1, bool fire2)) {
+ bool isPlayer = IS_PLAYER(actor);
if (fire1)
- if ((!isPlayer && time >= self.spider_web_delay) || weapon_prepareattack(false, autocvar_g_monster_spider_attack_web_delay)) {
+ if ((!isPlayer && time >= actor.spider_web_delay) || weapon_prepareattack(actor, false, autocvar_g_monster_spider_attack_web_delay)) {
if (!isPlayer) {
- self.spider_web_delay = time + 3;
- setanim(self, self.anim_shoot, true, true, true);
- self.attack_finished_single = time + (autocvar_g_monster_spider_attack_web_delay);
- self.anim_finished = time + 1;
+ actor.spider_web_delay = time + 3;
+ setanim(actor, actor.anim_shoot, true, true, true);
+ actor.attack_finished_single = time + (autocvar_g_monster_spider_attack_web_delay);
+ actor.anim_finished = time + 1;
}
- if (isPlayer) self.enemy = Monster_FindTarget(self);
- W_SetupShot_Dir(self, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
- if (!isPlayer) w_shotdir = normalize((self.enemy.origin + '0 0 10') - self.origin);
+ if (isPlayer) actor.enemy = Monster_FindTarget(actor);
+ W_SetupShot_Dir(actor, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
+ if (!isPlayer) w_shotdir = normalize((actor.enemy.origin + '0 0 10') - actor.origin);
M_Spider_Attack_Web();
- weapon_thinkf(WFRAME_FIRE1, 0, w_ready);
+ weapon_thinkf(actor, WFRAME_FIRE1, 0, w_ready);
return;
}
if (fire2)
- if (!isPlayer || weapon_prepareattack(true, 0.5)) {
+ if (!isPlayer || weapon_prepareattack(actor, true, 0.5)) {
if (isPlayer) {
- self.enemy = Monster_FindTarget(self);
- self.attack_range = 60;
+ actor.enemy = Monster_FindTarget(actor);
+ actor.attack_range = 60;
}
- Monster_Attack_Melee(self.enemy, (autocvar_g_monster_spider_attack_bite_damage), ((random() > 0.5) ? self.anim_melee : self.anim_shoot), self.attack_range, (autocvar_g_monster_spider_attack_bite_delay), DEATH_MONSTER_SPIDER, true);
- weapon_thinkf(WFRAME_FIRE2, 0, w_ready);
+ Monster_Attack_Melee(actor.enemy, (autocvar_g_monster_spider_attack_bite_damage), ((random() > 0.5) ? self.anim_melee : self.anim_shoot), self.attack_range, (autocvar_g_monster_spider_attack_bite_delay), DEATH_MONSTER_SPIDER, true);
+ weapon_thinkf(actor, WFRAME_FIRE2, 0, w_ready);
}
}
Weapon wep = WEP_SPIDER_ATTACK;
case MONSTER_ATTACK_MELEE:
{
- wep.wr_think(wep, false, true);
+ wep.wr_think(wep, self, false, true);
return true;
}
case MONSTER_ATTACK_RANGED:
{
- wep.wr_think(wep, true, false);
+ wep.wr_think(wep, self, true, false);
return true;
}
}
void M_Wyvern_Attack_Fireball_Explode();
void M_Wyvern_Attack_Fireball_Touch();
-METHOD(WyvernAttack, wr_think, void(WyvernAttack thiswep, bool fire1, bool fire2)) {
- SELFPARAM();
-
+METHOD(WyvernAttack, wr_think, void(WyvernAttack thiswep, entity actor, bool fire1, bool fire2)) {
if (fire1)
- if (time > self.attack_finished_single || weapon_prepareattack(false, 1.2)) {
- if (IS_PLAYER(self)) W_SetupShot_Dir(self, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
- if (IS_MONSTER(self)) {
- self.attack_finished_single = time + 1.2;
- self.anim_finished = time + 1.2;
- monster_makevectors(self.enemy);
+ if (time > actor.attack_finished_single || weapon_prepareattack(actor, false, 1.2)) {
+ if (IS_PLAYER(actor)) W_SetupShot_Dir(actor, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
+ if (IS_MONSTER(actor)) {
+ actor.attack_finished_single = time + 1.2;
+ actor.anim_finished = time + 1.2;
+ monster_makevectors(actor.enemy);
}
entity missile = spawn();
- missile.owner = missile.realowner = self;
+ missile.owner = missile.realowner = actor;
missile.solid = SOLID_TRIGGER;
missile.movetype = MOVETYPE_FLYMISSILE;
missile.projectiledeathtype = DEATH_MONSTER_WYVERN;
setsize(missile, '-6 -6 -6', '6 6 6');
- setorigin(missile, self.origin + self.view_ofs + v_forward * 14);
+ setorigin(missile, actor.origin + actor.view_ofs + v_forward * 14);
missile.flags = FL_PROJECTILE;
missile.velocity = w_shotdir * (autocvar_g_monster_wyvern_attack_fireball_speed);
missile.avelocity = '300 300 300';
missile.touch = M_Wyvern_Attack_Fireball_Touch;
CSQCProjectile(missile, true, PROJECTILE_FIREMINE, true);
- weapon_thinkf(WFRAME_FIRE1, 0, w_ready);
+ weapon_thinkf(actor, WFRAME_FIRE1, 0, w_ready);
}
}
{
w_shotdir = normalize((self.enemy.origin + '0 0 10') - self.origin);
Weapon wep = WEP_WYVERN_ATTACK;
- wep.wr_think(wep, true, false);
+ wep.wr_think(wep, self, true, false);
return true;
}
}
/** (SERVER) called when turret attacks */
METHOD(Turret, tr_attack, void(Turret this)) {
Weapon w = this.m_weapon;
- w.wr_think(w, true, false);
+ w.wr_think(w, self, true, false);
}
/** (ALL) */
METHOD(Turret, tr_config, void(Turret this)) {
#ifdef SVQC
void turret_initparams(entity);
-METHOD(EWheelAttack, wr_think, void(entity thiswep, bool fire1, bool fire2)) {
- SELFPARAM();
- bool isPlayer = IS_PLAYER(self);
+METHOD(EWheelAttack, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2)) {
+ bool isPlayer = IS_PLAYER(actor);
if (fire1)
- if (!isPlayer || weapon_prepareattack(false, WEP_CVAR_PRI(electro, refire))) {
+ if (!isPlayer || weapon_prepareattack(actor, false, WEP_CVAR_PRI(electro, refire))) {
if (isPlayer) {
- turret_initparams(self);
- W_SetupShot_Dir(self, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
- self.tur_shotdir_updated = w_shotdir;
- self.tur_shotorg = w_shotorg;
- self.tur_head = self;
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
+ turret_initparams(actor);
+ W_SetupShot_Dir(actor, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
+ actor.tur_shotdir_updated = w_shotdir;
+ actor.tur_shotorg = w_shotorg;
+ actor.tur_head = actor;
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
}
- turret_do_updates(self);
+ turret_do_updates(actor);
entity missile = turret_projectile(SND(LASERGUN_FIRE), 1, 0, DEATH_TURRET_EWHEEL, PROJECTILE_BLASTER, true, true);
missile.missile_flags = MIF_SPLASH;
- Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, self.tur_shotorg, self.tur_shotdir_updated * 1000, 1);
+ Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, actor.tur_shotorg, actor.tur_shotdir_updated * 1000, 1);
if (!isPlayer) {
- self.tur_head.frame += 2;
+ actor.tur_head.frame += 2;
- if (self.tur_head.frame > 3)
- self.tur_head.frame = 0;
+ if (actor.tur_head.frame > 3)
+ actor.tur_head.frame = 0;
}
}
}
#ifdef SVQC
void turret_flac_projectile_think_explode();
-METHOD(FlacAttack, wr_think, void(entity thiswep, bool fire1, bool fire2)) {
- SELFPARAM();
- bool isPlayer = IS_PLAYER(self);
+METHOD(FlacAttack, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2)) {
+ bool isPlayer = IS_PLAYER(actor);
if (fire1)
- if (!isPlayer || weapon_prepareattack(false, WEP_CVAR_PRI(electro, refire))) {
+ if (!isPlayer || weapon_prepareattack(actor, false, WEP_CVAR_PRI(electro, refire))) {
if (isPlayer) {
- turret_initparams(self);
- W_SetupShot_Dir(self, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
- self.tur_shotdir_updated = w_shotdir;
- self.tur_shotorg = w_shotorg;
- self.tur_head = self;
- self.tur_impacttime = 10;
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
+ turret_initparams(actor);
+ W_SetupShot_Dir(actor, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
+ actor.tur_shotdir_updated = w_shotdir;
+ actor.tur_shotorg = w_shotorg;
+ actor.tur_head = actor;
+ actor.tur_impacttime = 10;
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
}
turret_tag_fire_update();
entity proj = turret_projectile(SND(HAGAR_FIRE), 5, 0, DEATH_TURRET_FLAC, PROJECTILE_HAGAR, true, true);
proj.missile_flags = MIF_SPLASH | MIF_PROXY;
proj.think = turret_flac_projectile_think_explode;
- proj.nextthink = time + self.tur_impacttime + (random() * 0.01 - random() * 0.01);
- Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, self.tur_shotorg, self.tur_shotdir_updated * 1000, 1);
+ proj.nextthink = time + actor.tur_impacttime + (random() * 0.01 - random() * 0.01);
+ Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, actor.tur_shotorg, actor.tur_shotdir_updated * 1000, 1);
if (!isPlayer) {
- self.tur_head.frame = self.tur_head.frame + 1;
- if (self.tur_head.frame >= 4)
- self.tur_head.frame = 0;
+ actor.tur_head.frame = actor.tur_head.frame + 1;
+ if (actor.tur_head.frame >= 4)
+ actor.tur_head.frame = 0;
}
}
}
float autocvar_g_turrets_unit_hellion_shot_speed_max;
void turret_hellion_missile_think();
-METHOD(HellionAttack, wr_think, void(entity thiswep, bool fire1, bool fire2)) {
- SELFPARAM();
- bool isPlayer = IS_PLAYER(self);
+METHOD(HellionAttack, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2)) {
+ bool isPlayer = IS_PLAYER(actor);
if (fire1)
- if (!isPlayer || weapon_prepareattack(false, WEP_CVAR_PRI(electro, refire))) {
+ if (!isPlayer || weapon_prepareattack(actor, false, WEP_CVAR_PRI(electro, refire))) {
if (isPlayer) {
- turret_initparams(self);
- W_SetupShot_Dir(self, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
- self.tur_shotdir_updated = w_shotdir;
- self.tur_shotorg = w_shotorg;
- self.tur_head = self;
- self.shot_radius = 500;
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
+ turret_initparams(actor);
+ W_SetupShot_Dir(actor, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
+ actor.tur_shotdir_updated = w_shotdir;
+ actor.tur_shotorg = w_shotorg;
+ actor.tur_head = actor;
+ actor.shot_radius = 500;
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
}
if (!isPlayer) {
- if (self.tur_head.frame != 0)
- self.tur_shotorg = gettaginfo(self.tur_head, gettagindex(self.tur_head, "tag_fire"));
+ if (actor.tur_head.frame != 0)
+ actor.tur_shotorg = gettaginfo(actor.tur_head, gettagindex(actor.tur_head, "tag_fire"));
else
- self.tur_shotorg = gettaginfo(self.tur_head, gettagindex(self.tur_head, "tag_fire2"));
+ actor.tur_shotorg = gettaginfo(actor.tur_head, gettagindex(actor.tur_head, "tag_fire2"));
}
entity missile = turret_projectile(SND(ROCKET_FIRE), 6, 10, DEATH_TURRET_HELLION, PROJECTILE_ROCKET, FALSE, FALSE);
missile.max_health = time + 9;
missile.tur_aimpos = randomvec() * 128;
missile.missile_flags = MIF_SPLASH | MIF_PROXY | MIF_GUIDED_HEAT;
- if (!isPlayer) self.tur_head.frame += 1;
+ if (!isPlayer) actor.tur_head.frame += 1;
}
}
float autocvar_g_turrets_unit_hk_shot_speed_turnrate;
void turret_hk_missile_think();
-METHOD(HunterKillerAttack, wr_think, void(entity thiswep, bool fire1, bool fire2))
+METHOD(HunterKillerAttack, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
{
- SELFPARAM();
- bool isPlayer = IS_PLAYER(self);
+ bool isPlayer = IS_PLAYER(actor);
if (fire1)
- if (!isPlayer || weapon_prepareattack(false, WEP_CVAR_PRI(electro, refire))) {
+ if (!isPlayer || weapon_prepareattack(actor, false, WEP_CVAR_PRI(electro, refire))) {
if (isPlayer) {
- turret_initparams(self);
- W_SetupShot_Dir(self, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
- self.tur_shotdir_updated = w_shotdir;
- self.tur_shotorg = w_shotorg;
- self.tur_head = self;
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
+ turret_initparams(actor);
+ W_SetupShot_Dir(actor, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
+ actor.tur_shotdir_updated = w_shotdir;
+ actor.tur_shotorg = w_shotorg;
+ actor.tur_head = actor;
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
}
entity missile = turret_projectile(SND(ROCKET_FIRE), 6, 10, DEATH_TURRET_HK, PROJECTILE_ROCKET, FALSE, FALSE);
te_explosion (missile.origin);
missile.think = turret_hk_missile_think;
missile.nextthink = time + 0.25;
missile.movetype = MOVETYPE_BOUNCEMISSILE;
- missile.velocity = self.tur_shotdir_updated * (self.shot_speed * 0.75);
+ missile.velocity = actor.tur_shotdir_updated * (actor.shot_speed * 0.75);
missile.angles = vectoangles(missile.velocity);
missile.cnt = time + 30;
missile.ticrate = max(autocvar_sys_ticrate, 0.05);
missile.missile_flags = MIF_SPLASH | MIF_PROXY | MIF_GUIDED_AI;
if (!isPlayer)
- if (self.tur_head.frame == 0)
- self.tur_head.frame = self.tur_head.frame + 1;
+ if (actor.tur_head.frame == 0)
+ actor.tur_head.frame = actor.tur_head.frame + 1;
}
}
void W_MachineGun_MuzzleFlash();
-METHOD(MachineGunTurretAttack, wr_think, void(entity thiswep, bool fire1, bool fire2))
+METHOD(MachineGunTurretAttack, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
{
- SELFPARAM();
- bool isPlayer = IS_PLAYER(self);
+ bool isPlayer = IS_PLAYER(actor);
if (fire1)
- if (!isPlayer || weapon_prepareattack(false, WEP_CVAR(machinegun, sustained_refire))) {
+ if (!isPlayer || weapon_prepareattack(actor, false, WEP_CVAR(machinegun, sustained_refire))) {
if (isPlayer) {
- turret_initparams(self);
- W_SetupShot_Dir(self, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
- self.tur_shotdir_updated = w_shotdir;
- self.tur_shotorg = w_shotorg;
- self.tur_head = self;
- weapon_thinkf(WFRAME_FIRE1, 0, w_ready);
+ turret_initparams(actor);
+ W_SetupShot_Dir(actor, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
+ actor.tur_shotdir_updated = w_shotdir;
+ actor.tur_shotorg = w_shotorg;
+ actor.tur_head = actor;
+ weapon_thinkf(actor, WFRAME_FIRE1, 0, w_ready);
}
- fireBullet (self.tur_shotorg, self.tur_shotdir_updated, self.shot_spread, 0, self.shot_dmg, self.shot_force, DEATH_TURRET_MACHINEGUN, 0);
+ fireBullet (actor.tur_shotorg, actor.tur_shotdir_updated, actor.shot_spread, 0, actor.shot_dmg, actor.shot_force, DEATH_TURRET_MACHINEGUN, 0);
W_MachineGun_MuzzleFlash();
- setattachment(self.muzzle_flash, self.tur_head, "tag_fire");
+ setattachment(actor.muzzle_flash, actor.tur_head, "tag_fire");
}
}
#ifdef SVQC
-METHOD(MLRSTurretAttack, wr_think, void(entity thiswep, bool fire1, bool fire2))
+METHOD(MLRSTurretAttack, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
{
- SELFPARAM();
- bool isPlayer = IS_PLAYER(self);
+ bool isPlayer = IS_PLAYER(actor);
if (fire1)
- if (!isPlayer || weapon_prepareattack(false, WEP_CVAR(machinegun, sustained_refire))) {
+ if (!isPlayer || weapon_prepareattack(actor, false, WEP_CVAR(machinegun, sustained_refire))) {
if (isPlayer) {
- turret_initparams(self);
- W_SetupShot_Dir(self, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
- self.tur_shotdir_updated = w_shotdir;
- self.tur_shotorg = w_shotorg;
- self.tur_head = self;
- self.shot_radius = 500;
- weapon_thinkf(WFRAME_FIRE1, 0, w_ready);
+ turret_initparams(actor);
+ W_SetupShot_Dir(actor, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
+ actor.tur_shotdir_updated = w_shotdir;
+ actor.tur_shotorg = w_shotorg;
+ actor.tur_head = actor;
+ actor.shot_radius = 500;
+ weapon_thinkf(actor, WFRAME_FIRE1, 0, w_ready);
}
turret_tag_fire_update();
entity missile = turret_projectile(SND(ROCKET_FIRE), 6, 10, DEATH_TURRET_MLRS, PROJECTILE_ROCKET, TRUE, TRUE);
- missile.nextthink = time + max(self.tur_impacttime,(self.shot_radius * 2) / self.shot_speed);
+ missile.nextthink = time + max(actor.tur_impacttime,(actor.shot_radius * 2) / actor.shot_speed);
missile.missile_flags = MIF_SPLASH;
te_explosion (missile.origin);
}
.int fireflag;
-METHOD(PhaserTurretAttack, wr_think, void(entity thiswep, bool fire1, bool fire2))
+METHOD(PhaserTurretAttack, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
{
- SELFPARAM();
- bool isPlayer = IS_PLAYER(self);
+ bool isPlayer = IS_PLAYER(actor);
if (fire1)
- if (!isPlayer || weapon_prepareattack(false, WEP_CVAR_PRI(electro, refire))) {
+ if (!isPlayer || weapon_prepareattack(actor, false, WEP_CVAR_PRI(electro, refire))) {
if (isPlayer) {
- turret_initparams(self);
- W_SetupShot_Dir(self, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
- self.tur_shotdir_updated = w_shotdir;
- self.tur_shotorg = w_shotorg;
- self.tur_head = self;
- self.shot_speed = 1;
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
+ turret_initparams(actor);
+ W_SetupShot_Dir(actor, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
+ actor.tur_shotdir_updated = w_shotdir;
+ actor.tur_shotorg = w_shotorg;
+ actor.tur_head = actor;
+ actor.shot_speed = 1;
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
}
entity beam = spawn();
beam.ticrate = 0.1; //autocvar_sys_ticrate;
beam.effects = EF_LOWPRECISION;
beam.solid = SOLID_NOT;
beam.think = beam_think;
- beam.cnt = time + self.shot_speed;
+ beam.cnt = time + actor.shot_speed;
beam.shot_spread = time + 2;
beam.nextthink = time;
- beam.owner = self;
- beam.shot_dmg = self.shot_dmg / (self.shot_speed / beam.ticrate);
- beam.scale = self.target_range / 256;
+ beam.owner = actor;
+ beam.shot_dmg = actor.shot_dmg / (actor.shot_speed / beam.ticrate);
+ beam.scale = actor.target_range / 256;
beam.movetype = MOVETYPE_NONE;
- beam.enemy = self.enemy;
+ beam.enemy = actor.enemy;
beam.bot_dodge = true;
beam.bot_dodgerating = beam.shot_dmg;
sound (beam, CH_SHOTS_SINGLE, SND_TUR_PHASER, VOL_BASE, ATTEN_NORM);
- self.fireflag = 1;
+ actor.fireflag = 1;
- beam.attack_finished_single = self.attack_finished_single;
- self.attack_finished_single = time; // + autocvar_sys_ticrate;
+ beam.attack_finished_single = actor.attack_finished_single;
+ actor.attack_finished_single = time; // + autocvar_sys_ticrate;
- setattachment(beam,self.tur_head, "tag_fire");
+ setattachment(beam,actor.tur_head, "tag_fire");
- soundat (self, trace_endpos, CH_SHOTS, SND(NEXIMPACT), VOL_BASE, ATTEN_NORM);
+ soundat (actor, trace_endpos, CH_SHOTS, SND(NEXIMPACT), VOL_BASE, ATTEN_NORM);
if (!isPlayer)
- if (self.tur_head.frame == 0)
- self.tur_head.frame = 1;
+ if (actor.tur_head.frame == 0)
+ actor.tur_head.frame = 1;
}
}
#ifdef SVQC
-METHOD(PlasmaAttack, wr_think, void(entity thiswep, bool fire1, bool fire2)) {
- SELFPARAM();
- bool isPlayer = IS_PLAYER(self);
+METHOD(PlasmaAttack, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2)) {
+ bool isPlayer = IS_PLAYER(actor);
if (fire1)
- if (!isPlayer || weapon_prepareattack(false, WEP_CVAR_PRI(electro, refire))) {
+ if (!isPlayer || weapon_prepareattack(actor, false, WEP_CVAR_PRI(electro, refire))) {
if (isPlayer) {
- turret_initparams(self);
- W_SetupShot_Dir(self, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
- self.tur_shotdir_updated = w_shotdir;
- self.tur_shotorg = w_shotorg;
- self.tur_head = self;
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
+ turret_initparams(actor);
+ W_SetupShot_Dir(actor, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
+ actor.tur_shotdir_updated = w_shotdir;
+ actor.tur_shotorg = w_shotorg;
+ actor.tur_head = actor;
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
}
entity missile = turret_projectile(SND(HAGAR_FIRE), 1, 0, DEATH_TURRET_PLASMA, PROJECTILE_ELECTRO_BEAM, true, true);
missile.missile_flags = MIF_SPLASH;
- Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, self.tur_shotorg, self.tur_shotdir_updated * 1000, 1);
+ Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, actor.tur_shotorg, actor.tur_shotdir_updated * 1000, 1);
}
}
#ifdef SVQC
entity toast(entity from, float range, float damage);
-METHOD(TeslaCoilTurretAttack, wr_think, void(entity thiswep, bool fire1, bool fire2)) {
- SELFPARAM();
- bool isPlayer = IS_PLAYER(self);
+METHOD(TeslaCoilTurretAttack, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2)) {
+ bool isPlayer = IS_PLAYER(actor);
if (fire1)
- if (!isPlayer || weapon_prepareattack(false, WEP_CVAR_PRI(electro, refire))) {
+ if (!isPlayer || weapon_prepareattack(actor, false, WEP_CVAR_PRI(electro, refire))) {
if (isPlayer) {
- turret_initparams(self);
- W_SetupShot_Dir(self, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
- self.tur_shotdir_updated = w_shotdir;
- self.tur_shotorg = w_shotorg;
- self.tur_head = self;
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
+ turret_initparams(actor);
+ W_SetupShot_Dir(actor, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
+ actor.tur_shotdir_updated = w_shotdir;
+ actor.tur_shotorg = w_shotorg;
+ actor.tur_head = actor;
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
}
- float d = self.shot_dmg;
- float r = self.target_range;
+ float d = actor.shot_dmg;
+ float r = actor.target_range;
entity e = spawn();
- setorigin(e,self.tur_shotorg);
+ setorigin(e,actor.tur_shotorg);
- self.target_validate_flags = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_MISSILES | TFL_TARGETSELECT_RANGELIMITS | TFL_TARGETSELECT_TEAMCHECK;
+ actor.target_validate_flags = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_MISSILES | TFL_TARGETSELECT_RANGELIMITS | TFL_TARGETSELECT_TEAMCHECK;
entity t = toast(e,r,d);
remove(e);
if (t == NULL) return;
- self.target_validate_flags = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_MISSILES | TFL_TARGETSELECT_TEAMCHECK;
+ actor.target_validate_flags = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_MISSILES | TFL_TARGETSELECT_TEAMCHECK;
- self.attack_finished_single = time + self.shot_refire;
+ actor.attack_finished_single = time + actor.shot_refire;
for (int i = 0; i < 10; ++i) {
d *= 0.75;
r *= 0.85;
#ifdef SVQC
-METHOD(WalkerTurretAttack, wr_think, void(entity thiswep, bool fire1, bool fire2)) {
- SELFPARAM();
- bool isPlayer = IS_PLAYER(self);
+METHOD(WalkerTurretAttack, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2)) {
+ bool isPlayer = IS_PLAYER(actor);
if (fire1)
- if (!isPlayer || weapon_prepareattack(false, WEP_CVAR_PRI(electro, refire))) {
+ if (!isPlayer || weapon_prepareattack(actor, false, WEP_CVAR_PRI(electro, refire))) {
if (isPlayer) {
- turret_initparams(self);
- W_SetupShot_Dir(self, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
- self.tur_shotdir_updated = w_shotdir;
- self.tur_shotorg = w_shotorg;
- self.tur_head = self;
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
+ turret_initparams(actor);
+ W_SetupShot_Dir(actor, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
+ actor.tur_shotdir_updated = w_shotdir;
+ actor.tur_shotorg = w_shotorg;
+ actor.tur_head = actor;
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
}
- sound (self, CH_WEAPON_A, SND_UZI_FIRE, VOL_BASE, ATTEN_NORM);
- fireBullet (self.tur_shotorg, self.tur_shotdir_updated, self.shot_spread, 0, self.shot_dmg, self.shot_force, DEATH_TURRET_WALK_GUN, 0);
- Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, self.tur_shotorg, self.tur_shotdir_updated * 1000, 1);
+ sound (actor, CH_WEAPON_A, SND_UZI_FIRE, VOL_BASE, ATTEN_NORM);
+ fireBullet (actor.tur_shotorg, actor.tur_shotdir_updated, actor.shot_spread, 0, actor.shot_dmg, actor.shot_force, DEATH_TURRET_WALK_GUN, 0);
+ Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, actor.tur_shotorg, actor.tur_shotdir_updated * 1000, 1);
}
}
// Fix z-aim (for chase mode)
crosshair_trace(player);
w_shotdir.z = normalize(trace_endpos - org).z * 0.5;
- wep1.wr_think(wep1, true, false);
+ wep1.wr_think(wep1, self, true, false);
}
if(autocvar_g_vehicle_racer_rocket_locktarget)
float autocvar_g_vehicle_racer_rocket_locked_maxangle;
void racer_fire_rocket(vector org, vector dir, entity trg);
-METHOD(RacerAttack, wr_think, void(entity thiswep, bool fire1, bool fire2))
+METHOD(RacerAttack, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
{
- SELFPARAM();
- bool isPlayer = IS_PLAYER(self);
- entity player = isPlayer ? self : self.owner;
+ bool isPlayer = IS_PLAYER(actor);
+ entity player = isPlayer ? actor : actor.owner;
entity veh = player.vehicle;
- setself(player);
if (fire1)
- if (weapon_prepareattack(false, autocvar_g_vehicle_racer_cannon_refire)) {
+ if (weapon_prepareattack(player, false, autocvar_g_vehicle_racer_cannon_refire)) {
if (veh) {
veh.vehicle_energy -= autocvar_g_vehicle_racer_cannon_cost;
veh.wait = time;
autocvar_g_vehicle_racer_cannon_damage, autocvar_g_vehicle_racer_cannon_radius, autocvar_g_vehicle_racer_cannon_force, 0,
DEATH_VH_WAKI_GUN, PROJECTILE_WAKICANNON, 0, true, true, player);
bolt.velocity = normalize(dir) * autocvar_g_vehicle_racer_cannon_speed;
- weapon_thinkf(WFRAME_FIRE1, 0, w_ready);
+ weapon_thinkf(player, WFRAME_FIRE1, 0, w_ready);
}
if (fire2)
- if (!isPlayer || weapon_prepareattack(false, 0.2)) {
- if (isPlayer) W_SetupShot_Dir(self, v_forward, false, 0, SND(Null), CH_WEAPON_B, 0);
+ if (!isPlayer || weapon_prepareattack(actor, false, 0.2)) {
+ if (isPlayer) W_SetupShot_Dir(actor, v_forward, false, 0, SND(Null), CH_WEAPON_B, 0);
racer_fire_rocket(w_shotorg, w_shotdir, NULL);
- weapon_thinkf(WFRAME_FIRE2, 0, w_ready);
+ weapon_thinkf(actor, WFRAME_FIRE2, 0, w_ready);
}
- setself(this);
}
METHOD(RacerAttack, wr_checkammo1, bool(RacerAttack thiswep))
if(player.BUTTON_ATCK)
if (wep1.wr_checkammo1(wep1))
{
- wep1.wr_think(wep1, true, false);
+ wep1.wr_think(wep1, self, true, false);
}
if(self.vehicle_flags & VHF_SHIELDREGEN)
if(time > raptor.lip + autocvar_g_vehicle_raptor_bombs_refire)
if(player.BUTTON_ATCK2)
{
- wep2a.wr_think(wep2a, false, true);
+ wep2a.wr_think(wep2a, self, false, true);
raptor.delay = time + autocvar_g_vehicle_raptor_bombs_refire;
raptor.lip = time;
}
if(time > raptor.lip + autocvar_g_vehicle_raptor_flare_refire)
if(player.BUTTON_ATCK2)
{
- wep2b.wr_think(wep2b, false, true);
+ wep2b.wr_think(wep2b, self, false, true);
raptor.delay = time + autocvar_g_vehicle_raptor_flare_refire;
raptor.lip = time;
}
float autocvar_g_vehicle_raptor_bomblet_force;
float autocvar_g_vehicle_raptor_bomblet_explode_delay;
-METHOD(RaptorCannon, wr_think, void(entity thiswep, bool fire1, bool fire2)) {
- SELFPARAM();
- bool isPlayer = IS_PLAYER(self);
- entity player = isPlayer ? self : self.owner;
+METHOD(RaptorCannon, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2)) {
+ bool isPlayer = IS_PLAYER(actor);
+ entity player = isPlayer ? actor : actor.owner;
entity veh = player.vehicle;
- setself(player);
// 1 [wait] 1 [wait] 2 [wait] 2 [wait] [wait]
float t = autocvar_g_vehicle_raptor_cannon_refire * (1 + veh.misc_bulletcounter == 4);
if (fire1)
- if (weapon_prepareattack(false, t)) {
+ if (weapon_prepareattack(player, false, t)) {
if (isPlayer) W_SetupShot_Dir(player, v_forward, false, 0, SND(Null), CH_WEAPON_B, 0);
vector org = w_shotorg;
vector dir = w_shotdir;
: (((veh.misc_bulletcounter == 4) ? veh.misc_bulletcounter = 0 : 0), gettaginfo(veh.gun2, gettagindex(veh.gun2, "fire1")));
dir = v_forward;
veh.vehicle_energy -= autocvar_g_vehicle_raptor_cannon_cost;
- self.cnt = time;
+ actor.cnt = time;
}
vehicles_projectile(EFFECT_RAPTOR_MUZZLEFLASH.eent_eff_name, SND(LASERGUN_FIRE),
org, normalize(dir + randomvec() * autocvar_g_vehicle_raptor_cannon_spread) * autocvar_g_vehicle_raptor_cannon_speed,
autocvar_g_vehicle_raptor_cannon_damage, autocvar_g_vehicle_raptor_cannon_radius, autocvar_g_vehicle_raptor_cannon_force, 0,
DEATH_VH_RAPT_CANNON, PROJECTILE_RAPTORCANNON, 0, true, true, veh ? veh : player);
- weapon_thinkf(WFRAME_FIRE1, 0, w_ready);
+ weapon_thinkf(player, WFRAME_FIRE1, 0, w_ready);
}
- setself(this);
}
METHOD(RaptorCannon, wr_checkammo1, bool(RacerAttack thiswep)) {
SELFPARAM();
float autocvar_g_vehicle_raptor_bombs_refire;
void raptor_bombdrop();
-METHOD(RaptorBomb, wr_think, void(entity thiswep, bool fire1, bool fire2)) {
- SELFPARAM();
- bool isPlayer = IS_PLAYER(self);
- entity player = isPlayer ? self : self.owner;
+METHOD(RaptorBomb, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2)) {
+ bool isPlayer = IS_PLAYER(actor);
+ entity player = isPlayer ? actor : actor.owner;
entity veh = player.vehicle;
- setself(player);
if (fire2)
- if (weapon_prepareattack(false, autocvar_g_vehicle_raptor_bombs_refire)) {
+ if (!isPlayer || weapon_prepareattack(player, true, autocvar_g_vehicle_raptor_bombs_refire)) {
if (veh) setself(veh);
raptor_bombdrop();
- weapon_thinkf(WFRAME_FIRE1, 0, w_ready);
+ weapon_thinkf(player, WFRAME_FIRE2, 0, w_ready);
}
- setself(this);
}
float autocvar_g_vehicle_raptor_flare_refire;
void raptor_flare_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force);
void raptor_flare_touch();
-METHOD(RaptorFlare, wr_think, void(entity thiswep, bool fire1, bool fire2)) {
- SELFPARAM();
- bool isPlayer = IS_PLAYER(self);
- entity player = isPlayer ? self : self.owner;
+METHOD(RaptorFlare, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2)) {
+ bool isPlayer = IS_PLAYER(actor);
+ entity player = isPlayer ? actor : actor.owner;
entity veh = player.vehicle;
- setself(player);
if (fire2)
- if (weapon_prepareattack(true, autocvar_g_vehicle_raptor_flare_refire)) {
+ if (!isPlayer || weapon_prepareattack(player, true, autocvar_g_vehicle_raptor_flare_refire)) {
for(int i = 0; i < 3; ++i) {
entity _flare = spawn();
setmodel(_flare, MDL_VEH_RAPTOR_FLARE);
_flare.effects = EF_LOWPRECISION | EF_FLAME;
_flare.scale = 0.5;
- setorigin(_flare, self.origin - '0 0 16');
+ setorigin(_flare, actor.origin - '0 0 16');
_flare.movetype = MOVETYPE_TOSS;
_flare.gravity = 0.15;
- _flare.velocity = 0.25 * self.velocity + (v_forward + randomvec() * 0.25)* -500;
+ _flare.velocity = 0.25 * actor.velocity + (v_forward + randomvec() * 0.25)* -500;
_flare.think = raptor_flare_think;
_flare.nextthink = time;
_flare.owner = veh ? veh : player;
_flare.tur_impacttime = time + autocvar_g_vehicle_raptor_flare_lifetime;
_flare.touch = raptor_flare_touch;
}
- weapon_thinkf(WFRAME_FIRE2, 0, w_ready);
+ weapon_thinkf(player, WFRAME_FIRE2, 0, w_ready);
}
- setself(this);
}
/** (SERVER) setup weapon data */
METHOD(Weapon, wr_setup, void(Weapon this)) {}
/** (SERVER) logic to run every frame */
- METHOD(Weapon, wr_think, void(Weapon this, bool fire1, bool fire2)) {}
+ METHOD(Weapon, wr_think, void(Weapon this, entity actor, bool fire1, bool fire2)) {}
/** (SERVER) checks ammo for weapon primary */
METHOD(Weapon, wr_checkammo1, bool(Weapon this)) {return false;}
/** (SERVER) checks ammo for weapon second */
);
}
}
- METHOD(Arc, wr_think, void(entity thiswep, bool fire1, bool fire2))
+ METHOD(Arc, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
{
- SELFPARAM();
- Arc_Player_SetHeat(self);
+ Arc_Player_SetHeat(actor);
Arc_Smoke();
- if (time >= self.arc_overheat)
- if (fire1 || fire2 || self.arc_beam.beam_bursting)
+ if (time >= actor.arc_overheat)
+ if (fire1 || fire2 || actor.arc_beam.beam_bursting)
{
- if(self.arc_BUTTON_ATCK_prev)
+ if(actor.arc_BUTTON_ATCK_prev)
{
#if 0
- if(self.animstate_startframe == self.anim_shoot.x && self.animstate_numframes == self.anim_shoot.y)
- weapon_thinkf(WFRAME_DONTCHANGE, autocvar_g_balance_arc_primary_animtime, w_ready);
+ if(actor.animstate_startframe == actor.anim_shoot.x && actor.animstate_numframes == actor.anim_shoot.y)
+ weapon_thinkf(actor, WFRAME_DONTCHANGE, autocvar_g_balance_arc_primary_animtime, w_ready);
else
#endif
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
}
- if((!self.arc_beam) || wasfreed(self.arc_beam))
+ if((!actor.arc_beam) || wasfreed(actor.arc_beam))
{
- if(weapon_prepareattack(fire2, 0))
+ if(weapon_prepareattack(actor, fire2, 0))
{
W_Arc_Beam(fire2);
- if(!self.arc_BUTTON_ATCK_prev)
+ if(!actor.arc_BUTTON_ATCK_prev)
{
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
- self.arc_BUTTON_ATCK_prev = true;
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
+ actor.arc_BUTTON_ATCK_prev = true;
}
}
}
return;
}
- if(self.arc_BUTTON_ATCK_prev)
+ if(actor.arc_BUTTON_ATCK_prev)
{
- sound(self, CH_WEAPON_A, SND_ARC_STOP, VOL_BASE, ATTN_NORM);
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
- ATTACK_FINISHED(self) = time + WEP_CVAR(arc, beam_refire) * W_WeaponRateFactor();
+ sound(actor, CH_WEAPON_A, SND_ARC_STOP, VOL_BASE, ATTN_NORM);
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
+ ATTACK_FINISHED(actor) = time + WEP_CVAR(arc, beam_refire) * W_WeaponRateFactor();
}
- self.arc_BUTTON_ATCK_prev = false;
+ actor.arc_BUTTON_ATCK_prev = false;
#if 0
if(fire2)
- if(weapon_prepareattack(true, autocvar_g_balance_arc_secondary_refire))
+ if(weapon_prepareattack(actor, true, autocvar_g_balance_arc_secondary_refire))
{
W_Arc_Attack2();
- self.arc_count = autocvar_g_balance_arc_secondary_count;
- weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_arc_secondary_animtime, w_arc_checkattack);
- self.arc_secondarytime = time + autocvar_g_balance_arc_secondary_refire2 * W_WeaponRateFactor();
+ actor.arc_count = autocvar_g_balance_arc_secondary_count;
+ weapon_thinkf(actor, WFRAME_FIRE2, autocvar_g_balance_arc_secondary_animtime, w_arc_checkattack);
+ actor.arc_secondarytime = time + autocvar_g_balance_arc_secondary_refire2 * W_WeaponRateFactor();
}
#endif
}
}
void W_Blaster_Attack(
+ entity actor,
float atk_deathtype,
float atk_shotangle,
float atk_damage,
{SELFPARAM();
vector s_forward = v_forward * cos(atk_shotangle * DEG2RAD) + v_up * sin(atk_shotangle * DEG2RAD);
- W_SetupShot_Dir(self, s_forward, false, 3, SND(LASERGUN_FIRE), CH_WEAPON_B, atk_damage);
+ W_SetupShot_Dir(actor, s_forward, false, 3, SND(LASERGUN_FIRE), CH_WEAPON_B, atk_damage);
Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
entity missile = spawn();
- missile.owner = missile.realowner = self;
+ missile.owner = missile.realowner = actor;
missile.classname = "blasterbolt";
missile.bot_dodge = true;
missile.bot_dodgerating = atk_damage;
missile.think = W_Blaster_Think;
missile.nextthink = time + atk_delay;
- MUTATOR_CALLHOOK(EditProjectile, self, missile);
+ MUTATOR_CALLHOOK(EditProjectile, actor, missile);
- if(time >= missile.nextthink)
+ if (time >= missile.nextthink)
{
WITH(entity, self, missile, missile.think());
}
{ self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), false); }
}
- METHOD(Blaster, wr_think, void(entity thiswep, bool fire1, bool fire2))
+ METHOD(Blaster, wr_think, void(Blaster thiswep, entity actor, bool fire1, bool fire2))
{
if(fire1)
{
- if(weapon_prepareattack(false, WEP_CVAR_PRI(blaster, refire)))
+ if(weapon_prepareattack(actor, 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, delay),
WEP_CVAR_PRI(blaster, lifetime)
);
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(blaster, animtime), w_ready);
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(blaster, animtime), w_ready);
}
}
else if(fire2)
{
case 0: // switch to last used weapon
{
- if(self.switchweapon == WEP_BLASTER.m_id) // don't do this if already switching
+ if(actor.switchweapon == WEP_BLASTER.m_id) // don't do this if already switching
W_LastWeapon();
break;
}
case 1: // normal projectile secondary
{
- if(weapon_prepareattack(true, WEP_CVAR_SEC(blaster, refire)))
+ if(weapon_prepareattack(actor, 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, delay),
WEP_CVAR_SEC(blaster, lifetime)
);
- weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(blaster, animtime), w_ready);
+ weapon_thinkf(actor, WFRAME_FIRE2, WEP_CVAR_SEC(blaster, animtime), w_ready);
}
break;
vector forward, right, up;
float maxdmg;
- W_DecreaseAmmo(thiswep, WEP_CVAR_PRI(crylink, ammo));
+ W_DecreaseAmmo(thiswep, self, WEP_CVAR_PRI(crylink, ammo));
maxdmg = WEP_CVAR_PRI(crylink, damage) * WEP_CVAR_PRI(crylink, shots);
maxdmg *= 1 + WEP_CVAR_PRI(crylink, bouncedamagefactor) * WEP_CVAR_PRI(crylink, bounces);
vector forward, right, up;
float maxdmg;
- W_DecreaseAmmo(thiswep, WEP_CVAR_SEC(crylink, ammo));
+ W_DecreaseAmmo(thiswep, self, WEP_CVAR_SEC(crylink, ammo));
maxdmg = WEP_CVAR_SEC(crylink, damage) * WEP_CVAR_SEC(crylink, shots);
maxdmg *= 1 + WEP_CVAR_SEC(crylink, bouncedamagefactor) * WEP_CVAR_SEC(crylink, bounces);
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, bool fire1, bool fire2))
+ METHOD(Crylink, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
{
- SELFPARAM();
- if(autocvar_g_balance_crylink_reload_ammo && self.clip_load < min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo))) { // forced reload
- Weapon w = get_weaponinfo(self.weapon);
+ if(autocvar_g_balance_crylink_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo))) { // forced reload
+ Weapon w = get_weaponinfo(actor.weapon);
w.wr_reload(w);
}
if(fire1)
{
- if(self.crylink_waitrelease != 1)
- if(weapon_prepareattack(false, WEP_CVAR_PRI(crylink, refire)))
+ if(actor.crylink_waitrelease != 1)
+ if(weapon_prepareattack(actor, false, WEP_CVAR_PRI(crylink, refire)))
{
W_Crylink_Attack(thiswep);
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(crylink, animtime), w_ready);
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(crylink, animtime), w_ready);
}
}
if(fire2 && autocvar_g_balance_crylink_secondary)
{
- if(self.crylink_waitrelease != 2)
- if(weapon_prepareattack(true, WEP_CVAR_SEC(crylink, refire)))
+ if(actor.crylink_waitrelease != 2)
+ if(weapon_prepareattack(actor, true, WEP_CVAR_SEC(crylink, refire)))
{
W_Crylink_Attack2(thiswep);
- weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(crylink, animtime), w_ready);
+ weapon_thinkf(actor, WFRAME_FIRE2, WEP_CVAR_SEC(crylink, animtime), w_ready);
}
}
- if((self.crylink_waitrelease == 1 && !fire1) || (self.crylink_waitrelease == 2 && !fire2))
+ if((actor.crylink_waitrelease == 1 && !fire1) || (actor.crylink_waitrelease == 2 && !fire2))
{
- if(!self.crylink_lastgroup || time > self.crylink_lastgroup.teleport_time)
+ if(!actor.crylink_lastgroup || time > actor.crylink_lastgroup.teleport_time)
{
// fired and released now!
- if(self.crylink_lastgroup)
+ if(actor.crylink_lastgroup)
{
vector pos;
entity linkjoineffect;
- float isprimary = (self.crylink_waitrelease == 1);
+ float isprimary = (actor.crylink_waitrelease == 1);
- pos = W_Crylink_LinkJoin(self.crylink_lastgroup, WEP_CVAR_BOTH(crylink, isprimary, joinspread) * WEP_CVAR_BOTH(crylink, isprimary, speed));
+ pos = W_Crylink_LinkJoin(actor.crylink_lastgroup, WEP_CVAR_BOTH(crylink, isprimary, joinspread) * WEP_CVAR_BOTH(crylink, isprimary, speed));
linkjoineffect = spawn();
linkjoineffect.think = W_Crylink_LinkJoinEffect_Think;
linkjoineffect.classname = "linkjoineffect";
linkjoineffect.nextthink = time + w_crylink_linkjoin_time;
- linkjoineffect.owner = self;
+ linkjoineffect.owner = actor;
setorigin(linkjoineffect, pos);
}
- self.crylink_waitrelease = 0;
+ actor.crylink_waitrelease = 0;
if(!thiswep.wr_checkammo1(thiswep) && !thiswep.wr_checkammo2(thiswep))
- if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
+ if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
{
// ran out of ammo!
- self.cnt = WEP_CRYLINK.m_id;
- self.switchweapon = w_getbestweapon(self);
+ actor.cnt = WEP_CRYLINK.m_id;
+ actor.switchweapon = w_getbestweapon(actor);
}
}
}
}
METHOD(Crylink, wr_reload, void(entity thiswep))
{
- W_Reload(min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo)), SND(RELOAD));
+ W_Reload(self, min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo)), SND(RELOAD));
}
METHOD(Crylink, wr_suicidemessage, int(entity thiswep))
{
entity missile;
entity flash;
- W_DecreaseAmmo(thiswep, WEP_CVAR(devastator, ammo));
+ W_DecreaseAmmo(thiswep, self, WEP_CVAR(devastator, ammo));
W_SetupShot_ProjectileSize(self, '-3 -3 -3', '3 3 3', false, 5, SND(ROCKET_FIRE), CH_WEAPON_A, WEP_CVAR(devastator, damage));
Send_Effect(EFFECT_ROCKET_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
setmodel(flash, MDL_DEVASTATOR_MUZZLEFLASH); // precision set below
SUB_SetFade(flash, time, 0.1);
flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
- W_AttachToShotorg(flash, '5 0 0');
+ W_AttachToShotorg(self, flash, '5 0 0');
// common properties
MUTATOR_CALLHOOK(EditProjectile, self, missile);
}
}
#endif
- METHOD(Devastator, wr_think, void(entity thiswep, bool fire1, bool fire2))
+ METHOD(Devastator, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
{
- if(WEP_CVAR(devastator, reload_ammo) && self.clip_load < WEP_CVAR(devastator, ammo)) { // forced reload
- Weapon w = get_weaponinfo(self.weapon);
+ if(WEP_CVAR(devastator, reload_ammo) && actor.clip_load < WEP_CVAR(devastator, ammo)) { // forced reload
+ Weapon w = get_weaponinfo(actor.weapon);
w.wr_reload(w);
- } else
- {
+ } else {
if(fire1)
{
- if(self.rl_release || WEP_CVAR(devastator, guidestop))
- if(weapon_prepareattack(false, WEP_CVAR(devastator, refire)))
+ if(actor.rl_release || WEP_CVAR(devastator, guidestop))
+ if(weapon_prepareattack(actor, false, WEP_CVAR(devastator, refire)))
{
W_Devastator_Attack(thiswep);
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(devastator, animtime), w_ready);
- self.rl_release = 0;
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR(devastator, animtime), w_ready);
+ actor.rl_release = 0;
}
}
else
- self.rl_release = 1;
+ actor.rl_release = 1;
if(fire2)
- if(self.switchweapon == WEP_DEVASTATOR.m_id)
+ if(actor.switchweapon == WEP_DEVASTATOR.m_id)
{
entity rock;
bool rockfound = false;
- for(rock = world; (rock = find(rock, classname, "rocket")); ) if(rock.realowner == self)
+ for(rock = world; (rock = find(rock, classname, "rocket")); ) if(rock.realowner == actor)
{
if(!rock.rl_detonate_later)
{
}
}
if(rockfound)
- sound(self, CH_WEAPON_B, SND_ROCKET_DET, VOL_BASE, ATTN_NORM);
+ sound(actor, CH_WEAPON_B, SND_ROCKET_DET, VOL_BASE, ATTN_NORM);
}
}
}
}
METHOD(Devastator, wr_reload, void(entity thiswep))
{
- W_Reload(WEP_CVAR(devastator, ammo), SND(RELOAD));
+ W_Reload(self, WEP_CVAR(devastator, ammo), SND(RELOAD));
}
METHOD(Devastator, wr_suicidemessage, int(entity thiswep))
{
{SELFPARAM();
entity proj;
- W_DecreaseAmmo(thiswep, WEP_CVAR_PRI(electro, ammo));
+ W_DecreaseAmmo(thiswep, self, WEP_CVAR_PRI(electro, ammo));
W_SetupShot_ProjectileSize(
self,
void W_Electro_Attack_Orb(Weapon thiswep)
{SELFPARAM();
- W_DecreaseAmmo(thiswep, WEP_CVAR_SEC(electro, ammo));
+ W_DecreaseAmmo(thiswep, self, WEP_CVAR_SEC(electro, ammo));
W_SetupShot_ProjectileSize(
self,
MUTATOR_CALLHOOK(EditProjectile, self, proj);
}
-void W_Electro_CheckAttack(Weapon thiswep, bool fire1, bool fire2)
+void W_Electro_CheckAttack(Weapon thiswep, entity actor, bool fire1, bool fire2)
{SELFPARAM();
if(self.electro_count > 1)
if(self.BUTTON_ATCK2)
- if(weapon_prepareattack(true, -1))
+ if(weapon_prepareattack(actor, true, -1))
{
W_Electro_Attack_Orb(WEP_ELECTRO);
self.electro_count -= 1;
- weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(electro, animtime), W_Electro_CheckAttack);
+ weapon_thinkf(actor, WFRAME_FIRE2, WEP_CVAR_SEC(electro, animtime), W_Electro_CheckAttack);
return;
}
// WEAPONTODO: when the player releases the button, cut down the length of refire2?
- w_ready(thiswep, fire1, fire2);
+ w_ready(thiswep, actor, fire1, fire2);
}
.float bot_secondary_electromooth;
}
}
}
- METHOD(Electro, wr_think, void(entity thiswep, bool fire1, bool fire2))
+ METHOD(Electro, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
{
if(autocvar_g_balance_electro_reload_ammo) // forced reload // WEAPONTODO
{
float ammo_amount = 0;
- if(self.clip_load >= WEP_CVAR_PRI(electro, ammo))
+ if(actor.clip_load >= WEP_CVAR_PRI(electro, ammo))
ammo_amount = 1;
- if(self.clip_load >= WEP_CVAR_SEC(electro, ammo))
+ if(actor.clip_load >= WEP_CVAR_SEC(electro, ammo))
ammo_amount += 1;
if(!ammo_amount)
{
- Weapon w = get_weaponinfo(self.weapon);
+ Weapon w = get_weaponinfo(actor.weapon);
w.wr_reload(w);
return;
}
if(fire1)
{
- if(weapon_prepareattack(false, WEP_CVAR_PRI(electro, refire)))
+ if(weapon_prepareattack(actor, false, WEP_CVAR_PRI(electro, refire)))
{
W_Electro_Attack_Bolt(thiswep);
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
}
}
else if(fire2)
{
- if(time >= self.electro_secondarytime)
- if(weapon_prepareattack(true, WEP_CVAR_SEC(electro, refire)))
+ if(time >= actor.electro_secondarytime)
+ if(weapon_prepareattack(actor, true, WEP_CVAR_SEC(electro, refire)))
{
W_Electro_Attack_Orb(thiswep);
- self.electro_count = WEP_CVAR_SEC(electro, count);
- weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(electro, animtime), W_Electro_CheckAttack);
- self.electro_secondarytime = time + WEP_CVAR_SEC(electro, refire2) * W_WeaponRateFactor();
+ actor.electro_count = WEP_CVAR_SEC(electro, count);
+ weapon_thinkf(actor, WFRAME_FIRE2, WEP_CVAR_SEC(electro, animtime), W_Electro_CheckAttack);
+ actor.electro_secondarytime = time + WEP_CVAR_SEC(electro, refire2) * W_WeaponRateFactor();
}
}
}
}
METHOD(Electro, wr_reload, void(entity thiswep))
{
- W_Reload(min(WEP_CVAR_PRI(electro, ammo), WEP_CVAR_SEC(electro, ammo)), SND(RELOAD));
+ W_Reload(self, min(WEP_CVAR_PRI(electro, ammo), WEP_CVAR_SEC(electro, ammo)), SND(RELOAD));
}
METHOD(Electro, wr_suicidemessage, int(entity thiswep))
{
Send_Effect(EFFECT_FIREBALL_PRE_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
}
-void W_Fireball_Attack1_Frame4(Weapon thiswep, bool fire1, bool fire2)
+void W_Fireball_Attack1_Frame4(Weapon thiswep, entity actor, bool fire1, bool fire2)
{
W_Fireball_Attack1();
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(fireball, animtime), w_ready);
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(fireball, animtime), w_ready);
}
-void W_Fireball_Attack1_Frame3(Weapon thiswep, bool fire1, bool fire2)
+void W_Fireball_Attack1_Frame3(Weapon thiswep, entity actor, bool fire1, bool fire2)
{
W_Fireball_AttackEffect(0, '+1.25 +3.75 0');
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(fireball, animtime), W_Fireball_Attack1_Frame4);
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(fireball, animtime), W_Fireball_Attack1_Frame4);
}
-void W_Fireball_Attack1_Frame2(Weapon thiswep, bool fire1, bool fire2)
+void W_Fireball_Attack1_Frame2(Weapon thiswep, entity actor, bool fire1, bool fire2)
{
W_Fireball_AttackEffect(0, '-1.25 +3.75 0');
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(fireball, animtime), W_Fireball_Attack1_Frame3);
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(fireball, animtime), W_Fireball_Attack1_Frame3);
}
-void W_Fireball_Attack1_Frame1(Weapon thiswep, bool fire1, bool fire2)
+void W_Fireball_Attack1_Frame1(Weapon thiswep, entity actor, bool fire1, bool fire2)
{
W_Fireball_AttackEffect(1, '+1.25 -3.75 0');
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(fireball, animtime), W_Fireball_Attack1_Frame2);
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(fireball, animtime), W_Fireball_Attack1_Frame2);
}
-void W_Fireball_Attack1_Frame0(Weapon thiswep, bool fire1, bool fire2)
+void W_Fireball_Attack1_Frame0(Weapon thiswep, entity actor, bool fire1, bool fire2)
{SELFPARAM();
W_Fireball_AttackEffect(0, '-1.25 -3.75 0');
sound(self, CH_WEAPON_SINGLE, SND_FIREBALL_PREFIRE2, VOL_BASE, ATTEN_NORM);
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(fireball, animtime), W_Fireball_Attack1_Frame1);
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(fireball, animtime), W_Fireball_Attack1_Frame1);
}
void W_Fireball_Firemine_Think(void)
}
}
}
- METHOD(Fireball, wr_think, void(entity thiswep, bool fire1, bool fire2))
+ METHOD(Fireball, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
{
if(fire1)
{
- if(time >= self.fireball_primarytime)
- if(weapon_prepareattack(false, WEP_CVAR_PRI(fireball, refire)))
+ if(time >= actor.fireball_primarytime)
+ if(weapon_prepareattack(actor, false, WEP_CVAR_PRI(fireball, refire)))
{
- W_Fireball_Attack1_Frame0(thiswep, fire1, fire2);
- self.fireball_primarytime = time + WEP_CVAR_PRI(fireball, refire2) * W_WeaponRateFactor();
+ W_Fireball_Attack1_Frame0(thiswep, actor, fire1, fire2);
+ actor.fireball_primarytime = time + WEP_CVAR_PRI(fireball, refire2) * W_WeaponRateFactor();
}
}
else if(fire2)
{
- if(weapon_prepareattack(true, WEP_CVAR_SEC(fireball, refire)))
+ if(weapon_prepareattack(actor, true, WEP_CVAR_SEC(fireball, refire)))
{
W_Fireball_Attack2();
- weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(fireball, animtime), w_ready);
+ weapon_thinkf(actor, WFRAME_FIRE2, WEP_CVAR_SEC(fireball, animtime), w_ready);
}
}
}
{SELFPARAM();
entity missile;
- W_DecreaseAmmo(thiswep, WEP_CVAR_PRI(hagar, ammo));
+ W_DecreaseAmmo(thiswep, self, WEP_CVAR_PRI(hagar, ammo));
W_SetupShot(self, false, 2, SND(HAGAR_FIRE), CH_WEAPON_A, WEP_CVAR_PRI(hagar, damage));
{SELFPARAM();
entity missile;
- W_DecreaseAmmo(thiswep, WEP_CVAR_SEC(hagar, ammo));
+ W_DecreaseAmmo(thiswep, self, WEP_CVAR_SEC(hagar, ammo));
W_SetupShot(self, false, 2, SND(HAGAR_FIRE), CH_WEAPON_A, WEP_CVAR_SEC(hagar, damage));
if(!self.hagar_load)
return;
- weapon_prepareattack_do(true, WEP_CVAR_SEC(hagar, refire));
+ weapon_prepareattack_do(self, true, WEP_CVAR_SEC(hagar, refire));
W_SetupShot(self, false, 2, SND(HAGAR_FIRE), CH_WEAPON_A, WEP_CVAR_SEC(hagar, damage));
Send_Effect(EFFECT_HAGAR_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
MUTATOR_CALLHOOK(EditProjectile, self, missile);
}
- weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(hagar, load_animtime), w_ready);
+ weapon_thinkf(self, WFRAME_FIRE2, WEP_CVAR_SEC(hagar, load_animtime), w_ready);
self.hagar_loadstep = time + WEP_CVAR_SEC(hagar, refire) * W_WeaponRateFactor();
self.hagar_load = 0;
}
{
// if we pressed primary fire while loading, unload all rockets and abort
self.weaponentity.state = WS_READY;
- W_DecreaseAmmo(thiswep, WEP_CVAR_SEC(hagar, ammo) * self.hagar_load * -1); // give back ammo
+ W_DecreaseAmmo(thiswep, self, WEP_CVAR_SEC(hagar, ammo) * self.hagar_load * -1); // give back ammo
self.hagar_load = 0;
sound(self, CH_WEAPON_A, SND_HAGAR_BEEP, VOL_BASE, ATTN_NORM);
{
if(!self.hagar_loadblock && self.hagar_loadstep < time)
{
- W_DecreaseAmmo(thiswep, WEP_CVAR_SEC(hagar, ammo));
+ W_DecreaseAmmo(thiswep, self, WEP_CVAR_SEC(hagar, ammo));
self.weaponentity.state = WS_INUSE;
self.hagar_load += 1;
sound(self, CH_WEAPON_B, SND_HAGAR_LOAD, VOL_BASE * 0.8, ATTN_NORM); // sound is too loud according to most
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, bool fire1, bool fire2))
+ METHOD(Hagar, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
{
float loadable_secondary;
loadable_secondary = (WEP_CVAR_SEC(hagar, load) && WEP_CVAR(hagar, secondary));
if(loadable_secondary)
W_Hagar_Attack2_Load(thiswep); // must always run each frame
- if(autocvar_g_balance_hagar_reload_ammo && self.clip_load < min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo))) { // forced reload
- Weapon w = get_weaponinfo(self.weapon);
+ if(autocvar_g_balance_hagar_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo))) { // forced reload
+ Weapon w = get_weaponinfo(actor.weapon);
w.wr_reload(w);
- } else if(fire1 && !self.hagar_load && !self.hagar_loadblock) // not while secondary is loaded or awaiting reset
+ } else if(fire1 && !actor.hagar_load && !actor.hagar_loadblock) // not while secondary is loaded or awaiting reset
{
- if(weapon_prepareattack(false, WEP_CVAR_PRI(hagar, refire)))
+ if(weapon_prepareattack(actor, false, WEP_CVAR_PRI(hagar, refire)))
{
W_Hagar_Attack(thiswep);
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(hagar, refire), w_ready);
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(hagar, refire), w_ready);
}
}
else if(fire2 && !loadable_secondary && WEP_CVAR(hagar, secondary))
{
- if(weapon_prepareattack(true, WEP_CVAR_SEC(hagar, refire)))
+ if(weapon_prepareattack(actor, true, WEP_CVAR_SEC(hagar, refire)))
{
W_Hagar_Attack2(thiswep);
- weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(hagar, refire), w_ready);
+ weapon_thinkf(actor, WFRAME_FIRE2, WEP_CVAR_SEC(hagar, refire), w_ready);
}
}
}
if(self.hagar_load)
{
- W_DecreaseAmmo(thiswep, WEP_CVAR_SEC(hagar, ammo) * self.hagar_load * -1); // give back ammo if necessary
+ 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_reload, void(entity thiswep))
{
if(!self.hagar_load) // require releasing loaded rockets first
- W_Reload(min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo)), SND(RELOAD));
+ W_Reload(self, min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo)), SND(RELOAD));
}
METHOD(Hagar, wr_suicidemessage, int(entity thiswep))
{
entity missile;
float spread;
- W_DecreaseAmmo(thiswep, WEP_CVAR_PRI(hlac, ammo));
+ W_DecreaseAmmo(thiswep, self, WEP_CVAR_PRI(hlac, ammo));
spread = WEP_CVAR_PRI(hlac, spread_min) + (WEP_CVAR_PRI(hlac, spread_add) * self.misc_bulletcounter);
spread = min(spread,WEP_CVAR_PRI(hlac, spread_max));
}
// weapon frames
-void W_HLAC_Attack_Frame(Weapon thiswep, bool fire1, bool fire2)
-{SELFPARAM();
- if(self.weapon != self.switchweapon) // abort immediately if switching
+void W_HLAC_Attack_Frame(Weapon thiswep, entity actor, bool fire1, bool fire2)
+{
+ if(actor.weapon != actor.switchweapon) // abort immediately if switching
{
- w_ready(thiswep, fire1, fire2);
+ w_ready(thiswep, actor, fire1, fire2);
return;
}
- if(self.BUTTON_ATCK)
+ if(actor.BUTTON_ATCK)
{
- Weapon w = get_weaponinfo(self.weapon);
+ Weapon w = get_weaponinfo(actor.weapon);
if(!w.wr_checkammo1(w))
- if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
+ if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
{
- W_SwitchWeapon_Force(self, w_getbestweapon(self));
- w_ready(thiswep, fire1, fire2);
+ W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
+ w_ready(thiswep, actor, fire1, fire2);
return;
}
- ATTACK_FINISHED(self) = time + WEP_CVAR_PRI(hlac, refire) * W_WeaponRateFactor();
+ ATTACK_FINISHED(actor) = time + WEP_CVAR_PRI(hlac, refire) * W_WeaponRateFactor();
W_HLAC_Attack(WEP_HLAC);
- self.misc_bulletcounter = self.misc_bulletcounter + 1;
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), W_HLAC_Attack_Frame);
+ actor.misc_bulletcounter = actor.misc_bulletcounter + 1;
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), W_HLAC_Attack_Frame);
}
else
{
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(hlac, animtime), w_ready);
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(hlac, animtime), w_ready);
}
}
{SELFPARAM();
float i;
- W_DecreaseAmmo(thiswep, WEP_CVAR_SEC(hlac, ammo));
+ W_DecreaseAmmo(thiswep, self, WEP_CVAR_SEC(hlac, ammo));
for(i=WEP_CVAR_SEC(hlac, shots);i>0;--i)
W_HLAC_Attack2();
{
self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(hlac, speed), 0, WEP_CVAR_PRI(hlac, lifetime), false);
}
- METHOD(HLAC, wr_think, void(entity thiswep, bool fire1, bool fire2))
+ METHOD(HLAC, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
{
- if(autocvar_g_balance_hlac_reload_ammo && self.clip_load < min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo))) { // forced reload
- Weapon w = get_weaponinfo(self.weapon);
+ if(autocvar_g_balance_hlac_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo))) { // forced reload
+ Weapon w = get_weaponinfo(actor.weapon);
w.wr_reload(w);
} else if(fire1)
{
- if(weapon_prepareattack(false, WEP_CVAR_PRI(hlac, refire)))
+ if(weapon_prepareattack(actor, false, WEP_CVAR_PRI(hlac, refire)))
{
- self.misc_bulletcounter = 0;
+ actor.misc_bulletcounter = 0;
W_HLAC_Attack(thiswep);
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), W_HLAC_Attack_Frame);
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), W_HLAC_Attack_Frame);
}
}
else if(fire2 && WEP_CVAR(hlac, secondary))
{
- if(weapon_prepareattack(true, WEP_CVAR_SEC(hlac, refire)))
+ if(weapon_prepareattack(actor, true, WEP_CVAR_SEC(hlac, refire)))
{
W_HLAC_Attack2_Frame(thiswep);
- weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(hlac, animtime), w_ready);
+ weapon_thinkf(actor, WFRAME_FIRE2, WEP_CVAR_SEC(hlac, animtime), w_ready);
}
}
}
}
METHOD(HLAC, wr_reload, void(entity thiswep))
{
- W_Reload(min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo)), SND(RELOAD));
+ W_Reload(self, min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo)), SND(RELOAD));
}
METHOD(HLAC, wr_suicidemessage, int(entity thiswep))
{
void spawnfunc_weapon_hmg() { weapon_defaultspawnfunc(WEP_HMG.m_id); }
-void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, bool fire1, bool fire2)
-{SELFPARAM();
- if (!self.BUTTON_ATCK)
+void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, bool fire1, bool fire2)
+{
+ if (!actor.BUTTON_ATCK)
{
- w_ready(thiswep, fire1, fire2);
+ w_ready(thiswep, actor, fire1, fire2);
return;
}
- Weapon w = get_weaponinfo(self.weapon);
+ Weapon w = get_weaponinfo(actor.weapon);
if(!w.wr_checkammo1(w))
- if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
+ if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
{
- W_SwitchWeapon_Force(self, w_getbestweapon(self));
- w_ready(thiswep, fire1, fire2);
+ W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
+ w_ready(thiswep, actor, fire1, fire2);
return;
}
- W_DecreaseAmmo(WEP_HMG, WEP_CVAR(hmg, ammo));
+ W_DecreaseAmmo(WEP_HMG, self, WEP_CVAR(hmg, ammo));
- W_SetupShot (self, true, 0, SND(UZI_FIRE), CH_WEAPON_A, WEP_CVAR(hmg, damage));
+ W_SetupShot (actor, true, 0, SND(UZI_FIRE), CH_WEAPON_A, WEP_CVAR(hmg, damage));
if(!autocvar_g_norecoil)
{
- self.punchangle_x = random () - 0.5;
- self.punchangle_y = random () - 0.5;
+ actor.punchangle_x = random () - 0.5;
+ actor.punchangle_y = random () - 0.5;
}
- float hmg_spread = bound(WEP_CVAR(hmg, spread_min), WEP_CVAR(hmg, spread_min) + (WEP_CVAR(hmg, spread_add) * self.misc_bulletcounter), WEP_CVAR(hmg, spread_max));
+ float hmg_spread = bound(WEP_CVAR(hmg, spread_min), WEP_CVAR(hmg, spread_min) + (WEP_CVAR(hmg, spread_add) * actor.misc_bulletcounter), WEP_CVAR(hmg, spread_max));
fireBullet(w_shotorg, w_shotdir, hmg_spread, WEP_CVAR(hmg, solidpenetration), WEP_CVAR(hmg, damage), WEP_CVAR(hmg, force), WEP_HMG.m_id, 0);
- self.misc_bulletcounter = self.misc_bulletcounter + 1;
+ actor.misc_bulletcounter = actor.misc_bulletcounter + 1;
Send_Effect(EFFECT_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
W_MachineGun_MuzzleFlash();
- W_AttachToShotorg(self.muzzle_flash, '5 0 0');
+ W_AttachToShotorg(actor, actor.muzzle_flash, '5 0 0');
if (autocvar_g_casings >= 2) // casing code
- SpawnCasing (((random () * 50 + 50) * v_right) - (v_forward * (random () * 25 + 25)) - ((random () * 5 - 70) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 3, self);
+ SpawnCasing (((random () * 50 + 50) * v_right) - (v_forward * (random () * 25 + 25)) - ((random () * 5 - 70) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 3, actor);
- ATTACK_FINISHED(self) = time + WEP_CVAR(hmg, refire) * W_WeaponRateFactor();
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(hmg, refire), W_HeavyMachineGun_Attack_Auto);
+ ATTACK_FINISHED(actor) = time + WEP_CVAR(hmg, refire) * W_WeaponRateFactor();
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR(hmg, refire), W_HeavyMachineGun_Attack_Auto);
}
METHOD(HeavyMachineGun, wr_aim, void(entity thiswep))
else
self.BUTTON_ATCK2 = bot_aim(1000000, 0, 0.001, false);
}
- METHOD(HeavyMachineGun, wr_think, void(entity thiswep, bool fire1, bool fire2))
+ METHOD(HeavyMachineGun, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
{
- if(WEP_CVAR(hmg, reload_ammo) && self.clip_load < WEP_CVAR(hmg, ammo)) { // forced reload
- Weapon w = get_weaponinfo(self.weapon);
+ if(WEP_CVAR(hmg, reload_ammo) && actor.clip_load < WEP_CVAR(hmg, ammo)) { // forced reload
+ Weapon w = get_weaponinfo(actor.weapon);
w.wr_reload(w);
} else
{
if (fire1)
- if (weapon_prepareattack(false, 0))
+ if (weapon_prepareattack(actor, false, 0))
{
- self.misc_bulletcounter = 0;
- W_HeavyMachineGun_Attack_Auto(thiswep, fire1, fire2);
+ actor.misc_bulletcounter = 0;
+ W_HeavyMachineGun_Attack_Auto(thiswep, actor, fire1, fire2);
}
}
}
}
METHOD(HeavyMachineGun, wr_reload, void(entity thiswep))
{
- W_Reload(WEP_CVAR(hmg, ammo), SND(RELOAD));
+ W_Reload(self, WEP_CVAR(hmg, ammo), SND(RELOAD));
}
METHOD(HeavyMachineGun, wr_suicidemessage, int(entity thiswep))
{
METHOD(OffhandHook, offhand_think, void(OffhandHook this, entity player, bool key_pressed))
{
Weapon wep = WEP_HOOK;
- WITH(entity, self, player, wep.wr_think(wep, key_pressed, false));
+ WITH(entity, self, player, wep.wr_think(wep, self, key_pressed, false));
}
ENDCLASS(OffhandHook)
OffhandHook OFFHAND_HOOK; STATIC_INIT(OFFHAND_HOOK) { OFFHAND_HOOK = NEW(OffhandHook); }
{SELFPARAM();
entity gren;
- //W_DecreaseAmmo(thiswep, WEP_CVAR_SEC(hook, ammo)); // WEAPONTODO: Figure out how to handle ammo with hook secondary (gravitybomb)
+ //W_DecreaseAmmo(thiswep, self, WEP_CVAR_SEC(hook, ammo)); // WEAPONTODO: Figure out how to handle ammo with hook secondary (gravitybomb)
W_SetupShot(self, false, 4, SND(HOOKBOMB_FIRE), CH_WEAPON_A, WEP_CVAR_SEC(hook, damage));
gren = spawn();
MUTATOR_CALLHOOK(EditProjectile, self, gren);
}
- METHOD(Hook, wr_think, void(entity thiswep, bool fire1, bool fire2))
+ METHOD(Hook, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
{
- if(fire1 || self.BUTTON_HOOK)
+ if(fire1 || actor.BUTTON_HOOK)
{
- if(!self.hook)
- if(!(self.hook_state & HOOK_WAITING_FOR_RELEASE))
- if(!(self.hook_state & HOOK_FIRING))
- if(time > self.hook_refire)
- if(weapon_prepareattack(false, -1))
+ if(!actor.hook)
+ if(!(actor.hook_state & HOOK_WAITING_FOR_RELEASE))
+ if(!(actor.hook_state & HOOK_FIRING))
+ if(time > actor.hook_refire)
+ if(weapon_prepareattack(actor, false, -1))
{
- W_DecreaseAmmo(thiswep, WEP_CVAR_PRI(hook, ammo));
- self.hook_state |= HOOK_FIRING;
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(hook, animtime), w_ready);
+ W_DecreaseAmmo(thiswep, actor, WEP_CVAR_PRI(hook, ammo));
+ actor.hook_state |= HOOK_FIRING;
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(hook, animtime), w_ready);
}
}
if(fire2)
{
- if(weapon_prepareattack(true, WEP_CVAR_SEC(hook, refire)))
+ if(weapon_prepareattack(actor, true, WEP_CVAR_SEC(hook, refire)))
{
W_Hook_Attack2(thiswep);
- weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(hook, animtime), w_ready);
+ weapon_thinkf(actor, WFRAME_FIRE2, WEP_CVAR_SEC(hook, animtime), w_ready);
}
}
- if(self.hook)
+ if(actor.hook)
{
// if hooked, no bombs, and increase the timer
- self.hook_refire = max(self.hook_refire, time + WEP_CVAR_PRI(hook, refire) * W_WeaponRateFactor());
+ 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(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
- self.pauseregen_finished = max(self.pauseregen_finished, time + autocvar_g_balance_pause_fuel_regen);
+ if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
+ actor.pauseregen_finished = max(actor.pauseregen_finished, time + autocvar_g_balance_pause_fuel_regen);
}
- if(self.hook && self.hook.state == 1)
+ 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 > self.hook_time_hooked + hooked_time_max )
- self.hook_state |= HOOK_REMOVING;
+ if( time > actor.hook_time_hooked + hooked_time_max )
+ actor.hook_state |= HOOK_REMOVING;
}
float hooked_fuel = WEP_CVAR_PRI(hook, hooked_ammo);
if(hooked_fuel > 0)
{
- if( time > self.hook_time_fueldecrease )
+ if( time > actor.hook_time_fueldecrease )
{
- if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
+ if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
{
- if( self.ammo_fuel >= (time - self.hook_time_fueldecrease) * hooked_fuel )
+ if( actor.ammo_fuel >= (time - actor.hook_time_fueldecrease) * hooked_fuel )
{
- W_DecreaseAmmo(thiswep, (time - self.hook_time_fueldecrease) * hooked_fuel);
- self.hook_time_fueldecrease = time;
+ W_DecreaseAmmo(thiswep, actor, (time - actor.hook_time_fueldecrease) * hooked_fuel);
+ actor.hook_time_fueldecrease = time;
// decrease next frame again
}
else
{
- self.ammo_fuel = 0;
- self.hook_state |= HOOK_REMOVING;
- W_SwitchWeapon_Force(self, w_getbestweapon(self));
+ actor.ammo_fuel = 0;
+ actor.hook_state |= HOOK_REMOVING;
+ W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
}
}
}
}
else
{
- self.hook_time_hooked = time;
- self.hook_time_fueldecrease = time + WEP_CVAR_PRI(hook, hooked_time_free);
+ actor.hook_time_hooked = time;
+ actor.hook_time_fueldecrease = time + WEP_CVAR_PRI(hook, hooked_time_free);
}
- if(self.BUTTON_CROUCH)
+ if(actor.BUTTON_CROUCH)
{
- self.hook_state &= ~HOOK_PULLING;
- if(fire1 || self.BUTTON_HOOK)
- self.hook_state &= ~HOOK_RELEASING;
+ actor.hook_state &= ~HOOK_PULLING;
+ if(fire1 || actor.BUTTON_HOOK)
+ actor.hook_state &= ~HOOK_RELEASING;
else
- self.hook_state |= HOOK_RELEASING;
+ actor.hook_state |= HOOK_RELEASING;
}
else
{
- self.hook_state |= HOOK_PULLING;
- self.hook_state &= ~HOOK_RELEASING;
+ actor.hook_state |= HOOK_PULLING;
+ actor.hook_state &= ~HOOK_RELEASING;
- if(fire1 || self.BUTTON_HOOK)
+ if(fire1 || actor.BUTTON_HOOK)
{
// already fired
- if(self.hook)
- self.hook_state |= HOOK_WAITING_FOR_RELEASE;
+ if(actor.hook)
+ actor.hook_state |= HOOK_WAITING_FOR_RELEASE;
}
else
{
- self.hook_state |= HOOK_REMOVING;
- self.hook_state &= ~HOOK_WAITING_FOR_RELEASE;
+ actor.hook_state |= HOOK_REMOVING;
+ actor.hook_state &= ~HOOK_WAITING_FOR_RELEASE;
}
}
Send_Effect(EFFECT_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
W_MachineGun_MuzzleFlash();
- W_AttachToShotorg(self.muzzle_flash, '5 0 0');
+ W_AttachToShotorg(self, self.muzzle_flash, '5 0 0');
// casing code
if(autocvar_g_casings >= 2)
SpawnCasing(((random() * 50 + 50) * v_right) - (v_forward * (random() * 25 + 25)) - ((random() * 5 - 70) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 3, self);
if(self.misc_bulletcounter == 1)
- W_DecreaseAmmo(thiswep, WEP_CVAR(machinegun, first_ammo));
+ W_DecreaseAmmo(thiswep, self, WEP_CVAR(machinegun, first_ammo));
else
- W_DecreaseAmmo(thiswep, WEP_CVAR(machinegun, sustained_ammo));
+ W_DecreaseAmmo(thiswep, self, WEP_CVAR(machinegun, sustained_ammo));
}
// weapon frames
-void W_MachineGun_Attack_Frame(Weapon thiswep, bool fire1, bool fire2)
-{SELFPARAM();
- if(self.weapon != self.switchweapon) // abort immediately if switching
+void W_MachineGun_Attack_Frame(Weapon thiswep, entity actor, bool fire1, bool fire2)
+{
+ if(actor.weapon != actor.switchweapon) // abort immediately if switching
{
- w_ready(thiswep, fire1, fire2);
+ w_ready(thiswep, actor, fire1, fire2);
return;
}
- if(self.BUTTON_ATCK)
+ if(actor.BUTTON_ATCK)
{
- Weapon w = get_weaponinfo(self.weapon);
+ Weapon w = get_weaponinfo(actor.weapon);
if(!w.wr_checkammo2(w))
- if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
+ if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
{
- W_SwitchWeapon_Force(self, w_getbestweapon(self));
- w_ready(thiswep, fire1, fire2);
+ W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
+ w_ready(thiswep, actor, fire1, fire2);
return;
}
- self.misc_bulletcounter = self.misc_bulletcounter + 1;
+ actor.misc_bulletcounter = actor.misc_bulletcounter + 1;
W_MachineGun_Attack(WEP_MACHINEGUN, WEP_MACHINEGUN.m_id);
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(machinegun, sustained_refire), W_MachineGun_Attack_Frame);
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR(machinegun, sustained_refire), W_MachineGun_Attack_Frame);
}
else
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(machinegun, sustained_refire), w_ready);
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR(machinegun, sustained_refire), w_ready);
}
-void W_MachineGun_Attack_Auto(Weapon thiswep, bool fire1, bool fire2)
-{SELFPARAM();
+void W_MachineGun_Attack_Auto(Weapon thiswep, entity actor, bool fire1, bool fire2)
+{
float machinegun_spread;
if(!fire1)
{
- w_ready(thiswep, fire1, fire2);
+ w_ready(thiswep, actor, fire1, fire2);
return;
}
- Weapon w = get_weaponinfo(self.weapon);
+ Weapon w = get_weaponinfo(actor.weapon);
if(!w.wr_checkammo1(w))
- if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
+ if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
{
- W_SwitchWeapon_Force(self, w_getbestweapon(self));
- w_ready(thiswep, fire1, fire2);
+ W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
+ w_ready(thiswep, actor, fire1, fire2);
return;
}
- W_DecreaseAmmo(WEP_MACHINEGUN, WEP_CVAR(machinegun, sustained_ammo));
+ W_DecreaseAmmo(WEP_MACHINEGUN, actor, WEP_CVAR(machinegun, sustained_ammo));
- W_SetupShot(self, true, 0, SND(UZI_FIRE), CH_WEAPON_A, WEP_CVAR(machinegun, sustained_damage));
+ W_SetupShot(actor, true, 0, SND(UZI_FIRE), CH_WEAPON_A, WEP_CVAR(machinegun, sustained_damage));
if(!autocvar_g_norecoil)
{
- self.punchangle_x = random() - 0.5;
- self.punchangle_y = random() - 0.5;
+ actor.punchangle_x = random() - 0.5;
+ actor.punchangle_y = random() - 0.5;
}
- machinegun_spread = bound(WEP_CVAR(machinegun, spread_min), WEP_CVAR(machinegun, spread_min) + (WEP_CVAR(machinegun, spread_add) * self.misc_bulletcounter), WEP_CVAR(machinegun, spread_max));
+ machinegun_spread = bound(WEP_CVAR(machinegun, spread_min), WEP_CVAR(machinegun, spread_min) + (WEP_CVAR(machinegun, spread_add) * actor.misc_bulletcounter), WEP_CVAR(machinegun, spread_max));
fireBullet(w_shotorg, w_shotdir, machinegun_spread, WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), WEP_CVAR(machinegun, sustained_force), WEP_MACHINEGUN.m_id, 0);
- self.misc_bulletcounter = self.misc_bulletcounter + 1;
+ actor.misc_bulletcounter = actor.misc_bulletcounter + 1;
Send_Effect(EFFECT_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
W_MachineGun_MuzzleFlash();
- W_AttachToShotorg(self.muzzle_flash, '5 0 0');
+ W_AttachToShotorg(actor, actor.muzzle_flash, '5 0 0');
if(autocvar_g_casings >= 2) // casing code
- SpawnCasing(((random() * 50 + 50) * v_right) - (v_forward * (random() * 25 + 25)) - ((random() * 5 - 70) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 3, self);
+ SpawnCasing(((random() * 50 + 50) * v_right) - (v_forward * (random() * 25 + 25)) - ((random() * 5 - 70) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 3, actor);
- ATTACK_FINISHED(self) = time + WEP_CVAR(machinegun, first_refire) * W_WeaponRateFactor();
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(machinegun, sustained_refire), W_MachineGun_Attack_Auto);
+ ATTACK_FINISHED(actor) = time + WEP_CVAR(machinegun, first_refire) * W_WeaponRateFactor();
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR(machinegun, sustained_refire), W_MachineGun_Attack_Auto);
}
-void W_MachineGun_Attack_Burst(Weapon thiswep, bool fire1, bool fire2)
-{SELFPARAM();
- W_SetupShot(self, true, 0, SND(UZI_FIRE), CH_WEAPON_A, WEP_CVAR(machinegun, sustained_damage));
+void W_MachineGun_Attack_Burst(Weapon thiswep, entity actor, bool fire1, bool fire2)
+{
+ W_SetupShot(actor, true, 0, SND(UZI_FIRE), CH_WEAPON_A, WEP_CVAR(machinegun, sustained_damage));
if(!autocvar_g_norecoil)
{
- self.punchangle_x = random() - 0.5;
- self.punchangle_y = random() - 0.5;
+ actor.punchangle_x = random() - 0.5;
+ actor.punchangle_y = random() - 0.5;
}
fireBullet(w_shotorg, w_shotdir, WEP_CVAR(machinegun, burst_speed), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), WEP_CVAR(machinegun, sustained_force), WEP_MACHINEGUN.m_id, 0);
Send_Effect(EFFECT_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
W_MachineGun_MuzzleFlash();
- W_AttachToShotorg(self.muzzle_flash, '5 0 0');
+ W_AttachToShotorg(actor, actor.muzzle_flash, '5 0 0');
if(autocvar_g_casings >= 2) // casing code
- SpawnCasing(((random() * 50 + 50) * v_right) - (v_forward * (random() * 25 + 25)) - ((random() * 5 - 70) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 3, self);
+ SpawnCasing(((random() * 50 + 50) * v_right) - (v_forward * (random() * 25 + 25)) - ((random() * 5 - 70) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 3, actor);
- self.misc_bulletcounter = self.misc_bulletcounter + 1;
- if(self.misc_bulletcounter == 0)
+ actor.misc_bulletcounter = actor.misc_bulletcounter + 1;
+ if(actor.misc_bulletcounter == 0)
{
- ATTACK_FINISHED(self) = time + WEP_CVAR(machinegun, burst_refire2) * W_WeaponRateFactor();
- weapon_thinkf(WFRAME_FIRE2, WEP_CVAR(machinegun, burst_animtime), w_ready);
+ ATTACK_FINISHED(actor) = time + WEP_CVAR(machinegun, burst_refire2) * W_WeaponRateFactor();
+ weapon_thinkf(actor, WFRAME_FIRE2, WEP_CVAR(machinegun, burst_animtime), w_ready);
}
else
{
- weapon_thinkf(WFRAME_FIRE2, WEP_CVAR(machinegun, burst_refire), W_MachineGun_Attack_Burst);
+ weapon_thinkf(actor, WFRAME_FIRE2, WEP_CVAR(machinegun, burst_refire), W_MachineGun_Attack_Burst);
}
}
else
self.BUTTON_ATCK2 = bot_aim(1000000, 0, 0.001, false);
}
- METHOD(MachineGun, wr_think, void(entity thiswep, bool fire1, bool fire2))
+ METHOD(MachineGun, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
{
- if(WEP_CVAR(machinegun, reload_ammo) && self.clip_load < min(max(WEP_CVAR(machinegun, sustained_ammo), WEP_CVAR(machinegun, first_ammo)), WEP_CVAR(machinegun, burst_ammo))) { // forced reload
- Weapon w = get_weaponinfo(self.weapon);
+ 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
+ Weapon w = get_weaponinfo(actor.weapon);
w.wr_reload(w);
} else
if(WEP_CVAR(machinegun, mode) == 1)
{
if(fire1)
- if(weapon_prepareattack(false, 0))
+ if(weapon_prepareattack(actor, false, 0))
{
- self.misc_bulletcounter = 0;
- W_MachineGun_Attack_Auto(thiswep, fire1, fire2);
+ actor.misc_bulletcounter = 0;
+ W_MachineGun_Attack_Auto(thiswep, actor, fire1, fire2);
}
if(fire2)
- if(weapon_prepareattack(true, 0))
+ if(weapon_prepareattack(actor, true, 0))
{
- Weapon w = get_weaponinfo(self.weapon);
+ Weapon w = get_weaponinfo(actor.weapon);
if(!w.wr_checkammo2(w))
- if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
+ if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
{
- W_SwitchWeapon_Force(self, w_getbestweapon(self));
- w_ready(thiswep, fire1, fire2);
+ W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
+ w_ready(thiswep, actor, fire1, fire2);
return;
}
- W_DecreaseAmmo(thiswep, WEP_CVAR(machinegun, burst_ammo));
+ W_DecreaseAmmo(thiswep, actor, WEP_CVAR(machinegun, burst_ammo));
- self.misc_bulletcounter = WEP_CVAR(machinegun, burst) * -1;
- W_MachineGun_Attack_Burst(thiswep, fire1, fire2);
+ actor.misc_bulletcounter = WEP_CVAR(machinegun, burst) * -1;
+ W_MachineGun_Attack_Burst(thiswep, actor, fire1, fire2);
}
}
else
{
if(fire1)
- if(weapon_prepareattack(false, 0))
+ if(weapon_prepareattack(actor, false, 0))
{
- self.misc_bulletcounter = 1;
+ actor.misc_bulletcounter = 1;
W_MachineGun_Attack(WEP_MACHINEGUN, WEP_MACHINEGUN.m_id); // sets attack_finished
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(machinegun, sustained_refire), W_MachineGun_Attack_Frame);
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR(machinegun, sustained_refire), W_MachineGun_Attack_Frame);
}
if(fire2 && WEP_CVAR(machinegun, first))
- if(weapon_prepareattack(true, 0))
+ if(weapon_prepareattack(actor, true, 0))
{
- self.misc_bulletcounter = 1;
+ actor.misc_bulletcounter = 1;
W_MachineGun_Attack(WEP_MACHINEGUN, WEP_MACHINEGUN.m_id | HITTYPE_SECONDARY); // sets attack_finished
- weapon_thinkf(WFRAME_FIRE2, WEP_CVAR(machinegun, first_refire), w_ready);
+ weapon_thinkf(actor, WFRAME_FIRE2, WEP_CVAR(machinegun, first_refire), w_ready);
}
}
}
}
METHOD(MachineGun, wr_reload, void(entity thiswep))
{
- W_Reload(min(max(WEP_CVAR(machinegun, sustained_ammo), WEP_CVAR(machinegun, first_ammo)), WEP_CVAR(machinegun, burst_ammo)), SND(RELOAD));
+ 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))
{
}
}
- W_DecreaseAmmo(thiswep, WEP_CVAR(minelayer, ammo));
+ W_DecreaseAmmo(thiswep, self, WEP_CVAR(minelayer, ammo));
W_SetupShot_ProjectileSize(self, '-4 -4 -4', '4 4 4', false, 5, SND(MINE_FIRE), CH_WEAPON_A, WEP_CVAR(minelayer, damage));
Send_Effect(EFFECT_ROCKET_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
setmodel(flash, MDL_MINELAYER_MUZZLEFLASH); // precision set below
SUB_SetFade(flash, time, 0.1);
flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
- W_AttachToShotorg(flash, '5 0 0');
+ W_AttachToShotorg(self, flash, '5 0 0');
// common properties
if(self.BUTTON_ATCK2 == true) self.BUTTON_ATCK = false;
}
}
- METHOD(MineLayer, wr_think, void(entity thiswep, bool fire1, bool fire2))
+ METHOD(MineLayer, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
{
- if(autocvar_g_balance_minelayer_reload_ammo && self.clip_load < WEP_CVAR(minelayer, ammo)) // forced reload
+ 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) && self.WEP_AMMO(MINE_LAYER) < WEP_CVAR(minelayer, ammo))) {
- Weapon w = get_weaponinfo(self.weapon);
+ if(!(W_MineLayer_PlacedMines(false) && actor.WEP_AMMO(MINE_LAYER) < WEP_CVAR(minelayer, ammo))) {
+ Weapon w = get_weaponinfo(actor.weapon);
w.wr_reload(w);
}
}
else if(fire1)
{
- if(weapon_prepareattack(false, WEP_CVAR(minelayer, refire)))
+ if(weapon_prepareattack(actor, false, WEP_CVAR(minelayer, refire)))
{
W_MineLayer_Attack(thiswep);
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(minelayer, animtime), w_ready);
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR(minelayer, animtime), w_ready);
}
}
if(fire2)
{
if(W_MineLayer_PlacedMines(true))
- sound(self, CH_WEAPON_B, SND_MINE_DET, VOL_BASE, ATTN_NORM);
+ sound(actor, CH_WEAPON_B, SND_MINE_DET, VOL_BASE, ATTN_NORM);
}
}
METHOD(MineLayer, wr_init, void(entity thiswep))
}
METHOD(MineLayer, wr_reload, void(entity thiswep))
{
- W_Reload(WEP_CVAR(minelayer, ammo), SND(RELOAD));
+ W_Reload(self, WEP_CVAR(minelayer, ammo), SND(RELOAD));
}
METHOD(MineLayer, wr_suicidemessage, int(entity thiswep))
{
{SELFPARAM();
entity gren;
- W_DecreaseAmmo(thiswep, WEP_CVAR_PRI(mortar, ammo));
+ W_DecreaseAmmo(thiswep, self, WEP_CVAR_PRI(mortar, ammo));
W_SetupShot_ProjectileSize(self, '-3 -3 -3', '3 3 3', false, 4, SND(GRENADE_FIRE), CH_WEAPON_A, WEP_CVAR_PRI(mortar, damage));
w_shotdir = v_forward; // no TrueAim for grenades please
{SELFPARAM();
entity gren;
- W_DecreaseAmmo(thiswep, WEP_CVAR_SEC(mortar, ammo));
+ W_DecreaseAmmo(thiswep, self, WEP_CVAR_SEC(mortar, ammo));
W_SetupShot_ProjectileSize(self, '-3 -3 -3', '3 3 3', false, 4, SND(GRENADE_FIRE), CH_WEAPON_A, WEP_CVAR_SEC(mortar, damage));
w_shotdir = v_forward; // no TrueAim for grenades please
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, bool fire1, bool fire2))
+ METHOD(Mortar, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
{
- if(autocvar_g_balance_mortar_reload_ammo && self.clip_load < min(WEP_CVAR_PRI(mortar, ammo), WEP_CVAR_SEC(mortar, ammo))) { // forced reload
- Weapon w = get_weaponinfo(self.weapon);
+ if(autocvar_g_balance_mortar_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(mortar, ammo), WEP_CVAR_SEC(mortar, ammo))) { // forced reload
+ Weapon w = get_weaponinfo(actor.weapon);
w.wr_reload(w);
} else if(fire1)
{
- if(weapon_prepareattack(false, WEP_CVAR_PRI(mortar, refire)))
+ if(weapon_prepareattack(actor, false, WEP_CVAR_PRI(mortar, refire)))
{
W_Mortar_Attack(thiswep);
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(mortar, animtime), w_ready);
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(mortar, animtime), w_ready);
}
}
else if(fire2)
{
bool nadefound = false;
entity nade;
- for(nade = world; (nade = find(nade, classname, "grenade")); ) if(nade.realowner == self)
+ for(nade = world; (nade = find(nade, classname, "grenade")); ) if(nade.realowner == actor)
{
if(!nade.gl_detonate_later)
{
}
}
if(nadefound)
- sound(self, CH_WEAPON_B, SND_ROCKET_DET, VOL_BASE, ATTN_NORM);
+ sound(actor, CH_WEAPON_B, SND_ROCKET_DET, VOL_BASE, ATTN_NORM);
}
- else if(weapon_prepareattack(true, WEP_CVAR_SEC(mortar, refire)))
+ else if(weapon_prepareattack(actor, true, WEP_CVAR_SEC(mortar, refire)))
{
W_Mortar_Attack2(thiswep);
- weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(mortar, animtime), w_ready);
+ weapon_thinkf(actor, WFRAME_FIRE2, WEP_CVAR_SEC(mortar, animtime), w_ready);
}
}
}
}
METHOD(Mortar, wr_reload, void(entity thiswep))
{
- W_Reload(min(WEP_CVAR_PRI(mortar, ammo), WEP_CVAR_SEC(mortar, ammo)), SND(RELOAD)); // WEAPONTODO
+ W_Reload(self, min(WEP_CVAR_PRI(mortar, ammo), WEP_CVAR_SEC(mortar, ammo)), SND(RELOAD)); // WEAPONTODO
}
METHOD(Mortar, wr_suicidemessage, int(entity thiswep))
{
{
PORTO_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
}
- METHOD(PortoLaunch, wr_think, void(entity thiswep, bool fire1, bool fire2))
+ METHOD(PortoLaunch, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
{
- SELFPARAM();
if(WEP_CVAR(porto, secondary))
{
if(fire1)
- if(!self.porto_current)
- if(!self.porto_forbidden)
- if(weapon_prepareattack(false, WEP_CVAR_PRI(porto, refire)))
+ if(!actor.porto_current)
+ if(!actor.porto_forbidden)
+ if(weapon_prepareattack(actor, false, WEP_CVAR_PRI(porto, refire)))
{
W_Porto_Attack(0);
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(porto, animtime), w_ready);
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(porto, animtime), w_ready);
}
if(fire2)
- if(!self.porto_current)
- if(!self.porto_forbidden)
- if(weapon_prepareattack(true, WEP_CVAR_SEC(porto, refire)))
+ if(!actor.porto_current)
+ if(!actor.porto_forbidden)
+ if(weapon_prepareattack(actor, true, WEP_CVAR_SEC(porto, refire)))
{
W_Porto_Attack(1);
- weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(porto, animtime), w_ready);
+ weapon_thinkf(actor, WFRAME_FIRE2, WEP_CVAR_SEC(porto, animtime), w_ready);
}
}
else
{
- if(self.porto_v_angle_held)
+ if(actor.porto_v_angle_held)
{
if(!fire2)
{
- self.porto_v_angle_held = 0;
+ actor.porto_v_angle_held = 0;
- ClientData_Touch(self);
+ ClientData_Touch(actor);
}
}
else
{
if(fire2)
{
- self.porto_v_angle = self.v_angle;
- self.porto_v_angle_held = 1;
+ actor.porto_v_angle = actor.v_angle;
+ actor.porto_v_angle_held = 1;
- ClientData_Touch(self);
+ ClientData_Touch(actor);
}
}
- if(self.porto_v_angle_held)
- makevectors(self.porto_v_angle); // override the previously set angles
+ if(actor.porto_v_angle_held)
+ makevectors(actor.porto_v_angle); // override the previously set angles
if(fire1)
- if(!self.porto_current)
- if(!self.porto_forbidden)
- if(weapon_prepareattack(false, WEP_CVAR_PRI(porto, refire)))
+ if(!actor.porto_current)
+ if(!actor.porto_forbidden)
+ if(weapon_prepareattack(actor, false, WEP_CVAR_PRI(porto, refire)))
{
W_Porto_Attack(-1);
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(porto, animtime), w_ready);
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(porto, animtime), w_ready);
}
}
}
{SELFPARAM();
float i;
- W_DecreaseAmmo(thiswep, pAmmo);
+ W_DecreaseAmmo(thiswep, self, pAmmo);
W_SetupShot(self, true, 2, pSound, CH_WEAPON_A, pDamage * pShots);
.float rifle_bullethail_frame;
.float rifle_bullethail_animtime;
.float rifle_bullethail_refire;
-void W_Rifle_BulletHail_Continue(Weapon thiswep, bool fire1, bool fire2)
-{SELFPARAM();
+void W_Rifle_BulletHail_Continue(Weapon thiswep, entity actor, bool fire1, bool fire2)
+{
float r, sw, af;
- sw = self.switchweapon; // make it not detect weapon changes as reason to abort firing
- af = ATTACK_FINISHED(self);
- self.switchweapon = self.weapon;
- ATTACK_FINISHED(self) = time;
- LOG_INFO(ftos(self.WEP_AMMO(RIFLE)), "\n");
- r = weapon_prepareattack(self.rifle_bullethail_frame == WFRAME_FIRE2, self.rifle_bullethail_refire);
- if(self.switchweapon == self.weapon)
- self.switchweapon = sw;
+ sw = actor.switchweapon; // make it not detect weapon changes as reason to abort firing
+ af = ATTACK_FINISHED(actor);
+ actor.switchweapon = actor.weapon;
+ ATTACK_FINISHED(actor) = time;
+ LOG_INFO(ftos(actor.WEP_AMMO(RIFLE)), "\n");
+ r = weapon_prepareattack(actor, actor.rifle_bullethail_frame == WFRAME_FIRE2, actor.rifle_bullethail_refire);
+ if(actor.switchweapon == actor.weapon)
+ actor.switchweapon = sw;
if(r)
{
- self.rifle_bullethail_attackfunc();
- weapon_thinkf(self.rifle_bullethail_frame, self.rifle_bullethail_animtime, W_Rifle_BulletHail_Continue);
+ actor.rifle_bullethail_attackfunc();
+ weapon_thinkf(actor, actor.rifle_bullethail_frame, actor.rifle_bullethail_animtime, W_Rifle_BulletHail_Continue);
LOG_INFO("thinkf set\n");
}
else
{
- ATTACK_FINISHED(self) = af; // reset attack_finished if we didn't fire, so the last shot enforces the refire time
- LOG_INFO("out of ammo... ", ftos(self.weaponentity.state), "\n");
+ ATTACK_FINISHED(actor) = af; // reset attack_finished if we didn't fire, so the last shot enforces the refire time
+ LOG_INFO("out of ammo... ", ftos(actor.weaponentity.state), "\n");
}
}
self.rifle_bullethail_frame = fr;
self.rifle_bullethail_animtime = animtime;
self.rifle_bullethail_refire = refire;
- weapon_thinkf(fr, animtime, W_Rifle_BulletHail_Continue);
+ weapon_thinkf(self, fr, animtime, W_Rifle_BulletHail_Continue);
}
else
{
// just one shot
- weapon_thinkf(fr, animtime, w_ready);
+ weapon_thinkf(self, fr, animtime, w_ready);
}
}
}
}
}
- METHOD(Rifle, wr_think, void(entity thiswep, bool fire1, bool fire2))
+ METHOD(Rifle, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
{
- if(autocvar_g_balance_rifle_reload_ammo && self.clip_load < min(WEP_CVAR_PRI(rifle, ammo), WEP_CVAR_SEC(rifle, ammo))) { // forced reload
- Weapon w = get_weaponinfo(self.weapon);
+ if(autocvar_g_balance_rifle_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(rifle, ammo), WEP_CVAR_SEC(rifle, ammo))) { // forced reload
+ Weapon w = get_weaponinfo(actor.weapon);
w.wr_reload(w);
} else
{
- self.rifle_accumulator = bound(time - WEP_CVAR(rifle, bursttime), self.rifle_accumulator, time);
+ actor.rifle_accumulator = bound(time - WEP_CVAR(rifle, bursttime), actor.rifle_accumulator, time);
if(fire1)
- if(weapon_prepareattack_check(false, WEP_CVAR_PRI(rifle, refire)))
- if(time >= self.rifle_accumulator + WEP_CVAR_PRI(rifle, burstcost))
+ if(weapon_prepareattack_check(actor, false, WEP_CVAR_PRI(rifle, refire)))
+ if(time >= actor.rifle_accumulator + WEP_CVAR_PRI(rifle, burstcost))
{
- weapon_prepareattack_do(false, WEP_CVAR_PRI(rifle, refire));
+ weapon_prepareattack_do(actor, false, WEP_CVAR_PRI(rifle, refire));
W_Rifle_BulletHail(WEP_CVAR_PRI(rifle, bullethail), W_Rifle_Attack, WFRAME_FIRE1, WEP_CVAR_PRI(rifle, animtime), WEP_CVAR_PRI(rifle, refire));
- self.rifle_accumulator += WEP_CVAR_PRI(rifle, burstcost);
+ actor.rifle_accumulator += WEP_CVAR_PRI(rifle, burstcost);
}
if(fire2)
{
if(WEP_CVAR(rifle, secondary))
{
if(WEP_CVAR_SEC(rifle, reload)) {
- Weapon w = get_weaponinfo(self.weapon);
+ Weapon w = get_weaponinfo(actor.weapon);
w.wr_reload(w);
} else
{
- if(weapon_prepareattack_check(true, WEP_CVAR_SEC(rifle, refire)))
- if(time >= self.rifle_accumulator + WEP_CVAR_SEC(rifle, burstcost))
+ if(weapon_prepareattack_check(actor, true, WEP_CVAR_SEC(rifle, refire)))
+ if(time >= actor.rifle_accumulator + WEP_CVAR_SEC(rifle, burstcost))
{
- weapon_prepareattack_do(true, WEP_CVAR_SEC(rifle, refire));
+ weapon_prepareattack_do(actor, true, WEP_CVAR_SEC(rifle, refire));
W_Rifle_BulletHail(WEP_CVAR_SEC(rifle, bullethail), W_Rifle_Attack2, WFRAME_FIRE2, WEP_CVAR_SEC(rifle, animtime), WEP_CVAR_PRI(rifle, refire));
- self.rifle_accumulator += WEP_CVAR_SEC(rifle, burstcost);
+ actor.rifle_accumulator += WEP_CVAR_SEC(rifle, burstcost);
}
}
}
}
METHOD(Rifle, wr_reload, void(entity thiswep))
{
- W_Reload(min(WEP_CVAR_PRI(rifle, ammo), WEP_CVAR_SEC(rifle, ammo)), SND(RELOAD));
+ W_Reload(self, min(WEP_CVAR_PRI(rifle, ammo), WEP_CVAR_SEC(rifle, ammo)), SND(RELOAD));
}
METHOD(Rifle, wr_suicidemessage, int(entity thiswep))
{
entity missile = spawn(); //WarpZone_RefSys_SpawnSameRefSys(self);
entity flash = spawn ();
- W_DecreaseAmmo(thiswep, WEP_CVAR(rpc, ammo));
+ W_DecreaseAmmo(thiswep, self, WEP_CVAR(rpc, ammo));
W_SetupShot_ProjectileSize (self, '-3 -3 -3', '3 3 3', false, 5, SND(ROCKET_FIRE), CH_WEAPON_A, WEP_CVAR(rpc, damage));
Send_Effect(EFFECT_ROCKET_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
PROJECTILE_MAKETRIGGER(missile);
setmodel(flash, MDL_RPC_MUZZLEFLASH); // precision set below
SUB_SetFade (flash, time, 0.1);
flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
- W_AttachToShotorg(flash, '5 0 0');
+ W_AttachToShotorg(self, flash, '5 0 0');
missile.pos1 = missile.velocity;
MUTATOR_CALLHOOK(EditProjectile, self, missile);
{
self.BUTTON_ATCK = bot_aim(WEP_CVAR(rpc, speed), 0, WEP_CVAR(rpc, lifetime), false);
}
- METHOD(RocketPropelledChainsaw, wr_think, void(entity thiswep, bool fire1, bool fire2))
+ METHOD(RocketPropelledChainsaw, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
{
- if(WEP_CVAR(rpc, reload_ammo) && self.clip_load < WEP_CVAR(rpc, ammo)) {
- Weapon w = get_weaponinfo(self.weapon);
+ if(WEP_CVAR(rpc, reload_ammo) && actor.clip_load < WEP_CVAR(rpc, ammo)) {
+ Weapon w = get_weaponinfo(actor.weapon);
w.wr_reload(w);
} else
{
if (fire1)
{
- if(weapon_prepareattack(false, WEP_CVAR(rpc, refire)))
+ if(weapon_prepareattack(actor, false, WEP_CVAR(rpc, refire)))
{
W_RocketPropelledChainsaw_Attack(thiswep);
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(rpc, animtime), w_ready);
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR(rpc, animtime), w_ready);
}
}
}
METHOD(RocketPropelledChainsaw, wr_reload, void(entity thiswep))
{
- W_Reload(WEP_CVAR(rpc, ammo), SND(RELOAD));
+ W_Reload(self, WEP_CVAR(rpc, ammo), SND(RELOAD));
}
METHOD(RocketPropelledChainsaw, wr_suicidemessage, int(entity thiswep))
{
{SELFPARAM();
entity missile;
- W_DecreaseAmmo(thiswep, WEP_CVAR(seeker, missile_ammo));
+ W_DecreaseAmmo(thiswep, self, WEP_CVAR(seeker, missile_ammo));
makevectors(self.v_angle);
W_SetupShot_ProjectileSize(self, '-2 -2 -2', '2 2 2', false, 2, SND(SEEKER_FIRE), CH_WEAPON_A, 0);
vector f_diff;
float c;
- W_DecreaseAmmo(thiswep, WEP_CVAR(seeker, flac_ammo));
+ W_DecreaseAmmo(thiswep, self, WEP_CVAR(seeker, flac_ammo));
c = self.bulletcounter % 4;
switch(c)
void W_Seeker_Fire_Tag(Weapon thiswep)
{SELFPARAM();
entity missile;
- W_DecreaseAmmo(thiswep, WEP_CVAR(seeker, tag_ammo));
+ W_DecreaseAmmo(thiswep, self, WEP_CVAR(seeker, tag_ammo));
W_SetupShot_ProjectileSize(self, '-2 -2 -2', '2 2 2', false, 2, SND(TAG_FIRE), CH_WEAPON_A, WEP_CVAR(seeker, missile_damage) * WEP_CVAR(seeker, missile_count));
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, bool fire1, bool fire2))
+ METHOD(Seeker, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
{
- if(autocvar_g_balance_seeker_reload_ammo && self.clip_load < min(WEP_CVAR(seeker, missile_ammo), WEP_CVAR(seeker, tag_ammo))) { // forced reload
- Weapon w = get_weaponinfo(self.weapon);
+ if(autocvar_g_balance_seeker_reload_ammo && actor.clip_load < min(WEP_CVAR(seeker, missile_ammo), WEP_CVAR(seeker, tag_ammo))) { // forced reload
+ Weapon w = get_weaponinfo(actor.weapon);
w.wr_reload(w);
} else if(fire1)
{
if(WEP_CVAR(seeker, type) == 1)
{
- if(weapon_prepareattack(false, WEP_CVAR(seeker, missile_refire)))
+ if(weapon_prepareattack(actor, false, WEP_CVAR(seeker, missile_refire)))
{
W_Seeker_Attack();
- weapon_thinkf(WFRAME_FIRE2, WEP_CVAR(seeker, missile_animtime), w_ready);
+ weapon_thinkf(actor, WFRAME_FIRE2, WEP_CVAR(seeker, missile_animtime), w_ready);
}
}
else
{
- if(weapon_prepareattack(false, WEP_CVAR(seeker, tag_refire)))
+ if(weapon_prepareattack(actor, false, WEP_CVAR(seeker, tag_refire)))
{
W_Seeker_Fire_Tag(thiswep);
- weapon_thinkf(WFRAME_FIRE2, WEP_CVAR(seeker, tag_animtime), w_ready);
+ weapon_thinkf(actor, WFRAME_FIRE2, WEP_CVAR(seeker, tag_animtime), w_ready);
}
}
}
{
if(WEP_CVAR(seeker, type) == 1)
{
- if(weapon_prepareattack(false, WEP_CVAR(seeker, tag_refire)))
+ if(weapon_prepareattack(actor, false, WEP_CVAR(seeker, tag_refire)))
{
W_Seeker_Fire_Tag(thiswep);
- weapon_thinkf(WFRAME_FIRE2, WEP_CVAR(seeker, tag_animtime), w_ready);
+ weapon_thinkf(actor, WFRAME_FIRE2, WEP_CVAR(seeker, tag_animtime), w_ready);
}
}
else
{
- if(weapon_prepareattack(false, WEP_CVAR(seeker, flac_refire)))
+ if(weapon_prepareattack(actor, false, WEP_CVAR(seeker, flac_refire)))
{
W_Seeker_Fire_Flac(thiswep);
- weapon_thinkf(WFRAME_FIRE2, WEP_CVAR(seeker, flac_animtime), w_ready);
+ weapon_thinkf(actor, WFRAME_FIRE2, WEP_CVAR(seeker, flac_animtime), w_ready);
}
}
}
}
METHOD(Seeker, wr_reload, void(entity thiswep))
{
- W_Reload(min(WEP_CVAR(seeker, missile_ammo), WEP_CVAR(seeker, tag_ammo)), SND(RELOAD));
+ W_Reload(self, min(WEP_CVAR(seeker, missile_ammo), WEP_CVAR(seeker, tag_ammo)), SND(RELOAD));
}
METHOD(Seeker, wr_suicidemessage, int(entity thiswep))
{
}
}
-void W_Shockwave_Melee(Weapon thiswep, bool fire1, bool fire2)
-{SELFPARAM();
- sound(self, CH_WEAPON_A, SND_SHOTGUN_MELEE, VOL_BASE, ATTN_NORM);
- weapon_thinkf(WFRAME_FIRE2, WEP_CVAR(shockwave, melee_animtime), w_ready);
+void W_Shockwave_Melee(Weapon thiswep, entity actor, bool fire1, bool fire2)
+{
+ sound(actor, CH_WEAPON_A, SND_SHOTGUN_MELEE, VOL_BASE, ATTN_NORM);
+ weapon_thinkf(actor, WFRAME_FIRE2, WEP_CVAR(shockwave, melee_animtime), w_ready);
entity meleetemp;
meleetemp = spawn();
- meleetemp.owner = meleetemp.realowner = self;
+ meleetemp.owner = meleetemp.realowner = actor;
meleetemp.think = W_Shockwave_Melee_Think;
meleetemp.nextthink = time + WEP_CVAR(shockwave, melee_delay) * W_WeaponRateFactor();
- W_SetupShot_Range(self, true, 0, "", 0, WEP_CVAR(shockwave, melee_damage), WEP_CVAR(shockwave, melee_range));
+ W_SetupShot_Range(actor, true, 0, "", 0, WEP_CVAR(shockwave, melee_damage), WEP_CVAR(shockwave, melee_range));
}
// SHOCKWAVE ATTACK MODE
else
{ self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, false); }
}
- METHOD(Shockwave, wr_think, void(entity thiswep, bool fire1, bool fire2))
+ METHOD(Shockwave, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
{
if(fire1)
{
- if(time >= self.shockwave_blasttime) // handle refire separately so the secondary can be fired straight after a primary
+ if(time >= actor.shockwave_blasttime) // handle refire separately so the secondary can be fired straight after a primary
{
- if(weapon_prepareattack(false, WEP_CVAR(shockwave, blast_animtime)))
+ if(weapon_prepareattack(actor, false, WEP_CVAR(shockwave, blast_animtime)))
{
W_Shockwave_Attack();
- self.shockwave_blasttime = time + WEP_CVAR(shockwave, blast_refire) * W_WeaponRateFactor();
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(shockwave, blast_animtime), w_ready);
+ actor.shockwave_blasttime = time + WEP_CVAR(shockwave, blast_refire) * W_WeaponRateFactor();
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR(shockwave, blast_animtime), w_ready);
}
}
}
else if(fire2)
{
- //if(self.clip_load >= 0) // we are not currently reloading
- if(!self.crouch) // no crouchmelee please
- if(weapon_prepareattack(true, WEP_CVAR(shockwave, melee_refire)))
+ //if(actor.clip_load >= 0) // we are not currently reloading
+ if(!actor.crouch) // no crouchmelee please
+ if(weapon_prepareattack(actor, true, WEP_CVAR(shockwave, melee_refire)))
{
// attempt forcing playback of the anim by switching to another anim (that we never play) here...
- weapon_thinkf(WFRAME_FIRE1, 0, W_Shockwave_Melee);
+ weapon_thinkf(actor, WFRAME_FIRE1, 0, W_Shockwave_Melee);
}
}
}
float sc;
entity flash;
- W_DecreaseAmmo(thiswep, WEP_CVAR_PRI(shotgun, ammo));
+ W_DecreaseAmmo(thiswep, self, WEP_CVAR_PRI(shotgun, ammo));
W_SetupShot(self, true, 5, SND(SHOTGUN_FIRE), ((isprimary) ? CH_WEAPON_A : CH_WEAPON_SINGLE), WEP_CVAR_PRI(shotgun, damage) * WEP_CVAR_PRI(shotgun, bullets));
for(sc = 0;sc < WEP_CVAR_PRI(shotgun, bullets);sc = sc + 1)
flash.think = SUB_Remove;
flash.nextthink = time + 0.06;
flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
- W_AttachToShotorg(flash, '5 0 0');
+ W_AttachToShotorg(self, flash, '5 0 0');
}
.float swing_prev;
}
}
-void W_Shotgun_Attack2(Weapon thiswep, bool fire1, bool fire2)
-{SELFPARAM();
- sound(self, CH_WEAPON_A, SND_SHOTGUN_MELEE, VOL_BASE, ATTEN_NORM);
- weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(shotgun, animtime), w_ready);
+void W_Shotgun_Attack2(Weapon thiswep, entity actor, bool fire1, bool fire2)
+{
+ sound(actor, CH_WEAPON_A, SND_SHOTGUN_MELEE, VOL_BASE, ATTEN_NORM);
+ weapon_thinkf(actor, WFRAME_FIRE2, WEP_CVAR_SEC(shotgun, animtime), w_ready);
entity meleetemp;
meleetemp = spawn();
- meleetemp.realowner = self;
+ meleetemp.realowner = actor;
meleetemp.think = W_Shotgun_Melee_Think;
meleetemp.nextthink = time + WEP_CVAR_SEC(shotgun, melee_delay) * W_WeaponRateFactor();
- W_SetupShot_Range(self, true, 0, "", 0, WEP_CVAR_SEC(shotgun, damage), WEP_CVAR_SEC(shotgun, melee_range));
+ W_SetupShot_Range(actor, true, 0, "", 0, WEP_CVAR_SEC(shotgun, damage), WEP_CVAR_SEC(shotgun, melee_range));
}
// alternate secondary weapon frames
-void W_Shotgun_Attack3_Frame2(Weapon thiswep, bool fire1, bool fire2)
-{SELFPARAM();
- Weapon w = get_weaponinfo(self.weapon);
+void W_Shotgun_Attack3_Frame2(Weapon thiswep, entity actor, bool fire1, bool fire2)
+{
+ Weapon w = get_weaponinfo(actor.weapon);
if (!w.wr_checkammo2(w))
- if (!(self.items & IT_UNLIMITED_WEAPON_AMMO))
+ if (!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
{
- W_SwitchWeapon_Force(self, w_getbestweapon(self));
- w_ready(thiswep, fire1, fire2);
+ W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
+ w_ready(thiswep, actor, fire1, fire2);
return;
}
- sound(self, CH_WEAPON_SINGLE, SND_Null, VOL_BASE, ATTN_NORM); // kill previous sound
+ sound(actor, CH_WEAPON_SINGLE, SND_Null, VOL_BASE, ATTN_NORM); // kill previous sound
W_Shotgun_Attack(WEP_SHOTGUN, true); // actually is secondary, but we trick the last shot into playing full reload sound
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), w_ready);
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), w_ready);
}
-void W_Shotgun_Attack3_Frame1(Weapon thiswep, bool fire1, bool fire2)
-{SELFPARAM();
- Weapon w = get_weaponinfo(self.weapon);
+void W_Shotgun_Attack3_Frame1(Weapon thiswep, entity actor, bool fire1, bool fire2)
+{
+ Weapon w = get_weaponinfo(actor.weapon);
if (!w.wr_checkammo2(w))
- if (!(self.items & IT_UNLIMITED_WEAPON_AMMO))
+ if (!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
{
- W_SwitchWeapon_Force(self, w_getbestweapon(self));
- w_ready(thiswep, fire1, fire2);
+ W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
+ w_ready(thiswep, actor, fire1, fire2);
return;
}
W_Shotgun_Attack(WEP_SHOTGUN, false);
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), W_Shotgun_Attack3_Frame2);
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), W_Shotgun_Attack3_Frame2);
}
.float shotgun_primarytime;
else
self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, false);
}
- METHOD(Shotgun, wr_think, void(entity thiswep, bool fire1, bool fire2))
+ METHOD(Shotgun, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
{
- if(WEP_CVAR(shotgun, reload_ammo) && self.clip_load < WEP_CVAR_PRI(shotgun, ammo)) // forced reload
+ 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) {
- Weapon w = get_weaponinfo(self.weapon);
+ Weapon w = get_weaponinfo(actor.weapon);
w.wr_reload(w);
}
}
{
if(fire1)
{
- if(time >= self.shotgun_primarytime) // handle refire separately so the secondary can be fired straight after a primary
+ if(time >= actor.shotgun_primarytime) // handle refire separately so the secondary can be fired straight after a primary
{
- if(weapon_prepareattack(false, WEP_CVAR_PRI(shotgun, animtime)))
+ if(weapon_prepareattack(actor, false, WEP_CVAR_PRI(shotgun, animtime)))
{
W_Shotgun_Attack(thiswep, true);
- self.shotgun_primarytime = time + WEP_CVAR_PRI(shotgun, refire) * W_WeaponRateFactor();
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(shotgun, animtime), w_ready);
+ actor.shotgun_primarytime = time + WEP_CVAR_PRI(shotgun, refire) * W_WeaponRateFactor();
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(shotgun, animtime), w_ready);
}
}
}
else if(fire2 && WEP_CVAR(shotgun, secondary) == 2)
{
- if(time >= self.shotgun_primarytime) // handle refire separately so the secondary can be fired straight after a primary
+ if(time >= actor.shotgun_primarytime) // handle refire separately so the secondary can be fired straight after a primary
{
- if(weapon_prepareattack(false, WEP_CVAR_SEC(shotgun, alt_animtime)))
+ if(weapon_prepareattack(actor, false, WEP_CVAR_SEC(shotgun, alt_animtime)))
{
W_Shotgun_Attack(thiswep, false);
- self.shotgun_primarytime = time + WEP_CVAR_SEC(shotgun, alt_refire) * W_WeaponRateFactor();
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), W_Shotgun_Attack3_Frame1);
+ actor.shotgun_primarytime = time + WEP_CVAR_SEC(shotgun, alt_refire) * W_WeaponRateFactor();
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), W_Shotgun_Attack3_Frame1);
}
}
}
}
- if(self.clip_load >= 0) // we are not currently reloading
- if(!self.crouch) // no crouchmelee please
+ if(actor.clip_load >= 0) // we are not currently reloading
+ if(!actor.crouch) // no crouchmelee please
if(WEP_CVAR(shotgun, secondary) == 1)
- if((fire1 && self.WEP_AMMO(SHOTGUN) <= 0 && !(self.items & IT_UNLIMITED_WEAPON_AMMO)) || fire2)
- if(weapon_prepareattack(true, WEP_CVAR_SEC(shotgun, refire)))
+ if((fire1 && actor.WEP_AMMO(SHOTGUN) <= 0 && !(actor.items & IT_UNLIMITED_WEAPON_AMMO)) || fire2)
+ if(weapon_prepareattack(actor, true, WEP_CVAR_SEC(shotgun, refire)))
{
// attempt forcing playback of the anim by switching to another anim (that we never play) here...
- weapon_thinkf(WFRAME_FIRE1, 0, W_Shotgun_Attack2);
+ weapon_thinkf(actor, WFRAME_FIRE1, 0, W_Shotgun_Attack2);
}
}
METHOD(Shotgun, wr_init, void(entity thiswep))
}
METHOD(Shotgun, wr_reload, void(entity thiswep))
{
- W_Reload(WEP_CVAR_PRI(shotgun, ammo), SND(RELOAD)); // WEAPONTODO
+ W_Reload(self, WEP_CVAR_PRI(shotgun, ammo), SND(RELOAD)); // WEAPONTODO
}
METHOD(Shotgun, wr_suicidemessage, int(entity thiswep))
{
self.BUTTON_ATCK2 = 1;
}
}
- METHOD(Tuba, wr_think, void(entity thiswep, bool fire1, bool fire2))
+ METHOD(Tuba, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
{
if(fire1)
- if(weapon_prepareattack(false, WEP_CVAR(tuba, refire)))
+ if(weapon_prepareattack(actor, false, WEP_CVAR(tuba, refire)))
{
W_Tuba_NoteOn(0);
- //weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_tuba_animtime, w_ready);
- weapon_thinkf(WFRAME_IDLE, WEP_CVAR(tuba, animtime), w_ready);
+ //weapon_thinkf(actor, WFRAME_FIRE1, autocvar_g_balance_tuba_animtime, w_ready);
+ weapon_thinkf(actor, WFRAME_IDLE, WEP_CVAR(tuba, animtime), w_ready);
}
if(fire2)
- if(weapon_prepareattack(true, WEP_CVAR(tuba, refire)))
+ if(weapon_prepareattack(actor, true, WEP_CVAR(tuba, refire)))
{
W_Tuba_NoteOn(HITTYPE_SECONDARY);
- //weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_tuba_animtime, w_ready);
- weapon_thinkf(WFRAME_IDLE, WEP_CVAR(tuba, animtime), w_ready);
+ //weapon_thinkf(actor, WFRAME_FIRE2, autocvar_g_balance_tuba_animtime, w_ready);
+ weapon_thinkf(actor, WFRAME_IDLE, WEP_CVAR(tuba, animtime), w_ready);
}
- if(self.tuba_note)
+ if(actor.tuba_note)
{
if(!fire1 && !fire2)
{
- WITH(entity, self, self.tuba_note, W_Tuba_NoteOff());
+ WITH(entity, self, actor.tuba_note, W_Tuba_NoteOff());
}
}
}
W_SetupShot(self, false, 0, "", 0, 0);
Send_Effect(EFFECT_TELEPORT, w_shotorg, '0 0 0', 1);
self.weaponentity.state = WS_INUSE;
- weapon_thinkf(WFRAME_RELOAD, 0.5, w_ready);
+ weapon_thinkf(self, WFRAME_RELOAD, 0.5, w_ready);
}
}
METHOD(Tuba, wr_checkammo1, bool(entity thiswep))
if(!(trace_dphitq3surfaceflags & (Q3SURFACEFLAG_SKY | Q3SURFACEFLAG_NOIMPACT)))
W_RocketMinsta_Explosion(trace_endpos);
- W_DecreaseAmmo(thiswep, ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo)));
+ W_DecreaseAmmo(thiswep, self, ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo)));
}
void W_RocketMinsta_Laser_Explode (void)
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, bool fire1, bool fire2))
+ METHOD(Vaporizer, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
{
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) && self.clip_load < min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo))) { // forced reload
- Weapon w = get_weaponinfo(self.weapon);
+ if(WEP_CVAR(vaporizer, reload_ammo) && WEP_CVAR_SEC(vaporizer, ammo) && actor.clip_load < min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo))) { // forced reload
+ Weapon w = get_weaponinfo(actor.weapon);
w.wr_reload(w);
- } else if(WEP_CVAR(vaporizer, reload_ammo) && self.clip_load < vaporizer_ammo) { // forced reload
- Weapon w = get_weaponinfo(self.weapon);
+ } else if(WEP_CVAR(vaporizer, reload_ammo) && actor.clip_load < vaporizer_ammo) { // forced reload
+ Weapon w = get_weaponinfo(actor.weapon);
w.wr_reload(w);
}
- if(fire1 && (self.ammo_cells || !autocvar_g_rm) && !forbidWeaponUse(self))
+ if(fire1 && (actor.ammo_cells || !autocvar_g_rm) && !forbidWeaponUse(actor))
{
- if(weapon_prepareattack(false, WEP_CVAR_PRI(vaporizer, refire)))
+ if(weapon_prepareattack(actor, false, WEP_CVAR_PRI(vaporizer, refire)))
{
W_Vaporizer_Attack(thiswep);
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(vaporizer, animtime), w_ready);
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(vaporizer, animtime), w_ready);
}
}
- if(fire2 || (fire1 && !self.ammo_cells && autocvar_g_rm))
+ if(fire2 || (fire1 && !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(self.jump_interval <= time && !self.held_down)
+ if(actor.jump_interval <= time && !actor.held_down)
{
if(rapid)
- self.held_down = true;
- self.jump_interval = time + autocvar_g_rm_laser_refire;
- self.jump_interval2 = time + autocvar_g_rm_laser_rapid_delay;
+ 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 && self.jump_interval2 <= time && self.held_down)
+ else if(rapid && actor.jump_interval2 <= time && actor.held_down)
{
- self.jump_interval2 = time + autocvar_g_rm_laser_rapid_refire;
+ actor.jump_interval2 = time + autocvar_g_rm_laser_rapid_refire;
damage_goodhits = 0;
W_RocketMinsta_Attack3();
- //weapon_thinkf(WFRAME_FIRE2, autocvar_g_rm_laser_rapid_animtime, w_ready);
+ //weapon_thinkf(actor, WFRAME_FIRE2, autocvar_g_rm_laser_rapid_animtime, w_ready);
}
}
- else if (self.jump_interval <= time)
+ else if (actor.jump_interval <= time)
{
// handle refire manually, so that primary and secondary can be fired without conflictions (important for instagib)
- self.jump_interval = time + WEP_CVAR_SEC(vaporizer, refire) * W_WeaponRateFactor();
+ 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, 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(self.v_angle);
- int oldwep = self.weapon; // we can't avoid this hack
- self.weapon = WEP_BLASTER.m_id;
+ makevectors(actor.v_angle);
+ int oldwep = actor.weapon; // we can't avoid this hack
+ actor.weapon = WEP_BLASTER.m_id;
W_Blaster_Attack(
+ actor,
WEP_BLASTER.m_id | HITTYPE_SECONDARY,
WEP_CVAR_SEC(vaporizer, shotangle),
WEP_CVAR_SEC(vaporizer, damage),
WEP_CVAR_SEC(vaporizer, delay),
WEP_CVAR_SEC(vaporizer, lifetime)
);
- self.weapon = oldwep;
+ actor.weapon = oldwep;
// now do normal refire
- weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(vaporizer, animtime), w_ready);
+ weapon_thinkf(actor, WFRAME_FIRE2, WEP_CVAR_SEC(vaporizer, animtime), w_ready);
}
}
else
- self.held_down = false;
+ actor.held_down = false;
}
METHOD(Vaporizer, wr_init, void(entity thiswep))
{
else
used_ammo = vaporizer_ammo;
- W_Reload(used_ammo, SND(RELOAD));
+ W_Reload(self, used_ammo, SND(RELOAD));
}
METHOD(Vaporizer, wr_suicidemessage, int(entity thiswep))
{
//beam and muzzle flash done on client
SendCSQCVortexBeamParticle(charge);
- W_DecreaseAmmo(thiswep, myammo);
+ W_DecreaseAmmo(thiswep, self, myammo);
}
.float vortex_chargepool_pauseregen_finished;
self.BUTTON_ATCK2 = true;
}
}
- METHOD(Vortex, wr_think, void(entity thiswep, bool fire1, bool fire2))
+ METHOD(Vortex, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
{
- if(WEP_CVAR(vortex, charge) && self.vortex_charge < WEP_CVAR(vortex, charge_limit))
- self.vortex_charge = min(1, self.vortex_charge + WEP_CVAR(vortex, charge_rate) * frametime / W_TICSPERFRAME);
+ 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(self.vortex_chargepool_ammo < 1)
+ if(actor.vortex_chargepool_ammo < 1)
{
- if(self.vortex_chargepool_pauseregen_finished < time)
- self.vortex_chargepool_ammo = min(1, self.vortex_chargepool_ammo + WEP_CVAR_SEC(vortex, chargepool_regen) * frametime / W_TICSPERFRAME);
- self.pauseregen_finished = max(self.pauseregen_finished, time + WEP_CVAR_SEC(vortex, chargepool_pause_regen));
+ 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 && self.clip_load < min(WEP_CVAR_PRI(vortex, ammo), WEP_CVAR_SEC(vortex, ammo))) { // forced reload
- Weapon w = get_weaponinfo(self.weapon);
+ if(autocvar_g_balance_vortex_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(vortex, ammo), WEP_CVAR_SEC(vortex, ammo))) { // forced reload
+ Weapon w = get_weaponinfo(actor.weapon);
w.wr_reload(w);
} else
{
if(fire1)
{
- if(weapon_prepareattack(false, WEP_CVAR_PRI(vortex, refire)))
+ if(weapon_prepareattack(actor, false, WEP_CVAR_PRI(vortex, refire)))
{
W_Vortex_Attack(thiswep, 0);
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(vortex, animtime), w_ready);
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(vortex, animtime), w_ready);
}
}
- if((WEP_CVAR(vortex, charge) && !WEP_CVAR(vortex, secondary)) ? (self.BUTTON_ZOOM | self.BUTTON_ZOOMSCRIPT) : fire2)
+ if((WEP_CVAR(vortex, charge) && !WEP_CVAR(vortex, secondary)) ? (actor.BUTTON_ZOOM | actor.BUTTON_ZOOMSCRIPT) : fire2)
{
if(WEP_CVAR(vortex, charge))
{
- self.vortex_charge_rottime = time + WEP_CVAR(vortex, charge_rot_pause);
+ actor.vortex_charge_rottime = time + WEP_CVAR(vortex, charge_rot_pause);
float dt = frametime / W_TICSPERFRAME;
- if(self.vortex_charge < 1)
+ if(actor.vortex_charge < 1)
{
if(WEP_CVAR_SEC(vortex, chargepool))
{
if(WEP_CVAR_SEC(vortex, ammo))
{
// always deplete if secondary is held
- self.vortex_chargepool_ammo = max(0, self.vortex_chargepool_ammo - WEP_CVAR_SEC(vortex, ammo) * dt);
+ actor.vortex_chargepool_ammo = max(0, actor.vortex_chargepool_ammo - WEP_CVAR_SEC(vortex, ammo) * dt);
- dt = min(dt, (1 - self.vortex_charge) / WEP_CVAR(vortex, charge_rate));
- self.vortex_chargepool_pauseregen_finished = time + WEP_CVAR_SEC(vortex, chargepool_pause_regen);
- dt = min(dt, self.vortex_chargepool_ammo);
+ 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);
- self.vortex_charge += dt * WEP_CVAR(vortex, charge_rate);
+ actor.vortex_charge += dt * WEP_CVAR(vortex, charge_rate);
}
}
{
if(fire2) // only eat ammo when the button is pressed
{
- dt = min(dt, (1 - self.vortex_charge) / WEP_CVAR(vortex, charge_rate));
- if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
+ 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, (self.clip_load - WEP_CVAR_PRI(vortex, ammo)) / WEP_CVAR_SEC(vortex, ammo));
+ dt = min(dt, (actor.clip_load - WEP_CVAR_PRI(vortex, ammo)) / WEP_CVAR_SEC(vortex, ammo));
dt = max(0, dt);
if(dt > 0)
{
- self.clip_load = max(WEP_CVAR_SEC(vortex, ammo), self.clip_load - WEP_CVAR_SEC(vortex, ammo) * dt);
+ actor.clip_load = max(WEP_CVAR_SEC(vortex, ammo), actor.clip_load - WEP_CVAR_SEC(vortex, ammo) * dt);
}
- self.(weapon_load[WEP_VORTEX.m_id]) = self.clip_load;
+ actor.(weapon_load[WEP_VORTEX.m_id]) = actor.clip_load;
}
else
{
- dt = min(dt, (self.WEP_AMMO(VORTEX) - WEP_CVAR_PRI(vortex, ammo)) / WEP_CVAR_SEC(vortex, ammo));
+ dt = min(dt, (actor.WEP_AMMO(VORTEX) - WEP_CVAR_PRI(vortex, ammo)) / WEP_CVAR_SEC(vortex, ammo));
dt = max(0, dt);
if(dt > 0)
{
- self.WEP_AMMO(VORTEX) = max(WEP_CVAR_SEC(vortex, ammo), self.WEP_AMMO(VORTEX) - WEP_CVAR_SEC(vortex, ammo) * dt);
+ actor.WEP_AMMO(VORTEX) = max(WEP_CVAR_SEC(vortex, ammo), actor.WEP_AMMO(VORTEX) - WEP_CVAR_SEC(vortex, ammo) * dt);
}
}
}
- self.vortex_charge += dt * WEP_CVAR(vortex, charge_rate);
+ actor.vortex_charge += dt * WEP_CVAR(vortex, charge_rate);
}
}
else
{
- dt = min(dt, (1 - self.vortex_charge) / WEP_CVAR(vortex, charge_rate));
- self.vortex_charge += dt * WEP_CVAR(vortex, charge_rate);
+ 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(false, WEP_CVAR_SEC(vortex, refire)))
+ if(weapon_prepareattack(actor, false, WEP_CVAR_SEC(vortex, refire)))
{
W_Vortex_Attack(thiswep, 1);
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_SEC(vortex, animtime), w_ready);
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_SEC(vortex, animtime), w_ready);
}
}
}
}
METHOD(Vortex, wr_reload, void(entity thiswep))
{
- W_Reload(min(WEP_CVAR_PRI(vortex, ammo), WEP_CVAR_SEC(vortex, ammo)), SND(RELOAD));
+ W_Reload(self, min(WEP_CVAR_PRI(vortex, ammo), WEP_CVAR_SEC(vortex, ammo)), SND(RELOAD));
}
METHOD(Vortex, wr_suicidemessage, int(entity thiswep))
{
{
self.items &= ~self.items_added;
- W_WeaponFrame();
+ W_WeaponFrame(self);
self.items_added = 0;
if(self.items & ITEM_Jetpack.m_itemid)
// WEAPONTODO
.float autoswitch;
float client_hasweapon(entity cl, float wpn, float andammo, float complain);
-void w_clear(Weapon thiswep, bool fire1, bool fire2);
-void w_ready(Weapon thiswep, bool fire1, bool fire2);
+void w_clear(Weapon thiswep, entity actor, bool fire1, bool fire2);
+void w_ready(Weapon thiswep, entity actor, bool fire1, bool fire2);
// VorteX: standalone think for weapons, so normal think on weaponentity can be reserved by weaponflashes (which needs update even player dies)
.float weapon_nextthink;
-.void(Weapon thiswep, bool fire1, bool fire2) weapon_think;
+.void(Weapon thiswep, entity actor, bool fire1, bool fire2) weapon_think;
// weapon states (self.weaponentity.state)
return true;
}
- METHOD(BallStealer, wr_think, void(BallStealer thiswep, bool fire1, bool fire2))
+ METHOD(BallStealer, wr_think, void(BallStealer thiswep, entity actor, bool fire1, bool fire2))
{
if(fire1)
- if(weapon_prepareattack(false, autocvar_g_balance_nexball_primary_refire))
+ if(weapon_prepareattack(actor, false, autocvar_g_balance_nexball_primary_refire))
if(autocvar_g_nexball_basketball_meter)
{
if(self.ballcarried && !self.metertime)
self.metertime = time;
else
- weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
+ weapon_thinkf(actor, WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
}
else
{
W_Nexball_Attack(-1);
- weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
+ weapon_thinkf(actor, WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
}
if(fire2)
- if(weapon_prepareattack(true, autocvar_g_balance_nexball_secondary_refire))
+ if(weapon_prepareattack(actor, true, autocvar_g_balance_nexball_secondary_refire))
{
W_Nexball_Attack2();
- weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_nexball_secondary_animtime, w_ready);
+ weapon_thinkf(actor, WFRAME_FIRE2, autocvar_g_balance_nexball_secondary_animtime, w_ready);
}
if(!fire1 && self.metertime && self.ballcarried)
{
W_Nexball_Attack(time - self.metertime);
// DropBall or stealing will set metertime back to 0
- weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
+ weapon_thinkf(actor, WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
}
}
METHOD(BallStealer, wr_setup, void(BallStealer thiswep))
#include "mutator.qh"
-void W_Blaster_Attack(float, float, float, float, float, float, float, float, float, float);
+void W_Blaster_Attack(entity, float, float, float, float, float, float, float, float, float, float);
void spawnfunc_weapon_hmg();
void spawnfunc_weapon_rpc();
int oldwep = self.weapon;
self.weapon = WEP_BLASTER.m_id;
W_Blaster_Attack(
+ self,
WEP_BLASTER.m_id | HITTYPE_SECONDARY,
WEP_CVAR_SEC(vaporizer, shotangle),
WEP_CVAR_SEC(vaporizer, damage),
}
Weapon wpn = get_weaponinfo(self.weapon);
if(self.weaponentity.state != WS_CLEAR)
- w_ready(wpn, self.BUTTON_ATCK, self.BUTTON_ATCK2);
+ w_ready(wpn, self, self.BUTTON_ATCK, self.BUTTON_ATCK2);
self.weapon_blocked = true;
}
}
-void weapon_thinkf(float fr, float t, void(Weapon thiswep, bool fire1, bool fire2) func);
+void weapon_thinkf(entity actor, float fr, float t, void(Weapon thiswep, entity actor, bool fire1, bool fire2) func);
float CL_Weaponentity_CustomizeEntityForClient()
{SELFPARAM();
}
// Weapon subs
-void w_clear(Weapon thiswep, bool fire1, bool fire2)
-{SELFPARAM();
- if (self.weapon != -1)
+void w_clear(Weapon thiswep, entity actor, bool fire1, bool fire2)
+{
+ if (actor.weapon != -1)
{
- self.weapon = 0;
- self.switchingweapon = 0;
+ actor.weapon = 0;
+ actor.switchingweapon = 0;
}
- if (self.weaponentity)
+ if (actor.weaponentity)
{
- self.weaponentity.state = WS_CLEAR;
- self.weaponentity.effects = 0;
+ actor.weaponentity.state = WS_CLEAR;
+ actor.weaponentity.effects = 0;
}
}
-void w_ready(Weapon thiswep, bool fire1, bool fire2)
-{SELFPARAM();
- if (self.weaponentity)
- self.weaponentity.state = WS_READY;
- weapon_thinkf(WFRAME_IDLE, 1000000, w_ready);
+void w_ready(Weapon thiswep, entity actor, bool fire1, bool fire2)
+{
+ if (actor.weaponentity)
+ actor.weaponentity.state = WS_READY;
+ weapon_thinkf(actor, WFRAME_IDLE, 1000000, w_ready);
}
.float prevdryfire;
.float prevwarntime;
-float weapon_prepareattack_checkammo(float secondary)
-{SELFPARAM();
- Weapon w = get_weaponinfo(self.weapon);
- if (!(self.items & IT_UNLIMITED_WEAPON_AMMO))
+bool weapon_prepareattack_checkammo(entity actor, float secondary)
+{
+ Weapon w = get_weaponinfo(actor.weapon);
+ if (!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
if (!w.(secondary ? wr_checkammo2 : wr_checkammo1)(w))
{
// always keep the Mine Layer if we placed mines, so that we can detonate them
entity mine;
- if(self.weapon == WEP_MINE_LAYER.m_id)
- for(mine = world; (mine = find(mine, classname, "mine")); ) if(mine.owner == self)
+ if(actor.weapon == WEP_MINE_LAYER.m_id)
+ for(mine = world; (mine = find(mine, classname, "mine")); ) if(mine.owner == actor)
return false;
- if(self.weapon == WEP_SHOTGUN.m_id)
+ if(actor.weapon == WEP_SHOTGUN.m_id)
if(!secondary && WEP_CVAR(shotgun, secondary) == 1)
return false; // no clicking, just allow
- if(self.weapon == self.switchweapon && time - self.prevdryfire > 1) // only play once BEFORE starting to switch weapons
+ if(actor.weapon == actor.switchweapon && time - actor.prevdryfire > 1) // only play once BEFORE starting to switch weapons
{
- sound (self, CH_WEAPON_A, SND_DRYFIRE, VOL_BASE, ATTEN_NORM);
- self.prevdryfire = time;
+ sound (actor, CH_WEAPON_A, SND_DRYFIRE, VOL_BASE, ATTEN_NORM);
+ actor.prevdryfire = time;
}
if(w.(secondary ? wr_checkammo1 : wr_checkammo2)(w)) // check if the other firing mode has enough ammo
{
- if(time - self.prevwarntime > 1)
+ if(time - actor.prevwarntime > 1)
{
Send_Notification(
NOTIF_ONE,
- self,
+ actor,
MSG_MULTI,
ITEM_WEAPON_PRIMORSEC,
- self.weapon,
+ actor.weapon,
secondary,
(1 - secondary)
);
}
- self.prevwarntime = time;
+ actor.prevwarntime = time;
}
else // this weapon is totally unable to fire, switch to another one
{
- W_SwitchToOtherWeapon(self);
+ W_SwitchToOtherWeapon(actor);
}
return false;
return true;
}
.float race_penalty;
-float weapon_prepareattack_check(float secondary, float attacktime)
-{SELFPARAM();
- if(!weapon_prepareattack_checkammo(secondary))
+bool weapon_prepareattack_check(entity actor, bool secondary, float attacktime)
+{
+ if(!weapon_prepareattack_checkammo(actor, secondary))
return false;
//if sv_ready_restart_after_countdown is set, don't allow the player to shoot
//if all players readied up and the countdown is running
- if(time < game_starttime || time < self.race_penalty) {
+ if(time < game_starttime || time < actor.race_penalty) {
return false;
}
return false;
// do not even think about shooting if switching
- if(self.switchweapon != self.weapon)
+ if(actor.switchweapon != actor.weapon)
return false;
if(attacktime >= 0)
{
// don't fire if previous attack is not finished
- if (ATTACK_FINISHED(self) > time + self.weapon_frametime * 0.5)
+ if (ATTACK_FINISHED(actor) > time + actor.weapon_frametime * 0.5)
return false;
// don't fire while changing weapon
- if (self.weaponentity.state != WS_READY)
+ if (actor.weaponentity.state != WS_READY)
return false;
}
-
return true;
}
-float weapon_prepareattack_do(float secondary, float attacktime)
-{SELFPARAM();
- self.weaponentity.state = WS_INUSE;
+void weapon_prepareattack_do(entity actor, bool secondary, float attacktime)
+{
+ actor.weaponentity.state = WS_INUSE;
- self.spawnshieldtime = min(self.spawnshieldtime, time); // kill spawn shield when you fire
+ actor.spawnshieldtime = min(actor.spawnshieldtime, time); // kill spawn shield when you fire
// if the weapon hasn't been firing continuously, reset the timer
if(attacktime >= 0)
{
- if (ATTACK_FINISHED(self) < time - self.weapon_frametime * 1.5)
+ if (ATTACK_FINISHED(actor) < time - actor.weapon_frametime * 1.5)
{
- ATTACK_FINISHED(self) = time;
+ ATTACK_FINISHED(actor) = time;
//dprint("resetting attack finished to ", ftos(time), "\n");
}
- ATTACK_FINISHED(self) = ATTACK_FINISHED(self) + attacktime * W_WeaponRateFactor();
+ ATTACK_FINISHED(actor) = ATTACK_FINISHED(actor) + attacktime * W_WeaponRateFactor();
}
- self.bulletcounter += 1;
- //dprint("attack finished ", ftos(ATTACK_FINISHED(self)), "\n");
- return true;
+ actor.bulletcounter += 1;
+ //dprint("attack finished ", ftos(ATTACK_FINISHED(actor)), "\n");
}
-float weapon_prepareattack(float secondary, float attacktime)
+bool weapon_prepareattack(entity actor, bool secondary, float attacktime)
{
- if(weapon_prepareattack_check(secondary, attacktime))
- {
- weapon_prepareattack_do(secondary, attacktime);
+ if (weapon_prepareattack_check(actor, secondary, attacktime)) {
+ weapon_prepareattack_do(actor, secondary, attacktime);
return true;
}
- else
- return false;
+ return false;
}
-void weapon_thinkf(float fr, float t, void(Weapon thiswep, bool fire1, bool fire2) func)
-{SELFPARAM();
+void weapon_thinkf(entity actor, float fr, float t, void(Weapon thiswep, entity actor, bool fire1, bool fire2) func)
+{
vector a;
vector of, or, ou;
float restartanim;
if(fr == WFRAME_DONTCHANGE)
{
- fr = self.weaponentity.wframe;
+ fr = actor.weaponentity.wframe;
restartanim = false;
}
else if (fr == WFRAME_IDLE)
or = v_right;
ou = v_up;
- if (self.weaponentity)
+ if (actor.weaponentity)
{
- self.weaponentity.wframe = fr;
+ actor.weaponentity.wframe = fr;
a = '0 0 0';
if (fr == WFRAME_IDLE)
- a = self.weaponentity.anim_idle;
+ a = actor.weaponentity.anim_idle;
else if (fr == WFRAME_FIRE1)
- a = self.weaponentity.anim_fire1;
+ a = actor.weaponentity.anim_fire1;
else if (fr == WFRAME_FIRE2)
- a = self.weaponentity.anim_fire2;
+ a = actor.weaponentity.anim_fire2;
else // if (fr == WFRAME_RELOAD)
- a = self.weaponentity.anim_reload;
+ a = actor.weaponentity.anim_reload;
a.z *= g_weaponratefactor;
- setanim(self.weaponentity, a, restartanim == false, restartanim, restartanim);
+ setanim(actor.weaponentity, a, restartanim == false, restartanim, restartanim);
}
v_forward = of;
v_right = or;
v_up = ou;
- if(self.weapon_think == w_ready && func != w_ready && self.weaponentity.state == WS_RAISE)
+ if(actor.weapon_think == w_ready && func != w_ready && actor.weaponentity.state == WS_RAISE)
{
backtrace("Tried to override initial weapon think function - should this really happen?");
}
t *= W_WeaponRateFactor();
// VorteX: haste can be added here
- if (self.weapon_think == w_ready)
+ if (actor.weapon_think == w_ready)
{
- self.weapon_nextthink = time;
+ actor.weapon_nextthink = time;
//dprint("started firing at ", ftos(time), "\n");
}
- if (self.weapon_nextthink < time - self.weapon_frametime * 1.5 || self.weapon_nextthink > time + self.weapon_frametime * 1.5)
+ if (actor.weapon_nextthink < time - actor.weapon_frametime * 1.5 || actor.weapon_nextthink > time + actor.weapon_frametime * 1.5)
{
- self.weapon_nextthink = time;
+ actor.weapon_nextthink = time;
//dprint("reset weapon animation timer at ", ftos(time), "\n");
}
- self.weapon_nextthink = self.weapon_nextthink + t;
- self.weapon_think = func;
- //dprint("next ", ftos(self.weapon_nextthink), "\n");
+ actor.weapon_nextthink = actor.weapon_nextthink + t;
+ actor.weapon_think = func;
+ //dprint("next ", ftos(actor.weapon_nextthink), "\n");
if((fr == WFRAME_FIRE1 || fr == WFRAME_FIRE2) && t)
{
- if((self.weapon == WEP_SHOCKWAVE.m_id || self.weapon == WEP_SHOTGUN.m_id) && fr == WFRAME_FIRE2)
- animdecide_setaction(self, ANIMACTION_MELEE, restartanim);
+ if((actor.weapon == WEP_SHOCKWAVE.m_id || actor.weapon == WEP_SHOTGUN.m_id) && fr == WFRAME_FIRE2)
+ animdecide_setaction(actor, ANIMACTION_MELEE, restartanim);
else
- animdecide_setaction(self, ANIMACTION_SHOOT, restartanim);
+ animdecide_setaction(actor, ANIMACTION_SHOOT, restartanim);
}
else
{
- if(self.anim_upper_action == ANIMACTION_SHOOT || self.anim_upper_action == ANIMACTION_MELEE)
- self.anim_upper_action = 0;
+ if(actor.anim_upper_action == ANIMACTION_SHOOT || actor.anim_upper_action == ANIMACTION_MELEE)
+ actor.anim_upper_action = 0;
}
}
return 0;
}
-void W_WeaponFrame()
-{SELFPARAM();
+void W_WeaponFrame(entity actor)
+{
vector fo, ri, up;
if (frametime)
- self.weapon_frametime = frametime;
+ actor.weapon_frametime = frametime;
- if (!self.weaponentity || self.health < 1)
+ if (!actor.weaponentity || actor.health < 1)
return; // Dead player can't use weapons and injure impulse commands
- if(forbidWeaponUse(self))
- if(self.weaponentity.state != WS_CLEAR)
+ if(forbidWeaponUse(actor))
+ if(actor.weaponentity.state != WS_CLEAR)
{
- Weapon wpn = get_weaponinfo(self.weapon);
- w_ready(wpn, self.BUTTON_ATCK, self.BUTTON_ATCK2);
+ Weapon wpn = get_weaponinfo(actor.weapon);
+ w_ready(wpn, actor, actor.BUTTON_ATCK, actor.BUTTON_ATCK2);
return;
}
- if(!self.switchweapon)
+ if(!actor.switchweapon)
{
- self.weapon = 0;
- self.switchingweapon = 0;
- self.weaponentity.state = WS_CLEAR;
- self.weaponname = "";
- //self.items &= ~IT_AMMO;
+ actor.weapon = 0;
+ actor.switchingweapon = 0;
+ actor.weaponentity.state = WS_CLEAR;
+ actor.weaponname = "";
+ //actor.items &= ~IT_AMMO;
return;
}
- makevectors(self.v_angle);
+ makevectors(actor.v_angle);
fo = v_forward; // save them in case the weapon think functions change it
ri = v_right;
up = v_up;
// Change weapon
- if (self.weapon != self.switchweapon)
+ if (actor.weapon != actor.switchweapon)
{
- if (self.weaponentity.state == WS_CLEAR)
+ if (actor.weaponentity.state == WS_CLEAR)
{
// end switching!
- self.switchingweapon = self.switchweapon;
- entity newwep = get_weaponinfo(self.switchweapon);
+ actor.switchingweapon = actor.switchweapon;
+ entity newwep = get_weaponinfo(actor.switchweapon);
// the two weapon entities will notice this has changed and update their models
- self.weapon = self.switchweapon;
- self.weaponname = newwep.mdl;
- self.bulletcounter = 0;
- self.ammo_field = newwep.ammo_field;
- Weapon w = get_weaponinfo(self.switchweapon);
+ actor.weapon = actor.switchweapon;
+ actor.weaponname = newwep.mdl;
+ actor.bulletcounter = 0;
+ actor.ammo_field = newwep.ammo_field;
+ Weapon w = get_weaponinfo(actor.switchweapon);
w.wr_setup(w);
- self.weaponentity.state = WS_RAISE;
+ actor.weaponentity.state = WS_RAISE;
// set our clip load to the load of the weapon we switched to, if it's reloadable
if(newwep.spawnflags & WEP_FLAG_RELOADABLE && newwep.reloading_ammo) // prevent accessing undefined cvars
{
- self.clip_load = self.(weapon_load[self.switchweapon]);
- self.clip_size = newwep.reloading_ammo;
+ actor.clip_load = actor.(weapon_load[actor.switchweapon]);
+ actor.clip_size = newwep.reloading_ammo;
}
else
- self.clip_load = self.clip_size = 0;
+ actor.clip_load = actor.clip_size = 0;
- weapon_thinkf(WFRAME_IDLE, newwep.switchdelay_raise, w_ready);
+ weapon_thinkf(actor, WFRAME_IDLE, newwep.switchdelay_raise, w_ready);
}
- else if (self.weaponentity.state == WS_DROP)
+ else if (actor.weaponentity.state == WS_DROP)
{
// in dropping phase we can switch at any time
- self.switchingweapon = self.switchweapon;
+ actor.switchingweapon = actor.switchweapon;
}
- else if (self.weaponentity.state == WS_READY)
+ else if (actor.weaponentity.state == WS_READY)
{
// start switching!
- self.switchingweapon = self.switchweapon;
- entity oldwep = get_weaponinfo(self.weapon);
+ actor.switchingweapon = actor.switchweapon;
+ entity oldwep = get_weaponinfo(actor.weapon);
// set up weapon switch think in the future, and start drop anim
#ifndef INDEPENDENT_ATTACK_FINISHED
- if(ATTACK_FINISHED(self) <= time + self.weapon_frametime * 0.5)
+ if(ATTACK_FINISHED(actor) <= time + actor.weapon_frametime * 0.5)
{
#endif
- sound(self, CH_WEAPON_SINGLE, SND_WEAPON_SWITCH, VOL_BASE, ATTN_NORM);
- self.weaponentity.state = WS_DROP;
- weapon_thinkf(WFRAME_DONTCHANGE, oldwep.switchdelay_drop, w_clear);
+ sound(actor, CH_WEAPON_SINGLE, SND_WEAPON_SWITCH, VOL_BASE, ATTN_NORM);
+ actor.weaponentity.state = WS_DROP;
+ weapon_thinkf(actor, WFRAME_DONTCHANGE, oldwep.switchdelay_drop, w_clear);
#ifndef INDEPENDENT_ATTACK_FINISHED
}
#endif
}
// LordHavoc: network timing test code
- //if (self.button0)
- // print(ftos(frametime), " ", ftos(time), " >= ", ftos(ATTACK_FINISHED(self)), " >= ", ftos(self.weapon_nextthink), "\n");
+ //if (actor.button0)
+ // print(ftos(frametime), " ", ftos(time), " >= ", ftos(ATTACK_FINISHED(actor)), " >= ", ftos(actor.weapon_nextthink), "\n");
float w;
- w = self.weapon;
+ w = actor.weapon;
// call the think code which may fire the weapon
// and do so multiple times to resolve framerate dependency issues if the
while (c < W_TICSPERFRAME)
{
c = c + 1;
- if(w && !(self.weapons & WepSet_FromWeapon(w)))
+ if(w && !(actor.weapons & WepSet_FromWeapon(w)))
{
- if(self.weapon == self.switchweapon)
- W_SwitchWeapon_Force(self, w_getbestweapon(self));
+ if(actor.weapon == actor.switchweapon)
+ W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
w = 0;
}
v_up = up;
{
- bool key_pressed = self.BUTTON_HOOK;
- Weapon wpn = self.offhand;
- if (wpn.offhand_think) wpn.offhand_think(wpn, self, key_pressed);
+ bool key_pressed = actor.BUTTON_HOOK;
+ Weapon wpn = actor.offhand;
+ if (wpn.offhand_think) wpn.offhand_think(wpn, actor, key_pressed);
}
if (w) {
- Weapon e = get_weaponinfo(self.weapon);
- e.wr_think(e, self.BUTTON_ATCK, self.BUTTON_ATCK2);
+ Weapon e = get_weaponinfo(actor.weapon);
+ e.wr_think(e, actor, actor.BUTTON_ATCK, actor.BUTTON_ATCK2);
} else {
- Weapon w = get_weaponinfo(self.weapon);
+ Weapon w = get_weaponinfo(actor.weapon);
w.wr_gonethink(w);
}
- if (time + self.weapon_frametime * 0.5 >= self.weapon_nextthink)
+ if (time + actor.weapon_frametime * 0.5 >= actor.weapon_nextthink)
{
- if(self.weapon_think)
+ if(actor.weapon_think)
{
v_forward = fo;
v_right = ri;
v_up = up;
- Weapon wpn = get_weaponinfo(self.weapon);
- self.weapon_think(wpn, self.BUTTON_ATCK, self.BUTTON_ATCK2);
+ Weapon wpn = get_weaponinfo(actor.weapon);
+ actor.weapon_think(wpn, actor, actor.BUTTON_ATCK, actor.BUTTON_ATCK2);
}
else
- bprint("\{1}^1ERROR: undefined weapon think function for ", self.netname, "\n");
+ bprint("\{1}^1ERROR: undefined weapon think function for ", actor.netname, "\n");
}
}
}
-void W_AttachToShotorg(entity flash, vector offset)
-{SELFPARAM();
+void W_AttachToShotorg(entity actor, entity flash, vector offset)
+{
entity xflash;
- flash.owner = self;
+ flash.owner = actor;
flash.angles_z = random() * 360;
- if(gettagindex(self.weaponentity, "shot"))
- setattachment(flash, self.weaponentity, "shot");
+ if(gettagindex(actor.weaponentity, "shot"))
+ setattachment(flash, actor.weaponentity, "shot");
else
- setattachment(flash, self.weaponentity, "tag_shot");
+ setattachment(flash, actor.weaponentity, "tag_shot");
setorigin(flash, offset);
xflash = spawn();
copyentity(flash, xflash);
- flash.viewmodelforclient = self;
+ flash.viewmodelforclient = actor;
- if(self.weaponentity.oldorigin.x > 0)
+ if(actor.weaponentity.oldorigin.x > 0)
{
- setattachment(xflash, self.exteriorweaponentity, "");
- setorigin(xflash, self.weaponentity.oldorigin + offset);
+ setattachment(xflash, actor.exteriorweaponentity, "");
+ setorigin(xflash, actor.weaponentity.oldorigin + offset);
}
else
{
- if(gettagindex(self.exteriorweaponentity, "shot"))
- setattachment(xflash, self.exteriorweaponentity, "shot");
+ if(gettagindex(actor.exteriorweaponentity, "shot"))
+ setattachment(xflash, actor.exteriorweaponentity, "shot");
else
- setattachment(xflash, self.exteriorweaponentity, "tag_shot");
+ setattachment(xflash, actor.exteriorweaponentity, "tag_shot");
setorigin(xflash, offset);
}
}
-void W_DecreaseAmmo(Weapon wep, float ammo_use)
-{SELFPARAM();
+void W_DecreaseAmmo(Weapon wep, entity actor, float ammo_use)
+{
if(cvar("g_overkill"))
- if(self.ok_use_ammocharge)
+ if(actor.ok_use_ammocharge)
{
- ok_DecreaseCharge(self, self.weapon);
+ ok_DecreaseCharge(actor, actor.weapon);
return; // TODO
}
- if((self.items & IT_UNLIMITED_WEAPON_AMMO) && !wep.reloading_ammo)
+ if((actor.items & IT_UNLIMITED_WEAPON_AMMO) && !wep.reloading_ammo)
return;
// if this weapon is reloadable, decrease its load. Else decrease the player's ammo
if(wep.reloading_ammo)
{
- self.clip_load -= ammo_use;
- self.(weapon_load[self.weapon]) = self.clip_load;
+ actor.clip_load -= ammo_use;
+ actor.(weapon_load[actor.weapon]) = actor.clip_load;
}
else if(wep.ammo_field != ammo_none)
{
- self.(wep.ammo_field) -= ammo_use;
- if(self.(wep.ammo_field) < 0)
+ actor.(wep.ammo_field) -= ammo_use;
+ if(actor.(wep.ammo_field) < 0)
{
backtrace(sprintf(
"W_DecreaseAmmo(%.2f): '%s' subtracted too much %s from '%s', resulting with '%.2f' left... "
ammo_use,
wep.netname,
GetAmmoPicture(wep.ammo_field),
- self.netname,
- self.(wep.ammo_field)
+ actor.netname,
+ actor.(wep.ammo_field)
));
}
}
.float reload_complain;
.string reload_sound;
-void W_ReloadedAndReady(Weapon thiswep, bool fire1, bool fire2)
-{SELFPARAM();
+void W_ReloadedAndReady(Weapon thiswep, entity actor, bool fire1, bool fire2)
+{
// finish the reloading process, and do the ammo transfer
- self.clip_load = self.old_clip_load; // restore the ammo counter, in case we still had ammo in the weapon before reloading
+ actor.clip_load = actor.old_clip_load; // restore the ammo counter, in case we still had ammo in the weapon before reloading
// if the gun uses no ammo, max out weapon load, else decrease ammo as we increase weapon load
- if(!self.reload_ammo_min || self.items & IT_UNLIMITED_WEAPON_AMMO || self.ammo_field == ammo_none)
- self.clip_load = self.reload_ammo_amount;
+ if(!actor.reload_ammo_min || actor.items & IT_UNLIMITED_WEAPON_AMMO || actor.ammo_field == ammo_none)
+ actor.clip_load = actor.reload_ammo_amount;
else
{
// make sure we don't add more ammo than we have
- float load = min(self.reload_ammo_amount - self.clip_load, self.(self.ammo_field));
- self.clip_load += load;
- self.(self.ammo_field) -= load;
+ float load = min(actor.reload_ammo_amount - actor.clip_load, actor.(actor.ammo_field));
+ actor.clip_load += load;
+ actor.(actor.ammo_field) -= load;
}
- self.(weapon_load[self.weapon]) = self.clip_load;
+ actor.(weapon_load[actor.weapon]) = actor.clip_load;
// do not set ATTACK_FINISHED in reload code any more. This causes annoying delays if eg: You start reloading a weapon,
// then quickly switch to another weapon and back. Reloading is canceled, but the reload delay is still there,
// so your weapon is disabled for a few seconds without reason
- //ATTACK_FINISHED(self) -= self.reload_time - 1;
+ //ATTACK_FINISHED(actor) -= actor.reload_time - 1;
- Weapon wpn = get_weaponinfo(self.weapon);
- w_ready(wpn, self.BUTTON_ATCK, self.BUTTON_ATCK2);
+ Weapon wpn = get_weaponinfo(actor.weapon);
+ w_ready(wpn, actor, actor.BUTTON_ATCK, actor.BUTTON_ATCK2);
}
-void W_Reload(float sent_ammo_min, string sent_sound)
-{SELFPARAM();
+void W_Reload(entity actor, float sent_ammo_min, string sent_sound)
+{
// set global values to work with
entity e;
- e = get_weaponinfo(self.weapon);
+ e = get_weaponinfo(actor.weapon);
if(cvar("g_overkill"))
- if(self.ok_use_ammocharge)
+ if(actor.ok_use_ammocharge)
return; // TODO
- self.reload_ammo_min = sent_ammo_min;
- self.reload_ammo_amount = e.reloading_ammo;
- self.reload_time = e.reloading_time;
- self.reload_sound = sent_sound;
+ actor.reload_ammo_min = sent_ammo_min;
+ actor.reload_ammo_amount = e.reloading_ammo;
+ actor.reload_time = e.reloading_time;
+ actor.reload_sound = sent_sound;
// don't reload weapons that don't have the RELOADABLE flag
if (!(e.spawnflags & WEP_FLAG_RELOADABLE))
}
// return if reloading is disabled for this weapon
- if(!self.reload_ammo_amount)
+ if(!actor.reload_ammo_amount)
return;
// our weapon is fully loaded, no need to reload
- if (self.clip_load >= self.reload_ammo_amount)
+ if (actor.clip_load >= actor.reload_ammo_amount)
return;
// no ammo, so nothing to load
- if(self.ammo_field != ammo_none)
- if(!self.(self.ammo_field) && self.reload_ammo_min)
- if (!(self.items & IT_UNLIMITED_WEAPON_AMMO))
+ if(actor.ammo_field != ammo_none)
+ if(!actor.(actor.ammo_field) && actor.reload_ammo_min)
+ if (!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
{
- if(IS_REAL_CLIENT(self) && self.reload_complain < time)
+ if(IS_REAL_CLIENT(actor) && actor.reload_complain < time)
{
- play2(self, SND(UNAVAILABLE));
- sprint(self, strcat("You don't have enough ammo to reload the ^2", WEP_NAME(self.weapon), "\n"));
- self.reload_complain = time + 1;
+ play2(actor, SND(UNAVAILABLE));
+ sprint(actor, strcat("You don't have enough ammo to reload the ^2", WEP_NAME(actor.weapon), "\n"));
+ actor.reload_complain = time + 1;
}
// switch away if the amount of ammo is not enough to keep using this weapon
- Weapon w = get_weaponinfo(self.weapon);
+ Weapon w = get_weaponinfo(actor.weapon);
if (!(w.wr_checkammo1(w) + w.wr_checkammo2(w)))
{
- self.clip_load = -1; // reload later
- W_SwitchToOtherWeapon(self);
+ actor.clip_load = -1; // reload later
+ W_SwitchToOtherWeapon(actor);
}
return;
}
- if (self.weaponentity)
+ if (actor.weaponentity)
{
- if (self.weaponentity.wframe == WFRAME_RELOAD)
+ if (actor.weaponentity.wframe == WFRAME_RELOAD)
return;
// allow switching away while reloading, but this will cause a new reload!
- self.weaponentity.state = WS_READY;
+ actor.weaponentity.state = WS_READY;
}
// now begin the reloading process
- _sound(self, CH_WEAPON_SINGLE, self.reload_sound, VOL_BASE, ATTEN_NORM);
+ _sound(actor, CH_WEAPON_SINGLE, actor.reload_sound, VOL_BASE, ATTEN_NORM);
// do not set ATTACK_FINISHED in reload code any more. This causes annoying delays if eg: You start reloading a weapon,
// then quickly switch to another weapon and back. Reloading is canceled, but the reload delay is still there,
// so your weapon is disabled for a few seconds without reason
- //ATTACK_FINISHED(self) = max(time, ATTACK_FINISHED(self)) + self.reload_time + 1;
+ //ATTACK_FINISHED(actor) = max(time, ATTACK_FINISHED(actor)) + actor.reload_time + 1;
- weapon_thinkf(WFRAME_RELOAD, self.reload_time, W_ReloadedAndReady);
+ weapon_thinkf(actor, WFRAME_RELOAD, actor.reload_time, W_ReloadedAndReady);
- if(self.clip_load < 0)
- self.clip_load = 0;
- self.old_clip_load = self.clip_load;
- self.clip_load = self.(weapon_load[self.weapon]) = -1;
+ if(actor.clip_load < 0)
+ actor.clip_load = 0;
+ actor.old_clip_load = actor.clip_load;
+ actor.clip_load = actor.(weapon_load[actor.weapon]) = -1;
}
void W_DropEvent(.void(Weapon) event, entity player, float weapon_type, entity weapon_item)
float forbidWeaponUse(entity player);
-void W_AttachToShotorg(entity flash, vector offset);
+void W_AttachToShotorg(entity actor, entity flash, vector offset);
-void W_DecreaseAmmo(Weapon wep, float ammo_use);
+void W_DecreaseAmmo(Weapon wep, entity actor, float ammo_use);
void W_DropEvent(.void(Weapon) event, entity player, float weapon_type, entity weapon_item);
-void W_Reload(float sent_ammo_min, string sent_sound);
+void W_Reload(entity actor, float sent_ammo_min, string sent_sound);
-void W_WeaponFrame();
+void W_WeaponFrame(entity actor);
float W_WeaponRateFactor();
float W_WeaponSpeedFactor();
-float weapon_prepareattack(float secondary, float attacktime);
+bool weapon_prepareattack(entity actor, bool secondary, float attacktime);
-float weapon_prepareattack_check(float secondary, float attacktime);
+bool weapon_prepareattack_check(entity actor, float secondary, float attacktime);
-float weapon_prepareattack_do(float secondary, float attacktime);
+void weapon_prepareattack_do(entity actor, float secondary, float attacktime);
-void weapon_thinkf(float fr, float t, void(Weapon thiswep, bool fire1, bool fire2) func);
+void weapon_thinkf(entity actor, float fr, float t, void(Weapon thiswep, entity actor, bool fire1, bool fire2) func);
#endif