- Blood: instead of messing around with the damage factors when toggling god mode, let the game check the actual god mode flag itself.

This was just too volatile and prone to breakage.
Fixes #210.
This commit is contained in:
Christoph Oelckers 2020-12-06 08:36:54 +01:00
parent 99da4151d1
commit 5fc8859342
3 changed files with 9 additions and 18 deletions

View file

@ -103,13 +103,16 @@ void aiNewState(DBloodActor* actor, AISTATE *pAIState)
pAIState->enterFunc(&bloodActors[pXSprite->reference]);
}
bool isImmune(spritetype* pSprite, int dmgType, int minScale) {
bool isImmune(spritetype* pSprite, int dmgType, int minScale)
{
if (dmgType >= kDmgFall && dmgType < kDmgMax && pSprite->extra >= 0 && xsprite[pSprite->extra].locked != 1) {
if (dmgType >= kDmgFall && dmgType < kDmgMax && pSprite->extra >= 0 && xsprite[pSprite->extra].locked != 1)
{
if (pSprite->type >= kThingBase && pSprite->type < kThingMax)
return (thingInfo[pSprite->type - kThingBase].dmgControl[dmgType] <= minScale);
else if (IsDudeSprite(pSprite)) {
if (IsPlayerSprite(pSprite)) return (gPlayer[pSprite->type - kDudePlayer1].damageControl[dmgType] <= minScale);
else if (IsDudeSprite(pSprite))
{
if (IsPlayerSprite(pSprite)) return (gPlayer[pSprite->type - kDudePlayer1].godMode || gPlayer[pSprite->type - kDudePlayer1].damageControl[dmgType] <= minScale);
else return (dudeInfo[pSprite->type - kDudeBase].at70[dmgType] <= minScale);
}
}

View file

@ -2317,8 +2317,7 @@ void useSpriteDamager(XSPRITE* pXSource, spritetype* pSprite) {
int dmgType = (pXSource->data2 >= kDmgFall) ? ClipHigh(pXSource->data2, kDmgElectric) : -1;
int dmg = pXSprite->health << 4; int armor[3];
bool godMode = (pPlayer && ((dmgType >= 0 && pPlayer->damageControl[dmgType]) || powerupCheck(pPlayer, kPwUpDeathMask) || pPlayer->godMode
/*|| seqGetID(3, pSprite->extra) == getDudeInfo(pSprite->type)->seqStartID + 16*/)); // kneeling
bool godMode = (pPlayer && ((dmgType >= 0 && pPlayer->damageControl[dmgType]) || powerupCheck(pPlayer, kPwUpDeathMask) || pPlayer->godMode)); // kneeling
if (godMode || pXSprite->locked) return;
else if (pXSource->data3) {

View file

@ -606,17 +606,6 @@ void playerSetRace(PLAYER *pPlayer, int nLifeMode)
void playerSetGodMode(PLAYER *pPlayer, bool bGodMode)
{
if (pPlayer->godMode == bGodMode) return;
if (bGodMode)
{
for (int i = 0; i < 7; i++)
pPlayer->damageControl[i]++;
}
else
{
for (int i = 0; i < 7; i++)
pPlayer->damageControl[i]--;
}
pPlayer->godMode = bGodMode;
}
@ -1929,7 +1918,7 @@ int playerDamageSprite(int nSource, PLAYER *pPlayer, DAMAGE_TYPE nDamageType, in
{
assert(nSource < kMaxSprites);
assert(pPlayer != NULL);
if (pPlayer->damageControl[nDamageType])
if (pPlayer->damageControl[nDamageType] || pPlayer->godMode)
return 0;
nDamage = playerDamageArmor(pPlayer, nDamageType, nDamage);
pPlayer->painEffect = ClipHigh(pPlayer->painEffect+(nDamage>>3), 600);