X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fweapons%2Fweapon%2Fcrylink.qc;h=2c919c52f5396c1f323a215ad557dcc6c48b7baa;hb=refs%2Fheads%2Fmorosophos%2F2184-crylink-buttons-swap;hp=82b47037615e1d51cf6808e5ba55cf9fcb7a9493;hpb=1deb523af5f2edddb70ed34cbb0d4463f21d6cad;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/weapons/weapon/crylink.qc b/qcsrc/common/weapons/weapon/crylink.qc index 82b470376..2c919c52f 100644 --- a/qcsrc/common/weapons/weapon/crylink.qc +++ b/qcsrc/common/weapons/weapon/crylink.qc @@ -1,7 +1,6 @@ #include "crylink.qh" #ifdef SVQC -spawnfunc(weapon_crylink) { weapon_defaultspawnfunc(this, WEP_CRYLINK); } void W_Crylink_CheckLinks(entity e) { @@ -67,7 +66,7 @@ void W_Crylink_LinkExplode(entity e, entity e2, entity directhitentity) float isprimary = !(e.projectiledeathtype & HITTYPE_SECONDARY); RadiusDamage(e, e.realowner, WEP_CVAR_BOTH(crylink, isprimary, damage) * a, WEP_CVAR_BOTH(crylink, isprimary, edgedamage) * a, WEP_CVAR_BOTH(crylink, isprimary, radius), - NULL, NULL, WEP_CVAR_BOTH(crylink, isprimary, force) * a, e.projectiledeathtype, directhitentity); + NULL, NULL, WEP_CVAR_BOTH(crylink, isprimary, force) * a, e.projectiledeathtype, e.weaponentity_fld, directhitentity); W_Crylink_LinkExplode(e.queuenext, e2, directhitentity); @@ -197,6 +196,7 @@ void W_Crylink_LinkJoinEffect_Think(entity this) NULL, WEP_CVAR_BOTH(crylink, isprimary, joinexplode_force) * n, e.projectiledeathtype, + e.weaponentity_fld, NULL ); Send_Effect(EFFECT_CRYLINK_JOINEXPLODE, this.origin, '0 0 0', n); @@ -247,7 +247,8 @@ void W_Crylink_Touch(entity this, entity toucher) if(a) f *= a; - float totaldamage = RadiusDamage(this, this.realowner, WEP_CVAR_BOTH(crylink, isprimary, damage) * f, WEP_CVAR_BOTH(crylink, isprimary, edgedamage) * f, WEP_CVAR_BOTH(crylink, isprimary, radius), NULL, NULL, WEP_CVAR_BOTH(crylink, isprimary, force) * f, this.projectiledeathtype, toucher); + float totaldamage = RadiusDamage(this, this.realowner, WEP_CVAR_BOTH(crylink, isprimary, damage) * f, WEP_CVAR_BOTH(crylink, isprimary, edgedamage) * f, WEP_CVAR_BOTH(crylink, isprimary, radius), + NULL, NULL, WEP_CVAR_BOTH(crylink, isprimary, force) * f, this.projectiledeathtype, this.weaponentity_fld, toucher); if(totaldamage && ((WEP_CVAR_BOTH(crylink, isprimary, linkexplode) == 2) || ((WEP_CVAR_BOTH(crylink, isprimary, linkexplode) == 1) && !W_Crylink_Touch_WouldHitFriendly(this, WEP_CVAR_BOTH(crylink, isprimary, radius))))) { @@ -296,7 +297,7 @@ void W_Crylink_Attack(Weapon thiswep, entity actor, .entity weaponentity) if(WEP_CVAR_PRI(crylink, joinexplode)) maxdmg += WEP_CVAR_PRI(crylink, joinexplode_damage); - W_SetupShot(actor, weaponentity, false, 2, SND_CRYLINK_FIRE, CH_WEAPON_A, maxdmg); + W_SetupShot(actor, weaponentity, false, 2, SND_CRYLINK_FIRE, CH_WEAPON_A, maxdmg, thiswep.m_id); forward = v_forward; right = v_right; up = v_up; @@ -335,7 +336,7 @@ void W_Crylink_Attack(Weapon thiswep, entity actor, .entity weaponentity) set_movetype(proj, MOVETYPE_BOUNCEMISSILE); PROJECTILE_MAKETRIGGER(proj); - proj.projectiledeathtype = WEP_CRYLINK.m_id; + proj.projectiledeathtype = thiswep.m_id; //proj.gravity = 0.001; setorigin(proj, w_shotorg); @@ -408,7 +409,7 @@ void W_Crylink_Attack2(Weapon thiswep, entity actor, .entity weaponentity) if(WEP_CVAR_SEC(crylink, joinexplode)) maxdmg += WEP_CVAR_SEC(crylink, joinexplode_damage); - W_SetupShot(actor, weaponentity, false, 2, SND_CRYLINK_FIRE2, CH_WEAPON_A, maxdmg); + W_SetupShot(actor, weaponentity, false, 2, SND_CRYLINK_FIRE2, CH_WEAPON_A, maxdmg, thiswep.m_id | HITTYPE_SECONDARY); forward = v_forward; right = v_right; up = v_up; @@ -447,7 +448,7 @@ void W_Crylink_Attack2(Weapon thiswep, entity actor, .entity weaponentity) set_movetype(proj, MOVETYPE_BOUNCEMISSILE); PROJECTILE_MAKETRIGGER(proj); - proj.projectiledeathtype = WEP_CRYLINK.m_id | HITTYPE_SECONDARY; + proj.projectiledeathtype = thiswep.m_id | HITTYPE_SECONDARY; //proj.gravity = 0.001; setorigin(proj, w_shotorg); @@ -525,7 +526,11 @@ METHOD(Crylink, wr_think, void(entity thiswep, entity actor, .entity weaponentit thiswep.wr_reload(thiswep, actor, weaponentity); } - if(fire & 1) + // attack swapping is useful for emulating BFG behavior in XDF + int primary_fire = autocvar_g_balance_crylink_swap_attacks ? fire & 2 : fire & 1; + int secondary_fire = autocvar_g_balance_crylink_swap_attacks ? fire & 1 : fire & 2; + + if(primary_fire) { if(actor.(weaponentity).crylink_waitrelease != 1) if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(crylink, refire))) @@ -535,7 +540,7 @@ METHOD(Crylink, wr_think, void(entity thiswep, entity actor, .entity weaponentit } } - if((fire & 2) && autocvar_g_balance_crylink_secondary) + if((secondary_fire) && autocvar_g_balance_crylink_secondary) { if(actor.(weaponentity).crylink_waitrelease != 2) if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(crylink, refire))) @@ -545,7 +550,7 @@ METHOD(Crylink, wr_think, void(entity thiswep, entity actor, .entity weaponentit } } - if((actor.(weaponentity).crylink_waitrelease == 1 && !(fire & 1)) || (actor.(weaponentity).crylink_waitrelease == 2 && !(fire & 2))) + if((actor.(weaponentity).crylink_waitrelease == 1 && !(primary_fire)) || (actor.(weaponentity).crylink_waitrelease == 2 && !(secondary_fire))) { if(!actor.(weaponentity).crylink_lastgroup || time > actor.(weaponentity).crylink_lastgroup.teleport_time) { @@ -570,7 +575,7 @@ METHOD(Crylink, wr_think, void(entity thiswep, entity actor, .entity weaponentit if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO)) { // ran out of ammo! - actor.cnt = WEP_CRYLINK.m_id; + actor.cnt = thiswep.m_id; actor.(weaponentity).m_switchweapon = w_getbestweapon(actor, weaponentity); } } @@ -582,8 +587,8 @@ METHOD(Crylink, wr_checkammo1, bool(entity thiswep, entity actor, .entity weapon if(actor.(weaponentity).crylink_lastgroup && actor.(weaponentity).crylink_waitrelease) return true; - float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR_PRI(crylink, ammo); - ammo_amount += actor.(weaponentity).(weapon_load[WEP_CRYLINK.m_id]) >= WEP_CVAR_PRI(crylink, ammo); + float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(crylink, ammo); + ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(crylink, ammo); return ammo_amount; } METHOD(Crylink, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity)) @@ -592,8 +597,8 @@ METHOD(Crylink, wr_checkammo2, bool(entity thiswep, entity actor, .entity weapon if(actor.(weaponentity).crylink_lastgroup && actor.(weaponentity).crylink_waitrelease) return true; - float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR_SEC(crylink, ammo); - ammo_amount += actor.(weaponentity).(weapon_load[WEP_CRYLINK.m_id]) >= WEP_CVAR_SEC(crylink, ammo); + float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(crylink, ammo); + ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(crylink, ammo); return ammo_amount; } METHOD(Crylink, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))