]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix weapons with blaster secondary attack improperly using damage and force settings...
authorterencehill <piuntn@gmail.com>
Sun, 11 Aug 2024 13:04:17 +0000 (15:04 +0200)
committerterencehill <piuntn@gmail.com>
Sun, 11 Aug 2024 13:04:17 +0000 (15:04 +0200)
qcsrc/common/mutators/mutator/overkill/okhmg.qc
qcsrc/common/mutators/mutator/overkill/okmachinegun.qc
qcsrc/common/mutators/mutator/overkill/oknex.qc
qcsrc/common/mutators/mutator/overkill/okrpc.qc
qcsrc/common/mutators/mutator/overkill/okshotgun.qc
qcsrc/common/weapons/all.qh
qcsrc/common/weapons/weapon/blaster.qc
qcsrc/common/weapons/weapon/vaporizer.qc

index 391d9acbbab15defbdef1828f81c7685b6dee780..7348f2efe2df234bde3fe4ad28996f4c9b26ea04 100644 (file)
@@ -65,7 +65,7 @@ METHOD(OverkillHeavyMachineGun, wr_think, void(entity thiswep, entity actor, .en
                // Secondary uses it's own refire timer if refire_type is 1.
                actor.jump_interval = time + WEP_CVAR_SEC(okhmg, refire) * W_WeaponRateFactor(actor);
                makevectors(actor.v_angle);
-               W_Blaster_Attack(actor, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY);
+               W_Blaster_Attack(actor, thiswep, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY);
                if ((actor.(weaponentity).wframe == WFRAME_IDLE) ||
                        (actor.(weaponentity).wframe == WFRAME_FIRE2))
                {
@@ -103,7 +103,7 @@ METHOD(OverkillHeavyMachineGun, wr_think, void(entity thiswep, entity actor, .en
                        return;
                }
                makevectors(actor.v_angle);
-               W_Blaster_Attack(actor, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY);
+               W_Blaster_Attack(actor, thiswep, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY);
                weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(okhmg, animtime), w_ready);
        }
 }
index e73e63fa1fb51eef9d050d4b7ebe4828dcd2e748..9eec4f2ffe4dd905ff690f602cbe4dea7cfd5609 100644 (file)
@@ -69,7 +69,7 @@ METHOD(OverkillMachineGun, wr_think, void(entity thiswep, entity actor, .entity
                // Secondary uses it's own refire timer if refire_type is 1.
                actor.jump_interval = time + WEP_CVAR_SEC(okmachinegun, refire) * W_WeaponRateFactor(actor);
                makevectors(actor.v_angle);
-               W_Blaster_Attack(actor, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY);
+               W_Blaster_Attack(actor, thiswep, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY);
                if ((actor.(weaponentity).wframe == WFRAME_IDLE) ||
                        (actor.(weaponentity).wframe == WFRAME_FIRE2))
                {
@@ -107,7 +107,7 @@ METHOD(OverkillMachineGun, wr_think, void(entity thiswep, entity actor, .entity
                        return;
                }
                makevectors(actor.v_angle);
-               W_Blaster_Attack(actor, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY);
+               W_Blaster_Attack(actor, thiswep, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY);
                weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(okmachinegun, animtime), w_ready);
        }
 }
index 311e7a73813a1cdfb828c30f1377f44c01a6d8ee..a6a6d633b5b34a0ade5d6d77fd491e17d579560f 100644 (file)
@@ -142,7 +142,7 @@ METHOD(OverkillNex, wr_think, void(entity thiswep, entity actor, .entity weapone
                // Secondary uses it's own refire timer if refire_type is 1.
                actor.jump_interval = time + WEP_CVAR_SEC(oknex, refire) * W_WeaponRateFactor(actor);
                makevectors(actor.v_angle);
-               W_Blaster_Attack(actor, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY);
+               W_Blaster_Attack(actor, thiswep, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY);
                if ((actor.(weaponentity).wframe == WFRAME_IDLE) ||
                        (actor.(weaponentity).wframe == WFRAME_FIRE2))
                {
@@ -182,7 +182,7 @@ METHOD(OverkillNex, wr_think, void(entity thiswep, entity actor, .entity weapone
                        return;
                }
                makevectors(actor.v_angle);
-               W_Blaster_Attack(actor, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY);
+               W_Blaster_Attack(actor, thiswep, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY);
                weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(oknex, animtime), w_ready);
                return;
        }
index a1f9d5db63b38d68a0b239a13612f8738042f9aa..3437883ad2149d59d4a5b3bca9cd2902bcf65f92 100644 (file)
@@ -140,7 +140,7 @@ METHOD(OverkillRocketPropelledChainsaw, wr_think, void(entity thiswep, entity ac
                // Secondary uses it's own refire timer if refire_type is 1.
                actor.jump_interval = time + WEP_CVAR_SEC(okrpc, refire) * W_WeaponRateFactor(actor);
                makevectors(actor.v_angle);
-               W_Blaster_Attack(actor, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY);
+               W_Blaster_Attack(actor, thiswep, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY);
                if ((actor.(weaponentity).wframe == WFRAME_IDLE) ||
                        (actor.(weaponentity).wframe == WFRAME_FIRE2))
                {
@@ -178,7 +178,7 @@ METHOD(OverkillRocketPropelledChainsaw, wr_think, void(entity thiswep, entity ac
                        return;
                }
                makevectors(actor.v_angle);
-               W_Blaster_Attack(actor, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY);
+               W_Blaster_Attack(actor, thiswep, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY);
                weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(okrpc, animtime), w_ready);
        }
 }
index 301ed4d9ea969621af3c578c8a7b69256bb2acb1..3524430b6936d68c3a9d3e8fee59bab13a060994 100644 (file)
@@ -20,7 +20,7 @@ METHOD(OverkillShotgun, wr_think, void(entity thiswep, entity actor, .entity wea
                // Secondary uses it's own refire timer if refire_type is 1.
                actor.jump_interval = time + WEP_CVAR_SEC(okshotgun, refire) * W_WeaponRateFactor(actor);
                makevectors(actor.v_angle);
-               W_Blaster_Attack(actor, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY);
+               W_Blaster_Attack(actor, thiswep, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY);
                if ((actor.(weaponentity).wframe == WFRAME_IDLE) ||
                        (actor.(weaponentity).wframe == WFRAME_FIRE2))
                {
@@ -71,7 +71,7 @@ METHOD(OverkillShotgun, wr_think, void(entity thiswep, entity actor, .entity wea
                        return;
                }
                makevectors(actor.v_angle);
-               W_Blaster_Attack(actor, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY);
+               W_Blaster_Attack(actor, thiswep, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY);
                weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(okshotgun, animtime), w_ready);
        }
 }
index 50c6e3cb50d98e53a29c241a9e4f8de66107a226..729cd831f30ce1ca7246288e0bba9bdd7f98bf9e 100644 (file)
@@ -38,6 +38,8 @@ STATIC_INIT(WeaponPickup) { FOREACH(Weapons, true, it.m_pickup = NEW(WeaponPicku
 #define WepSet_FromWeapon(it) ((it).m_wepset)
 WepSet _WepSet_FromWeapon(int i);
 
+.entity real_weapon;
+
 #define DEFAULT_FILENAME "weapons_dump.cfg"
 // NOTE: dumpeffectinfo, dumpnotifs, dumpturrets and dumpweapons use similar code
 GENERIC_COMMAND(dumpweapons, "Dump all turrets into " DEFAULT_FILENAME, false) // WEAPONTODO: make this work with other progs than just server
@@ -301,6 +303,11 @@ const .float reloading_time = reload_time;
 #define WEP_CVAR_SEC(wepname, name) WEP_CVAR(wepname, secondary_##name)
 #define WEP_CVAR_BOTH(wepname, isprimary, name) ((isprimary) ? WEP_CVAR_PRI(wepname, name) : WEP_CVAR_SEC(wepname, name))
 
+#define WEP_CVAR_E(wep, name) (wep.wepvar_##name)
+#define WEP_CVAR_PRI_E(wep, name) WEP_CVAR_E(wep, primary_##name)
+#define WEP_CVAR_SEC_E(wep, name) WEP_CVAR_E(wep, secondary_##name)
+#define WEP_CVAR_BOTH_E(wep, isprimary, name) ((isprimary) ? WEP_CVAR_PRI_E(wep, name) : WEP_CVAR_SEC_E(wep, name))
+
 const int WEP_FIRST = 1;
 #define WEP_LAST (REGISTRY_COUNT(Weapons) - 1)
 WepSet WEPSET_ALL;
index 6ac1415df865dde8258f32fdacc7b9a15c723219..426a68ec37d829c17b8656d56cad751cf4f777a1 100644 (file)
@@ -14,14 +14,14 @@ void W_Blaster_Touch(entity this, entity toucher)
                (this.origin + (this.mins + this.maxs) * 0.5),
                this.velocity,
                this.realowner,
-               WEP_CVAR_BOTH(blaster, isprimary, damage),
-               WEP_CVAR_BOTH(blaster, isprimary, edgedamage),
-               WEP_CVAR_BOTH(blaster, isprimary, radius),
+               WEP_CVAR_BOTH_E(this.real_weapon, isprimary, damage),
+               WEP_CVAR_BOTH_E(this.real_weapon, isprimary, edgedamage),
+               WEP_CVAR_BOTH_E(this.real_weapon, isprimary, radius),
                NULL,
                NULL,
                false,
-               WEP_CVAR_BOTH(blaster, isprimary, force),
-               WEP_CVAR_BOTH(blaster, isprimary, force_zscale),
+               WEP_CVAR_BOTH_E(this.real_weapon, isprimary, force),
+               WEP_CVAR_BOTH_E(this.real_weapon, isprimary, force_zscale),
                this.projectiledeathtype,
                this.weaponentity_fld,
                toucher
@@ -41,6 +41,7 @@ void W_Blaster_Think(entity this)
 
 void W_Blaster_Attack(
        entity actor,
+       entity real_wpn,
        .entity weaponentity,
        float atk_deathtype)
 {
@@ -53,6 +54,7 @@ void W_Blaster_Attack(
        W_MuzzleFlash(WEP_BLASTER, actor, weaponentity, w_shotorg, w_shotdir);
 
        entity missile = new(blasterbolt);
+       missile.real_weapon = real_wpn;
        missile.owner = missile.realowner = actor;
        missile.bot_dodge = true;
        missile.bot_dodgerating = atk_damage;
@@ -107,7 +109,7 @@ METHOD(Blaster, wr_think, void(Blaster thiswep, entity actor, .entity weaponenti
     {
         if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(blaster, refire)))
         {
-            W_Blaster_Attack(actor, weaponentity, WEP_BLASTER.m_id);
+            W_Blaster_Attack(actor, thiswep, weaponentity, WEP_BLASTER.m_id);
             weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(blaster, animtime), w_ready);
         }
     }
@@ -126,7 +128,7 @@ METHOD(Blaster, wr_think, void(Blaster thiswep, entity actor, .entity weaponenti
             {
                 if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(blaster, refire)))
                 {
-                    W_Blaster_Attack(actor, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY);
+                    W_Blaster_Attack(actor, thiswep, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY);
                     weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(blaster, animtime), w_ready);
                 }
 
@@ -165,7 +167,7 @@ METHOD(OffhandBlaster, offhand_think, void(OffhandBlaster this, entity actor, bo
        actor.jump_interval = time + WEP_CVAR_SEC(blaster, refire) * W_WeaponRateFactor(actor);
        .entity weaponentity = weaponentities[1];
        makevectors(actor.v_angle);
-       W_Blaster_Attack(actor, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY);
+       W_Blaster_Attack(actor, this, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY);
 }
 
 #endif
index 00be9c2188d92eb4e55bcc5dbbc3641a13ba5e8b..d5ee4cf61cf03b6c8df1debec76b38ecb5abb202 100644 (file)
@@ -305,7 +305,7 @@ METHOD(Vaporizer, wr_think, void(entity thiswep, entity actor, .entity weaponent
                 W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(vaporizer, ammo), weaponentity);
 
             makevectors(actor.v_angle);
-            W_Blaster_Attack(actor, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY);
+            W_Blaster_Attack(actor, thiswep, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY);
 
             // now do normal refire
             weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(vaporizer, animtime), w_ready);