X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Fweapons%2Fweapon%2Fhook.qc;h=38a416383320c8b71c2fe8b39a321df5c83adbd4;hp=8926ffa306ea0bd5bbfbe68438deed9481b460f4;hb=931d24d4337e58557fa82a68aa8a740e523c2f22;hpb=12354d764a576f55a290ba11d9f34ccf4e3930d0 diff --git a/qcsrc/common/weapons/weapon/hook.qc b/qcsrc/common/weapons/weapon/hook.qc index 8926ffa30..38a416383 100644 --- a/qcsrc/common/weapons/weapon/hook.qc +++ b/qcsrc/common/weapons/weapon/hook.qc @@ -1,12 +1,13 @@ +#include "hook.qh" #ifndef IMPLEMENTATION CLASS(Hook, Weapon) -/* ammotype */ ATTRIB(Hook, ammo_field, .int, ammo_fuel) -/* impulse */ ATTRIB(Hook, impulse, int, 0) +/* ammotype */ ATTRIB(Hook, ammo_field, .int, ammo_fuel); +/* impulse */ ATTRIB(Hook, impulse, int, 0); /* flags */ ATTRIB(Hook, spawnflags, int, WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH); /* rating */ ATTRIB(Hook, bot_pickupbasevalue, float, 0); /* color */ ATTRIB(Hook, wpcolor, vector, '0 0.5 0'); /* modelname */ ATTRIB(Hook, mdl, string, "hookgun"); -#ifndef MENUQC +#ifdef GAMEQC /* model */ ATTRIB(Hook, m_model, Model, MDL_HOOK_ITEM); #endif /* crosshair */ ATTRIB(Hook, w_crosshair, string, "gfx/crosshairhook"); @@ -14,7 +15,7 @@ CLASS(Hook, Weapon) /* wepimg */ ATTRIB(Hook, model2, string, "weaponhook"); /* refname */ ATTRIB(Hook, netname, string, "hook"); /* wepname */ ATTRIB(Hook, m_name, string, _("Grappling Hook")); - ATTRIB(Hook, ammo_factor, float, 1) + ATTRIB(Hook, ammo_factor, float, 1); #define X(BEGIN, P, END, class, prefix) \ BEGIN(class) \ @@ -96,7 +97,7 @@ void W_Hook_ExplodeThink(entity this) if(dt < this.dmg_duration) this.nextthink = time + 0.05; // soon else - remove(this); + delete(this); } void W_Hook_Explode2(entity this) @@ -143,10 +144,10 @@ void W_Hook_Touch2(entity this, entity toucher) this.use(this, NULL, NULL); } -void W_Hook_Attack2(Weapon thiswep, entity actor) +void W_Hook_Attack2(Weapon thiswep, entity actor, .entity weaponentity) { //W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(hook, ammo)); // WEAPONTODO: Figure out how to handle ammo with hook secondary (gravitybomb) - W_SetupShot(actor, false, 4, SND_HOOKBOMB_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(hook, damage)); + W_SetupShot(actor, weaponentity, false, 4, SND_HOOKBOMB_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(hook, damage)); entity gren = new(hookbomb); gren.owner = gren.realowner = actor; @@ -179,6 +180,8 @@ void W_Hook_Attack2(Weapon thiswep, entity actor) gren.angles = '0 0 0'; gren.flags = FL_PROJECTILE; + IL_PUSH(g_projectiles, gren); + IL_PUSH(g_bot_dodge, gren); CSQCProjectile(gren, true, PROJECTILE_HOOKBOMB, true); @@ -193,7 +196,7 @@ METHOD(Hook, wr_think, void(entity thiswep, entity actor, .entity weaponentity, if(time > actor.hook_refire) if(weapon_prepareattack(thiswep, actor, weaponentity, false, -1)) { - W_DecreaseAmmo(thiswep, actor, thiswep.ammo_factor * WEP_CVAR_PRI(hook, ammo)); + W_DecreaseAmmo(thiswep, actor, thiswep.ammo_factor * WEP_CVAR_PRI(hook, ammo), weaponentity); actor.hook_state |= HOOK_FIRING; actor.hook_state |= HOOK_WAITING_FOR_RELEASE; weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hook, animtime), w_ready); @@ -207,7 +210,7 @@ METHOD(Hook, wr_think, void(entity thiswep, entity actor, .entity weaponentity, { if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(hook, refire))) { - W_Hook_Attack2(thiswep, actor); + W_Hook_Attack2(thiswep, actor, weaponentity); weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(hook, animtime), w_ready); } } @@ -240,7 +243,7 @@ METHOD(Hook, wr_think, void(entity thiswep, entity actor, .entity weaponentity, { if( actor.ammo_fuel >= (time - actor.hook_time_fueldecrease) * hooked_fuel ) { - W_DecreaseAmmo(thiswep, actor, (time - actor.hook_time_fueldecrease) * hooked_fuel); + W_DecreaseAmmo(thiswep, actor, (time - actor.hook_time_fueldecrease) * hooked_fuel, weaponentity); actor.hook_time_fueldecrease = time; // decrease next frame again } @@ -248,7 +251,7 @@ METHOD(Hook, wr_think, void(entity thiswep, entity actor, .entity weaponentity, { actor.ammo_fuel = 0; actor.hook_state |= HOOK_REMOVING; - W_SwitchWeapon_Force(actor, w_getbestweapon(actor)); + W_SwitchWeapon_Force(actor, w_getbestweapon(actor), weaponentity); } } } @@ -541,6 +544,7 @@ NET_HANDLE(ENT_CLIENT_HOOK, bool bIsNew) if(bIsNew || !this.teleport_time) { this.draw = Draw_GrapplingHook; + IL_PUSH(g_drawables, this); this.entremove = Remove_GrapplingHook; switch(this.HookType)