Fix racer rockets not showing a proper explosion effect
authorMario <mario.mario@y7mail.com>
Tue, 14 Jul 2020 10:34:22 +0000 (20:34 +1000)
committerMario <mario.mario@y7mail.com>
Tue, 14 Jul 2020 10:34:22 +0000 (20:34 +1000)
qcsrc/common/effects/all.inc
qcsrc/common/vehicles/vehicle/racer.qc
qcsrc/common/vehicles/vehicle/racer_weapon.qc
qcsrc/common/vehicles/vehicle/racer_weapon.qh

index c25805c..019ae61 100644 (file)
@@ -122,7 +122,7 @@ EFFECT(0, RACER_BOOSTER,            "wakizashi_booster_smoke")
 EFFECT(0, RACER_IMPACT,             "wakizashi_gun_impact")
 EFFECT(0, RACER_MUZZLEFLASH,        "wakizashi_gun_muzzleflash")
 EFFECT(0, RACER_ROCKETLAUNCH,       "wakizashi_rocket_launch")
-EFFECT(0, RACER_ROCKET_EXPLODE,     "wakizashi_rocket_launch")
+EFFECT(0, RACER_ROCKET_EXPLODE,     "wakizashi_rocket_explode")
 EFFECT(1, RACER_ROCKET_TRAIL,       "wakizashi_rocket_thrust")
 
 EFFECT(0, SPIDERBOT_ROCKETLAUNCH,           "spiderbot_rocket_launch")
index ff124d0..e59184d 100644 (file)
@@ -142,7 +142,7 @@ void racer_align4point(entity this, entity player, float _delta)
 void racer_fire_rocket_aim(entity this, entity player, string tagname, entity trg)
 {
        vector v = gettaginfo(this, gettagindex(this, tagname));
-       racer_fire_rocket(player, v, v_forward, trg);
+       racer_fire_rocket(this, player, v, v_forward, trg);
 }
 
 bool racer_frame(entity this, float dt)
index 473f9a7..e8c18ed 100644 (file)
@@ -2,7 +2,7 @@
 
 #ifdef SVQC
 
-void racer_fire_rocket(entity player, vector org, vector dir, entity trg);
+void racer_fire_rocket(entity this, entity player, vector org, vector dir, entity trg);
 METHOD(RacerAttack, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
 {
     bool isPlayer = IS_PLAYER(actor);
@@ -14,20 +14,23 @@ METHOD(RacerAttack, wr_think, void(entity thiswep, entity actor, .entity weapone
             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 vshotorg = gettaginfo(veh, gettagindex(veh, tagname));
-        w_shotorg = vshotorg;
-        w_shotdir = v_forward;
-        // Fix z-aim (for chase mode)
-        crosshair_trace(player);
-        w_shotdir.z = normalize(trace_endpos - vshotorg).z * 0.5;
-
+        if(!isPlayer)
+        {
+            string tagname = (veh.cnt)
+                ? (veh.cnt = 0, "tag_fire1")
+                : (veh.cnt = 1, "tag_fire2");
+            vector vshotorg = gettaginfo(veh, gettagindex(veh, tagname));
+            w_shotorg = vshotorg;
+            w_shotdir = v_forward;
+
+            // Fix z-aim (for chase mode)
+            crosshair_trace(player);
+            w_shotdir.z = normalize(trace_endpos - vshotorg).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;
-        entity bolt = vehicles_projectile(veh, EFFECT_RACER_MUZZLEFLASH, SND_LASERGUN_FIRE,
+        entity bolt = vehicles_projectile(((veh) ? veh : player), EFFECT_RACER_MUZZLEFLASH, SND_LASERGUN_FIRE,
                                org, normalize(v_forward + randomvec() * autocvar_g_vehicle_racer_cannon_spread) * autocvar_g_vehicle_racer_cannon_speed,
                                autocvar_g_vehicle_racer_cannon_damage, autocvar_g_vehicle_racer_cannon_radius, autocvar_g_vehicle_racer_cannon_force,  0,
                                DEATH_VH_WAKI_GUN.m_id, PROJECTILE_WAKICANNON, 0, true, true, player);
@@ -37,7 +40,7 @@ METHOD(RacerAttack, wr_think, void(entity thiswep, entity actor, .entity weapone
     if (fire & 2)
     if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, 0.2)) {
         if (isPlayer) W_SetupShot_Dir(actor, weaponentity, v_forward, false, 0, SND_Null, CH_WEAPON_B, 0, DEATH_VH_WAKI_ROCKET.m_id);
-        racer_fire_rocket(player, w_shotorg, w_shotdir, NULL);
+        racer_fire_rocket(((veh) ? veh : player), player, w_shotorg, w_shotdir, NULL);
         weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, 0, w_ready);
     }
 }
@@ -53,9 +56,9 @@ METHOD(RacerAttack, wr_checkammo1, bool(RacerAttack thiswep, entity actor, .enti
 void racer_rocket_tracker(entity this);
 void racer_rocket_groundhugger(entity this);
 
-void racer_fire_rocket(entity player, vector org, vector dir, entity trg)
+void racer_fire_rocket(entity this, entity player, vector org, vector dir, entity trg)
 {
-    entity rocket = vehicles_projectile(player.vehicle, EFFECT_RACER_ROCKETLAUNCH, SND_ROCKET_FIRE,
+    entity rocket = vehicles_projectile(this, EFFECT_RACER_ROCKETLAUNCH, SND_ROCKET_FIRE,
                            org, dir * autocvar_g_vehicle_racer_rocket_speed,
                            autocvar_g_vehicle_racer_rocket_damage, autocvar_g_vehicle_racer_rocket_radius, autocvar_g_vehicle_racer_rocket_force, 3,
                            DEATH_VH_WAKI_ROCKET.m_id, PROJECTILE_WAKIROCKET, 20, false, false, player);
index ede81f6..f4f3104 100644 (file)
@@ -12,7 +12,7 @@ REGISTER_WEAPON(RACER, NEW(RacerAttack));
 
 // TODO: move into implementation
 #ifdef SVQC
-void racer_fire_rocket(entity player, vector org, vector dir, entity trg);
+void racer_fire_rocket(entity this, entity player, vector org, vector dir, entity trg);
 #endif
 
 #ifdef SVQC