Quadravol melee and stance swap fully implemented.

Fix quick melee not hitting world geometry (oops).
This commit is contained in:
Mari the Deer 2022-08-19 21:58:44 +02:00
commit ab462cc05d
8 changed files with 565 additions and 61 deletions

View file

@ -371,7 +371,9 @@ extend Class SWWMWeapon
MELEE_Vertical = 16, // ring is widened vertically, rather than horizontally
MELEE_Wider = 32, // ring is widened by 2.5x rather than 1.5x
MELEE_ExtraWide = 64, // if Wider is also specified, widen by 5x, otherwise widen by 3x
MELEE_HammerHit = 128 // is hammer melee (gibbing counts for "HAHA DAB" achievement)
MELEE_HammerHit = 128, // is hammer melee (gibbing counts for "HAHA DAB" achievement)
MELEE_NoRage = 256, // unaffected by ragekit
MELEE_NoUse = 512 // do not pass use actions to this melee
};
action void A_Parry( int duration )
@ -401,7 +403,7 @@ extend Class SWWMWeapon
int rings = 1;
double step = spread/20.;
double range = 1.5*DEFMELEERANGE*rangemul;
bool raging = CountInv("RagekitPower");
bool raging = (flags&MELEE_NoRage)?false:CountInv("RagekitPower");
double widemul = (flags&MELEE_ExtraWide)?(flags&MELEE_Wider)?5:3:(flags&MELEE_Wider)?2.5:1.5;
for ( double i=0; i<spread; i+=step )
{
@ -499,38 +501,42 @@ extend Class SWWMWeapon
action bool A_Melee( int dmg = 40, String hitsound = "", double rangemul = 1., double spreadmul = 1., double kickmul = 1., int flags = 0 )
{
let raging = RagekitPower(FindInventory("RagekitPower"));
if ( flags&MELEE_NoRage ) raging = null;
if ( raging ) rangemul += .2;
Vector3 origin = Vec3Offset(0,0,player.viewheight);
Vector3 dir = SWWMUtility.Vec3FromAngles(angle,pitch);
// check for usables
if ( !invoker.ut ) invoker.ut = new("UseLineTracer");
let ut = invoker.ut; // for convenience
ut.uses.Clear();
ut.Trace(origin,level.PointInSector(origin.xy),dir,DEFMELEERANGE*rangemul,0);
invoker.wallponch = true;
for ( int i=0; i<ut.uses.Size(); i++ )
if ( !(flags&MELEE_NoUse) )
{
if ( ut.uses[i].hitactor )
if ( !invoker.ut ) invoker.ut = new("UseLineTracer");
let ut = invoker.ut; // for convenience
ut.uses.Clear();
ut.Trace(origin,level.PointInSector(origin.xy),dir,DEFMELEERANGE*rangemul,0);
invoker.wallponch = true;
for ( int i=0; i<ut.uses.Size(); i++ )
{
// punching is not greeting/patting (that'd be weird)
if ( (ut.uses[i].hitactor == self) || (ut.uses[i].hitactor is 'Demolitionist')
|| (ut.uses[i].hitactor is 'HeadpatTracker')
|| (ut.uses[i].hitactor is 'FroggyChair') ) continue;
if ( ut.uses[i].hitactor.Used(self) ) break;
}
else if ( ut.uses[i].hitline && UseLineTracer.TangibleLine(ut.uses[i]) )
{
int locknum = SWWMUtility.GetLineLock(ut.uses[i].hitline);
if ( !locknum || CheckKeys(locknum,false,true) )
ut.uses[i].hitline.RemoteActivate(self,ut.uses[i].hitside,SPAC_Use,ut.uses[i].pos);
if ( !(ut.uses[i].hitline.activation&SPAC_UseThrough) ) break;
if ( ut.uses[i].hitactor )
{
// punching is not greeting/patting (that'd be weird)
if ( (ut.uses[i].hitactor == self) || (ut.uses[i].hitactor is 'Demolitionist')
|| (ut.uses[i].hitactor is 'HeadpatTracker')
|| (ut.uses[i].hitactor is 'FroggyChair') ) continue;
if ( ut.uses[i].hitactor.Used(self) ) break;
}
else if ( ut.uses[i].hitline && UseLineTracer.TangibleLine(ut.uses[i]) )
{
int locknum = SWWMUtility.GetLineLock(ut.uses[i].hitline);
if ( !locknum || CheckKeys(locknum,false,true) )
ut.uses[i].hitline.RemoteActivate(self,ut.uses[i].hitside,SPAC_Use,ut.uses[i].pos);
if ( !(ut.uses[i].hitline.activation&SPAC_UseThrough) ) break;
}
}
invoker.wallponch = false;
// check for shootables
SWWMBulletTrail.DoTrail(self,origin,dir,DEFMELEERANGE*rangemul,0);
}
invoker.wallponch = false;
// check for shootables
SWWMBulletTrail.DoTrail(self,origin,dir,DEFMELEERANGE*rangemul,0);
bool res = TryMelee((raging?.3:.2)*spreadmul,dmg,hitsound,rangemul,kickmul,flags);
if ( !flags&MELEE_Rip ) return res;
if ( res && !(flags&MELEE_Rip) ) return res;
// check for walls instead
FTranslatedLineTarget t;
double slope = AimLineAttack(angle,DEFMELEERANGE*rangemul,t,0.,ALF_CHECK3D);
@ -552,7 +558,7 @@ extend Class SWWMWeapon
{
HitNormal = (-d.HitLine.delta.y,d.HitLine.delta.x,0).unit();
if ( !d.LineSide ) HitNormal *= -1;
d.HitLine.RemoteActivate(self,d.LineSide,SPAC_Impact,d.HitLocation+HitNormal*4);
if ( !(flags&MELEE_NoUse) ) d.HitLine.RemoteActivate(self,d.LineSide,SPAC_Impact,d.HitLocation+HitNormal*4);
}
let p = Spawn(raging?"BigPunchImpact":"PunchImpact",d.HitLocation+HitNormal*4);
p.angle = atan2(HitNormal.y,HitNormal.x);