Cherrypicked changes from devel.

This commit is contained in:
Mari the Deer 2021-11-07 11:21:46 +01:00
commit 30d53ef991
7 changed files with 122 additions and 32 deletions

View file

@ -219,17 +219,35 @@ extend Class SWWMHandler
SWWMUtility.AchievementProgress('swwm_progress_onehp',onehpspree[pnum],src.player);
}
// tasty treats
if ( swwm_demoslayer && (src.Health < 100) )
if ( swwm_demoslayer )
{
int amt = clamp(e.Thing.SpawnHealth()/20,1,10);
if ( e.Thing.Health < (e.Thing.GetGibHealth()*2) ) amt *= 3;
else if ( e.Thing.Health < e.Thing.GetGibHealth() ) amt *= 2;
for ( int i=0; i<amt; i++ )
if ( src.Health < 100 )
{
let a = Actor.Spawn("HealthOrb",e.Thing.Vec3Offset(0,0,e.Thing.Height/2));
a.vel.z = FRandom[Junk](4,16);
double ang = FRandom[Junk](0,360);
a.vel.xy = (cos(ang),sin(ang))*FRandom[Junk](4,8);
int amt = clamp(e.Thing.SpawnHealth()/20,1,10);
if ( e.Thing.Health < (e.Thing.GetGibHealth()*2) ) amt *= 3;
else if ( e.Thing.Health < e.Thing.GetGibHealth() ) amt *= 2;
for ( int i=0; i<amt; i++ )
{
if ( !Random[Junk](0,2) ) continue;
let a = Actor.Spawn("HealthOrb",e.Thing.Vec3Offset(0,0,e.Thing.Height/2));
a.vel.z = FRandom[Junk](4,16);
double ang = FRandom[Junk](0,360);
a.vel.xy = (cos(ang),sin(ang))*FRandom[Junk](4,8);
}
}
if ( src.CountInv("ArmorNugget") < 100 )
{
int amt = clamp(e.Thing.SpawnHealth()/40,1,5);
if ( e.Thing.Health < (e.Thing.GetGibHealth()*2) ) amt *= 3;
else if ( e.Thing.Health < e.Thing.GetGibHealth() ) amt *= 2;
for ( int i=0; i<amt; i++ )
{
if ( Random[Junk](0,1) ) continue;
let a = Actor.Spawn("ArmorOrb",e.Thing.Vec3Offset(0,0,e.Thing.Height/2));
a.vel.z = FRandom[Junk](4,16);
double ang = FRandom[Junk](0,360);
a.vel.xy = (cos(ang),sin(ang))*FRandom[Junk](4,8);
}
}
}
}

View file

@ -599,15 +599,22 @@ Class SWWMMessageBox : MessageBoxMenu
double y = destHeight/2;
int c = mMessage.Count();
int theight = 0;
int l1 = c;
for ( int i=0; i<c; i++ )
{
int scl = ((i==c-1)||(mMessage.StringWidth(i)==0))?2:3;
if ( mMessage.StringWidth(i) != 0 ) continue;
l1 = i;
break;
}
for ( int i=0; i<c; i++ )
{
int scl = ((i==c-1)||(mMessage.StringWidth(i)==0))?2:(i>l1)?1:3;
theight += fontheight*scl;
}
y -= theight/2;
for ( int i=0; i<c; i++ )
{
double scl = ((i==c-1)||(mMessage.StringWidth(i)==0))?2.:3.;
double scl = ((i==c-1)||(mMessage.StringWidth(i)==0))?2.:(i>l1)?1.:3.;
Screen.DrawText(textfont,OptionMenuSettings.mFontColorValue,destWidth/2-mMessage.StringWidth(i)*(scl/2.),y,mMessage.StringAt(i),DTA_VirtualWidth,destWidth,DTA_VirtualHeight,destHeight,DTA_KeepRatio,true,DTA_ScaleX,scl,DTA_ScaleY,scl);
y += fontheight*scl;
}

View file

