Fix tracking of morphed monsters.

This commit is contained in:
Mari the Deer 2021-09-22 00:33:16 +02:00
commit 5f817df8b4
3 changed files with 30 additions and 6 deletions

View file

@ -1,3 +1,3 @@
[default]
SWWM_MODVER="\chSWWM \czGZ\c- \cw1.1.7 r1 \cu(Wed 22 Sep 00:32:40 CEST 2021)\c-";
SWWM_SHORTVER="\cw1.1.7 r1 \cu(2021-09-22 00:32:40)\c-";
SWWM_MODVER="\chSWWM \czGZ\c- \cw1.1.7 r2 \cu(Wed 22 Sep 00:33:16 CEST 2021)\c-";
SWWM_SHORTVER="\cw1.1.7 r2 \cu(2021-09-22 00:33:16)\c-";

View file

@ -251,7 +251,7 @@ extend Class SWWMHandler
continue;
if ( !thesight && !(deathmatch && (a is 'Inventory') && !a.bDROPPED) && !(a.IsFriend(players[consoleplayer].mo) && !(a.player && (a.player.mo != a))) && !players[consoleplayer].Camera.CheckSight(a,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) )
continue;
if ( a.bKILLED || (a.Health <= 0) )
if ( a.bKILLED || (a.Health <= 0) || a.bUnmorphed )
continue;
if ( (a is 'Inventory') && (!a.bSPECIAL || Inventory(a).Owner) )
continue;
@ -307,7 +307,7 @@ extend Class SWWMHandler
continue;
if ( !thesight && !(deathmatch && (a is 'Inventory') && !a.bDROPPED) && !a.IsFriend(players[consoleplayer].mo) && !players[consoleplayer].Camera.CheckSight(a,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) )
continue;
if ( a.bKILLED || (a.Health <= 0) )
if ( a.bKILLED || (a.Health <= 0) || a.bUnmorphed )
continue;
if ( (a is 'Inventory') && (!a.bSPECIAL || Inventory(a).Owner) )
continue;
@ -353,7 +353,8 @@ extend Class SWWMHandler
if ( (trk.target.bKILLED || (trk.target.Health <= 0))
|| ((trk.target is 'Inventory') && (!trk.target.bSPECIAL || Inventory(trk.target).Owner))
|| ((trk.target is 'Chancebox') && (trk.target.CurState != trk.target.SpawnState))
|| (trk.target.default.bMISSILE && !trk.target.bMISSILE) )
|| (trk.target.default.bMISSILE && !trk.target.bMISSILE)
|| trk.target.bUnmorphed )
trk.Update();
}
// prune expired trackers

View file

@ -285,6 +285,8 @@ Class SWWMCombatTracker : Thinker
int mxdist, dbar;
bool bBOSS, bFRIENDLY;
bool firsthit;
bool bUpdateMorph;
String unmorphedtag;
void UpdateTag()
{
@ -405,6 +407,12 @@ Class SWWMCombatTracker : Thinker
pos = level.Vec3Offset(mytarget.pos,(0,0,height));
prevpos = level.Vec3Offset(mytarget.prev,(0,0,height));
}
if ( bUpdateMorph && !(mytarget is 'MorphedMonster') )
{
// reset our tag
mytag = unmorphedtag;
bUpdateMorph = false;
}
tcnt++;
if ( (tcnt == 1) && !mytarget.player )
{
@ -414,6 +422,21 @@ Class SWWMCombatTracker : Thinker
maxhealth = lasthealth;
intp.Reset(lasthealth);
}
// post-spawn morph check
if ( (mytarget is 'MorphedMonster') && MorphedMonster(mytarget).UnmorphedMe )
{
// look for a previous tracker that has the same target as us
for ( SWWMCombatTracker t=next; t; t=t.next )
{
if ( t.mytarget != mytarget ) continue;
// change its tag and destroy ourselves (such is life)
t.bUpdateMorph = true;
t.unmorphedtag = t.mytag;
t.mytag = String.Format("%s (%s)",mytag,t.unmorphedtag);
Destroy();
return;
}
}
}
if ( (tcnt == 6) && !mytarget.player )
{
@ -547,7 +570,7 @@ Class SWWMSimpleTracker : Thinker
}
else if ( ismonster )
{
expired = target.bKILLED;
expired = target.bKILLED||target.bUnmorphed;
if ( !expired )
{
lastupdate += 35;