]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/weapon/arc.qc
Remove legacy Quake bbox expansion: projectiles
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / arc.qc
index 4b159019e62acdcad320c8b84262dd6130bd0b34..5aa7bfa5254391e30d1626b9ebdd9f0c81aadf00 100644 (file)
@@ -158,10 +158,11 @@ void W_Arc_Attack_Bolt(Weapon thiswep, entity actor, .entity weaponentity, int f
        setthink(missile, adaptor_think2use_hittype_splash);
        missile.nextthink = time + WEP_CVAR(arc, bolt_lifetime);
        PROJECTILE_MAKETRIGGER(missile);
+       missile.clipgroup = CLIPGROUP_UNHITTABLEPROJ;
        missile.projectiledeathtype = thiswep.m_id | HITTYPE_SECONDARY;
        missile.weaponentity_fld = weaponentity;
        setorigin(missile, w_shotorg);
-       setsize(missile, '0 0 0', '0 0 0');
+       setsize(missile, UNHITTABLEPROJ_MINS, UNHITTABLEPROJ_MAXS);
 
        set_movetype(missile, MOVETYPE_BOUNCEMISSILE);
        W_SetupProjVelocity_PRE(missile, arc, bolt_);
@@ -208,23 +209,11 @@ void W_Arc_Beam_Think(entity this)
        Weapon thiswep = WEP_ARC;
 
        // TODO: use standard weapon use checks here!
-       if(
-               !IS_PLAYER(own)
-               ||
-               IS_DEAD(own)
-               ||
-               game_stopped
-               ||
-               !weapon_prepareattack_check(thiswep, own, weaponentity, this.beam_bursting, -1)
-               ||
-               own.(weaponentity).m_switchweapon != WEP_ARC
-               ||
-               (!PHYS_INPUT_BUTTON_ATCK(own) && !burst )
-               ||
-               own.vehicle
-               ||
-               (WEP_CVAR(arc, overheat_max) > 0 && this.beam_heat >= WEP_CVAR(arc, overheat_max))
-       )
+       if(!IS_PLAYER(own) || IS_DEAD(own) || STAT(FROZEN, own) || game_stopped || own.vehicle
+               || !weapon_prepareattack_check(thiswep, own, weaponentity, this.beam_bursting, -1)
+               || own.(weaponentity).m_switchweapon != WEP_ARC
+               || (!PHYS_INPUT_BUTTON_ATCK(own) && !burst)
+               || (WEP_CVAR(arc, overheat_max) > 0 && this.beam_heat >= WEP_CVAR(arc, overheat_max)) )
        {
                if ( WEP_CVAR(arc, cooldown) > 0 )
                {
@@ -238,19 +227,20 @@ void W_Arc_Beam_Think(entity this)
                                cooldown_speed = this.beam_heat / WEP_CVAR(arc, beam_refire);
                        }
 
+                       bool overheat = (WEP_CVAR(arc, overheat_max) > 0 && this.beam_heat >= WEP_CVAR(arc, overheat_max));
+                       if (overheat)
+                       {
+                               Send_Effect(EFFECT_ARC_OVERHEAT, this.beam_start, this.beam_wantdir, 1);
+                               sound(this, CH_WEAPON_A, SND_ARC_STOP, VOL_BASE, ATTN_NORM);
+                       }
+
                        if ( cooldown_speed )
                        {
-                               if ( WEP_CVAR(arc, cooldown_release) || (WEP_CVAR(arc, overheat_max) > 0 && this.beam_heat >= WEP_CVAR(arc, overheat_max)) )
+                               if (WEP_CVAR(arc, cooldown_release) || overheat)
                                        own.arc_overheat = time + this.beam_heat / cooldown_speed;
                                own.arc_cooldown = cooldown_speed;
                        }
 
-                       if ( WEP_CVAR(arc, overheat_max) > 0 && this.beam_heat >= WEP_CVAR(arc, overheat_max) )
-                       {
-                               Send_Effect(EFFECT_ARC_OVERHEAT,
-                                       this.beam_start, this.beam_wantdir, 1 );
-                               sound(this, CH_WEAPON_A, SND_ARC_STOP, VOL_BASE, ATTN_NORM);
-                       }
                }
 
                if(this == own.(weaponentity).arc_beam) { own.(weaponentity).arc_beam = NULL; }
@@ -436,16 +426,9 @@ void W_Arc_Beam_Think(entity this)
                beam_endpos = WarpZone_TransformOrigin(WarpZone_trace_transform, beam_endpos);
                new_dir = WarpZone_TransformVelocity(WarpZone_trace_transform, new_dir);
 
-               bool is_player = (
-                       IS_PLAYER(trace_ent)
-                       ||
-                       trace_ent.classname == "body"
-                       ||
-                       IS_MONSTER(trace_ent)
-               );
-
                if(trace_ent)
                {
+                       bool is_player = (IS_PLAYER(trace_ent) || trace_ent.classname == "body" || IS_MONSTER(trace_ent));
                        if(SAME_TEAM(own, trace_ent))
                        {
                                float roothealth = ((burst) ? WEP_CVAR(arc, burst_healing_hps) : WEP_CVAR(arc, beam_healing_hps));
@@ -578,9 +561,14 @@ void W_Arc_Attack(Weapon thiswep, entity actor, .entity weaponentity, int fire)
 }
 void Arc_Smoke(Weapon thiswep, entity actor, .entity weaponentity, int fire)
 {
-       // TODO: spamming this without checking any refires is asking for trouble!
+       // calculate a rough shot origin to show the effect from TODO: move this to the client side!
        makevectors(actor.v_angle);
-       W_SetupShot_Range(actor,weaponentity,false,0,SND_Null,0,0,0,thiswep.m_id); // TODO: probably doesn't need deathtype, since this is just a prefire effect
+       w_shotdir = v_forward;
+       vector md = actor.(weaponentity).movedir;
+       vector vecs = ((md.x > 0) ? md : '0 0 0');
+       vector dv = v_forward * vecs.x + v_right * -vecs.y + v_up * vecs.z;
+       w_shotorg = actor.origin + actor.view_ofs + dv;
+       //W_SetupShot_Range(actor,weaponentity,false,0,SND_Null,0,0,0,thiswep.m_id);
 
        vector smoke_origin = w_shotorg + actor.velocity*frametime;
        if ( actor.arc_overheat > time )
@@ -624,7 +612,7 @@ METHOD(Arc, wr_aim, void(entity thiswep, entity actor, .entity weaponentity))
             WEP_CVAR(arc, beam_botaimspeed),
             0,
             WEP_CVAR(arc, beam_botaimlifetime),
-            false
+            false, true
         );
     }
     else
@@ -635,7 +623,7 @@ METHOD(Arc, wr_aim, void(entity thiswep, entity actor, .entity weaponentity))
             1000000,
             0,
             0.001,
-            false
+            false, true
         );
     }
 }