@ -2,8 +2,12 @@
// drop from monsters when using "Demoslayer" fun option
// heals up to 100 HP when touched
Class HealthOrb : Actor
Class SlayerOrb : Actor abstract
{
Class<Actor> tclass;
Property TrailClass : tclass;
Default
{
RenderStyle "Add";
@ -24,13 +28,16 @@ Class HealthOrb : Actor
+CANBOUNCEWATER;
+FORCEXYBILLBOARD;
}
virtual void PickedUp( int np, PlayerPawn mo )
{
}
override void Tick()
{
Vector3 oldp = pos;
Super.Tick();
if ( !isFrozen() )
{
let t = Spawn("HealthOrbTrail",pos);
let t = Spawn(tclass,pos);
t.scale *= abs(scale.x);
t.alpha *= alpha;
scale *= .995;
@ -55,13 +62,7 @@ Class HealthOrb : Actor
let mo = players[np].mo;
if ( (GetAge() > 5) && SWWMUtility.BoxIntersect(self,mo,pad:8) )
{
int flg = CHANF_OVERLAP|CHANF_MAYBE_LOCAL;
if ( mo.CheckLocalView() ) flg |= CHANF_NOPAUSE;
mo.A_StartSound("misc/health_pkup",CHAN_ITEM,flg);
int hp = int(ceil(abs(scale.x*10)));
mo.GiveBody(hp,100);
SWWMHandler.HealthFlash(np);
SWWMScoreObj.Spawn(hp,mo.Vec3Offset(FRandom[ScoreBits](-8,8),FRandom[ScoreBits](-8,8),FRandom[ScoreBits](-8,8)+mo.Height/2),ST_Health);
PickedUp(np,mo);
Destroy();
return;
}
@ -80,14 +81,65 @@ Class HealthOrb : Actor
Scale.x *= RandomPick[Junk](-1,-1);
Scale.y *= RandomPick[Junk](-1,-1);
}
}
Class HealthOrb : SlayerOrb
{
Default
{
SlayerOrb.TrailClass "HealthOrbTrail";
}
override void PickedUp( int np, PlayerPawn mo )
{
int flg = CHANF_OVERLAP|CHANF_MAYBE_LOCAL;
if ( mo.CheckLocalView() ) flg |= CHANF_NOPAUSE;
mo.A_StartSound("misc/health_pkup",CHAN_ITEM,flg);
int hp = int(ceil(abs(scale.x*10)));
mo.GiveBody(hp,100);
SWWMHandler.HealthFlash(np);
SWWMScoreObj.Spawn(hp,mo.Vec3Offset(FRandom[ScoreBits](-8,8),FRandom[ScoreBits](-8,8),FRandom[ScoreBits](-8,8)+mo.Height/2),ST_Health);
}
States
{
Spawn:
BLPF E -1 Bright;
Stop;
}
}
Class HealthOrbTrail : Actor
Class ArmorOrb : SlayerOrb
{
Default
{
SlayerOrb.TrailClass "ArmorOrbTrail";
}
override void PickedUp( int np, PlayerPawn mo )
{
int flg = CHANF_OVERLAP|CHANF_MAYBE_LOCAL;
if ( mo.CheckLocalView() ) flg |= CHANF_NOPAUSE;
mo.A_StartSound("misc/armor_pkup",CHAN_ITEM,flg);
int hp = int(ceil(abs(scale.x*10)));
let n = mo.FindInventory("ArmorNugget");
if ( !n )
{
n = Inventory(Spawn("ArmorNugget"));
n.AttachToOwner(mo);
SWWMLoreLibrary.Add(mo.player,"Nugget");
n.Amount = 0;
}
if ( n.Amount < 100 ) n.Amount = min(n.Amount+hp,100);
SWWMHandler.ArmorFlash(np);
SWWMScoreObj.Spawn(hp,mo.Vec3Offset(FRandom[ScoreBits](-8,8),FRandom[ScoreBits](-8,8),FRandom[ScoreBits](-8,8)+mo.Height/2),ST_Armor);
}
States
{
Spawn:
BLPF D -1 Bright;
Stop;
}
}
Class SlayerOrbTrail : Actor abstract
{
Default
{
@ -115,6 +167,9 @@ Class HealthOrbTrail : Actor
Super.PostBeginPlay();
SpriteOffset = (0,-4);
}
}
Class HealthOrbTrail : SlayerOrbTrail
{
States
{
Spawn:
@ -122,6 +177,15 @@ Class HealthOrbTrail : Actor
Stop;
}
}
Class ArmorOrbTrail : SlayerOrbTrail
{
States
{
Spawn:
BLPS D -1 Bright;
Stop;
}
}
Class DashTrail : Actor
{