mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 17:01:51 +00:00
- nnExtIsImmune
This commit is contained in:
parent
6846b50a21
commit
6a96d6c354
4 changed files with 31 additions and 19 deletions
|
@ -230,7 +230,7 @@ bool CanMove(DBloodActor* actor, DBloodActor* target, int nAngle, int nRange)
|
|||
#ifdef NOONE_EXTENSIONS
|
||||
case kDudeModernCustom:
|
||||
case kDudeModernCustomBurning:
|
||||
if ((Crusher && !nnExtIsImmune(pSprite, pXSector->damageType)) || ((Water || Underwater) && !canSwim(actor))) return false;
|
||||
if ((Crusher && !nnExtIsImmune(actor, pXSector->damageType)) || ((Water || Underwater) && !canSwim(actor))) return false;
|
||||
return true;
|
||||
[[fallthrough]];
|
||||
#endif
|
||||
|
|
|
@ -905,7 +905,7 @@ static void unicultThinkChase(DBloodActor* actor)
|
|||
VectorScan(pSprite, 0, 0, bcos(pSprite->ang), bsin(pSprite->ang), actor->dudeSlope, dist, 1);
|
||||
if (actor == gHitInfo.hitactor) break;
|
||||
|
||||
bool immune = nnExtIsImmune(pHSprite, gVectorData[curWeapon].dmgType);
|
||||
bool immune = nnExtIsImmune(hitactor, gVectorData[curWeapon].dmgType);
|
||||
if (!(pXHSprite != NULL && (!immune || (immune && pHSprite->statnum == kStatThing && pXHSprite->Vector)) && !pXHSprite->locked))
|
||||
{
|
||||
if ((approxDist(gHitInfo.hitx - pSprite->x, gHitInfo.hity - pSprite->y) <= 1500 && !blck)
|
||||
|
@ -1008,7 +1008,7 @@ static void unicultThinkChase(DBloodActor* actor)
|
|||
// check also for damage resistance (all possible damages missile can use)
|
||||
for (int i = 0; i < kDmgMax; i++)
|
||||
{
|
||||
if (gMissileInfoExtra[curWeapon - kMissileBase].dmgType[i] && (failed = nnExtIsImmune(pHSprite, i)) == false)
|
||||
if (gMissileInfoExtra[curWeapon - kMissileBase].dmgType[i] && (failed = nnExtIsImmune(hitactor, i)) == false)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -280,7 +280,8 @@ static DBloodActor* nnExtSpawnDude(DBloodActor* sourceActor, DBloodActor* origin
|
|||
{
|
||||
x = pOrigin->x;
|
||||
y = pOrigin->y;
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
x = pOrigin->x + mulscale30r(Cos(angle), a3);
|
||||
y = pOrigin->y + mulscale30r(Sin(angle), a3);
|
||||
|
@ -342,15 +343,25 @@ static DBloodActor* nnExtSpawnDude(DBloodActor* sourceActor, DBloodActor* origin
|
|||
return pDudeActor;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
bool nnExtIsImmune(spritetype* pSprite, int dmgType, int minScale) {
|
||||
|
||||
if (dmgType >= kDmgFall && dmgType < kDmgMax && pSprite->extra >= 0 && xsprite[pSprite->extra].locked != 1) {
|
||||
bool nnExtIsImmune(DBloodActor* actor, int dmgType, int minScale)
|
||||
{
|
||||
auto pSprite = &actor->s();
|
||||
if (dmgType >= kDmgFall && dmgType < kDmgMax && actor->hasX() && actor->x().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]);
|
||||
else if (pSprite->type == kDudeModernCustom) return (gGenDudeExtra[pSprite->index].dmgControl[dmgType] <= minScale);
|
||||
}
|
||||
else if (actor->IsDudeActor())
|
||||
{
|
||||
if (actor->IsPlayerActor()) return (gPlayer[pSprite->type - kDudePlayer1].damageControl[dmgType]);
|
||||
else if (pSprite->type == kDudeModernCustom) return (actor->genDudeExtra().dmgControl[dmgType] <= minScale);
|
||||
else return (getDudeInfo(pSprite->type)->damageVal[dmgType] <= minScale);
|
||||
}
|
||||
}
|
||||
|
@ -3047,13 +3058,13 @@ void damageSprites(XSPRITE* pXSource, spritetype* pSprite)
|
|||
if (dmgType >= kDmgFall) {
|
||||
if (dmg < (int)pXSprite->health << 4) {
|
||||
|
||||
if (!nnExtIsImmune(pSprite, dmgType, 0)) {
|
||||
|
||||
if (pPlayer) {
|
||||
|
||||
if (!nnExtIsImmune(actor, dmgType, 0))
|
||||
{
|
||||
if (pPlayer)
|
||||
{
|
||||
playerDamageArmor(pPlayer, (DAMAGE_TYPE)dmgType, dmg);
|
||||
for (int i = 0; i < 3; armor[i] = pPlayer->armor[i], pPlayer->armor[i] = 0, i++);
|
||||
actDamageSprite(sourceactor, actor, (DAMAGE_TYPE)dmgType, dmg);
|
||||
actDamageSprite(sourceactor, actor, (DAMAGE_TYPE)dmgType, dmg);
|
||||
for (int i = 0; i < 3; pPlayer->armor[i] = armor[i], i++);
|
||||
|
||||
}
|
||||
|
@ -3967,13 +3978,13 @@ bool condCheckSprite(XSPRITE* pXCond, int cmpOp, bool PUSH) {
|
|||
case 31:
|
||||
if (arg1 == -1) {
|
||||
for (var = 0; var < kDmgMax; var++) {
|
||||
if (!nnExtIsImmune(pSpr, arg1, 0))
|
||||
if (!nnExtIsImmune(spractor, arg1, 0))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return nnExtIsImmune(pSpr, arg1, 0);
|
||||
return nnExtIsImmune(spractor, arg1, 0);
|
||||
case 35: // hitscan: ceil?
|
||||
case 36: // hitscan: floor?
|
||||
case 37: // hitscan: wall?
|
||||
|
@ -6512,6 +6523,7 @@ bool setDataValueOfObject(int objType, int objIndex, int dataIndex, int value) {
|
|||
// a replacement of vanilla CanMove for patrol dudes
|
||||
bool nnExtCanMove(spritetype* pSprite, int nTarget, int nAngle, int nRange) {
|
||||
|
||||
auto actor = &bloodActors[pSprite->index];
|
||||
int x = pSprite->x, y = pSprite->y, z = pSprite->z, nSector = pSprite->sectnum;
|
||||
HitScan(pSprite, z, Cos(nAngle) >> 16, Sin(nAngle) >> 16, 0, CLIPMASK0, nRange);
|
||||
int nDist = approxDist(x - gHitInfo.hitx, y - gHitInfo.hity);
|
||||
|
@ -6526,7 +6538,7 @@ bool nnExtCanMove(spritetype* pSprite, int nTarget, int nAngle, int nRange) {
|
|||
if (sector[nSector].extra > 0) {
|
||||
|
||||
XSECTOR* pXSector = &xsector[sector[nSector].extra];
|
||||
return !((sector[nSector].type == kSectorDamage || pXSector->damageType > 0) && pXSector->state && !nnExtIsImmune(pSprite, pXSector->damageType, 16));
|
||||
return !((sector[nSector].type == kSectorDamage || pXSector->damageType > 0) && pXSector->state && !nnExtIsImmune(actor, pXSector->damageType, 16));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -295,7 +295,7 @@ inline bool xsprIsFine(spritetype* pSpr) {
|
|||
bool nnExtEraseModernStuff(spritetype* pSprite, XSPRITE* pXSprite);
|
||||
void nnExtInitModernStuff(bool bSaveLoad);
|
||||
void nnExtProcessSuperSprites(void);
|
||||
bool nnExtIsImmune(spritetype* pSprite, int dmgType, int minScale = 16);
|
||||
bool nnExtIsImmune(DBloodActor* pSprite, int dmgType, int minScale = 16);
|
||||
int nnExtRandom(int a, int b);
|
||||
void nnExtResetGlobals();
|
||||
void nnExtTriggerObject(int objType, int objIndex, int command);
|
||||
|
|
Loading…
Reference in a new issue