X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Fturrets%2Fturret%2Fphaser_weapon.qc;h=6b5b4fae803ce103d0846f783201e27a6c430788;hp=440bdf6a7299a6271363f3968b03a55d258d0db5;hb=af43b181a15f348a4de2045b716ebc7765ce8f9f;hpb=109c5785a22fb4336ac5e91d5f1fa91678582164 diff --git a/qcsrc/common/turrets/turret/phaser_weapon.qc b/qcsrc/common/turrets/turret/phaser_weapon.qc index 440bdf6a7..6b5b4fae8 100644 --- a/qcsrc/common/turrets/turret/phaser_weapon.qc +++ b/qcsrc/common/turrets/turret/phaser_weapon.qc @@ -1,9 +1,7 @@ #include "phaser_weapon.qh" -#ifdef IMPLEMENTATION - #ifdef SVQC -void beam_think(); +void beam_think(entity this); .int fireflag; SOUND(PhaserTurretAttack_FIRE, W_Sound("electro_fire")); @@ -14,7 +12,7 @@ METHOD(PhaserTurretAttack, wr_think, void(entity thiswep, entity actor, .entity if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(electro, refire))) { if (isPlayer) { turret_initparams(actor); - W_SetupShot_Dir(actor, v_forward, false, 0, SND_PhaserTurretAttack_FIRE, CH_WEAPON_B, 0); + W_SetupShot_Dir(actor, weaponentity, v_forward, false, 0, SND_PhaserTurretAttack_FIRE, CH_WEAPON_B, 0, DEATH_TURRET_PHASER.m_id); actor.tur_shotdir_updated = w_shotdir; actor.tur_shotorg = w_shotorg; actor.tur_head = actor; @@ -26,16 +24,17 @@ METHOD(PhaserTurretAttack, wr_think, void(entity thiswep, entity actor, .entity setmodel(beam, MDL_TUR_PHASER_BEAM); beam.effects = EF_LOWPRECISION; beam.solid = SOLID_NOT; - beam.think = beam_think; + setthink(beam, beam_think); beam.cnt = time + actor.shot_speed; beam.shot_spread = time + 2; beam.nextthink = time; beam.owner = actor; beam.shot_dmg = actor.shot_dmg / (actor.shot_speed / beam.ticrate); beam.scale = actor.target_range / 256; - beam.movetype = MOVETYPE_NONE; + set_movetype(beam, MOVETYPE_NONE); beam.enemy = actor.enemy; beam.bot_dodge = true; + IL_PUSH(g_bot_dodge, beam); beam.bot_dodgerating = beam.shot_dmg; sound (beam, CH_SHOTS_SINGLE, SND_TUR_PHASER, VOL_BASE, ATTEN_NORM); actor.fireflag = 1; @@ -43,7 +42,7 @@ METHOD(PhaserTurretAttack, wr_think, void(entity thiswep, entity actor, .entity beam.attack_finished_single[0] = actor.attack_finished_single[0]; actor.attack_finished_single[0] = time; // + autocvar_sys_ticrate; - setattachment(beam,actor.tur_head, "tag_fire"); + setattachment(beam, actor.tur_head, "tag_fire"); soundat (actor, trace_endpos, CH_SHOTS, SND(NEXIMPACT), VOL_BASE, ATTEN_NORM); if (!isPlayer) @@ -52,44 +51,39 @@ METHOD(PhaserTurretAttack, wr_think, void(entity thiswep, entity actor, .entity } } -void beam_think() -{SELFPARAM(); - if ((time > self.cnt) || (IS_DEAD(self.owner))) +void beam_think(entity this) +{ + entity actor = this.owner; + if ((time > this.cnt) || (IS_DEAD(actor))) { - self.owner.attack_finished_single[0] = time + self.owner.shot_refire; - self.owner.fireflag = 2; - self.owner.tur_head.frame = 10; - sound (self, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM); - remove(self); + actor.attack_finished_single[0] = time + actor.shot_refire; + actor.fireflag = 2; + actor.tur_head.frame = 10; + sound (this, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM); + delete(this); return; } - turret_do_updates(self.owner); + turret_do_updates(actor); - if (time - self.shot_spread > 0) + if (time - this.shot_spread > 0) { - self.shot_spread = time + 2; - sound (self, CH_SHOTS_SINGLE, SND_TUR_PHASER, VOL_BASE, ATTEN_NORM); + this.shot_spread = time + 2; + sound (this, CH_SHOTS_SINGLE, SND_TUR_PHASER, VOL_BASE, ATTEN_NORM); } + this.nextthink = time + this.ticrate; - self.nextthink = time + self.ticrate; - - self.owner.attack_finished_single[0] = time + frametime; - setself(self.owner); - FireImoBeam ( self.tur_shotorg, - self.tur_shotorg + self.tur_shotdir_updated * self.target_range, - '-1 -1 -1' * self.shot_radius, - '1 1 1' * self.shot_radius, - self.shot_force, + actor.attack_finished_single[0] = time + frametime; + FireImoBeam ( actor, actor.tur_shotorg, + actor.tur_shotorg + actor.tur_shotdir_updated * actor.target_range, + '-1 -1 -1' * actor.shot_radius, + '1 1 1' * actor.shot_radius, + actor.shot_force, this.shot_dmg, 0.75, DEATH_TURRET_PHASER.m_id); - setself(this); - self.scale = vlen(self.owner.tur_shotorg - trace_endpos) / 256; - + this.scale = vlen(actor.tur_shotorg - trace_endpos) / 256; } #endif - -#endif