Made healthbar/scorenum/damnum limits tweakable.

Removed some leftover debug prints.
Additional inventory rearranging so invinciball/ragekit take priority over healing items and armor.
Adjusted ragekit punch splash damage.
This commit is contained in:
Mari the Deer 2020-04-28 12:09:31 +02:00
commit ba79f54cf2
7 changed files with 114 additions and 17 deletions

View file

@ -27,7 +27,7 @@ Class SWWMStatusBar : BaseStatusBar
SWWMVanillaBossHandler bosshnd;
// client cvars
transient CVar safezone, maxchat[2], maxpick, chatduration, msgduration, pickduration, chatcol, teamcol, obitcol, critcol, pickcol, targetter, healthnums, scorenums, scorebonus, targettag, lang;
transient CVar safezone, maxchat[2], maxpick, chatduration, msgduration, pickduration, chatcol, teamcol, obitcol, critcol, pickcol, targetter, healthnums, scorenums, scorebonus, targettag, lang, maxtarg, maxscore, maxdamns;
// shared stuff
Vector2 ss, hs;
@ -201,6 +201,12 @@ Class SWWMStatusBar : BaseStatusBar
if ( !targetter ) targetter = CVar.GetCVar('swwm_targeter',players[consoleplayer]);
if ( !healthnums ) healthnums = CVar.GetCVar('swwm_healthnums',players[consoleplayer]);
if ( !scorenums ) scorenums = CVar.GetCVar('swwm_scorenums',players[consoleplayer]);
if ( !maxtarg ) maxtarg = CVar.GetCVar('swwm_maxtargets',players[consoleplayer]);
if ( !maxscore ) maxscore = CVar.GetCVar('swwm_maxscorenums',players[consoleplayer]);
if ( !maxdamns ) maxdamns = CVar.GetCVar('swwm_maxdamnums',players[consoleplayer]);
int maxtargetnum = max(0,maxtarg.GetInt());
int maxscorenum = max(0,maxscore.GetInt());
int maxdamnum = max(0,maxdamns.GetInt());
// prune old messages
for ( int i=0; i<PickupQueue.Size(); i++ )
{
@ -276,7 +282,7 @@ Class SWWMStatusBar : BaseStatusBar
if ( trackers.Size() != hnd.trackers_cnt )
trackers.Resize(hnd.trackers_cnt);
int i = 0;
for ( SWWMCombatTracker trk=hnd.trackers; trk && (i<40); trk=trk.next )
for ( SWWMCombatTracker trk=hnd.trackers; trk && (!maxtargetnum||(i<maxtargetnum)); trk=trk.next )
{
// ignore player unless chasecamming
if ( (trk.mytarget == players[consoleplayer].mo) && (players[consoleplayer].Camera == players[consoleplayer].mo) && !(players[consoleplayer].cheats&CF_CHASECAM) ) continue;
@ -313,8 +319,8 @@ Class SWWMStatusBar : BaseStatusBar
else trackers.Clear();
// update floating scores, adding the scorenums first, then the damnums
int total_sz = 0;
if ( scorenums.GetBool() ) total_sz += min(20,hnd.scorenums_cnt);
if ( healthnums.GetBool() ) total_sz += min(40,hnd.damnums_cnt);
if ( scorenums.GetBool() ) total_sz += maxscorenum?min(maxscorenum,hnd.scorenums_cnt):hnd.scorenums_cnt;
if ( healthnums.GetBool() ) total_sz += maxdamnum?min(maxdamnum,hnd.damnums_cnt):hnd.damnums_cnt;
if ( scoreobjs.Size() != total_sz )
scoreobjs.Resize(total_sz);
int i = 0;

View file

@ -38,10 +38,9 @@ Class SWWMArmor : Armor abstract
bool foundarmor = false;
for ( Inventory i=other.Inv; i; i=i.Inv )
{
if ( i is 'SWWMArmor' ) foundarmor = true;
if ( (i is 'SWWMArmor') && (i != self) ) foundarmor = true;
if ( !(i is 'SWWMArmor') || (i == self) || (SWWMArmor(i).priority < priority) ) continue;
found = i;
Console.Printf("%s is better",i.GetTag());
}
if ( !found && !foundarmor )
{
@ -49,7 +48,6 @@ Class SWWMArmor : Armor abstract
if ( (other.Inv is 'SWWMHealth') || (other.Inv is 'GrilledCheeseSandwich') )
{
// place ourselves before it
Console.Printf("Moving before %s",other.Inv.GetTag());
Inv = other.Inv;
other.Inv = self;
return;
@ -58,11 +56,19 @@ Class SWWMArmor : Armor abstract
for ( Inventory i=other.Inv; i; i=i.Inv )
{
if ( (i == self) || (!(i.Inv is 'SWWMHealth' ) && !(i.Inv is 'GrilledCheeseSandwich')) ) continue;
Console.Printf("%s is right next to %s",i.GetTag(),i.Inv.GetTag());
found = i;
break;
}
}
if ( !found && !foundarmor )
{
// find last of either invinciball or ragekit power
for ( Inventory i=other.Inv; i; i=i.Inv )
{
if ( !(i is 'InvinciballPower') && !(i is 'RagekitPower') ) continue;
found = i;
}
}
if ( !found ) return;
// place ourselves right after it
Inventory saved = found.Inv;
@ -193,7 +199,6 @@ Class SWWMHealth : Inventory abstract
{
if ( !(i is 'SWWMHealth') || (i == self) || (GetDefaultByType(SWWMHealth(i).giveme).Amount < GetDefaultByType(giveme).Amount) ) continue;
found = i;
Console.Printf("%s is better",i.GetTag());
}
if ( !found )
{
@ -202,7 +207,6 @@ Class SWWMHealth : Inventory abstract
{
if ( !(i is 'SWWMArmor') ) continue;
found = i;
Console.Printf("Moving next to armor %s",i.GetTag());
}
}
if ( !found )
@ -210,7 +214,6 @@ Class SWWMHealth : Inventory abstract
// check if the first item in inventory is a sandwich
if ( other.Inv is 'GrilledCheeseSandwich' )
{
Console.Printf("Moving before %s",other.Inv.GetTag());
// place ourselves before it
Inv = other.Inv;
other.Inv = self;
@ -220,11 +223,19 @@ Class SWWMHealth : Inventory abstract
for ( Inventory i=other.Inv; i; i=i.Inv )
{
if ( (i == self) || !(i.Inv is 'GrilledCheeseSandwich') ) continue;
Console.Printf("%s is right next to %s",i.GetTag(),i.Inv.GetTag());
found = i;
break;
}
}
if ( !found )
{
// find last of either invinciball or ragekit power
for ( Inventory i=other.Inv; i; i=i.Inv )
{
if ( !(i is 'InvinciballPower') && !(i is 'RagekitPower') ) continue;
found = i;
}
}
if ( !found ) return;
// place ourselves right after it
Inventory saved = found.Inv;
@ -527,8 +538,8 @@ Class BigPunchSplash : Actor
override void PostBeginPlay()
{
Super.PostBeginPlay();
SWWMHandler.DoBlast(self,50,40000,target);
A_Explode(5,80,0);
SWWMHandler.DoBlast(self,120,40000,target);
A_Explode(special1,120,0);
Destroy();
}
}
@ -1033,6 +1044,7 @@ Class SWWMWeapon : Weapon abstract
{
let ps = Spawn("BigPunchSplash",d.HitLocation);
ps.target = self;
ps.special1 = dmg;
}
A_QuakeEx(quakin/2,quakin/2,quakin/2,3,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.06*quakin);
if ( raging ) A_StartSound(bloodless?"pusher/althit":"pusher/altmeat",CHAN_WEAPON,CHANF_OVERLAP);
@ -1112,6 +1124,7 @@ Class SWWMWeapon : Weapon abstract
{
let ps = Spawn("BigPunchSplash",d.HitLocation+HitNormal*4);
ps.target = self;
ps.special1 = dmg;
}
int quakin = raging?4:1;
A_QuakeEx(quakin,quakin,quakin,3,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.12*quakin);

View file

@ -65,11 +65,11 @@ Class GrilledCheeseSandwich : Inventory
override void AttachToOwner( Actor other )
{
Super.AttachToOwner(other);
// find last armor or health item
// find last armor/health item or invuln/ragekit
Inventory found = null;
for ( Inventory i=other.Inv; i; i=i.Inv )
{
if ( !(i is 'SWWMHealth') && !(i is 'SWWMArmor') ) continue;
if ( !(i is 'SWWMHealth') && !(i is 'SWWMArmor') && !(i is 'InvinciballPower') && !(i is 'RagekitPower') ) continue;
found = i;
}
if ( !found ) return;
@ -526,6 +526,36 @@ Class InvinciballPower : Powerup
if ( (EffectTics <= 0) && Owner && Owner.CheckLocalView() ) Console.Printf(StringTable.Localize("$D_INVINCIBALL"));
}
override void AttachToOwner( Actor other )
{
Super.AttachToOwner(other);
// find first with health/armor or sandwich after it
Inventory found = null;
for ( Inventory i=other.Inv; i; i=i.Inv )
{
if ( !(i.Inv is 'SWWMHealth') && !(i.Inv is 'SWWMArmor') && !(i.Inv is 'GrilledCheeseSandwich') ) continue;
found = i;
break;
}
if ( !found )
{
// check if first item in inventory is health/armor or a sandwich
if ( (other.Inv is 'SWWMHealth') || (other.Inv is 'SWWMArmor') || (other.Inv is 'GrilledCheeseSandwich') )
{
// place ourselves before it
Inv = other.Inv;
other.Inv = self;
return;
}
return;
}
// place ourselves right after it
Inventory saved = found.Inv;
found.Inv = self;
other.Inv = Inv;
Inv = saved;
}
override void ModifyDamage( int damage, Name damageType, out int newdamage, bool passive, Actor inflictor, Actor source, int flags )
{
if ( damageType == 'EndLevel' ) return;
@ -738,6 +768,36 @@ Class RagekitPower : Powerup
if ( (EffectTics <= 0) && Owner && Owner.CheckLocalView() ) Console.Printf(StringTable.Localize("$D_RAGEKIT"));
}
override void AttachToOwner( Actor other )
{
Super.AttachToOwner(other);
// find first with health/armor or sandwich after it
Inventory found = null;
for ( Inventory i=other.Inv; i; i=i.Inv )
{
if ( !(i.Inv is 'SWWMHealth') && !(i.Inv is 'SWWMArmor') && !(i.Inv is 'GrilledCheeseSandwich') ) continue;
found = i;
break;
}
if ( !found )
{
// check if first item in inventory is health/armor or a sandwich
if ( (other.Inv is 'SWWMHealth') || (other.Inv is 'SWWMArmor') || (other.Inv is 'GrilledCheeseSandwich') )
{
// place ourselves before it
Inv = other.Inv;
other.Inv = self;
return;
}
return;
}
// place ourselves right after it
Inventory saved = found.Inv;
found.Inv = self;
other.Inv = Inv;
Inv = saved;
}
void DoHitFX()
{
if ( level.maptime <= lasteffect+5 ) return;