From: TimePath Date: Wed, 23 Mar 2016 21:28:46 +0000 (+1100) Subject: Typecheck weaponframe X-Git-Tag: xonotic-v0.8.2~1035 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=39d10d07030a1d8e4bc82cb0b18b999840dcd81f;p=xonotic%2Fxonotic-data.pk3dir.git Typecheck weaponframe --- diff --git a/qcsrc/server/g_damage.qh b/qcsrc/server/g_damage.qh index 38094ef95..ca5c45b9e 100644 --- a/qcsrc/server/g_damage.qh +++ b/qcsrc/server/g_damage.qh @@ -55,7 +55,7 @@ float IsFlying(entity a); void UpdateFrags(entity player, float f); // NOTE: f=0 means still count as a (positive) kill, but count no frags for it -void W_SwitchWeapon_Force(entity e, Weapon w); +void W_SwitchWeapon_Force(Player this, Weapon w); entity GiveFrags_randomweapons; void GiveFrags (entity attacker, entity targ, float f, int deathtype); diff --git a/qcsrc/server/weapons/selection.qc b/qcsrc/server/weapons/selection.qc index 0d729fd6b..1337a1d71 100644 --- a/qcsrc/server/weapons/selection.qc +++ b/qcsrc/server/weapons/selection.qc @@ -226,11 +226,12 @@ float W_GetCycleWeapon(entity pl, string weaponorder, float dir, float imp, floa return 0; } -void W_SwitchWeapon_Force(entity e, Weapon wep) +void W_SwitchWeapon_Force(Player this, Weapon wep) { - e.cnt = PS(e).m_switchweapon.m_id; - PS(e).m_switchweapon = wep; - e.selectweapon = wep.m_id; + TC(Player, this); TC(Weapon, wep); + this.cnt = PS(this).m_switchweapon.m_id; + PS(this).m_switchweapon = wep; + this.selectweapon = wep.m_id; } // perform weapon to attack (weaponstate and attack_finished check is here) diff --git a/qcsrc/server/weapons/selection.qh b/qcsrc/server/weapons/selection.qh index 5800f9415..07f27f5b5 100644 --- a/qcsrc/server/weapons/selection.qh +++ b/qcsrc/server/weapons/selection.qh @@ -11,7 +11,7 @@ float W_GetCycleWeapon(entity pl, string weaponorder, float dir, float imp, floa #define w_getbestweapon(ent) Weapons_from(W_GetCycleWeapon(ent, ent.cvar_cl_weaponpriority, 0, -1, false, true)) -void W_SwitchWeapon_Force(entity e, Weapon w); +void W_SwitchWeapon_Force(Player this, Weapon w); // perform weapon to attack (weaponstate and attack_finished check is here) void W_SwitchToOtherWeapon(entity pl); diff --git a/qcsrc/server/weapons/weaponsystem.qc b/qcsrc/server/weapons/weaponsystem.qc index 999688b46..0e8ea5876 100644 --- a/qcsrc/server/weapons/weaponsystem.qc +++ b/qcsrc/server/weapons/weaponsystem.qc @@ -414,8 +414,9 @@ bool forbidWeaponUse(entity player) .bool hook_switchweapon; -void W_WeaponFrame(entity actor) +void W_WeaponFrame(Player actor) { + TC(Player, actor); .entity weaponentity = weaponentities[0]; // TODO: unhardcode entity this = actor.(weaponentity); if (frametime) actor.weapon_frametime = frametime; diff --git a/qcsrc/server/weapons/weaponsystem.qh b/qcsrc/server/weapons/weaponsystem.qh index e65ffd67b..74d120150 100644 --- a/qcsrc/server/weapons/weaponsystem.qh +++ b/qcsrc/server/weapons/weaponsystem.qh @@ -18,7 +18,7 @@ void W_DropEvent(.void(Weapon) event, entity player, float weapon_type, entity w void W_Reload(entity actor, float sent_ammo_min, Sound sent_sound); -void W_WeaponFrame(entity actor); +void W_WeaponFrame(Player actor); float W_WeaponRateFactor();