Fixed burning cultists switching type in water

Fixed glitched burning enemy state
Fixed burning Caleb using innocent burning sprite
This commit is contained in:
carnivoroussociety 2021-08-15 17:12:33 +10:00 committed by Christoph Oelckers
parent fb5e8e72ab
commit cd88bb1a67
2 changed files with 42 additions and 14 deletions

View file

@ -3089,6 +3089,18 @@ static bool actKillDudeStage1(DBloodActor* actor, DAMAGE_TYPE damageType)
return true;
}
break;
case kDudeTinyCaleb:
if (VanillaMode() || DemoRecordStatus())
break;
if (damageType == kDamageBurn && pXSprite->medium == kMediumNormal)
{
pSprite->type = kDudeBurningTinyCaleb;
aiNewState(actor, &innocentBurnGoto);
actHealDude(actor, dudeInfo[39].startHealth, dudeInfo[39].startHealth);
return true;
}
break;
}
return false;
}
@ -5093,22 +5105,17 @@ void MoveDude(spritetype *pSprite)
break;
case kDudeBurningCultist:
{
const bool fixRandomCultist = (pSprite->inittype >= kDudeBase) && (pSprite->inittype < kDudeMax) && !VanillaMode() && !DemoRecordStatus(); // fix burning cultists randomly switching types underwater
if (Chance(chance))
{
pSprite->type = kDudeCultistTommy;
pXSprite->burnTime = 0;
evPost(nSprite, 3, 0, kCallbackEnemeyBubble);
sfxPlay3DSound(pSprite, 720, -1, 0);
aiNewState(&bloodActors[pXSprite->reference], &cultistSwimGoto);
}
else
{
pSprite->type = kDudeCultistShotgun;
pXSprite->burnTime = 0;
evPost(nSprite, 3, 0, kCallbackEnemeyBubble);
sfxPlay3DSound(pSprite, 720, -1, 0);
aiNewState(&bloodActors[pXSprite->reference], &cultistSwimGoto);
}
if (fixRandomCultist) // fix burning cultists randomly switching types underwater
pSprite->type = pSprite->inittype; // restore back to spawned cultist type
pXSprite->burnTime = 0;
evPost(nSprite, 3, 0, kCallbackEnemeyBubble);
sfxPlay3DSound(pSprite, 720, -1, 0);
aiNewState(&bloodActors[pXSprite->reference], &cultistSwimGoto);
break;
}
case kDudeZombieAxeNormal:
@ -5727,6 +5734,7 @@ void actProcessSprites(void)
int nXSprite = pSprite->extra;
if (nXSprite > 0) {
XSPRITE *pXSprite = &xsprite[nXSprite];
const bool fixBurnGlitch = IsBurningDude(pSprite) && !VanillaMode() && !DemoRecordStatus(); // if enemies are these types, always apply burning damage per tick
switch (pSprite->type) {
case kThingBloodBits:
case kThingBloodChunks:
@ -5735,7 +5743,7 @@ void actProcessSprites(void)
break;
}
if (pXSprite->burnTime > 0)
if ((pXSprite->burnTime > 0) || fixBurnGlitch)
{
pXSprite->burnTime = ClipLow(pXSprite->burnTime-4,0);
actDamageSprite(pXSprite->burnSource, pSprite, kDamageBurn, 8);

View file

@ -896,11 +896,24 @@ int aiDamageSprite(DBloodActor* source, DBloodActor* actor, DAMAGE_TYPE nDmgType
spritetype *pSource = &source->s();
int nSource = pSource->index;
if (pSprite == pSource) return 0;
else if (pXSprite->target == -1 || (nSource != pXSprite->target && Chance(pSprite->type == pSource->type ? nDamage*pDudeInfo->changeTargetKin : nDamage*pDudeInfo->changeTarget)))
else if (pXSprite->target == -1) // if no target, give the dude a target
{
aiSetTarget(pXSprite, nSource);
aiActivateDude(&bloodActors[pXSprite->reference]);
}
else if (nSource != pXSprite->target) // if found a new target, retarget
{
int nThresh = nDamage;
if (pSprite->type == pSource->type)
nThresh *= pDudeInfo->changeTargetKin;
else
nThresh *= pDudeInfo->changeTarget;
if (Chance(nThresh))
{
aiSetTarget(pXSprite, nSource);
aiActivateDude(&bloodActors[pXSprite->reference]);
}
}
#ifdef NOONE_EXTENSIONS
if (gModernMap) {
@ -1020,6 +1033,7 @@ int aiDamageSprite(DBloodActor* source, DBloodActor* actor, DAMAGE_TYPE nDmgType
DUDEEXTRA *pDudeExtra = &gDudeExtra[pSprite->extra];
pDudeExtra->recoil = 1;
}
const bool fixRandomCultist = (pSprite->inittype >= kDudeBase) && (pSprite->inittype < kDudeMax) && !VanillaMode() && !DemoRecordStatus(); // fix burning cultists randomly switching types underwater
switch (pSprite->type)
{
case kDudeCultistTommy:
@ -1066,12 +1080,16 @@ int aiDamageSprite(DBloodActor* source, DBloodActor* actor, DAMAGE_TYPE nDmgType
if (Chance(0x600) && (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo))
{
pSprite->type = kDudeCultistTommy;
if (fixRandomCultist) // fix burning cultists randomly switching types underwater
pSprite->type = pSprite->inittype; // restore back to spawned cultist type
pXSprite->burnTime = 0;
aiNewState(actor, &cultistSwimGoto);
}
else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo)
{
pSprite->type = kDudeCultistShotgun;
if (fixRandomCultist) // fix burning cultists randomly switching types underwater
pSprite->type = pSprite->inittype; // restore back to spawned cultist type
pXSprite->burnTime = 0;
aiNewState(actor, &cultistSwimGoto);
}
@ -1093,6 +1111,8 @@ int aiDamageSprite(DBloodActor* source, DBloodActor* actor, DAMAGE_TYPE nDmgType
if (nDmgType == kDamageBurn && pXSprite->health <= (unsigned int)pDudeInfo->fleeHealth/* && (pXSprite->at17_6 != 1 || pXSprite->at17_6 != 2)*/)
{
pSprite->type = kDudeBurningInnocent;
if (!VanillaMode() && !DemoRecordStatus()) // fix burning sprite for tiny caleb
pSprite->type = kDudeBurningTinyCaleb;
aiNewState(actor, &cultistBurnGoto);
aiPlay3DSound(pSprite, 361, AI_SFX_PRIORITY_0, -1);
gDudeExtra[pSprite->extra].time = PlayClock+360;