@@ -682,7 +670,7 @@ METHOD(Arc, wr_think, void(entity thiswep, entity actor, .entity weaponentity, i
     {
         if(weapon_prepareattack(thiswep, actor, weaponentity, true, 0))
         {
-               if(!thiswep.wr_checkammo2(thiswep, actor, weaponentity))
+            if(!thiswep.wr_checkammo2(thiswep, actor, weaponentity))
             if(!(actor.items & IT_UNLIMITED_AMMO))
             {
                 W_SwitchWeapon_Force(actor, w_getbestweapon(actor, weaponentity), weaponentity);
@@ -724,6 +712,13 @@ METHOD(Arc, wr_think, void(entity thiswep, entity actor, .entity weaponentity, i
     }
     #endif
 }
+METHOD(Arc, wr_suicidemessage, Notification(entity thiswep))
+{
+    if(w_deathtype & HITTYPE_SECONDARY)
+        return WEAPON_ARC_SUICIDE_BOLT;
+    else
+       return WEAPON_THINKING_WITH_PORTALS;
+}
 METHOD(Arc, wr_init, void(entity thiswep))
 {
     if(!arc_shotorigin[0])
@@ -801,8 +796,7 @@ METHOD(Arc, wr_impacteffect, void(entity thiswep, entity actor))
 {
     if(w_deathtype & HITTYPE_SECONDARY)
     {
-        vector org2;
-        org2 = w_org + w_backoff * 6;
+        vector org2 = w_org + w_backoff * 2;
         pointparticles(EFFECT_ELECTRO_IMPACT, org2, w_backoff * 1000, 1);
         if(!w_issilent) { sound(actor, CH_SHOTS, SND_ELECTRO_IMPACT, VOL_BASE, ATTN_NORM); }
     }
@@ -933,7 +927,14 @@ void Draw_ArcBeam(entity this)
                // into a weapon system for client code.
 
                // find where we are aiming
-               vector myviewangle = ((autocvar_chase_active) ? warpzone_save_view_angles : view_angles);
+               vector myviewangle = view_angles;
+               if (autocvar_chase_active)
+               {
+                       if (autocvar_cl_lockview)
+                               myviewangle = eX * csqcplayer.v_angle.x + eY * csqcplayer.angles.y;
+                       else
+                               myviewangle = warpzone_save_view_angles;
+               }
                vector forward, right, up;
                MAKE_VECTORS(myviewangle, forward, right, up);
                entity wepent = viewmodels[this.beam_slot];