cleaned up actInitDude.

Moved the modernDude stuff to a commented out stub in aiunicult and made custom monster health an engine feature.
This commit is contained in:
Christoph Oelckers 2023-10-09 19:07:14 +02:00
parent 2f6998f980
commit 0abba1ab7d
3 changed files with 21 additions and 33 deletions

View file

@ -896,43 +896,14 @@ static void actInitDudes()
int seqStartId = act->seqStartID();
if (!act->IsPlayerActor())
{
#ifdef NOONE_EXTENSIONS
switch (act->GetType())
{
case kDudeModernCustom:
case kDudeModernCustomBurning:
act->spr.cstat |= CSTAT_SPRITE_BLOOD_BIT1 | CSTAT_SPRITE_BLOCK_ALL;
if (act->xspr.data2 > 0 && getSequence(act->xspr.data2))
seqStartId = act->xspr.data2; // Custom Dude stores it's SEQ in data2
seqStartId = genDudeSeqStartId(act); // Custom Dude stores its SEQ in data2
act->xspr.sysData1 = act->xspr.data3; // move sndStartId to sysData1, because data3 used by the game;
act->xspr.data3 = 0;
break;
case kDudePodMother: // FakeDude type (no seq, custom flags, clipdist and cstat)
if (gModernMap) break;
[[fallthrough]];
default:
act->clipdist = act->fClipDist();
act->spr.cstat |= CSTAT_SPRITE_BLOOD_BIT1 | CSTAT_SPRITE_BLOCK_ALL;
break;
}
#else
act->clipdist = act->fClipDist();
act->spr.cstat |= CSTAT_SPRITE_BLOOD_BIT1 | CSTAT_SPRITE_BLOCK_ALL;
#endif
act->vel.Zero();
#ifdef NOONE_EXTENSIONS
// add a way to set custom hp for every enemy - should work only if map just started and not loaded.
if (!gModernMap || act->xspr.sysData2 <= 0) act->xspr.health = act->startHealth() << 4;
else act->xspr.health = ClipRange(act->xspr.sysData2 << 4, 1, 65535);
#else
act->xspr.health = act->startHealth() << 4;
#endif
if ((currentLevel->featureflags & kFeatureEnemyAttacks) && act->xspr.sysData2 > 0)
act->xspr.health = clamp(act->xspr.sysData2 << 4, 1, 65535);
else
act->xspr.health = act->startHealth() << 4;
}
if (getSequence(seqStartId)) seqSpawn(seqStartId, act);

View file

@ -2651,5 +2651,21 @@ void modernCustomDudeBurningDeath(DBloodActor* actor, int nSeq)
}
void onGenDudeInit() // should be called virtually from actInitDude
{
if (act->xspr.data2 > 0 && getSequence(act->xspr.data2))
seqStartId = act->xspr.data2; // Custom Dude stores it's SEQ in data2
seqStartId = genDudeSeqStartId(act); // Custom Dude stores its SEQ in data2
act->xspr.sysData1 = act->xspr.data3; // move sndStartId to sysData1, because data3 used by the game;
act->xspr.data3 = 0;
}
/* onInit
case kDudePodMother: // FakeDude type (no seq, custom flags, clipdist and cstat)
if (gModernMap) break;
[[fallthrough]];
*/
END_BLD_NS
#endif

View file

@ -281,6 +281,7 @@ enum EFeatureFlags
kFeatureEnemyAttacks = 2,
kFeatureCustomClipdist = 4,
kFeatureCustomTrapExploder = 8,
kFeatureCustomEnemyHealth = 16,
};
constexpr int BMAX_PATH = 260;