From 93df21bca1a2ce10550fe2348c98256d14844306 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 30 Sep 2023 10:35:42 +0200 Subject: [PATCH] replaced a few more spr.type's. --- source/games/blood/src/actor.cpp | 36 +++++++++---------- source/games/blood/src/ai.cpp | 10 +++--- source/games/blood/src/aiboneel.cpp | 2 +- source/games/blood/src/aiunicult.cpp | 4 +-- source/games/blood/src/nnexts.cpp | 52 +++++++++++++-------------- source/games/blood/src/player.cpp | 12 +++---- source/games/blood/src/prediction.cpp | 6 ++-- source/games/blood/src/triggers.cpp | 16 ++++----- source/games/blood/src/warp.cpp | 16 ++++----- 9 files changed, 77 insertions(+), 77 deletions(-) diff --git a/source/games/blood/src/actor.cpp b/source/games/blood/src/actor.cpp index dabbb70a9..f15538634 100644 --- a/source/games/blood/src/actor.cpp +++ b/source/games/blood/src/actor.cpp @@ -2352,7 +2352,7 @@ static void actInitTraps() BloodStatIterator it(kStatTraps); while (auto act = it.Next()) { - if (act->spr.type == kTrapExploder) + if (act->GetType() == kTrapExploder) { act->spr.cstat &= ~CSTAT_SPRITE_BLOCK; act->spr.cstat |= CSTAT_SPRITE_INVISIBLE; @@ -2390,7 +2390,7 @@ static void actInitThings() if (act->spr.flags & kPhysGravity) act->spr.flags |= kPhysFalling; act->vel.Zero(); - switch (act->spr.type) + switch (act->GetType()) { case kThingArmedProxBomb: case kTrapMachinegun: @@ -2465,7 +2465,7 @@ static void actInitDudes() if (!act->IsPlayerActor()) { #ifdef NOONE_EXTENSIONS - switch (act->spr.type) + switch (act->GetType()) { case kDudeModernCustom: case kDudeModernCustomBurning: @@ -2525,7 +2525,7 @@ void actInit(TArray& actors) BloodStatIterator it(kStatItem); while (auto act = it.Next()) { - if (act->spr.type == kItemWeaponVoodooDoll) + if (act->GetType() == kItemWeaponVoodooDoll) { act->ChangeType(kItemAmmoVoodooDoll); break; @@ -3632,7 +3632,7 @@ static int actDamageDude(DBloodActor* source, DBloodActor* actor, int damage, DA static int actDamageThing(DBloodActor* source, DBloodActor* actor, int damage, DAMAGE_TYPE damageType, PLAYER* pSourcePlayer) { - assert(actor->spr.type >= kThingBase && actor->spr.type < kThingMax); + assert(actor->IsThingActor()); int nType = actor->spr.type - kThingBase; int nDamageFactor = thingInfo[nType].dmgControl[damageType]; @@ -3830,7 +3830,7 @@ static void actImpactMissile(DBloodActor* missileActor, int hitCode) if (gGameOptions.weaponsV10x && !VanillaMode() && pDudeInfo != nullptr) { if (missileOwner->IsDudeActor() && missileOwner->hasX() && missileOwner->xspr.health != 0) - actHealDude(missileOwner, nDamage >> 2, getDudeInfo(missileOwner->spr.type)->startHealth); + actHealDude(missileOwner, nDamage >> 2, getDudeInfo(missileOwner)->startHealth); } } @@ -3894,7 +3894,7 @@ static void actImpactMissile(DBloodActor* missileActor, int hitCode) if (hitCode == 3 && actorHit && (pThingInfo || pDudeInfo)) { - int nDmgMul = (missileActor->spr.type == kMissileLifeLeechAltSmall) ? 6 : 3; + int nDmgMul = (missileActor->GetType() == kMissileLifeLeechAltSmall) ? 6 : 3; int nDamage = (nDmgMul + Random(nDmgMul)) << 4; actDamageSprite(missileOwner, actorHit, kDamageSpirit, nDamage); } @@ -4153,7 +4153,7 @@ static void checkCeilHit(DBloodActor* actor) // add size shroom abilities if ((actor->IsPlayerActor() && isShrinked(actor)) || (actor2->IsPlayerActor() && isGrown(actor2))) { - int mass1 = getDudeInfo(actor2->spr.type)->mass; + int mass1 = getDudeInfo(actor2)->mass; int mass2 = getDudeInfo(actor)->mass; switch (actor->GetType()) { @@ -4203,7 +4203,7 @@ static void checkCeilHit(DBloodActor* actor) } } - if (actor2->spr.type == kTrapSawCircular && actor2->hasX()) + if (actor2->GetType() == kTrapSawCircular && actor2->hasX()) { if (!actor2->xspr.state) actDamageSprite(actor, actor, kDamageBullet, 1); else { @@ -4242,7 +4242,7 @@ static void checkHit(DBloodActor* actor) if (actor->vel.X != 0 && actor2->IsDudeActor()) { int mass1 = getDudeInfo(actor)->mass; - int mass2 = getDudeInfo(actor2->spr.type)->mass; + int mass2 = getDudeInfo(actor2)->mass; switch (actor2->spr.type) { case kDudeModernCustom: @@ -4314,7 +4314,7 @@ static void checkFloorHit(DBloodActor* actor) { int mass1 = getDudeInfo(actor)->mass; - int mass2 = getDudeInfo(actor2->spr.type)->mass; + int mass2 = getDudeInfo(actor2)->mass; switch (actor2->spr.type) { case kDudeModernCustom: @@ -4828,10 +4828,10 @@ void MoveDude(DBloodActor* actor) if (pXSector->Underwater) bUnderwater = 1; if (pXSector->Depth) bDepth = 1; } - DCoreActor* pUpperLink = pSector->upperLink; - DCoreActor* pLowerLink = pSector->lowerLink; - if (pUpperLink && (pUpperLink->spr.type == kMarkerUpWater || pUpperLink->spr.type == kMarkerUpGoo)) bDepth = 1; - if (pLowerLink && (pLowerLink->spr.type == kMarkerLowWater || pLowerLink->spr.type == kMarkerLowGoo)) bDepth = 1; + DBloodActor* pUpperLink = barrier_cast(pSector->upperLink); + DBloodActor* pLowerLink = barrier_cast(pSector->lowerLink); + if (pUpperLink && (pUpperLink->GetType() == kMarkerUpWater || pUpperLink->GetType() == kMarkerUpGoo)) bDepth = 1; + if (pLowerLink && (pLowerLink->GetType() == kMarkerLowWater || pLowerLink->GetType() == kMarkerLowGoo)) bDepth = 1; if (pPlayer) wdf += 1; if (actor->vel.Z) actor->spr.pos.Z += actor->vel.Z; @@ -5182,7 +5182,7 @@ int MoveMissile(DBloodActor* actor) } } gHitInfo.clearObj(); - if (actor->spr.type == kMissileFlameSpray) actAirDrag(actor, 0x1000); + if (actor->GetType() == kMissileFlameSpray) actAirDrag(actor, 0x1000); if (actor->GetTarget() != nullptr && !actor->vel.isZero()) { @@ -5204,7 +5204,7 @@ int MoveMissile(DBloodActor* actor) GetActorExtents(actor, &top, &bottom); int i = 1; const int bakCompat = enginecompatibility_mode; - const bool isFlameSprite = (actor->spr.type == kMissileFlameSpray || actor->spr.type == kMissileFlameHound); // do not use accurate clipmove for flame based sprites (changes damage too much) + const bool isFlameSprite = (actor->GetType() == kMissileFlameSpray || actor->GetType() == kMissileFlameHound); // do not use accurate clipmove for flame based sprites (changes damage too much) while (1) { auto ppos = actor->spr.pos; @@ -5536,7 +5536,7 @@ static void actCheckProximity() if (gModernMap && actor->spr.type != kThingDroppedLifeLeech && actor->xspr.DudeLockout && !dudeactor->IsPlayerActor()) continue; - if (actor->spr.type == kModernThingEnemyLifeLeech) proxyDist = 512; + if (actor->GetType() == kModernThingEnemyLifeLeech) proxyDist = 512; #endif if (actor->GetType() == kThingDroppedLifeLeech && actor->GetTarget() == nullptr) { diff --git a/source/games/blood/src/ai.cpp b/source/games/blood/src/ai.cpp index 892c1eaad..f693035e2 100644 --- a/source/games/blood/src/ai.cpp +++ b/source/games/blood/src/ai.cpp @@ -162,16 +162,16 @@ bool CanMove(DBloodActor* actor, DBloodActor* target, DAngle nAngle, double nRan if (pSector->type == kSectorDamage || pXSector->damageType > 0) Crusher = 1; } - auto Upper = pSector->upperLink; - auto Lower = pSector->lowerLink; + auto Upper = barrier_cast(pSector->upperLink); + auto Lower = barrier_cast(pSector->lowerLink); if (Upper != nullptr) { - if (Upper->spr.type == kMarkerUpWater || Upper->spr.type == kMarkerUpGoo) + if (Upper->GetType() == kMarkerUpWater || Upper->GetType() == kMarkerUpGoo) Water = Depth = 1; } if (Lower != nullptr) { - if (Lower->spr.type == kMarkerLowWater || Lower->spr.type == kMarkerLowGoo) + if (Lower->GetType() == kMarkerLowWater || Lower->GetType() == kMarkerLowGoo) Depth = 1; } switch (actor->GetType()) { @@ -1684,7 +1684,7 @@ void aiInitSprite(DBloodActor* actor) if (gModernMap) { // must keep it in case of loading save - if (actor->xspr.dudeFlag4 && actor->GetTarget() && actor->GetTarget()->spr.type == kMarkerPath) + if (actor->xspr.dudeFlag4 && actor->GetTarget() && actor->GetTarget()->GetType() == kMarkerPath) { stateTimer = actor->xspr.stateTimer; pTargetMarker = actor->GetTarget(); diff --git a/source/games/blood/src/aiboneel.cpp b/source/games/blood/src/aiboneel.cpp index c525bc320..69ff1492f 100644 --- a/source/games/blood/src/aiboneel.cpp +++ b/source/games/blood/src/aiboneel.cpp @@ -182,7 +182,7 @@ static void eelThinkPonder(DBloodActor* actor) { DAngle nDeltaAngle = absangle(actor->spr.Angles.Yaw, nAngle); double height = (pDudeInfo->eyeHeight * actor->spr.scale.Y); - double height2 = (getDudeInfo(target->spr.type)->eyeHeight * target->spr.scale.Y); + double height2 = (getDudeInfo(target)->eyeHeight * target->spr.scale.Y); double top, bottom; GetActorExtents(actor, &top, &bottom); if (cansee(target->spr.pos, target->sector(), actor->spr.pos.plusZ(-height), actor->sector())) diff --git a/source/games/blood/src/aiunicult.cpp b/source/games/blood/src/aiunicult.cpp index 695cbdfa0..ff670713a 100644 --- a/source/games/blood/src/aiunicult.cpp +++ b/source/games/blood/src/aiunicult.cpp @@ -191,7 +191,7 @@ void punchCallback(int, DBloodActor* actor) if (target->IsDudeActor()) - nZOffset2 = getDudeInfo(target->spr.type)->eyeHeight * target->spr.scale.Y; + nZOffset2 = getDudeInfo(target)->eyeHeight * target->spr.scale.Y; if (!playGenDudeSound(actor, kGenDudeSndAttackMelee)) sfxPlay3DSound(actor, 530, 1, 0); @@ -2412,7 +2412,7 @@ bool genDudePrepare(DBloodActor* actor, int propId) BloodStatIterator it(kStatThing); while (auto actor2 = it.Next()) { - if (actor2->GetOwner() == actor && actor2->spr.type == kModernThingEnemyLifeLeech) { + if (actor2->GetOwner() == actor && actor2->GetType() == kModernThingEnemyLifeLeech) { pExtra->pLifeLeech = actor2; break; } diff --git a/source/games/blood/src/nnexts.cpp b/source/games/blood/src/nnexts.cpp index c9fee47ab..f076564fe 100644 --- a/source/games/blood/src/nnexts.cpp +++ b/source/games/blood/src/nnexts.cpp @@ -479,7 +479,7 @@ CCMD(nnext_ifshow) int cnt = 0; while (auto actor = it.Next()) { - if (actor->spr.type == kModernCondition || actor->spr.type == kModernConditionFalse) + if (actor->GetType() == kModernCondition || actor->GetType() == kModernConditionFalse) { if (actor->spr.cstat & CSTAT_SPRITE_INVISIBLE) { @@ -814,7 +814,7 @@ void nnExtInitModernStuff(TArray& actors) continue; } - if (iactor2->spr.type == kModernCondition || iactor2->spr.type == kModernConditionFalse) + if (iactor2->GetType() == kModernCondition || iactor2->GetType() == kModernConditionFalse) condError(iactor, "Tracking condition always must be first in condition sequence!"); pCond->objects.Reserve(1); @@ -1006,7 +1006,7 @@ static void windGenDoVerticalWind(int factor, sectortype* pSector) BloodSectIterator it(pSector); while (auto actor = it.Next()) { - if (actor->spr.type == kMarkerOn && actor->spr.statnum != kStatMarker) + if (actor->GetType() == kMarkerOn && actor->spr.statnum != kStatMarker) { maxZ = actor->spr.pos.Z; maxZfound = true; @@ -2895,7 +2895,7 @@ void usePropertiesChanger(DBloodActor* sourceactor, int objType, sectortype* pSe if (pXSector->Underwater) { if (aLower) - iactor->xspr.medium = (aLower->spr.type == kMarkerUpGoo) ? kMediumGoo : kMediumWater; + iactor->xspr.medium = (aLower->GetType() == kMarkerUpGoo) ? kMediumGoo : kMediumWater; if (pPlayer) { @@ -2903,7 +2903,7 @@ void usePropertiesChanger(DBloodActor* sourceactor, int objType, sectortype* pSe if (aLower) { if (aLower->xspr.data2 > 0) waterPal = aLower->xspr.data2; - else if (aLower->spr.type == kMarkerUpGoo) waterPal = kMediumGoo; + else if (aLower->GetType() == kMarkerUpGoo) waterPal = kMediumGoo; } pPlayer->nWaterPal = waterPal; @@ -3184,7 +3184,7 @@ void useTeleportTarget(DBloodActor* sourceactor, DBloodActor* actor) } if (aUpper) - actor->xspr.medium = (aLink->spr.type == kMarkerUpGoo) ? kMediumGoo : kMediumWater; + actor->xspr.medium = (aLink->GetType() == kMarkerUpGoo) ? kMediumGoo : kMediumWater; if (pPlayer) { @@ -3192,7 +3192,7 @@ void useTeleportTarget(DBloodActor* sourceactor, DBloodActor* actor) if (aUpper) { if (aLink->xspr.data2 > 0) waterPal = aLink->xspr.data2; - else if (aLink->spr.type == kMarkerUpGoo) waterPal = kMediumGoo; + else if (aLink->GetType() == kMarkerUpGoo) waterPal = kMediumGoo; } pPlayer->nWaterPal = waterPal; @@ -4481,7 +4481,7 @@ bool condCheckDude(DBloodActor* aCond, int cmpOp, bool PUSH) else if (!(objActor->xspr.unused1 & kDudeFlagStealth) || objActor->xspr.data3 < 0 || objActor->xspr.data3 > kMaxPatrolSpotValue) var = 0; else var = (kPercFull * objActor->xspr.data3) / kMaxPatrolSpotValue; return condCmp(var, arg1, arg2, cmpOp); - case 15: return getDudeInfo(objActor->spr.type)->lockOut; // dude allowed to interact with objects? + case 15: return getDudeInfo(objActor)->lockOut; // dude allowed to interact with objects? case 16: return condCmp(objActor->xspr.aiState->stateType, arg1, arg2, cmpOp); case 17: return condCmp(objActor->xspr.stateTimer, arg1, arg2, cmpOp); case 20: // kDudeModernCustom conditions @@ -4685,7 +4685,7 @@ bool condCheckSprite(DBloodActor* aCond, int cmpOp, bool PUSH) { default: break; case 50: // compare hp (in %) - if (objActor->IsDudeActor()) var = (objActor->xspr.sysData2 > 0) ? ClipRange(objActor->xspr.sysData2 << 4, 1, 65535) : getDudeInfo(objActor->spr.type)->startHealth << 4; + if (objActor->IsDudeActor()) var = (objActor->xspr.sysData2 > 0) ? ClipRange(objActor->xspr.sysData2 << 4, 1, 65535) : getDudeInfo(objActor)->startHealth << 4; else if (objActor->GetType() == kThingBloodChunks) return condCmp(0, arg1, arg2, cmpOp); else if (objActor->spr.type >= kThingBase && objActor->spr.type < kThingMax) var = thingInfo[objActor->spr.type - kThingBase].startHealth << 4; return condCmp((kPercFull * objActor->xspr.health) / ClipLow(var, 1), arg1, arg2, cmpOp); @@ -5776,18 +5776,18 @@ bool modernTypeOperateSprite(DBloodActor* actor, EVENT& event) if (actor->xspr.state == 1) { SetSpriteState(actor, 0, initiator); - if (actor->spr.type == kModernEffectSpawner) + if (actor->GetType() == kModernEffectSpawner) killEffectGenCallbacks(actor); } break; case kCmdOn: evKillActor(actor, initiator); // queue overflow protect if (actor->xspr.state == 0) SetSpriteState(actor, 1, initiator); - if (actor->spr.type == kModernSeqSpawner) seqSpawnerOffSameTx(actor); + if (actor->GetType() == kModernSeqSpawner) seqSpawnerOffSameTx(actor); [[fallthrough]]; case kCmdRepeat: if (actor->xspr.txID > 0) modernTypeSendCommand(actor, actor->xspr.txID, (COMMAND_ID)actor->xspr.command, initiator); - else if (actor->spr.type == kModernSeqSpawner) useSeqSpawnerGen(actor, OBJ_SPRITE, nullptr, nullptr, actor); + else if (actor->GetType() == kModernSeqSpawner) useSeqSpawnerGen(actor, OBJ_SPRITE, nullptr, nullptr, actor); else useEffectGen(actor, nullptr); if (actor->xspr.busyTime > 0) @@ -6004,7 +6004,7 @@ bool modernTypeOperateSprite(DBloodActor* actor, EVENT& event) switch (cmd) { case 36: - actHealDude(pPlayer->actor, ((actor->xspr.data2 > 0) ? ClipHigh(actor->xspr.data2, 200) : getDudeInfo(pPlayer->actor->spr.type)->startHealth), 200); + actHealDude(pPlayer->actor, ((actor->xspr.data2 > 0) ? ClipHigh(actor->xspr.data2, 200) : getDudeInfo(pPlayer->actor)->startHealth), 200); pPlayer->curWeapon = kWeapPitchFork; break; } @@ -6341,7 +6341,7 @@ int useCondition(DBloodActor* sourceactor, EVENT& event) if (event.isActor() && pActor == nullptr) return -1; if (event.isActor() && pActor != sourceactor) - srcIsCondition = (pActor->spr.type == kModernCondition || pActor->spr.type == kModernConditionFalse); + srcIsCondition = (pActor->GetType() == kModernCondition || pActor->GetType() == kModernConditionFalse); // if it's a tracking condition, it must ignore all the commands sent from objects if (sourceactor->xspr.busyTime > 0 && event.funcID != kCallbackMax) return -1; @@ -6359,7 +6359,7 @@ int useCondition(DBloodActor* sourceactor, EVENT& event) int cond = sourceactor->xspr.data1; bool ok = false; - bool RVRS = (sourceactor->spr.type == kModernConditionFalse); + bool RVRS = (sourceactor->GetType() == kModernConditionFalse); bool RSET = (sourceactor->xspr.command == kCmdNumberic + 36); bool PUSH = (sourceactor->xspr.command == kCmdNumberic); int comOp = sourceactor->spr.cstat; // comparison operator @@ -7031,7 +7031,7 @@ void useTargetChanger(DBloodActor* sourceactor, DBloodActor* actor) if (actor->xspr.health < (unsigned)startHp) actHealDude(actor, receiveHp, startHp); // heal mate - startHp = (mateactor->xspr.sysData2 > 0) ? ClipRange(mateactor->xspr.sysData2 << 4, 1, 65535) : getDudeInfo(mateactor->spr.type)->startHealth << 4; + startHp = (mateactor->xspr.sysData2 > 0) ? ClipRange(mateactor->xspr.sysData2 << 4, 1, 65535) : getDudeInfo(mateactor)->startHealth << 4; if (mateactor->xspr.health < (unsigned)startHp) actHealDude(mateactor, receiveHp, startHp); auto matetarget = mateactor->GetTarget(); @@ -7268,7 +7268,7 @@ void playerQavSceneProcess(PLAYER* pPlayer, QAVSCENE* pQavScene) auto rxactor = rxBucket[i].actor(); if (!rxactor || !rxactor->hasX() || rxactor == initiator) continue; - if (rxactor->spr.type == kModernPlayerControl && rxactor->xspr.command == 67) + if (rxactor->GetType() == kModernPlayerControl && rxactor->xspr.command == 67) { if (rxactor->xspr.data2 == initiator->xspr.data2 || rxactor->xspr.locked) continue; else trPlayerCtrlStartScene(rxactor, pPlayer, true); @@ -7741,7 +7741,7 @@ void aiPatrolState(DBloodActor* actor, int state) assert(actor->GetTarget()); auto markeractor = actor->GetTarget(); - assert(markeractor->spr.type == kMarkerPath); + assert(markeractor->GetType() == kMarkerPath); bool nSeqOverride = false, crouch = false; int i, seq = -1, start = 0, end = kPatrolStateSize; @@ -7838,7 +7838,7 @@ DBloodActor* aiPatrolMarkerBusy(DBloodActor* except, DBloodActor* marker) continue; auto targ = actor->GetTarget(); - if (actor->xspr.health > 0 && targ != nullptr && targ->spr.type == kMarkerPath && targ == marker) + if (actor->xspr.health > 0 && targ != nullptr && targ->GetType() == kMarkerPath && targ == marker) return actor; } return nullptr; @@ -7856,7 +7856,7 @@ bool aiPatrolMarkerReached(DBloodActor* actor) const DUDEINFO_EXTRA* pExtra = &gDudeInfoExtra[actor->spr.type - kDudeBase]; auto markeractor = actor->GetTarget(); - if (markeractor && markeractor->spr.type == kMarkerPath) + if (markeractor && markeractor->GetType() == kMarkerPath) { double okDist = max(markeractor->clipdist * 8, 4.); auto ov = markeractor->spr.pos.XY() - actor->spr.pos.XY(); // this was already shifted right by 4 in the old code. @@ -7963,7 +7963,7 @@ void aiPatrolSetMarker(DBloodActor* actor) } } // set next marker - else if (targetactor->spr.type == kMarkerPath && targetactor->hasX()) + else if (targetactor->GetType() == kMarkerPath && targetactor->hasX()) { // idea: which one of next (allowed) markers are closer to the potential target? // idea: -3 select random next marker that dude can see in radius of reached marker @@ -8048,7 +8048,7 @@ void aiPatrolStop(DBloodActor* actor, DBloodActor* targetactor, bool alarm) auto mytarget = actor->GetTarget(); - if (mytarget && mytarget->spr.type == kMarkerPath) + if (mytarget && mytarget->GetType() == kMarkerPath) { if (targetactor == nullptr) actor->spr.Angles.Yaw = mytarget->spr.Angles.Yaw; actor->SetTarget(nullptr); @@ -8232,7 +8232,7 @@ void aiPatrolAlarmLite(DBloodActor* actor, DBloodActor* targetactor) if (dudeactor->xspr.health <= 0) continue; - double eaz2 = (getDudeInfo(targetactor->spr.type)->eyeHeight * targetactor->spr.scale.Y); + double eaz2 = (getDudeInfo(targetactor)->eyeHeight * targetactor->spr.scale.Y); double nDist = (dudeactor->spr.pos.XY() - actor->spr.pos.XY()).LengthSquared(); if (nDist >= kPatrolAlarmSeeDistSq || !cansee(DVector3(actor->spr.pos, zt1), actor->sector(), dudeactor->spr.pos.plusZ(-eaz2), dudeactor->sector())) { @@ -8284,7 +8284,7 @@ void aiPatrolAlarmFull(DBloodActor* actor, DBloodActor* targetactor, bool chain) if (dudeactor->xspr.health <= 0) continue; - double eaz1 = (getDudeInfo(dudeactor->spr.type)->eyeHeight * dudeactor->spr.scale.Y); + double eaz1 = (getDudeInfo(dudeactor)->eyeHeight * dudeactor->spr.scale.Y); auto pos1 = dudeactor->spr.pos.plusZ(-eaz1); auto pSect1 = dudeactor->sector(); @@ -8292,8 +8292,8 @@ void aiPatrolAlarmFull(DBloodActor* actor, DBloodActor* targetactor, bool chain) double nDist1 = (pos1 - pos2).Length(); double nDist2 = (pos1 - pos3).Length(); - //double hdist = (dudeactor->xspr.dudeDeaf) ? 0 : getDudeInfo(dudeactor->spr.type)->HearDist() / 4; - double sdist = (dudeactor->xspr.dudeGuard) ? 0 : getDudeInfo(dudeactor->spr.type)->SeeDist() / 2; + //double hdist = (dudeactor->xspr.dudeDeaf) ? 0 : getDudeInfo(dudeactor)->HearDist() / 4; + double sdist = (dudeactor->xspr.dudeGuard) ? 0 : getDudeInfo(dudeactor)->SeeDist() / 2; if (//(nDist1 < hdist || nDist2 < hdist) || ((nDist1 < sdist && cansee(pos1, pSect1, pos2, pSect2)) || (nDist2 < sdist && cansee(pos1, pSect1, pos3, pSect3)))) diff --git a/source/games/blood/src/player.cpp b/source/games/blood/src/player.cpp index 4adba798d..33fab10f0 100644 --- a/source/games/blood/src/player.cpp +++ b/source/games/blood/src/player.cpp @@ -1060,7 +1060,7 @@ bool PickupItem(PLAYER* pPlayer, DBloodActor* itemactor) case kItemFlagABase: case kItemFlagBBase: { if (gGameOptions.nGameType != 3 || !itemactor->hasX()) return 0; - if (itemactor->spr.type == kItemFlagABase) { + if (itemactor->GetType() == kItemFlagABase) { if (pPlayer->teamId == 1) { if ((pPlayer->hasFlag & 1) == 0 && itemactor->xspr.state) { pPlayer->hasFlag |= 1; @@ -1096,7 +1096,7 @@ bool PickupItem(PLAYER* pPlayer, DBloodActor* itemactor) } } - else if (itemactor->spr.type == kItemFlagBBase) { + else if (itemactor->GetType() == kItemFlagBBase) { if (pPlayer->teamId == 0) { if ((pPlayer->hasFlag & 2) == 0 && itemactor->xspr.state) { @@ -1286,7 +1286,7 @@ bool PickupWeapon(PLAYER* pPlayer, DBloodActor* weaponactor) int nWeaponType = pWeaponItemData->type; int nAmmoType = pWeaponItemData->ammoType; if (!pPlayer->hasWeapon[nWeaponType] || gGameOptions.nWeaponSettings == 2 || gGameOptions.nWeaponSettings == 3) { - if (weaponactor->spr.type == kItemWeaponLifeLeech && gGameOptions.nGameType > 1 && findDroppedLeech(pPlayer, NULL)) + if (weaponactor->GetType() == kItemWeaponLifeLeech && gGameOptions.nGameType > 1 && findDroppedLeech(pPlayer, NULL)) return 0; pPlayer->hasWeapon[nWeaponType] = 1; if (nAmmoType == -1) return 0; @@ -1447,7 +1447,7 @@ int ActionScan(PLAYER* pPlayer, HitInfo* out) return 3; if (hitactor->spr.statnum == kStatDude) { - int nMass = getDudeInfo(hitactor->spr.type)->mass; + int nMass = getDudeInfo(hitactor)->mass; if (nMass) { hitactor->vel += pos * (FixedToFloat<10>(0xccccc) / nMass); @@ -1854,8 +1854,8 @@ void playerProcess(PLAYER* pPlayer) if (pPlayer->posture == 1) { pPlayer->isUnderwater = 1; - auto link = actor->sector()->lowerLink; - if (link && (link->spr.type == kMarkerLowGoo || link->spr.type == kMarkerLowWater)) + auto link = barrier_cast(actor->sector()->lowerLink); + if (link && (link->GetType() == kMarkerLowGoo || link->GetType() == kMarkerLowWater)) { if (getceilzofslopeptr(actor->sector(), actor->spr.pos) > pPlayer->zView) pPlayer->isUnderwater = 0; diff --git a/source/games/blood/src/prediction.cpp b/source/games/blood/src/prediction.cpp index ef168e7da..e0bd78234 100644 --- a/source/games/blood/src/prediction.cpp +++ b/source/games/blood/src/prediction.cpp @@ -340,7 +340,7 @@ void fakePlayerProcess(PLAYER* pPlayer, InputPacket* pInput) predict.isUnderwater = 1; int nSector = predict.sector; auto nLink = getLowerLink(nSector); - if (nLink && (nLink->spr.type == kMarkerLowGoo || nLink->spr.type == kMarkerLowWater)) + if (nLink && (nLink->GetType() == kMarkerLowGoo || nLink->GetType() == kMarkerLowWater)) { if (getceilzofslope(nSector, predict.x, predict.y) > predict.viewz) predict.isUnderwater = 0; @@ -430,9 +430,9 @@ static void fakeMoveDude(DBloodActor* actor) } auto nUpperLink = getUpperLink(nSector); auto nLowerLink = getLowerLink(nSector); - if (nUpperLink >= 0 && (nUpperLink->spr.type == kMarkerUpWater || nUpperLink->spr.type == kMarkerUpGoo)) + if (nUpperLink >= 0 && (nUpperLink->GetType() == kMarkerUpWater || nUpperLink->GetType() == kMarkerUpGoo)) bDepth = 1; - if (nLowerLink >= 0 && (nLowerLink->spr.type == kMarkerLowWater || nLowerLink->spr.type == kMarkerLowGoo)) + if (nLowerLink >= 0 && (nLowerLink->GetType() == kMarkerLowWater || nLowerLink->GetType() == kMarkerLowGoo)) bDepth = 1; if (pPlayer) wd += 16; diff --git a/source/games/blood/src/triggers.cpp b/source/games/blood/src/triggers.cpp index 60312f9fb..3cd13095b 100644 --- a/source/games/blood/src/triggers.cpp +++ b/source/games/blood/src/triggers.cpp @@ -761,7 +761,7 @@ void SectorStartSound(sectortype* pSector, int nState) BloodSectIterator it(pSector); while (auto actor = it.Next()) { - if (actor->spr.statnum == kStatDecoration && actor->spr.type == kSoundSector && actor->hasX()) + if (actor->spr.statnum == kStatDecoration && actor->GetType() == kSoundSector && actor->hasX()) { if (nState) { @@ -788,7 +788,7 @@ void SectorEndSound(sectortype* pSector, int nState) BloodSectIterator it(pSector); while (auto actor = it.Next()) { - if (actor->spr.statnum == kStatDecoration && actor->spr.type == kSoundSector && actor->hasX()) + if (actor->spr.statnum == kStatDecoration && actor->GetType() == kSoundSector && actor->hasX()) { if (nState) { @@ -815,7 +815,7 @@ void PathSound(sectortype* pSector, int nSound) BloodSectIterator it(pSector); while (auto actor = it.Next()) { - if (actor->spr.statnum == kStatDecoration && actor->spr.type == kSoundSector) + if (actor->spr.statnum == kStatDecoration && actor->GetType() == kSoundSector) sfxPlay3DSound(actor, nSound, 0, 0); } } @@ -1589,7 +1589,7 @@ void OperateTeleport(sectortype* pSector) auto destactor = pXSector->marker0; assert(destactor != nullptr); assert(destactor->spr.statnum == kStatMarker); - assert(destactor->spr.type == kMarkerWarpDest); + assert(destactor->GetType() == kMarkerWarpDest); assert(destactor->insector()); BloodSectIterator it(pSector); while (auto actor = it.Next()) @@ -1645,7 +1645,7 @@ void OperatePath(sectortype* pSector, EVENT event) BloodStatIterator it(kStatPathMarker); while ((actor = it.Next())) { - if (actor->spr.type == kMarkerPath) + if (actor->GetType() == kMarkerPath) { if (actor->xspr.data1 == nId) break; @@ -1800,7 +1800,7 @@ void InitPath(sectortype* pSector, XSECTOR* pXSector) BloodStatIterator it(kStatPathMarker); while ((actor = it.Next())) { - if (actor->spr.type == kMarkerPath && actor->hasX()) + if (actor->GetType() == kMarkerPath && actor->hasX()) { if (actor->xspr.data1 == nId) break; @@ -2473,7 +2473,7 @@ void ActivateGenerator(DBloodActor* actor) case kGenDripBlood: { double top, bottom; GetActorExtents(actor, &top, &bottom); - actSpawnThing(actor->sector(), DVector3(actor->spr.pos.XY(), bottom), (actor->spr.type == kGenDripWater) ? kThingDripWater : kThingDripBlood); + actSpawnThing(actor->sector(), DVector3(actor->spr.pos.XY(), bottom), (actor->GetType() == kGenDripWater) ? kThingDripWater : kThingDripBlood); break; } case kGenSound: @@ -2498,7 +2498,7 @@ void ActivateGenerator(DBloodActor* actor) case kGenBubbleMulti: { double top, bottom; GetActorExtents(actor, &top, &bottom); - gFX.fxSpawnActor((actor->spr.type == kGenBubble) ? FX_23 : FX_26, actor->sector(), DVector3(actor->spr.pos.XY(), top)); + gFX.fxSpawnActor((actor->GetType() == kGenBubble) ? FX_23 : FX_26, actor->sector(), DVector3(actor->spr.pos.XY(), top)); break; } } diff --git a/source/games/blood/src/warp.cpp b/source/games/blood/src/warp.cpp index 9add1b881..c4e506249 100644 --- a/source/games/blood/src/warp.cpp +++ b/source/games/blood/src/warp.cpp @@ -201,7 +201,7 @@ int CheckLink(DBloodActor* actor) if (aUpper) { double z; - if (aUpper->spr.type == kMarkerUpLink) + if (aUpper->GetType() == kMarkerUpLink) z = aUpper->spr.pos.Z; else z = getflorzofslopeptr(actor->sector(), actor->spr.pos); @@ -213,7 +213,7 @@ int CheckLink(DBloodActor* actor) ChangeActorSect(actor, aLower->sector()); actor->spr.pos.XY() += aLower->spr.pos.XY() - aUpper->spr.pos.XY(); double z2; - if (aLower->spr.type == kMarkerLowLink) + if (aLower->GetType() == kMarkerLowLink) z2 = aLower->spr.pos.Z; else z2 = getceilzofslopeptr(actor->sector(), actor->spr.pos); @@ -225,7 +225,7 @@ int CheckLink(DBloodActor* actor) if (aLower) { double z; - if (aLower->spr.type == kMarkerLowLink) + if (aLower->GetType() == kMarkerLowLink) z = aLower->spr.pos.Z; else z = getceilzofslopeptr(actor->sector(), actor->spr.pos); @@ -237,7 +237,7 @@ int CheckLink(DBloodActor* actor) ChangeActorSect(actor, aUpper->sector()); actor->spr.pos.XY() += aUpper->spr.pos.XY() - aLower->spr.pos.XY(); double z2; - if (aUpper->spr.type == kMarkerUpLink) + if (aUpper->GetType() == kMarkerUpLink) z2 = aUpper->spr.pos.Z; else z2 = getflorzofslopeptr(actor->sector(), actor->spr.pos); @@ -262,7 +262,7 @@ int CheckLink(DVector3& cPos, sectortype** pSector) if (aUpper) { double z1; - if (aUpper->spr.type == kMarkerUpLink) + if (aUpper->GetType() == kMarkerUpLink) z1 = aUpper->spr.pos.Z; else z1 = getflorzofslopeptr(*pSector, cPos); @@ -274,7 +274,7 @@ int CheckLink(DVector3& cPos, sectortype** pSector) *pSector = aLower->sector(); cPos.XY() += aLower->spr.pos.XY() - aUpper->spr.pos.XY(); double z2; - if (aUpper->spr.type == kMarkerLowLink) + if (aUpper->GetType() == kMarkerLowLink) z2 = aLower->spr.pos.Z; else z2 = getceilzofslopeptr(*pSector, cPos); @@ -285,7 +285,7 @@ int CheckLink(DVector3& cPos, sectortype** pSector) if (aLower) { double z1; - if (aLower->spr.type == kMarkerLowLink) + if (aLower->GetType() == kMarkerLowLink) z1 = aLower->spr.pos.Z; else z1 = getceilzofslopeptr(*pSector, cPos); @@ -296,7 +296,7 @@ int CheckLink(DVector3& cPos, sectortype** pSector) *pSector = aUpper->sector(); cPos.XY() += aUpper->spr.pos.XY() - aLower->spr.pos.XY(); double z2; - if (aLower->spr.type == kMarkerUpLink) + if (aLower->GetType() == kMarkerUpLink) z2 = aUpper->spr.pos.Z; else z2 = getflorzofslopeptr(*pSector, cPos);