Update attack mode crosshair while raptor is launching
authorMario <mario@smbclan.net>
Mon, 9 Jan 2017 13:16:54 +0000 (23:16 +1000)
committerMario <mario@smbclan.net>
Mon, 9 Jan 2017 13:16:54 +0000 (23:16 +1000)
qcsrc/common/vehicles/vehicle/raptor.qc
qcsrc/common/vehicles/vehicle/spiderbot.qc

index 19ac988..838376e 100644 (file)
@@ -83,6 +83,9 @@ void raptor_land(entity this)
 
 void raptor_exit(entity this, int eject)
 {
+       entity player = this.owner;
+       this.owner = NULL;
+
        this.tur_head.exteriormodeltoclient = NULL;
 
        if(!IS_DEAD(this))
@@ -91,7 +94,7 @@ void raptor_exit(entity this, int eject)
                this.nextthink = time;
        }
 
-       if(!this.owner)
+       if(!player)
                return;
 
        makevectors(this.angles);
@@ -100,32 +103,31 @@ void raptor_exit(entity this, int eject)
        {
                spot = this.origin + v_forward * 100 + '0 0 64';
                spot = vehicles_findgoodexit(this, spot);
-               setorigin(this.owner , spot);
-               this.owner.velocity = (v_up + v_forward * 0.25) * 750;
-               this.owner.oldvelocity = this.owner.velocity;
+               setorigin(player, spot);
+               player.velocity = (v_up + v_forward * 0.25) * 750;
+               player.oldvelocity = player.velocity;
        }
        else
        {
                if(vdist(this.velocity, >, 2 * autocvar_sv_maxairspeed))
                {
-                       this.owner.velocity = normalize(this.velocity) * autocvar_sv_maxairspeed * 2;
-                       this.owner.velocity_z += 200;
+                       player.velocity = normalize(this.velocity) * autocvar_sv_maxairspeed * 2;
+                       player.velocity_z += 200;
                        spot = this.origin + v_forward * 32 + '0 0 64';
                        spot = vehicles_findgoodexit(this, spot);
                }
                else
                {
-                       this.owner.velocity = this.velocity * 0.5;
-                       this.owner.velocity_z += 10;
+                       player.velocity = this.velocity * 0.5;
+                       player.velocity_z += 10;
                        spot = this.origin - v_forward * 200 + '0 0 64';
                        spot = vehicles_findgoodexit(this, spot);
                }
-               this.owner.oldvelocity = this.owner.velocity;
-               setorigin(this.owner , spot);
+               player.oldvelocity = player.velocity;
+               setorigin(player, spot);
        }
 
-       antilag_clear(this.owner, CS(this.owner));
-       this.owner = NULL;
+       antilag_clear(player, CS(player));
 }
 
 bool raptor_frame(entity this, float dt)
@@ -463,6 +465,8 @@ bool raptor_takeoff(entity this, float dt)
        else
                this.PlayerPhysplug = raptor_frame;
 
+       this.vehicle_weapon2mode = vehic.vehicle_weapon2mode;
+
        if(vehic.vehicle_flags  & VHF_SHIELDREGEN)
                vehicles_regen(vehic, vehic.dmg_time, vehicle_shield, autocvar_g_vehicle_raptor_shield, autocvar_g_vehicle_raptor_shield_regen_pause, autocvar_g_vehicle_raptor_shield_regen, dt, true);
 
index 1c651b1..d395324 100644 (file)
@@ -318,11 +318,12 @@ bool spiderbot_frame(entity this, float dt)
 
 void spiderbot_exit(entity this, int eject)
 {
-       vector spot;
+       entity player = this.owner;
+       this.owner = NULL;
 
-       IL_EACH(g_projectiles, it.owner == this.owner && it.classname == "spiderbot_rocket",
+       IL_EACH(g_projectiles, it.owner == player && it.classname == "spiderbot_rocket",
        {
-               it.realowner = this.owner;
+               it.realowner = player;
                it.owner = NULL;
        });
 
@@ -331,40 +332,40 @@ void spiderbot_exit(entity this, int eject)
        this.frame = 5;
        set_movetype(this, MOVETYPE_WALK);
 
-       if(!this.owner)
+       if(!player)
                return;
 
        makevectors(this.angles);
+       vector spot;
        if(eject)
        {
                spot = this.origin + v_forward * 100 + '0 0 64';
                spot = vehicles_findgoodexit(this, spot);
-               setorigin(this.owner , spot);
-               this.owner.velocity = (v_up + v_forward * 0.25) * 750;
-               this.owner.oldvelocity = this.owner.velocity;
+               setorigin(player, spot);
+               player.velocity = (v_up + v_forward * 0.25) * 750;
+               player.oldvelocity = player.velocity;
        }
        else
        {
                if(vdist(this.velocity, >, autocvar_g_vehicle_spiderbot_speed_strafe))
                {
-                       this.owner.velocity = normalize(this.velocity) * vlen(this.velocity);
-                       this.owner.velocity_z += 200;
+                       player.velocity = normalize(this.velocity) * vlen(this.velocity);
+                       player.velocity_z += 200;
                        spot = this.origin + v_forward * 128 + '0 0 64';
                        spot = vehicles_findgoodexit(this, spot);
                }
                else
                {
-                       this.owner.velocity = this.velocity * 0.5;
-                       this.owner.velocity_z += 10;
+                       player.velocity = this.velocity * 0.5;
+                       player.velocity_z += 10;
                        spot = this.origin + v_forward * 256 + '0 0 64';
                        spot = vehicles_findgoodexit(this, spot);
                }
-               this.owner.oldvelocity = this.owner.velocity;
-               setorigin(this.owner , spot);
+               player.oldvelocity = player.velocity;
+               setorigin(player, spot);
        }
 
-       antilag_clear(this.owner, CS(this.owner));
-       this.owner = NULL;
+       antilag_clear(player, CS(player));
 }
 
 void spiderbot_headfade(entity this)
@@ -397,11 +398,7 @@ void spiderbot_blowup(entity this)
                return;
        }
 
-       entity h, g1, g2, b;
-       b = spawn();
-       h = spawn();
-       g1 = spawn();
-       g2 = spawn();
+       entity h = spawn(), g1 = spawn(), g2 = spawn(), b = spawn();
 
        setmodel(b, MDL_VEH_SPIDERBOT_BODY);
        setmodel(h, MDL_VEH_SPIDERBOT_TOP);