X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fweapons%2Fweapon%2Fhlac.qc;h=3f52224897196c305fd57c956f8586b575d7f692;hb=eb6fabc8b16e23fcf0704ecf97685dffa7387bb7;hp=639847a7e30ee231557c9407a08745360e694562;hpb=dd56fad16f10856522e381bbecdfb887f86b0f8e;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/weapons/weapon/hlac.qc b/qcsrc/common/weapons/weapon/hlac.qc index 639847a7e..3f5222489 100644 --- a/qcsrc/common/weapons/weapon/hlac.qc +++ b/qcsrc/common/weapons/weapon/hlac.qc @@ -13,7 +13,7 @@ CLASS(HLAC, Weapon) /* crosshair */ ATTRIB(HLAC, w_crosshair_size, float, 0.6); /* wepimg */ ATTRIB(HLAC, model2, string, "weaponhlac"); /* refname */ ATTRIB(HLAC, netname, string, "hlac"); -/* wepname */ ATTRIB(HLAC, message, string, _("Heavy Laser Assault Cannon")); +/* wepname */ ATTRIB(HLAC, m_name, string, _("Heavy Laser Assault Cannon")); ENDCLASS(HLAC) REGISTER_WEAPON(HLAC, NEW(HLAC)); @@ -50,9 +50,9 @@ HLAC_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) #endif #ifdef IMPLEMENTATION #ifdef SVQC -spawnfunc(weapon_hlac) { weapon_defaultspawnfunc(WEP_HLAC.m_id); } +spawnfunc(weapon_hlac) { weapon_defaultspawnfunc(this, WEP_HLAC); } -void W_HLAC_Touch(void) +void W_HLAC_Touch() {SELFPARAM(); float isprimary; @@ -87,9 +87,8 @@ void W_HLAC_Attack(Weapon thiswep) self.punchangle_y = random() - 0.5; } - missile = spawn(); + missile = new(hlacbolt); missile.owner = missile.realowner = self; - missile.classname = "hlacbolt"; missile.bot_dodge = true; missile.bot_dodgerating = WEP_CVAR_PRI(hlac, damage); @@ -104,7 +103,7 @@ void W_HLAC_Attack(Weapon thiswep) //missile.angles = vectoangles(missile.velocity); // csqc missile.touch = W_HLAC_Touch; - missile.think = SUB_Remove; + missile.think = SUB_Remove_self; missile.nextthink = time + WEP_CVAR_PRI(hlac, lifetime); @@ -116,7 +115,7 @@ void W_HLAC_Attack(Weapon thiswep) MUTATOR_CALLHOOK(EditProjectile, self, missile); } -void W_HLAC_Attack2(void) +void W_HLAC_Attack2() {SELFPARAM(); entity missile; float spread; @@ -130,9 +129,8 @@ void W_HLAC_Attack2(void) W_SetupShot(self, false, 3, SND(LASERGUN_FIRE), CH_WEAPON_A, WEP_CVAR_SEC(hlac, damage)); Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); - missile = spawn(); + missile = new(hlacbolt); missile.owner = missile.realowner = self; - missile.classname = "hlacbolt"; missile.bot_dodge = true; missile.bot_dodgerating = WEP_CVAR_SEC(hlac, damage); @@ -147,7 +145,7 @@ void W_HLAC_Attack2(void) //missile.angles = vectoangles(missile.velocity); // csqc missile.touch = W_HLAC_Touch; - missile.think = SUB_Remove; + missile.think = SUB_Remove_self; missile.nextthink = time + WEP_CVAR_SEC(hlac, lifetime); @@ -161,33 +159,33 @@ void W_HLAC_Attack2(void) } // weapon frames -void W_HLAC_Attack_Frame(Weapon thiswep, entity actor, int slot, int fire) +void W_HLAC_Attack_Frame(Weapon thiswep, entity actor, .entity weaponentity, int fire) { if(actor.weapon != actor.switchweapon) // abort immediately if switching { - w_ready(thiswep, actor, slot, fire); + w_ready(thiswep, actor, weaponentity, fire); return; } if(actor.BUTTON_ATCK) { - Weapon w = get_weaponinfo(actor.weapon); - if(!w.wr_checkammo1(w)) + if(!thiswep.wr_checkammo1(thiswep)) if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO)) { - W_SwitchWeapon_Force(actor, w_getbestweapon(actor)); - w_ready(thiswep, actor, slot, fire); + W_SwitchWeapon_Force(actor, Weapons_from(w_getbestweapon(actor))); + w_ready(thiswep, actor, weaponentity, fire); return; } + int slot = weaponslot(weaponentity); ATTACK_FINISHED(actor, slot) = time + WEP_CVAR_PRI(hlac, refire) * W_WeaponRateFactor(); W_HLAC_Attack(WEP_HLAC); actor.misc_bulletcounter = actor.misc_bulletcounter + 1; - weapon_thinkf(actor, slot, WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), W_HLAC_Attack_Frame); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), W_HLAC_Attack_Frame); } else { - weapon_thinkf(actor, slot, WFRAME_FIRE1, WEP_CVAR_PRI(hlac, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hlac, animtime), w_ready); } } @@ -211,27 +209,26 @@ void W_HLAC_Attack2_Frame(Weapon thiswep) { self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(hlac, speed), 0, WEP_CVAR_PRI(hlac, lifetime), false); } - METHOD(HLAC, wr_think, void(entity thiswep, entity actor, int slot, int fire)) + METHOD(HLAC, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { if(autocvar_g_balance_hlac_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo))) { // forced reload - Weapon w = get_weaponinfo(actor.weapon); - w.wr_reload(w); + thiswep.wr_reload(thiswep); } else if(fire & 1) { - if(weapon_prepareattack(thiswep, actor, slot, false, WEP_CVAR_PRI(hlac, refire))) + if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(hlac, refire))) { actor.misc_bulletcounter = 0; W_HLAC_Attack(thiswep); - weapon_thinkf(actor, slot, WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), W_HLAC_Attack_Frame); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), W_HLAC_Attack_Frame); } } else if((fire & 2) && WEP_CVAR(hlac, secondary)) { - if(weapon_prepareattack(thiswep, actor, slot, true, WEP_CVAR_SEC(hlac, refire))) + if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(hlac, refire))) { W_HLAC_Attack2_Frame(thiswep); - weapon_thinkf(actor, slot, WFRAME_FIRE2, WEP_CVAR_SEC(hlac, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(hlac, animtime), w_ready); } } } @@ -275,7 +272,7 @@ void W_HLAC_Attack2_Frame(Weapon thiswep) { vector org2; org2 = w_org + w_backoff * 6; - pointparticles(particleeffectnum(EFFECT_BLASTER_IMPACT), org2, w_backoff * 1000, 1); + pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1); if(!w_issilent) sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); }