Added new cl_bloodvanillaenemies CVAR

GetClosestSpriteSectors(): If newSectCheckMethod is set, then always test midpoints at least once
Use new CVAR for tiny Caleb/burning cultists/Cerberus fixes
Do not use new GetClosestSpriteSectors() fix for teslaHit() if vanilla explosions is set
Do not use GetClosestSpriteSectors() fix for enemies sight scanning if vanilla enemies is set
This commit is contained in:
carnivoroussociety 2021-08-19 14:19:41 +10:00
parent 440fa3b70e
commit db9a413f21
7 changed files with 25 additions and 26 deletions

View File

@ -84,7 +84,8 @@ CVARD(Bool, cl_exhumedoldturn, false, CVAR_ARCHIVE, "enable/disable legacy turni
CVARD(Bool, cl_hudinterpolation, true, CVAR_ARCHIVE, "enable/disable HUD (weapon drawer) interpolation")
CVARD(Bool, cl_bloodvanillarun, true, CVAR_ARCHIVE, "enable/disable Blood's vanilla run mode")
CVARD(Bool, cl_bloodvanillabobbing, true, CVAR_ARCHIVE, "enable/disable Blood's vanilla bobbing while not using vanilla run mode")
CVARD(Bool, cl_bloodvanillaexplosions, false, CVAR_ARCHIVE, "enable/disable Blood's original explosion behavior")
CVARD(Bool, cl_bloodvanillaexplosions, false, CVAR_ARCHIVE, "enable/disable Blood's vanilla explosion behavior")
CVARD(Bool, cl_bloodvanillaenemies, false, CVAR_ARCHIVE, "enable/disable Blood's vanilla enemy behavior")
CVARD(Bool, cl_bloodhudinterp, false, CVAR_ARCHIVE, "enable/disable Blood's HUD interpolation")
CVARD(Bool, cl_bloodoldweapbalance, false, CVAR_ARCHIVE, "enable/disable legacy 1.0 weapon handling for Blood")

View File

@ -30,6 +30,7 @@ EXTERN_CVAR(Bool, cl_hudinterpolation)
EXTERN_CVAR(Bool, cl_bloodvanillarun)
EXTERN_CVAR(Bool, cl_bloodvanillabobbing)
EXTERN_CVAR(Bool, cl_bloodvanillaexplosions)
EXTERN_CVAR(Bool, cl_bloodvanillaenemies)
EXTERN_CVAR(Bool, cl_bloodhudinterp)
EXTERN_CVAR(Bool, cl_bloodoldweapbalance)

View File

@ -3092,7 +3092,7 @@ static bool actKillDudeStage1(DBloodActor* actor, DAMAGE_TYPE damageType)
break;
case kDudeTinyCaleb:
if (VanillaMode() || DemoRecordStatus())
if (cl_bloodvanillaenemies || VanillaMode() || DemoRecordStatus())
break;
if (damageType == kDamageBurn && pXSprite->medium == kMediumNormal)
{
@ -5110,7 +5110,7 @@ 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
const bool fixRandomCultist = !cl_bloodvanillaenemies && (pSprite->inittype >= kDudeBase) && (pSprite->inittype < kDudeMax) && !VanillaMode() && !DemoRecordStatus(); // fix burning cultists randomly switching types underwater
if (Chance(chance))
pSprite->type = kDudeCultistTommy;
else
@ -6197,7 +6197,7 @@ void actProcessSprites(void)
if (nXSprite > 0)
{
XSPRITE *pXSprite = &xsprite[nXSprite];
const bool fixBurnGlitch = IsBurningDude(pSprite) && !VanillaMode() && !DemoRecordStatus(); // if enemies are burning, always apply burning damage per tick
const bool fixBurnGlitch = !cl_bloodvanillaenemies && IsBurningDude(pSprite) && !VanillaMode() && !DemoRecordStatus(); // if enemies are burning, always apply burning damage per tick
if ((pXSprite->burnTime > 0) || fixBurnGlitch)
{
switch (pSprite->type)

View File

@ -177,7 +177,7 @@ bool CanMove(spritetype *pSprite, int a2, int nAngle, int nRange)
// It makes ignore danger if enemy immune to N damageType. As result Cerberus start acting like
// in Blood 1.0 so it can move normally to player. It's up to you for adding rest of enemies here as
// i don't think it will broke something in game.
if (!VanillaMode() && Crusher && isImmune(pSprite, pXSector->damageType, 16)) return true;
if (!cl_bloodvanillaenemies && !VanillaMode() && Crusher && isImmune(pSprite, pXSector->damageType, 16)) return true;
fallthrough__;
case kDudeZombieButcher:
case kDudeSpiderBrown:
@ -1033,7 +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
const bool fixRandomCultist = !cl_bloodvanillaenemies && (pSprite->inittype >= kDudeBase) && (pSprite->inittype < kDudeMax) && !VanillaMode() && !DemoRecordStatus(); // fix burning cultists randomly switching types underwater
switch (pSprite->type)
{
case kDudeCultistTommy:
@ -1110,7 +1110,7 @@ int aiDamageSprite(DBloodActor* source, DBloodActor* actor, DAMAGE_TYPE nDmgType
case kDudeTinyCaleb:
if (nDmgType == kDamageBurn && pXSprite->health <= (unsigned int)pDudeInfo->fleeHealth/* && (pXSprite->at17_6 != 1 || pXSprite->at17_6 != 2)*/)
{
if (!VanillaMode() && !DemoRecordStatus()) // fix burning sprite for tiny caleb
if (!cl_bloodvanillaenemies && !VanillaMode() && !DemoRecordStatus()) // fix burning sprite for tiny caleb
{
pSprite->type = kDudeBurningTinyCaleb;
aiNewState(actor, &tinycalebBurnGoto);
@ -1480,7 +1480,7 @@ void aiLookForTarget(spritetype *pSprite, XSPRITE *pXSprite)
if (pXSprite->state)
{
uint8_t sectmap[(kMaxSectors+7)>>3];
const bool newSectCheckMethod = !VanillaMode() && !DemoRecordStatus(); // use new sector checking logic
const bool newSectCheckMethod = !cl_bloodvanillaenemies && !VanillaMode() && !DemoRecordStatus(); // use new sector checking logic
GetClosestSpriteSectors(pSprite->sectnum, pSprite->x, pSprite->y, 400, sectmap, nullptr, newSectCheckMethod);
int nSprite2;

View File

@ -95,7 +95,7 @@ void StompSeqCallback(int, DBloodActor* actor1)
int nSector = pSprite->sectnum;
int v1c = 5+2*gGameOptions.nDifficulty;
int v10 = 25+30*gGameOptions.nDifficulty;
const bool newSectCheckMethod = !VanillaMode() && !DemoRecordStatus(); // use new sector checking logic
const bool newSectCheckMethod = !cl_bloodvanillaenemies && !VanillaMode() && !DemoRecordStatus(); // use new sector checking logic
GetClosestSpriteSectors(nSector, x, y, vc, sectmap, nullptr, newSectCheckMethod);
char v4 = 0;
int hit = HitScan(pSprite, pSprite->z, dx, dy, 0, CLIPMASK1, 0);

View File

@ -886,23 +886,20 @@ int GetClosestSpriteSectors(int nSector, int x, int y, int nDist, uint8_t *pSect
int x2 = wall[nWallB].x, y2 = wall[nWallB].y;
int nLength = approxDist(x1-x2, y1-y2);
const int nDist2 = (nDist+(nDist>>1))<<4;
if (nLength > nDist2) // if span is greater than range * 1.5, test midsection
nLength = ClipRange(nLength / nDist2, 1, 4); // never split more than 4 times
for (int k = 0; true; k++) // subdivide span into smaller chunks towards direction
{
nLength = ClipRange(nLength / nDist2, 1, 4); // never split more than 4 times
for (int k = 0; k < nLength; k++) // subdivide span into smaller chunks towards direction
{
const int xcenter = (x1+x2)>>1, ycenter = (y1+y2)>>1;
withinRange = CheckProximityPoint(xcenter, ycenter, 0, x, y, 0, nDist);
if (withinRange)
break;
if ((k+1) == nLength) // reached end, no point in calculating direction/center again
break;
const bool bDir = approxDist(x-x1, y-y1) < approxDist(x-x2, y-y2);
if (bDir) // step closer and check again
x2 = xcenter, y2 = ycenter;
else
x1 = xcenter, y1 = ycenter;
}
const int xcenter = (x1+x2)>>1, ycenter = (y1+y2)>>1;
withinRange = CheckProximityPoint(xcenter, ycenter, 0, x, y, 0, nDist);
if (withinRange)
break;
if (k == (nLength-1)) // reached end
break;
const bool bDir = approxDist(x-x1, y-y1) < approxDist(x-x2, y-y2);
if (bDir) // step closer and check again
x2 = xcenter, y2 = ycenter;
else
x1 = xcenter, y1 = ycenter;
}
}
if (withinRange) // if new sector is within range, set to current sector and test walls

View File

@ -2625,7 +2625,7 @@ void teslaHit(spritetype *pMissile, int a2)
int nDist = 300;
int nSector = pMissile->sectnum;
int nOwner = pMissile->owner;
const bool newSectCheckMethod = !VanillaMode() && !DemoRecordStatus(); // use new sector checking logic
const bool newSectCheckMethod = !cl_bloodvanillaexplosions && !VanillaMode() && !DemoRecordStatus(); // use new sector checking logic
GetClosestSpriteSectors(nSector, x, y, nDist, sectmap, nullptr, newSectCheckMethod);
bool v4 = true;
DBloodActor* actor = nullptr;