]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/weapon/hook.qc
Weapons: pass weaponentity field instead of slot
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / hook.qc
index 315310b36e36a5a43f0df93569b63c1dcca28a88..f447a154256a006aeb427bdf58d06c87277e0ab8 100644 (file)
@@ -19,11 +19,14 @@ ENDCLASS(Hook)
 REGISTER_WEAPON(HOOK, NEW(Hook));
 
 CLASS(OffhandHook, OffhandWeapon)
+#ifdef SVQC
     METHOD(OffhandHook, offhand_think, void(OffhandHook this, entity actor, bool key_pressed))
     {
        Weapon wep = WEP_HOOK;
-       wep.wr_think(wep, actor, 1, key_pressed ? 1 : 0);
+       .entity weaponentity = weaponentities[1];
+       wep.wr_think(wep, actor, weaponentity, key_pressed ? 1 : 0);
     }
+#endif
 ENDCLASS(OffhandHook)
 OffhandHook OFFHAND_HOOK; STATIC_INIT(OFFHAND_HOOK) { OFFHAND_HOOK = NEW(OffhandHook); }
 
@@ -174,18 +177,18 @@ void W_Hook_Attack2(Weapon thiswep, entity actor)
        MUTATOR_CALLHOOK(EditProjectile, actor, gren);
 }
 
-               METHOD(Hook, wr_think, void(entity thiswep, entity actor, int slot, int fire))
+               METHOD(Hook, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
                {
                        if (fire & 1) {
                                if(!actor.hook)
                                if(!(actor.hook_state & HOOK_WAITING_FOR_RELEASE))
                                if(time > actor.hook_refire)
-                               if(weapon_prepareattack(thiswep, actor, slot, false, -1))
+                               if(weapon_prepareattack(thiswep, actor, weaponentity, false, -1))
                                {
                                        W_DecreaseAmmo(thiswep, actor, thiswep.ammo_factor * WEP_CVAR_PRI(hook, ammo));
                                        actor.hook_state |= HOOK_FIRING;
                                        actor.hook_state |= HOOK_WAITING_FOR_RELEASE;
-                                       weapon_thinkf(actor, slot, WFRAME_FIRE1, WEP_CVAR_PRI(hook, animtime), w_ready);
+                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hook, animtime), w_ready);
                                }
                        } else {
                                actor.hook_state |= HOOK_REMOVING;
@@ -194,10 +197,10 @@ void W_Hook_Attack2(Weapon thiswep, entity actor)
 
                        if(fire & 2)
                        {
-                               if(weapon_prepareattack(thiswep, actor, slot, true, WEP_CVAR_SEC(hook, refire)))
+                               if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(hook, refire)))
                                {
                                        W_Hook_Attack2(thiswep, actor);
-                                       weapon_thinkf(actor, slot, WFRAME_FIRE2, WEP_CVAR_SEC(hook, animtime), w_ready);
+                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(hook, animtime), w_ready);
                                }
                        }