]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Do traces for shot origin when the racer is actually going to fire, instead of every...
authorMario <mario.mario@y7mail.com>
Tue, 14 Jan 2020 16:22:21 +0000 (02:22 +1000)
committerMario <mario.mario@y7mail.com>
Tue, 14 Jan 2020 16:22:21 +0000 (02:22 +1000)
qcsrc/common/vehicles/vehicle/racer.qc
qcsrc/common/vehicles/vehicle/racer_weapon.qc

index e2a2593948130a5d3e896dd3e779fd4c3345ecd7..87804586a2c13130688fc699952e4c6701bc9d0b 100644 (file)
@@ -291,15 +291,6 @@ bool racer_frame(entity this, float dt)
        if (PHYS_INPUT_BUTTON_ATCK(player))
        if (wep1.wr_checkammo1(wep1, vehic, weaponentity))
        {
        if (PHYS_INPUT_BUTTON_ATCK(player))
        if (wep1.wr_checkammo1(wep1, vehic, weaponentity))
        {
-               string tagname = (vehic.cnt)
-                   ? (vehic.cnt = 0, "tag_fire1")
-                   : (vehic.cnt = 1, "tag_fire2");
-               vector org = gettaginfo(vehic, gettagindex(vehic, tagname));
-               w_shotorg = org;
-               w_shotdir = v_forward;
-               // Fix z-aim (for chase mode)
-               crosshair_trace(player);
-               w_shotdir.z = normalize(trace_endpos - org).z * 0.5;
                wep1.wr_think(wep1, vehic, weaponentity, 1);
        }
 
                wep1.wr_think(wep1, vehic, weaponentity, 1);
        }
 
index 30a1873ac8f4ced7705a11f37a629e1208c65614..f7253d8d8e9985c426adf353858332d0b478f6b4 100644 (file)
@@ -14,6 +14,16 @@ METHOD(RacerAttack, wr_think, void(entity thiswep, entity actor, .entity weapone
             veh.vehicle_energy -= autocvar_g_vehicle_racer_cannon_cost;
             veh.wait = time;
         }
             veh.vehicle_energy -= autocvar_g_vehicle_racer_cannon_cost;
             veh.wait = time;
         }
+        string tagname = (veh.cnt)
+            ? (veh.cnt = 0, "tag_fire1")
+            : (veh.cnt = 1, "tag_fire2");
+        vector shotorg = gettaginfo(veh, gettagindex(veh, tagname));
+        w_shotorg = shotorg;
+        w_shotdir = v_forward;
+        // Fix z-aim (for chase mode)
+        crosshair_trace(player);
+        w_shotdir.z = normalize(trace_endpos - shotorg).z * 0.5;
+
         if (isPlayer) W_SetupShot_Dir(player, weaponentity, v_forward, false, 0, SND_Null, CH_WEAPON_B, 0, DEATH_VH_WAKI_GUN.m_id);
         vector org = w_shotorg;
         vector dir = w_shotdir;
         if (isPlayer) W_SetupShot_Dir(player, weaponentity, v_forward, false, 0, SND_Null, CH_WEAPON_B, 0, DEATH_VH_WAKI_GUN.m_id);
         vector org = w_shotorg;
         vector dir = w_shotdir;