diff --git a/source/games/blood/src/actor.cpp b/source/games/blood/src/actor.cpp index fa5960282..9c743c979 100644 --- a/source/games/blood/src/actor.cpp +++ b/source/games/blood/src/actor.cpp @@ -2562,13 +2562,13 @@ static void ConcussSprite(DBloodActor* source, DBloodActor* actor, const DVector } #endif } - else if (actor->spr.type >= kThingBase && actor->spr.type < kThingMax) + else if (actor->GetType() >= kThingBase && actor->GetType() < kThingMax) { mass = thingInfo[actor->GetType() - kThingBase].mass; } else { - Printf(PRINT_HIGH, "Unexpected type in ConcussSprite(): Sprite: %d Type: %d Stat: %d", actor->GetIndex(), (int)actor->spr.type, (int)actor->spr.statnum); + Printf(PRINT_HIGH, "Unexpected type in ConcussSprite(): Sprite: %d Type: %d Stat: %d", actor->GetIndex(), (int)actor->GetType(), (int)actor->spr.statnum); return; } @@ -3384,7 +3384,7 @@ void actKillDude(DBloodActor* killerActor, DBloodActor* actor, DAMAGE_TYPE damag if (gPlayer[p].fragger == actor && gPlayer[p].deathTime > 0) gPlayer[p].fragger = nullptr; } - if (actor->spr.type != kDudeCultistBeast) + if (actor->GetType() != kDudeCultistBeast) trTriggerSprite(actor, kCmdOff, killerActor); actor->spr.flags |= 7; @@ -3592,9 +3592,8 @@ static int actDamageDude(DBloodActor* source, DBloodActor* actor, int damage, DA { if (!actor->IsDudeActor()) { - Printf(PRINT_HIGH, "Bad Dude Failed: initial=%d type=%d %s\n", (int)actor->spr.inittype, (int)actor->spr.type, (int)(actor->spr.flags & kHitagRespawn) ? "RESPAWN" : "NORMAL"); + Printf(PRINT_HIGH, "Bad Dude Failed: initial=%d type=%d %s\n", (int)actor->spr.inittype, (int)actor->GetType(), (int)(actor->spr.flags & kHitagRespawn) ? "RESPAWN" : "NORMAL"); return damage >> 4; - //I_Error("Bad Dude Failed: initial=%d type=%d %s\n", (int)actor->spr.inittype, (int)actor->spr.type, (int)(actor->spr.flags & 16) ? "RESPAWN" : "NORMAL"); } auto pDudeInfo = getDudeInfo(actor); @@ -3810,11 +3809,11 @@ static void actImpactMissile(DBloodActor* missileActor, int hitCode) pThingInfo = &thingInfo[actorHit->GetType() - kThingBase]; break; case kStatDude: - pDudeInfo = getDudeInfo(actorHit->spr.type); + pDudeInfo = getDudeInfo(actorHit); break; } } - switch (missileActor->spr.type) + switch (missileActor->GetType()) { case kMissileLifeLeechRegular: if (hitCode == 3 && actorHit && (pThingInfo || pDudeInfo)) @@ -4493,7 +4492,7 @@ void actAirDrag(DBloodActor* actor, fixed_t drag) static Collision MoveThing(DBloodActor* actor) { assert(actor->hasX()); - assert(actor->spr.type >= kThingBase && actor->spr.type < kThingMax); + assert(actor->GetType() >= kThingBase && actor->GetType() < kThingMax); const THINGINFO* pThingInfo = &thingInfo[actor->GetType() - kThingBase]; auto pSector = actor->sector(); assert(pSector); @@ -4695,7 +4694,7 @@ void MoveDude(DBloodActor* actor) if (actor->IsPlayerActor()) pPlayer = getPlayer(actor); if (!(actor->IsDudeActor())) { - Printf(PRINT_HIGH, "%d: actor->IsDudeActor()", actor->spr.type); + Printf(PRINT_HIGH, "%d: actor->IsDudeActor()", actor->GetType()); return; } @@ -4970,7 +4969,7 @@ void MoveDude(DBloodActor* actor) break; case kDudeBurningCultist: { - const bool fixRandomCultist = !cl_bloodvanillaenemies && (actor->spr.inittype >= kDudeBase) && (actor->spr.inittype < kDudeMax) && (actor->spr.inittype != actor->spr.type) && !VanillaMode(); // fix burning cultists randomly switching types underwater + const bool fixRandomCultist = !cl_bloodvanillaenemies && (actor->spr.inittype >= kDudeBase) && (actor->spr.inittype < kDudeMax) && (actor->spr.inittype != actor->GetType()) && !VanillaMode(); // fix burning cultists randomly switching types underwater if (Chance(chance)) actor->ChangeType(kDudeCultistTommy); else @@ -5533,7 +5532,7 @@ static void actCheckProximity() int proxyDist = 96; #ifdef NOONE_EXTENSIONS // allow dudeLockout for proximity flag - if (gModernMap && actor->spr.type != kThingDroppedLifeLeech && actor->xspr.DudeLockout && !dudeactor->IsPlayerActor()) + if (gModernMap && actor->GetType() != kThingDroppedLifeLeech && actor->xspr.DudeLockout && !dudeactor->IsPlayerActor()) continue; if (actor->GetType() == kModernThingEnemyLifeLeech) proxyDist = 512; @@ -5726,7 +5725,7 @@ static void actCheckExplosion() if (!actor->hasX()) continue; auto Owner = actor->GetOwner(); - int nType = actor->spr.type; + int nType = actor->GetType(); assert(nType >= 0 && nType < kExplodeMax); const EXPLOSION* pExplodeInfo = &explodeInfo[nType]; const auto apos = actor->spr.pos; @@ -6205,7 +6204,7 @@ DBloodActor* actSpawnDude(DBloodActor* source, int nType, double dist) if (gModernMap && source->spr.flags & kModernTypeFlag1) { // allow inheriting only for selected source types - switch (source->spr.type) + switch (source->GetType()) { case kMarkerDudeSpawn: //inherit pal? @@ -6358,7 +6357,7 @@ DBloodActor* actFireThing(DBloodActor* actor, double xyoff, double zoff, double void actBuildMissile(DBloodActor* spawned, DBloodActor* actor) { - switch (spawned->spr.type) + switch (spawned->GetType()) { case kMissileLifeLeechRegular: evPostActor(spawned, 0, kCallbackFXFlameLick); @@ -6557,7 +6556,7 @@ bool actCheckRespawn(DBloodActor* actor) if (nRespawnTime < 0) return 0; actor->xspr.respawnPending = 1; - if (actor->spr.type >= kThingBase && actor->spr.type < kThingMax) + if (actor->GetType() >= kThingBase && actor->GetType() < kThingMax) { actor->xspr.respawnPending = 3; if (actor->GetType() == kThingTNTBarrel) actor->spr.cstat |= CSTAT_SPRITE_INVISIBLE; @@ -6796,7 +6795,7 @@ void actFireVector(DBloodActor* shooter, double offset, double zoffset, DVector3 actBurnSprite(shooter->GetOwner(), actor, pVectorData->burnTime); } - if (actor->spr.type >= kThingBase && actor->spr.type < kThingMax) { + if (actor->GetType() >= kThingBase && actor->GetType() < kThingMax) { actor->spr.statnum = kStatThing; // temporary change statnum property actDamageSprite(shooter, actor, pVectorData->dmgType, pVectorData->dmg << 4); actor->spr.statnum = kStatDecoration; // return statnum property back diff --git a/source/games/blood/src/ai.cpp b/source/games/blood/src/ai.cpp index 71b3efb69..49a4ad3c7 100644 --- a/source/games/blood/src/ai.cpp +++ b/source/games/blood/src/ai.cpp @@ -109,7 +109,7 @@ static bool isImmune(DBloodActor* actor, int dmgType, int minScale) if (dmgType >= kDmgFall && dmgType < kDmgMax && actor->hasX() && actor->xspr.locked != 1) { - int type = actor->spr.type; + int type = actor->GetType(); if (type >= kThingBase && type < kThingMax) return (thingInfo[type - kThingBase].dmgControl[dmgType] <= minScale); else if (actor->IsDudeActor()) @@ -952,7 +952,7 @@ int aiDamageSprite(DBloodActor* source, DBloodActor* actor, DAMAGE_TYPE nDmgType else if (source != actor->GetTarget()) // if found a new target, retarget { int nThresh = nDamage; - if (actor->spr.type == source->spr.type) + if (actor->GetType() == source->GetType()) nThresh *= pDudeInfo->changeTargetKin; else nThresh *= pDudeInfo->changeTarget; @@ -971,7 +971,7 @@ int aiDamageSprite(DBloodActor* source, DBloodActor* actor, DAMAGE_TYPE nDmgType { aiPatrolStop(actor, source, actor->xspr.dudeAmbush); - PLAYER* pPlayer = getPlayerById(source->spr.type); + PLAYER* pPlayer = getPlayerById(source->GetType()); if (!pPlayer) return nDamage; //if (powerupCheck(pPlayer, kPwUpShadowCloak)) pPlayer->pwUpTime[kPwUpShadowCloak] = 0; if (readyForCrit(source, actor)) @@ -1097,7 +1097,7 @@ int aiDamageSprite(DBloodActor* source, DBloodActor* actor, DAMAGE_TYPE nDmgType DUDEEXTRA* pDudeExtra = &actor->dudeExtra; pDudeExtra->teslaHit = 0; } - const bool fixRandomCultist = !cl_bloodvanillaenemies && (actor->spr.inittype >= kDudeBase) && (actor->spr.inittype < kDudeMax) && (actor->spr.inittype != actor->spr.type) && !VanillaMode(); // fix burning cultists randomly switching types underwater + const bool fixRandomCultist = !cl_bloodvanillaenemies && (actor->spr.inittype >= kDudeBase) && (actor->spr.inittype < kDudeMax) && (actor->spr.inittype != actor->GetType()) && !VanillaMode(); // fix burning cultists randomly switching types underwater switch (actor->GetType()) { case kDudeCultistTommy: @@ -1915,7 +1915,7 @@ void aiInitSprite(DBloodActor* actor) // make dude follow the markers bool uwater = spriteIsUnderwater(actor); - if (actor->GetTarget() == nullptr || actor->GetTarget()->spr.type != kMarkerPath) + if (actor->GetTarget() == nullptr || actor->GetTarget()->GetType() != kMarkerPath) { actor->SetTarget(nullptr); aiPatrolSetMarker(actor); diff --git a/source/games/blood/src/aibat.cpp b/source/games/blood/src/aibat.cpp index 6446d5c91..b105fc2f5 100644 --- a/source/games/blood/src/aibat.cpp +++ b/source/games/blood/src/aibat.cpp @@ -261,7 +261,7 @@ static void batThinkChase(DBloodActor* actor) { DAngle nDeltaAngle = absangle(actor->spr.Angles.Yaw, dvec.Angle()); double height = pDudeInfo->eyeHeight * actor->spr.scale.Y; - // Should be dudeInfo[pTarget->spr.type-kDudeBase] + // Should be dudeInfo[pTarget] double height2 = pDudeInfo->eyeHeight * pTarget->spr.scale.Y; double top, bottom; GetActorExtents(actor, &top, &bottom); diff --git a/source/games/blood/src/bloodactor.h b/source/games/blood/src/bloodactor.h index c9d8e1f9b..7e3303154 100644 --- a/source/games/blood/src/bloodactor.h +++ b/source/games/blood/src/bloodactor.h @@ -105,22 +105,22 @@ public: bool IsThingActor() { - return spr.type >= kThingBase && spr.type < kThingMax; + return GetType() >= kThingBase && GetType() < kThingMax; } bool IsItemActor() { - return spr.type >= kItemBase && spr.type < kItemMax; + return GetType() >= kItemBase && GetType() < kItemMax; } bool IsWeaponActor() { - return spr.type >= kItemWeaponBase && spr.type < kItemWeaponMax; + return GetType() >= kItemWeaponBase && GetType() < kItemWeaponMax; } bool IsAmmoActor() { - return spr.type >= kItemAmmoBase && spr.type < kItemAmmoMax; + return GetType() >= kItemAmmoBase && GetType() < kItemAmmoMax; } bool isActive() diff --git a/source/games/blood/src/callback.cpp b/source/games/blood/src/callback.cpp index 93d730ed9..3f172370a 100644 --- a/source/games/blood/src/callback.cpp +++ b/source/games/blood/src/callback.cpp @@ -289,7 +289,7 @@ void Respawn(DBloodActor* actor, sectortype*) // 9 if (!gModernMap || actor->xspr.sysData2 <= 0) actor->xspr.health = dudeInfo[actor->GetType() - kDudeBase].startHealth << 4; else actor->xspr.health = ClipRange(actor->xspr.sysData2 << 4, 1, 65535); - switch (actor->spr.type) { + switch (actor->GetType()) { default: actor->clipdist = getDudeInfo(nType + kDudeBase)->fClipdist(); if (getSequence(getDudeInfo(nType + kDudeBase)->seqStartID)) @@ -582,7 +582,7 @@ void returnFlagToBase(DBloodActor* actor, sectortype*) // 17 auto aOwner = actor->GetOwner(); if (aOwner) { - switch (actor->spr.type) + switch (actor->GetType()) { case kItemFlagA: trTriggerSprite(aOwner, kCmdOn, aOwner); @@ -611,7 +611,7 @@ void fxPodBloodSpray(DBloodActor* actor, sectortype*) // 18 { if (!actor) return; DBloodActor* pFX; - if (actor->spr.type == 53) + if (actor->spr.type == FX_53) pFX = gFX.fxSpawnActor(FX_53, actor->sector(), actor->spr.pos); else pFX = gFX.fxSpawnActor(FX_54, actor->sector(), actor->spr.pos); @@ -643,7 +643,7 @@ void fxPodBloodSplat(DBloodActor* actor, sectortype*) // 19 int nDist = Random(16); auto pos = actor->spr.pos.XY() + nAngle.ToVector() * nDist * 4; - if (actor->spr.Angles.Yaw == DAngle180 && actor->spr.type == 53) + if (actor->spr.Angles.Yaw == DAngle180 && actor->spr.type == FX_53) { int nChannel = 28 + (actor->GetIndex() & 2); assert(nChannel < 32); @@ -677,7 +677,7 @@ void LeechStateTimer(DBloodActor* actor, sectortype*) // 20 { if (!actor) return; if (actor->spr.statnum == kStatThing && !(actor->spr.flags & 32)) { - switch (actor->spr.type) { + switch (actor->GetType()) { case kThingDroppedLifeLeech: #ifdef NOONE_EXTENSIONS case kModernThingEnemyLifeLeech: @@ -782,7 +782,7 @@ void DropVoodooCb(DBloodActor* actor, sectortype*) // unused else { int vd = 0x2666; - switch (actor2->spr.type) + switch (actor2->GetType()) { case kDudeBoneEel: case kDudeBat: diff --git a/source/games/blood/src/player.cpp b/source/games/blood/src/player.cpp index 789d55e09..c3c358f19 100644 --- a/source/games/blood/src/player.cpp +++ b/source/games/blood/src/player.cpp @@ -1030,7 +1030,7 @@ bool PickupItem(PLAYER* pPlayer, DBloodActor* itemactor) int nType = itemactor->GetType() - kItemBase; auto plActor = pPlayer->actor; - switch (itemactor->spr.type) { + switch (itemactor->GetType()) { case kItemShadowCloak: #ifdef NOONE_EXTENSIONS if (isGrown(pPlayer->actor) || !powerupActivate(pPlayer, nType)) return false; @@ -1043,7 +1043,7 @@ bool PickupItem(PLAYER* pPlayer, DBloodActor* itemactor) case kItemShroomGrow: if (gModernMap) { - switch (itemactor->spr.type) { + switch (itemactor->GetType()) { case kItemShroomShrink: if (isShrinked(pPlayer->actor)) return false; break; @@ -1217,8 +1217,8 @@ bool PickupItem(PLAYER* pPlayer, DBloodActor* itemactor) case kItemKeySpider: case kItemKeyMoon: case kItemKeyKey7: - if (pPlayer->hasKey[itemactor->spr.type - 99]) return 0; - pPlayer->hasKey[itemactor->spr.type - 99] = 1; + if (pPlayer->hasKey[itemactor->GetType() - 99]) return 0; + pPlayer->hasKey[itemactor->GetType() - 99] = 1; pickupSnd = 781; break; case kItemHealthMedPouch: @@ -1328,7 +1328,7 @@ bool PickupWeapon(PLAYER* pPlayer, DBloodActor* weaponactor) void PickUp(PLAYER* pPlayer, DBloodActor* actor) { const char* msg = nullptr; - int nType = actor->spr.type; + int nType = actor->GetType(); bool pickedUp = 0; int customMsg = -1; #ifdef NOONE_EXTENSIONS @@ -2075,7 +2075,7 @@ int playerDamageSprite(DBloodActor* source, PLAYER* pPlayer, DAMAGE_TYPE nDamage pPlayer->painEffect = ClipHigh(pPlayer->painEffect + (nDamage >> 3), 600); DBloodActor* pActor = pPlayer->actor; - DUDEINFO* pDudeInfo = getDudeInfo(pActor->spr.type); + DUDEINFO* pDudeInfo = getDudeInfo(pActor->GetType()); int nDeathSeqID = -1; int nKneelingPlayer = -1; bool va = playerSeqPlaying(pPlayer, 16); diff --git a/source/games/blood/src/preload.cpp b/source/games/blood/src/preload.cpp index 5bd50f1f1..757eea8a0 100644 --- a/source/games/blood/src/preload.cpp +++ b/source/games/blood/src/preload.cpp @@ -83,7 +83,7 @@ void PrecacheDude(DBloodActor* actor) seqPrecacheId(pDudeInfo->seqStartID + 5, palette); seqPrecacheId(pDudeInfo->seqStartID + 1, palette); seqPrecacheId(pDudeInfo->seqStartID + 2, palette); - switch (actor->spr.type) + switch (actor->GetType()) { case kDudeCultistTommy: case kDudeCultistShotgun: @@ -170,7 +170,7 @@ void PrecacheDude(DBloodActor* actor) void PrecacheThing(DBloodActor* actor) { int palette = actor->spr.pal; - switch (actor->spr.type) { + switch (actor->GetType()) { case kThingGlassWindow: // worthless... case kThingFluorescent: seqPrecacheId(12, palette); diff --git a/source/games/blood/src/triggers.cpp b/source/games/blood/src/triggers.cpp index a90e32934..9777da168 100644 --- a/source/games/blood/src/triggers.cpp +++ b/source/games/blood/src/triggers.cpp @@ -345,7 +345,7 @@ void OperateSprite(DBloodActor* actor, EVENT event) } - switch (actor->spr.type) { + switch (actor->GetType()) { case kTrapMachinegun: if (actor->xspr.health <= 0) break; switch (event.cmd) { @@ -580,7 +580,7 @@ void OperateSprite(DBloodActor* actor, EVENT event) SetSpriteState(actor, 0, initiator); break; case kCmdRepeat: - if (actor->spr.type != kGenTrigger) ActivateGenerator(actor); + if (actor->GetType() != kGenTrigger) ActivateGenerator(actor); if (actor->xspr.txID) evSendActor(actor, actor->xspr.txID, (COMMAND_ID)actor->xspr.command, initiator); if (actor->xspr.busyTime > 0) { int nRand = Random2(actor->xspr.data1); @@ -1863,7 +1863,7 @@ void LinkSprite(DBloodActor* actor, EVENT event) DBloodActor* initiator = event.initiator; int nBusy = GetSourceBusy(event); - switch (actor->spr.type) { + switch (actor->GetType()) { case kSwitchCombo: { if (event.isActor()) @@ -2280,7 +2280,7 @@ void trInit(TArray& actors) for (auto actor : actors) { if (!actor->exists()) continue; - actor->spr.inittype = actor->spr.type; + actor->spr.inittype = actor->GetType(); actor->basePoint = actor->spr.pos; } for (auto& wal : wall) @@ -2356,7 +2356,7 @@ void trInit(TArray& actors) { if (actor->xspr.state) actor->xspr.busy = 65536; - switch (actor->spr.type) { + switch (actor->GetType()) { case kSwitchPadlock: actor->xspr.triggerOnce = 1; break; @@ -2449,7 +2449,7 @@ void trTextOver(int nId) void InitGenerator(DBloodActor* actor) { assert(actor->hasX()); - switch (actor->spr.type) { + switch (actor->GetType()) { case kGenTrigger: actor->spr.cstat &= ~CSTAT_SPRITE_BLOCK; actor->spr.cstat |= CSTAT_SPRITE_INVISIBLE; @@ -2468,7 +2468,7 @@ void InitGenerator(DBloodActor* actor) void ActivateGenerator(DBloodActor* actor) { assert(actor->hasX()); - switch (actor->spr.type) { + switch (actor->GetType()) { case kGenDripWater: case kGenDripBlood: { double top, bottom; diff --git a/source/games/blood/src/view.cpp b/source/games/blood/src/view.cpp index a187328e5..6469242eb 100644 --- a/source/games/blood/src/view.cpp +++ b/source/games/blood/src/view.cpp @@ -644,7 +644,7 @@ void viewDrawScreen(bool sceneonly) it.Reset(kStatProjectile); while (auto actor = it.Next()) { - switch (actor->spr.type) { + switch (actor->GetType()) { case kMissileFlareRegular: case kMissileTeslaAlt: case kMissileFlareAlt: