diff --git a/source/games/blood/src/actor.cpp b/source/games/blood/src/actor.cpp index f15538634..fa5960282 100644 --- a/source/games/blood/src/actor.cpp +++ b/source/games/blood/src/actor.cpp @@ -2376,7 +2376,7 @@ static void actInitThings() { if (!act->hasX()) continue; - int nType = act->spr.type - kThingBase; + int nType = act->GetType() - kThingBase; act->xspr.health = thingInfo[nType].startHealth << 4; #ifdef NOONE_EXTENSIONS // allow level designer to set custom clipdist. @@ -2564,7 +2564,7 @@ static void ConcussSprite(DBloodActor* source, DBloodActor* actor, const DVector } else if (actor->spr.type >= kThingBase && actor->spr.type < kThingMax) { - mass = thingInfo[actor->spr.type - kThingBase].mass; + mass = thingInfo[actor->GetType() - kThingBase].mass; } else { @@ -3053,7 +3053,7 @@ static void checkAddFrag(DBloodActor* killerActor, DBloodActor* actor) { if (killerActor->IsPlayerActor()) { - PLAYER* pPlayer = &gPlayer[killerActor->spr.type - kDudePlayer1]; + PLAYER* pPlayer = getPlayer(killerActor); if (gGameOptions.nGameType == 1) pPlayer->fragCount++; } @@ -3068,7 +3068,7 @@ static void checkAddFrag(DBloodActor* killerActor, DBloodActor* actor) case kDudeBurningInnocent: break; default: - PLAYER* pKillerPlayer = &gPlayer[killerActor->spr.type - kDudePlayer1]; + PLAYER* pKillerPlayer = getPlayer(killerActor); pKillerPlayer->fragCount++; break; } @@ -3616,7 +3616,7 @@ static int actDamageDude(DBloodActor* source, DBloodActor* actor, int damage, DA } else { - PLAYER* pPlayer = &gPlayer[actor->spr.type - kDudePlayer1]; + PLAYER* pPlayer = getPlayer(actor); if (actor->xspr.health > 0 || playerSeqPlaying(pPlayer, 16)) damage = playerDamageSprite(source, pPlayer, damageType, damage); @@ -3633,7 +3633,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->IsThingActor()); - int nType = actor->spr.type - kThingBase; + int nType = actor->GetType() - kThingBase; int nDamageFactor = thingInfo[nType].dmgControl[damageType]; if (!nDamageFactor) return 0; @@ -3740,7 +3740,7 @@ int actDamageSprite(DBloodActor* source, DBloodActor* actor, DAMAGE_TYPE damageT if (source == nullptr) source = actor; PLAYER* pSourcePlayer = nullptr; - if (source->IsPlayerActor()) pSourcePlayer = &gPlayer[source->spr.type - kDudePlayer1]; + if (source->IsPlayerActor()) pSourcePlayer = getPlayer(source); if (!gGameOptions.bFriendlyFire && IsTargetTeammate(pSourcePlayer, actor)) return 0; switch (actor->spr.statnum) @@ -3807,7 +3807,7 @@ static void actImpactMissile(DBloodActor* missileActor, int hitCode) switch (actorHit->spr.statnum) { case kStatThing: - pThingInfo = &thingInfo[actorHit->spr.type - kThingBase]; + pThingInfo = &thingInfo[actorHit->GetType() - kThingBase]; break; case kStatDude: pDudeInfo = getDudeInfo(actorHit->spr.type); @@ -4028,7 +4028,7 @@ static void actImpactMissile(DBloodActor* missileActor, int hitCode) { int nDamage = (10 + Random(10)) << 4; actDamageSprite(missileOwner, actorHit, kDamageSpirit, nDamage); - int nType = missileOwner->spr.type - kDudeBase; + int nType = missileOwner->GetType() - kDudeBase; if (missileOwner->xspr.health > 0) actHealDude(missileOwner, 10, getDudeInfo(nType + kDudeBase)->startHealth); } @@ -4141,7 +4141,7 @@ static void checkCeilHit(DBloodActor* actor) if (actor2->spr.statnum == kStatThing) { - int nType = actor2->spr.type - kThingBase; + int nType = actor2->GetType() - kThingBase; const THINGINFO* pThingInfo = &thingInfo[nType]; if (pThingInfo->flags & 1) actor2->spr.flags |= 1; if (pThingInfo->flags & 2) actor2->spr.flags |= 4; @@ -4173,9 +4173,9 @@ static void checkCeilHit(DBloodActor* actor) } } #endif - if (!actor->IsPlayerActor() || gPlayer[actor->spr.type - kDudePlayer1].godMode == 0) + if (!actor->IsPlayerActor() || gPlayer[actor->GetType() - kDudePlayer1].godMode == 0) { - switch (actor2->spr.type) + switch (actor2->GetType()) { case kDudeTchernobog: actDamageSprite(actor2, actor, kDamageExplode, actor->xspr.health << 2); @@ -4192,7 +4192,7 @@ static void checkCeilHit(DBloodActor* actor) actDamageSprite(actor2, actor, kDamageFall, dmg); if (actor->hasX() && !actor->isActive()) aiActivateDude(actor); } - else if (powerupCheck(&gPlayer[actor->spr.type - kDudePlayer1], kPwUpJumpBoots) > 0) actDamageSprite(actor2, actor, kDamageExplode, dmg); + else if (powerupCheck(getPlayer(actor), kPwUpJumpBoots) > 0) actDamageSprite(actor2, actor, kDamageExplode, dmg); else actDamageSprite(actor2, actor, kDamageFall, dmg); break; #endif @@ -4243,7 +4243,7 @@ static void checkHit(DBloodActor* actor) { int mass1 = getDudeInfo(actor)->mass; int mass2 = getDudeInfo(actor2)->mass; - switch (actor2->spr.type) + switch (actor2->GetType()) { case kDudeModernCustom: case kDudeModernCustomBurning: @@ -4261,7 +4261,7 @@ static void checkHit(DBloodActor* actor) } #endif - switch (actor2->spr.type) + switch (actor2->GetType()) { case kThingKickablePail: actKickObject(actor, actor2); @@ -4315,7 +4315,7 @@ static void checkFloorHit(DBloodActor* actor) int mass1 = getDudeInfo(actor)->mass; int mass2 = getDudeInfo(actor2)->mass; - switch (actor2->spr.type) + switch (actor2->GetType()) { case kDudeModernCustom: case kDudeModernCustomBurning: @@ -4335,9 +4335,9 @@ static void checkFloorHit(DBloodActor* actor) #endif PLAYER* pPlayer = nullptr; - if (actor->IsPlayerActor()) pPlayer = &gPlayer[actor->spr.type - kDudePlayer1]; + if (actor->IsPlayerActor()) pPlayer = getPlayer(actor); - switch (actor2->spr.type) + switch (actor2->GetType()) { case kThingKickablePail: if (pPlayer) @@ -4494,7 +4494,7 @@ static Collision MoveThing(DBloodActor* actor) { assert(actor->hasX()); assert(actor->spr.type >= kThingBase && actor->spr.type < kThingMax); - const THINGINFO* pThingInfo = &thingInfo[actor->spr.type - kThingBase]; + const THINGINFO* pThingInfo = &thingInfo[actor->GetType() - kThingBase]; auto pSector = actor->sector(); assert(pSector); double top, bottom; @@ -4692,7 +4692,7 @@ static Collision MoveThing(DBloodActor* actor) void MoveDude(DBloodActor* actor) { PLAYER* pPlayer = nullptr; - if (actor->IsPlayerActor()) pPlayer = &gPlayer[actor->spr.type - kDudePlayer1]; + if (actor->IsPlayerActor()) pPlayer = getPlayer(actor); if (!(actor->IsDudeActor())) { Printf(PRINT_HIGH, "%d: actor->IsDudeActor()", actor->spr.type); @@ -5190,7 +5190,7 @@ int MoveMissile(DBloodActor* actor) if (target->spr.statnum == kStatDude && target->hasX() && target->xspr.health > 0) { - double vel = missileInfo[actor->spr.type - kMissileBase].fVelocity(); + double vel = missileInfo[actor->GetType() - kMissileBase].fVelocity(); actor->vel.XY() = DVector2(vel, 0).Rotated((target->spr.pos - actor->spr.pos).Angle()); double deltaz = (target->spr.pos.Z - actor->spr.pos.Z) / (10 * 256); @@ -5543,8 +5543,8 @@ static void actCheckProximity() auto Owner = actor->GetOwner(); if (!Owner->IsPlayerActor()) continue; - PLAYER* pPlayer = &gPlayer[Owner->spr.type - kDudePlayer1]; - PLAYER* pPlayer2 = dudeactor->IsPlayerActor() ? &gPlayer[dudeactor->spr.type - kDudePlayer1] : nullptr; + PLAYER* pPlayer = getPlayer(Owner); + PLAYER* pPlayer2 = dudeactor->IsPlayerActor() ? &gPlayer[dudeactor->GetType() - kDudePlayer1] : nullptr; if (dudeactor == Owner || dudeactor->GetType() == kDudeZombieAxeBuried || dudeactor->GetType() == kDudeRat || dudeactor->GetType() == kDudeBat) continue; if (gGameOptions.nGameType == 3 && pPlayer2 && pPlayer->teamId == pPlayer2->teamId) continue; @@ -5605,7 +5605,7 @@ static void actCheckThings() XSECTOR* pXSector = pSector->hasX() ? &pSector->xs() : nullptr; if (pXSector && pXSector->panVel && (pXSector->panAlways || pXSector->state || pXSector->busy)) { - int nType = actor->spr.type - kThingBase; + int nType = actor->GetType() - kThingBase; const THINGINFO* pThingInfo = &thingInfo[nType]; if (pThingInfo->flags & 1) actor->spr.flags |= 1; if (pThingInfo->flags & 2) actor->spr.flags |= 4; @@ -5975,7 +5975,7 @@ static void actCheckDudes() } if (actor->IsPlayerActor()) { - PLAYER* pPlayer = &gPlayer[actor->spr.type - kDudePlayer1]; + PLAYER* pPlayer = getPlayer(actor); if (pPlayer->voodooTargets) voodooTarget(pPlayer); if (pPlayer->hand && Chance(0x8000)) actDamageSprite(actor, actor, kDamageDrown, 12); @@ -6049,7 +6049,7 @@ static void actCheckDudes() if (actor->IsPlayerActor()) { - PLAYER* pPlayer = &gPlayer[actor->spr.type - kDudePlayer1]; + PLAYER* pPlayer = getPlayer(actor); double nDrag = FixedToFloat(gDudeDrag); if (actor->xspr.height > 0) nDrag -= Scale(nDrag, (double)actor->xspr.height, 256.); @@ -6624,7 +6624,7 @@ void actFireVector(DBloodActor* shooter, double offset, double zoffset, DVector3 if (!gGameOptions.bFriendlyFire && IsTargetTeammate(shooter, hitactor)) return; if (hitactor->IsPlayerActor()) { - PLAYER* pPlayer = &gPlayer[hitactor->spr.type - kDudePlayer1]; + PLAYER* pPlayer = getPlayer(hitactor); if (powerupCheck(pPlayer, kPwUpReflectShots)) { gHitInfo.hitActor = shooter; @@ -6701,7 +6701,7 @@ void actFireVector(DBloodActor* shooter, double offset, double zoffset, DVector3 if (actor->spr.statnum == kStatThing) { - int mass = thingInfo[actor->spr.type - kThingBase].mass; + int mass = thingInfo[actor->GetType() - kThingBase].mass; if (mass > 0 && pVectorData->impulse) { double thrust = double(pVectorData->impulse) / (mass * 1024); diff --git a/source/games/blood/src/ai.cpp b/source/games/blood/src/ai.cpp index f693035e2..71b3efb69 100644 --- a/source/games/blood/src/ai.cpp +++ b/source/games/blood/src/ai.cpp @@ -920,7 +920,7 @@ void aiSetTarget(DBloodActor* actor, DBloodActor* target) if (actor->GetOwner() != target) { actor->SetTarget(target); - DUDEINFO* pDudeInfo = getDudeInfo(target->spr.type); + DUDEINFO* pDudeInfo = getDudeInfo(target); double eyeHeight = (pDudeInfo->eyeHeight * target->spr.scale.Y); actor->xspr.TargetPos = target->spr.pos.plusZ(-eyeHeight); } @@ -1574,7 +1574,7 @@ void aiLookForTarget(DBloodActor* actor) double nDist = (actor2->spr.pos.XY() - actor->spr.pos.XY()).Length(); if (actor2->GetType() == kDudeInnocent) { - pDudeInfo = getDudeInfo(actor2->spr.type); + pDudeInfo = getDudeInfo(actor2); if (nDist > pDudeInfo->SeeDist() && nDist > pDudeInfo->HearDist()) continue; aiSetTarget(actor, actor2); diff --git a/source/games/blood/src/aibat.cpp b/source/games/blood/src/aibat.cpp index 6c14a4764..6446d5c91 100644 --- a/source/games/blood/src/aibat.cpp +++ b/source/games/blood/src/aibat.cpp @@ -251,7 +251,7 @@ static void batThinkChase(DBloodActor* actor) aiNewState(actor, &batSearch); return; } - if (pTarget->IsPlayerActor() && powerupCheck(&gPlayer[pTarget->spr.type - kDudePlayer1], kPwUpShadowCloak) > 0) + if (pTarget->IsPlayerActor() && powerupCheck(&gPlayer[pTarget->GetType() - kDudePlayer1], kPwUpShadowCloak) > 0) { aiNewState(actor, &batSearch); return; diff --git a/source/games/blood/src/aibeast.cpp b/source/games/blood/src/aibeast.cpp index e97f6cca0..abc56f920 100644 --- a/source/games/blood/src/aibeast.cpp +++ b/source/games/blood/src/aibeast.cpp @@ -120,7 +120,7 @@ void StompSeqCallback(int, DBloodActor* actor) else nDamage = nBaseDamage + int(nBaseDamage2 * ((nDist - nDist2) / nDist)); if (actor2->IsPlayerActor()) - gPlayer[actor2->spr.type - kDudePlayer1].quakeEffect += nDamage * 4; + gPlayer[actor2->GetType() - kDudePlayer1].quakeEffect += nDamage * 4; actDamageSprite(actor, actor2, kDamageFall, nDamage << 4); } } @@ -148,7 +148,7 @@ void StompSeqCallback(int, DBloodActor* actor) nDamage = nBaseDamage + int(nBaseDamage2 * ((nDist - nDist2) / nDist)); if (actor2->IsPlayerActor()) - gPlayer[actor2->spr.type - kDudePlayer1].quakeEffect += nDamage * 4; + gPlayer[actor2->GetType() - kDudePlayer1].quakeEffect += nDamage * 4; actDamageSprite(actor, actor2, kDamageFall, nDamage << 4); } } @@ -221,7 +221,7 @@ static void beastThinkChase(DBloodActor* actor) aiNewState(actor, &beastSearch); return; } - if (target->IsPlayerActor() && powerupCheck(&gPlayer[target->spr.type - kDudePlayer1], kPwUpShadowCloak) > 0) + if (target->IsPlayerActor() && powerupCheck(getPlayer(target), kPwUpShadowCloak) > 0) { if (pXSector && pXSector->Underwater) aiNewState(actor, &beastSwimSearch); @@ -253,7 +253,7 @@ static void beastThinkChase(DBloodActor* actor) aiNewState(actor, &beastStomp); break; case 3: - if (actor->spr.type != gHitInfo.actor()->spr.type) + if (actor->GetType() != gHitInfo.actor()->GetType()) { if (!pXSector || !pXSector->Underwater) aiNewState(actor, &beastStomp); @@ -285,7 +285,7 @@ static void beastThinkChase(DBloodActor* actor) aiNewState(actor, &beastSlash); break; case 3: - if (actor->spr.type != gHitInfo.actor()->spr.type) + if (actor->GetType() != gHitInfo.actor()->GetType()) { if (pXSector && pXSector->Underwater) aiNewState(actor, &beastSwimSlash); @@ -355,7 +355,7 @@ static void beastThinkSwimChase(DBloodActor* actor) aiNewState(actor, &beastSwimSearch); return; } - if (target->IsPlayerActor() && powerupCheck(&gPlayer[target->spr.type - kDudePlayer1], kPwUpShadowCloak) > 0) + if (target->IsPlayerActor() && powerupCheck(getPlayer(target), kPwUpShadowCloak) > 0) { aiNewState(actor, &beastSwimSearch); return; diff --git a/source/games/blood/src/aiboneel.cpp b/source/games/blood/src/aiboneel.cpp index 69ff1492f..b53fc8e88 100644 --- a/source/games/blood/src/aiboneel.cpp +++ b/source/games/blood/src/aiboneel.cpp @@ -79,7 +79,7 @@ void eelBiteSeqCallback(int, DBloodActor* actor) auto target = actor->GetTarget(); assert(actor->IsDudeActor()); DUDEINFO* pDudeInfo = getDudeInfo(actor); - DUDEINFO* pDudeInfoT = getDudeInfo(target->spr.type); + DUDEINFO* pDudeInfoT = getDudeInfo(target); double height = (pDudeInfo->eyeHeight * actor->spr.scale.Y); double height2 = (pDudeInfoT->eyeHeight * target->spr.scale.Y); DVector3 vect(actor->spr.Angles.Yaw.ToVector() * 1024, height2 - height); @@ -267,7 +267,7 @@ static void eelThinkChase(DBloodActor* actor) aiNewState(actor, &eelSearch); return; } - if (target->IsPlayerActor() && powerupCheck(&gPlayer[target->spr.type - kDudePlayer1], kPwUpShadowCloak) > 0) + if (target->IsPlayerActor() && powerupCheck(getPlayer(target), kPwUpShadowCloak) > 0) { aiNewState(actor, &eelSearch); return; diff --git a/source/games/blood/src/aiburn.cpp b/source/games/blood/src/aiburn.cpp index 932bbf23f..da2c56df6 100644 --- a/source/games/blood/src/aiburn.cpp +++ b/source/games/blood/src/aiburn.cpp @@ -90,7 +90,7 @@ static void burnThinkGoto(DBloodActor* actor) aiChooseDirection(actor, nAngle); if (nDist < 32 && absangle(actor->spr.Angles.Yaw, nAngle) < pDudeInfo->Periphery()) { - switch (actor->spr.type) + switch (actor->GetType()) { case kDudeBurningCultist: aiNewState(actor, &cultistBurnSearch); @@ -124,7 +124,7 @@ static void burnThinkChase(DBloodActor* actor) { if (actor->GetTarget() == nullptr) { - switch (actor->spr.type) + switch (actor->GetType()) { case kDudeBurningCultist: aiNewState(actor, &cultistBurnGoto); @@ -163,7 +163,7 @@ static void burnThinkChase(DBloodActor* actor) aiChooseDirection(actor, nAngle); if (target->xspr.health == 0) { - switch (actor->spr.type) + switch (actor->GetType()) { case kDudeBurningCultist: aiNewState(actor, &cultistBurnSearch); @@ -203,7 +203,7 @@ static void burnThinkChase(DBloodActor* actor) aiSetTarget(actor, actor->GetTarget()); if (nDist < 51.1875 && nDeltaAngle < DAngle15) { - switch (actor->spr.type) + switch (actor->GetType()) { case kDudeBurningCultist: aiNewState(actor, &cultistBurnAttack); @@ -235,7 +235,7 @@ static void burnThinkChase(DBloodActor* actor) } } - switch (actor->spr.type) + switch (actor->GetType()) { case kDudeBurningCultist: aiNewState(actor, &cultistBurnGoto); diff --git a/source/games/blood/src/aicaleb.cpp b/source/games/blood/src/aicaleb.cpp index 49c5558bf..ba5168160 100644 --- a/source/games/blood/src/aicaleb.cpp +++ b/source/games/blood/src/aicaleb.cpp @@ -140,7 +140,7 @@ static void calebThinkChase(DBloodActor* actor) } return; } - if (target->IsPlayerActor() && powerupCheck(&gPlayer[target->spr.type - kDudePlayer1], kPwUpShadowCloak) > 0) + if (target->IsPlayerActor() && powerupCheck(getPlayer(target), kPwUpShadowCloak) > 0) { if (pXSector && pXSector->Underwater) aiNewState(actor, &tinycalebSwimSearch); @@ -171,7 +171,7 @@ static void calebThinkChase(DBloodActor* actor) aiNewState(actor, &tinycalebAttack); break; case 3: - if (actor->spr.type != gHitInfo.actor()->spr.type) + if (actor->GetType() != gHitInfo.actor()->GetType()) { if (pXSector && pXSector->Underwater) aiNewState(actor, &tinycalebSwimAttack); @@ -242,7 +242,7 @@ static void calebThinkSwimChase(DBloodActor* actor) aiNewState(actor, &tinycalebSwimSearch); return; } - if (target->IsPlayerActor() && powerupCheck(&gPlayer[target->spr.type - kDudePlayer1], kPwUpShadowCloak) > 0) + if (target->IsPlayerActor() && powerupCheck(getPlayer(target), kPwUpShadowCloak) > 0) { aiNewState(actor, &tinycalebSwimSearch); return; diff --git a/source/games/blood/src/aicerber.cpp b/source/games/blood/src/aicerber.cpp index 9dfad8eaf..cbe112199 100644 --- a/source/games/blood/src/aicerber.cpp +++ b/source/games/blood/src/aicerber.cpp @@ -125,7 +125,7 @@ void cerberusBurnSeqCallback(int, DBloodActor* actor) } } } - switch (actor->spr.type) { + switch (actor->GetType()) { case kDudeCerberusTwoHead: actFireMissile(actor, -Cerberus_XYOff, 0, Aim, kMissileFireballCerberus); actFireMissile(actor, Cerberus_XYOff, -Cerberus_ZOff, Aim, kMissileFireballCerberus); @@ -180,7 +180,7 @@ void cerberusBurnSeqCallback2(int, DBloodActor* actor) DAngle nDeltaAngle = absangle(nAngle, actor->spr.Angles.Yaw); if (nDeltaAngle <= DAngle45) { - DUDEINFO* pDudeInfo2 = getDudeInfo(actor2->spr.type); + DUDEINFO* pDudeInfo2 = getDudeInfo(actor2); double height1 = (pDudeInfo2->aimHeight * actor2->spr.scale.Y); double tz1 = actor2->spr.pos.Z - height - actor->spr.pos.Z; @@ -195,7 +195,7 @@ void cerberusBurnSeqCallback2(int, DBloodActor* actor) } } } - switch (actor->spr.type) { + switch (actor->GetType()) { case kDudeCerberusTwoHead: actFireMissile(actor, Cerberus_XYOff, -Cerberus_ZOff, Aim, kMissileFlameHound); @@ -282,7 +282,7 @@ static void cerberusThinkGoto(DBloodActor* actor) aiChooseDirection(actor, nAngle); if (nDist < 32 && absangle(actor->spr.Angles.Yaw, nAngle) < pDudeInfo->Periphery()) { - switch (actor->spr.type) { + switch (actor->GetType()) { case kDudeCerberusTwoHead: aiNewState(actor, &cerberusSearch); break; @@ -297,7 +297,7 @@ static void cerberusThinkGoto(DBloodActor* actor) static void cerberusThinkChase(DBloodActor* actor) { if (actor->GetTarget() == nullptr) { - switch (actor->spr.type) { + switch (actor->GetType()) { case kDudeCerberusTwoHead: aiNewState(actor, &cerberusGoto); break; @@ -325,7 +325,7 @@ static void cerberusThinkChase(DBloodActor* actor) aiChooseDirection(actor, nAngle); if (target->xspr.health == 0) { - switch (actor->spr.type) { + switch (actor->GetType()) { case kDudeCerberusTwoHead: aiNewState(actor, &cerberusSearch); break; @@ -336,8 +336,8 @@ static void cerberusThinkChase(DBloodActor* actor) return; } - if (target->IsPlayerActor() && powerupCheck(&gPlayer[target->spr.type - kDudePlayer1], kPwUpShadowCloak) > 0) { - switch (actor->spr.type) { + if (target->IsPlayerActor() && powerupCheck(getPlayer(target), kPwUpShadowCloak) > 0) { + switch (actor->GetType()) { case kDudeCerberusTwoHead: aiNewState(actor, &cerberusSearch); break; @@ -361,7 +361,7 @@ static void cerberusThinkChase(DBloodActor* actor) if (nDist < 0x1b0 && nDist > 0xd0 && nDeltaAngle < DAngle15) { - switch (actor->spr.type) { + switch (actor->GetType()) { case kDudeCerberusTwoHead: aiNewState(actor, &cerberusBurn); break; @@ -373,7 +373,7 @@ static void cerberusThinkChase(DBloodActor* actor) else if (nDist < 0xb0 && nDist > 0x50 && nDeltaAngle < DAngle15) { - switch (actor->spr.type) { + switch (actor->GetType()) { case kDudeCerberusTwoHead: aiNewState(actor, &cerberus3Burn); break; @@ -385,14 +385,14 @@ static void cerberusThinkChase(DBloodActor* actor) else if (nDist < 0x20 && nDeltaAngle < DAngle15) { int hit = HitScan(actor, actor->spr.pos.Z, DVector3(dvec, 0), CLIPMASK1, 0); - switch (actor->spr.type) { + switch (actor->GetType()) { case kDudeCerberusTwoHead: switch (hit) { case -1: aiNewState(actor, &cerberusBite); break; case 3: - if (actor->spr.type != gHitInfo.actor()->spr.type && gHitInfo.actor()->spr.type != kDudeHellHound) + if (actor->GetType() != gHitInfo.actor()->GetType() && gHitInfo.actor()->GetType() != kDudeHellHound) aiNewState(actor, &cerberusBite); break; case 0: @@ -409,7 +409,7 @@ static void cerberusThinkChase(DBloodActor* actor) aiNewState(actor, &cerberus2Bite); break; case 3: - if (actor->spr.type != gHitInfo.actor()->spr.type && gHitInfo.actor()->spr.type != kDudeHellHound) + if (actor->GetType() != gHitInfo.actor()->GetType() && gHitInfo.actor()->GetType() != kDudeHellHound) aiNewState(actor, &cerberus2Bite); break; case 0: @@ -427,7 +427,7 @@ static void cerberusThinkChase(DBloodActor* actor) } } - switch (actor->spr.type) { + switch (actor->GetType()) { case kDudeCerberusTwoHead: aiNewState(actor, &cerberusGoto); break; diff --git a/source/games/blood/src/aicult.cpp b/source/games/blood/src/aicult.cpp index ef6131fc7..cd9b375a9 100644 --- a/source/games/blood/src/aicult.cpp +++ b/source/games/blood/src/aicult.cpp @@ -247,7 +247,7 @@ static void cultThinkChase(DBloodActor* actor) } return; } - if (target->IsPlayerActor() && powerupCheck(&gPlayer[target->spr.type - kDudePlayer1], kPwUpShadowCloak) > 0) + if (target->IsPlayerActor() && powerupCheck(getPlayer(target), kPwUpShadowCloak) > 0) { switch (actor->xspr.medium) { @@ -271,11 +271,11 @@ static void cultThinkChase(DBloodActor* actor) { aiSetTarget(actor, actor->GetTarget()); actor->dudeSlope = nDist == 0 ? 0 : (target->spr.pos.Z - actor->spr.pos.Z) / nDist; - switch (actor->spr.type) + switch (actor->GetType()) { case kDudeCultistTommy: if (nDist < 0x1e0 && nDist > 0xe0 && nDeltaAngle < DAngle15 && !TargetNearExplosion(target->sector()) - && (target->spr.flags & 2) && gGameOptions.nDifficulty > 2 && target->IsPlayerActor() && gPlayer[target->spr.type - kDudePlayer1].isRunning + && (target->spr.flags & 2) && gGameOptions.nDifficulty > 2 && target->IsPlayerActor() && gPlayer[target->GetType() - kDudePlayer1].isRunning && Chance(0x8000)) { int hit = HitScan(actor, actor->spr.pos.Z, DVector3(dvec, 0), CLIPMASK1, 0); @@ -289,7 +289,7 @@ static void cultThinkChase(DBloodActor* actor) case 4: break; case 3: - if (actor->spr.type != gHitInfo.actor()->spr.type && gHitInfo.actor()->spr.type != kDudeCultistShotgun && actor->xspr.medium != kMediumWater && actor->xspr.medium != kMediumGoo) + if (actor->GetType() != gHitInfo.actor()->GetType() && gHitInfo.actor()->GetType() != kDudeCultistShotgun && actor->xspr.medium != kMediumWater && actor->xspr.medium != kMediumGoo) aiNewState(actor, &cultistTThrow); break; default: @@ -311,7 +311,7 @@ static void cultThinkChase(DBloodActor* actor) aiNewState(actor, &cultistTSwimFire); break; case 3: - if (actor->spr.type != gHitInfo.actor()->spr.type && gHitInfo.actor()->spr.type != kDudeCultistShotgun) + if (actor->GetType() != gHitInfo.actor()->GetType() && gHitInfo.actor()->GetType() != kDudeCultistShotgun) { if (!dudeIsPlayingSeq(actor, 14) && actor->xspr.medium == kMediumNormal) aiNewState(actor, &cultistTFire); @@ -343,7 +343,7 @@ static void cultThinkChase(DBloodActor* actor) break; case kDudeCultistShotgun: if (nDist < 0x2c0 && nDist > 0x140 && !TargetNearExplosion(target->sector()) - && (target->spr.flags & 2) && gGameOptions.nDifficulty >= 2 && target->IsPlayerActor() && !gPlayer[target->spr.type - kDudePlayer1].isRunning + && (target->spr.flags & 2) && gGameOptions.nDifficulty >= 2 && target->IsPlayerActor() && !gPlayer[target->GetType() - kDudePlayer1].isRunning && Chance(0x8000)) { int hit = HitScan(actor, actor->spr.pos.Z, DVector3(dvec, 0), CLIPMASK1, 0); @@ -357,7 +357,7 @@ static void cultThinkChase(DBloodActor* actor) case 4: break; case 3: - if (actor->spr.type != gHitInfo.actor()->spr.type && gHitInfo.actor()->spr.type != kDudeCultistShotgun && actor->xspr.medium != kMediumWater && actor->xspr.medium != kMediumGoo) + if (actor->GetType() != gHitInfo.actor()->GetType() && gHitInfo.actor()->GetType() != kDudeCultistShotgun && actor->xspr.medium != kMediumWater && actor->xspr.medium != kMediumGoo) aiNewState(actor, &cultistSThrow); break; default: @@ -379,7 +379,7 @@ static void cultThinkChase(DBloodActor* actor) aiNewState(actor, &cultistSSwimFire); break; case 3: - if (actor->spr.type != gHitInfo.actor()->spr.type && gHitInfo.actor()->spr.type != kDudeCultistTommy) + if (actor->GetType() != gHitInfo.actor()->GetType() && gHitInfo.actor()->GetType() != kDudeCultistTommy) { if (!dudeIsPlayingSeq(actor, 14) && actor->xspr.medium == kMediumNormal) aiNewState(actor, &cultistSFire); @@ -411,7 +411,7 @@ static void cultThinkChase(DBloodActor* actor) break; case kDudeCultistTesla: if (nDist < 0x1e0 && nDist > 0xe0 && !TargetNearExplosion(target->sector()) - && (target->spr.flags & 2) && gGameOptions.nDifficulty > 2 && target->IsPlayerActor() && gPlayer[target->spr.type - kDudePlayer1].isRunning + && (target->spr.flags & 2) && gGameOptions.nDifficulty > 2 && target->IsPlayerActor() && gPlayer[target->GetType() - kDudePlayer1].isRunning && Chance(0x8000)) { int hit = HitScan(actor, actor->spr.pos.Z, DVector3(dvec, 0), CLIPMASK1, 0); @@ -425,7 +425,7 @@ static void cultThinkChase(DBloodActor* actor) case 4: break; case 3: - if (actor->spr.type != gHitInfo.actor()->spr.type && gHitInfo.actor()->spr.type != kDudeCultistShotgun && actor->xspr.medium != kMediumWater && actor->xspr.medium != kMediumGoo) + if (actor->GetType() != gHitInfo.actor()->GetType() && gHitInfo.actor()->GetType() != kDudeCultistShotgun && actor->xspr.medium != kMediumWater && actor->xspr.medium != kMediumGoo) aiNewState(actor, &cultistTsThrow); break; default: @@ -448,7 +448,7 @@ static void cultThinkChase(DBloodActor* actor) aiNewState(actor, &cultistTsSwimFire); break; case 3: - if (actor->spr.type != gHitInfo.actor()->spr.type && gHitInfo.actor()->spr.type != kDudeCultistTommy) + if (actor->GetType() != gHitInfo.actor()->GetType() && gHitInfo.actor()->GetType() != kDudeCultistTommy) { if (!dudeIsPlayingSeq(actor, 14) && actor->xspr.medium == kMediumNormal) aiNewState(actor, &cultistTsFire); @@ -491,7 +491,7 @@ static void cultThinkChase(DBloodActor* actor) case 4: break; case 3: - if (actor->spr.type != gHitInfo.actor()->spr.type && gHitInfo.actor()->spr.type != kDudeCultistShotgun && actor->xspr.medium != kMediumWater && actor->xspr.medium != kMediumGoo) + if (actor->GetType() != gHitInfo.actor()->GetType() && gHitInfo.actor()->GetType() != kDudeCultistShotgun && actor->xspr.medium != kMediumWater && actor->xspr.medium != kMediumGoo) aiNewState(actor, &cultistDThrow); break; default: @@ -511,7 +511,7 @@ static void cultThinkChase(DBloodActor* actor) case 4: break; case 3: - if (actor->spr.type != gHitInfo.actor()->spr.type && gHitInfo.actor()->spr.type != kDudeCultistShotgun && actor->xspr.medium != kMediumWater && actor->xspr.medium != kMediumGoo) + if (actor->GetType() != gHitInfo.actor()->GetType() && gHitInfo.actor()->GetType() != kDudeCultistShotgun && actor->xspr.medium != kMediumWater && actor->xspr.medium != kMediumGoo) aiNewState(actor, &cultist139A78); break; default: @@ -522,7 +522,7 @@ static void cultThinkChase(DBloodActor* actor) break; case kDudeCultistBeast: if (nDist < 0x1e0 && nDist > 0xe0 && !TargetNearExplosion(target->sector()) - && (target->spr.flags & 2) && gGameOptions.nDifficulty > 2 && target->IsPlayerActor() && gPlayer[target->spr.type - kDudePlayer1].isRunning + && (target->spr.flags & 2) && gGameOptions.nDifficulty > 2 && target->IsPlayerActor() && gPlayer[target->GetType() - kDudePlayer1].isRunning && Chance(0x8000)) { int hit = HitScan(actor, actor->spr.pos.Z, DVector3(dvec, 0), CLIPMASK1, 0); @@ -536,7 +536,7 @@ static void cultThinkChase(DBloodActor* actor) case 4: break; case 3: - if (actor->spr.type != gHitInfo.actor()->spr.type && gHitInfo.actor()->spr.type != kDudeCultistShotgun && actor->xspr.medium != kMediumWater && actor->xspr.medium != kMediumGoo) + if (actor->GetType() != gHitInfo.actor()->GetType() && gHitInfo.actor()->GetType() != kDudeCultistShotgun && actor->xspr.medium != kMediumWater && actor->xspr.medium != kMediumGoo) aiNewState(actor, &cultistSThrow); break; default: @@ -558,7 +558,7 @@ static void cultThinkChase(DBloodActor* actor) aiNewState(actor, &cultistSSwimFire); break; case 3: - if (actor->spr.type != gHitInfo.actor()->spr.type && gHitInfo.actor()->spr.type != kDudeCultistTommy) + if (actor->GetType() != gHitInfo.actor()->GetType() && gHitInfo.actor()->GetType() != kDudeCultistTommy) { if (!dudeIsPlayingSeq(actor, 14) && actor->xspr.medium == kMediumNormal) aiNewState(actor, &cultistSFire); diff --git a/source/games/blood/src/aigarg.cpp b/source/games/blood/src/aigarg.cpp index 61a00e36c..a506ba99d 100644 --- a/source/games/blood/src/aigarg.cpp +++ b/source/games/blood/src/aigarg.cpp @@ -80,7 +80,7 @@ void SlashFSeqCallback(int, DBloodActor* actor) if (!actor->ValidateTarget(__FUNCTION__)) return; auto target = actor->GetTarget(); DUDEINFO* pDudeInfo = getDudeInfo(actor); - DUDEINFO* pDudeInfoT = getDudeInfo(target->spr.type); + DUDEINFO* pDudeInfoT = getDudeInfo(target); double height = (pDudeInfo->eyeHeight * actor->spr.scale.Y); double height2 = (pDudeInfoT->eyeHeight * target->spr.scale.Y); DVector3 vec(actor->spr.Angles.Yaw.ToVector() * 64, height - height2); @@ -312,7 +312,7 @@ static void gargThinkChase(DBloodActor* actor) aiNewState(actor, &gargoyleFSearch); return; } - if (target->IsPlayerActor() && powerupCheck(&gPlayer[target->spr.type - kDudePlayer1], kPwUpShadowCloak) > 0) + if (target->IsPlayerActor() && powerupCheck(getPlayer(target), kPwUpShadowCloak) > 0) { aiNewState(actor, &gargoyleFSearch); return; @@ -322,7 +322,7 @@ static void gargThinkChase(DBloodActor* actor) { DAngle nDeltaAngle = absangle(actor->spr.Angles.Yaw, dxyAngle); double height = pDudeInfo->eyeHeight * actor->spr.scale.Y; - // Should be dudeInfo[target->spr.type-kDudeBase] + // Should be dudeInfo[target] double height2 = pDudeInfo->eyeHeight * target->spr.scale.Y; double top, bottom; GetActorExtents(actor, &top, &bottom); @@ -335,7 +335,7 @@ static void gargThinkChase(DBloodActor* actor) double floorDelta = floorZ - bottom; double heightDelta = height2 - height; bool angWithinRange = nDeltaAngle < DAngle15; - switch (actor->spr.type) + switch (actor->GetType()) { case kDudeGargoyleFlesh: if (nDist < 0x180 && nDist > 0xc0 && angWithinRange) @@ -351,7 +351,7 @@ static void gargThinkChase(DBloodActor* actor) case 4: break; case 3: - if (actor->spr.type != gHitInfo.actor()->spr.type && gHitInfo.actor()->spr.type != kDudeGargoyleStone) + if (actor->GetType() != gHitInfo.actor()->GetType() && gHitInfo.actor()->GetType() != kDudeGargoyleStone) { sfxPlay3DSound(actor, 1408, 0, 0); aiNewState(actor, &gargoyleFThrow); @@ -376,7 +376,7 @@ static void gargThinkChase(DBloodActor* actor) case 4: break; case 3: - if (actor->spr.type != gHitInfo.actor()->spr.type && gHitInfo.actor()->spr.type != kDudeGargoyleStone) + if (actor->GetType() != gHitInfo.actor()->GetType() && gHitInfo.actor()->GetType() != kDudeGargoyleStone) { sfxPlay3DSound(actor, 1406, 0, 0); aiNewState(actor, &gargoyleFSlash); @@ -410,7 +410,7 @@ static void gargThinkChase(DBloodActor* actor) case 4: break; case 3: - if (actor->spr.type != gHitInfo.actor()->spr.type && gHitInfo.actor()->spr.type != kDudeGargoyleFlesh) + if (actor->GetType() != gHitInfo.actor()->GetType() && gHitInfo.actor()->GetType() != kDudeGargoyleFlesh) { sfxPlay3DSound(actor, 1457, 0, 0); aiNewState(actor, &gargoyleSBlast); @@ -434,7 +434,7 @@ static void gargThinkChase(DBloodActor* actor) case 4: break; case 3: - if (actor->spr.type != gHitInfo.actor()->spr.type && gHitInfo.actor()->spr.type != kDudeGargoyleFlesh) + if (actor->GetType() != gHitInfo.actor()->GetType() && gHitInfo.actor()->GetType() != kDudeGargoyleFlesh) aiNewState(actor, &gargoyleFSlash); break; default: @@ -535,7 +535,7 @@ static void gargMoveSlow(DBloodActor* actor) t2 *= 0.5; }); - switch (actor->spr.type) { + switch (actor->GetType()) { case kDudeGargoyleFlesh: actor->vel.Z = 4.26666; break; @@ -568,7 +568,7 @@ static void gargMoveSwoop(DBloodActor* actor) AdjustVelocity(actor, ADJUSTER{ t1 += nAccel * 0.5; - switch (actor->spr.type) { + switch (actor->GetType()) { case kDudeGargoyleFlesh: actor->vel.Z = t1; break; @@ -603,7 +603,7 @@ static void gargMoveFly(DBloodActor* actor) AdjustVelocity(actor, ADJUSTER{ t1 += nAccel * 0.5; - switch (actor->spr.type) { + switch (actor->GetType()) { case kDudeGargoyleFlesh: actor->vel.Z = -t1; break; diff --git a/source/games/blood/src/aighost.cpp b/source/games/blood/src/aighost.cpp index 5abf79e9d..5d3859b30 100644 --- a/source/games/blood/src/aighost.cpp +++ b/source/games/blood/src/aighost.cpp @@ -65,7 +65,7 @@ void ghostSlashSeqCallback(int, DBloodActor* actor) if (!actor->ValidateTarget(__FUNCTION__)) return; auto target = actor->GetTarget(); DUDEINFO* pDudeInfo = getDudeInfo(actor); - DUDEINFO* pDudeInfoT = getDudeInfo(target->spr.type); + DUDEINFO* pDudeInfoT = getDudeInfo(target); double height = (pDudeInfo->eyeHeight * actor->spr.scale.Y); double height2 = (pDudeInfoT->eyeHeight * target->spr.scale.Y); DVector3 dv(actor->spr.Angles.Yaw.ToVector() * 64, height - height2); @@ -291,7 +291,7 @@ static void ghostThinkChase(DBloodActor* actor) aiNewState(actor, &ghostSearch); return; } - if (target->IsPlayerActor() && powerupCheck(&gPlayer[target->spr.type - kDudePlayer1], kPwUpShadowCloak) > 0) + if (target->IsPlayerActor() && powerupCheck(getPlayer(target), kPwUpShadowCloak) > 0) { aiNewState(actor, &ghostSearch); return; @@ -301,7 +301,7 @@ static void ghostThinkChase(DBloodActor* actor) { DAngle nDeltaAngle = absangle(actor->spr.Angles.Yaw, dxyAngle); double height = pDudeInfo->eyeHeight * actor->spr.scale.Y; - // Should be dudeInfo[target->spr.type-kDudeBase] + // Should be dudeInfo[target->GetType()-kDudeBase] double height2 = pDudeInfo->eyeHeight * target->spr.scale.Y; double top, bottom; GetActorExtents(actor, &top, &bottom); @@ -314,7 +314,7 @@ static void ghostThinkChase(DBloodActor* actor) double floorDelta = floorZ - bottom; double heightDelta = height2 - height; bool angWithinRange = nDeltaAngle < DAngle15; - switch (actor->spr.type) { + switch (actor->GetType()) { case kDudePhantasm: if (nDist < 0x200 && nDist > 0x100 && angWithinRange) { int hit = HitScan(actor, actor->spr.pos.Z, DVector3(dxy, 0), CLIPMASK1, 0); @@ -327,7 +327,7 @@ static void ghostThinkChase(DBloodActor* actor) case 4: break; case 3: - if (actor->spr.type != gHitInfo.actor()->spr.type && gHitInfo.actor()->spr.type != kDudePhantasm) + if (actor->GetType() != gHitInfo.actor()->GetType() && gHitInfo.actor()->GetType() != kDudePhantasm) aiNewState(actor, &ghostBlast); break; default: @@ -347,7 +347,7 @@ static void ghostThinkChase(DBloodActor* actor) case 4: break; case 3: - if (actor->spr.type != gHitInfo.actor()->spr.type && gHitInfo.actor()->spr.type != kDudePhantasm) + if (actor->GetType() != gHitInfo.actor()->GetType() && gHitInfo.actor()->GetType() != kDudePhantasm) aiNewState(actor, &ghostSlash); break; default: @@ -429,7 +429,7 @@ static void ghostMoveSlow(DBloodActor* actor) t1 += nAccel * 0.5; t2 *= 0.5; }); - switch (actor->spr.type) { + switch (actor->GetType()) { case kDudePhantasm: actor->vel.Z = 4.26666; break; @@ -458,7 +458,7 @@ static void ghostMoveSwoop(DBloodActor* actor) return; AdjustVelocity(actor, ADJUSTER{ t1 += nAccel * 0.5; - switch (actor->spr.type) { + switch (actor->GetType()) { case kDudePhantasm: actor->vel.Z = t1; break; @@ -488,7 +488,7 @@ static void ghostMoveFly(DBloodActor* actor) return; AdjustVelocity(actor, ADJUSTER{ t1 += nAccel * 0.5; - switch (actor->spr.type) { + switch (actor->GetType()) { case kDudePhantasm: actor->vel.Z = -t1; break; diff --git a/source/games/blood/src/aigilbst.cpp b/source/games/blood/src/aigilbst.cpp index 2b00dd845..f57cb4c77 100644 --- a/source/games/blood/src/aigilbst.cpp +++ b/source/games/blood/src/aigilbst.cpp @@ -125,7 +125,7 @@ static void gillThinkChase(DBloodActor* actor) aiNewState(actor, &gillBeastSearch); return; } - if (target->IsPlayerActor() && powerupCheck(&gPlayer[target->spr.type - kDudePlayer1], kPwUpShadowCloak) > 0) + if (target->IsPlayerActor() && powerupCheck(getPlayer(target), kPwUpShadowCloak) > 0) { if (pXSector && pXSector->Underwater) aiNewState(actor, &gillBeastSwimSearch); @@ -156,7 +156,7 @@ static void gillThinkChase(DBloodActor* actor) aiNewState(actor, &gillBeastBite); break; case 3: - if (actor->spr.type != gHitInfo.actor()->spr.type) + if (actor->GetType() != gHitInfo.actor()->GetType()) { if (pXSector && pXSector->Underwater) aiNewState(actor, &gillBeastSwimBite); @@ -226,7 +226,7 @@ static void gillThinkSwimChase(DBloodActor* actor) aiNewState(actor, &gillBeastSwimSearch); return; } - if (target->IsPlayerActor() && powerupCheck(&gPlayer[target->spr.type - kDudePlayer1], kPwUpShadowCloak) > 0) + if (target->IsPlayerActor() && powerupCheck(getPlayer(target), kPwUpShadowCloak) > 0) { aiNewState(actor, &gillBeastSwimSearch); return; diff --git a/source/games/blood/src/aihand.cpp b/source/games/blood/src/aihand.cpp index e4af2ec95..e8afb5c2d 100644 --- a/source/games/blood/src/aihand.cpp +++ b/source/games/blood/src/aihand.cpp @@ -47,7 +47,7 @@ void HandJumpSeqCallback(int, DBloodActor* actor) auto target = actor->GetTarget(); if (target->IsPlayerActor()) { - PLAYER* pPlayer = &gPlayer[target->spr.type - kDudePlayer1]; + PLAYER* pPlayer = getPlayer(target); if (!pPlayer->hand) { pPlayer->hand = 1; @@ -96,7 +96,7 @@ static void handThinkChase(DBloodActor* actor) aiNewState(actor, &handSearch); return; } - if (target->IsPlayerActor() && powerupCheck(&gPlayer[target->spr.type - kDudePlayer1], kPwUpShadowCloak) > 0) + if (target->IsPlayerActor() && powerupCheck(getPlayer(target), kPwUpShadowCloak) > 0) { aiNewState(actor, &handSearch); return; diff --git a/source/games/blood/src/aihound.cpp b/source/games/blood/src/aihound.cpp index 022ef5f52..7f7039580 100644 --- a/source/games/blood/src/aihound.cpp +++ b/source/games/blood/src/aihound.cpp @@ -107,7 +107,7 @@ static void houndThinkChase(DBloodActor* actor) aiNewState(actor, &houndSearch); return; } - if (target->IsPlayerActor() && powerupCheck(&gPlayer[target->spr.type - kDudePlayer1], kPwUpShadowCloak) > 0) + if (target->IsPlayerActor() && powerupCheck(getPlayer(target), kPwUpShadowCloak) > 0) { aiNewState(actor, &houndSearch); return; diff --git a/source/games/blood/src/aipod.cpp b/source/games/blood/src/aipod.cpp index 6ef15dec4..566f645a9 100644 --- a/source/games/blood/src/aipod.cpp +++ b/source/games/blood/src/aipod.cpp @@ -71,7 +71,7 @@ void podAttack(int, DBloodActor* actor) dv.Y += Random2F(1000, 4); double nDist = dv.XY().Length(); DBloodActor* pMissile = nullptr; - switch (actor->spr.type) + switch (actor->GetType()) { case kDudePodGreen: dv.Z += 31.25; @@ -106,7 +106,7 @@ void sub_70284(int, DBloodActor* actor) sfxPlay3DSound(actor, 2502, -1, 0); int nDist, nBurn; DAMAGE_TYPE dmgType; - switch (actor->spr.type) { + switch (actor->GetType()) { case kDudeTentacleGreen: default: // ??? nBurn = 0; @@ -142,7 +142,7 @@ static void aiPodMove(DBloodActor* actor) aiChooseDirection(actor, nAngle); if (nDist < 32 && absangle(actor->spr.Angles.Yaw, nAngle) < pDudeInfo->Periphery()) { - switch (actor->spr.type) { + switch (actor->GetType()) { case kDudePodGreen: case kDudePodFire: aiNewState(actor, &podSearch); @@ -159,7 +159,7 @@ static void aiPodMove(DBloodActor* actor) static void aiPodChase(DBloodActor* actor) { if (actor->GetTarget() == nullptr) { - switch (actor->spr.type) { + switch (actor->GetType()) { case kDudePodGreen: case kDudePodFire: aiNewState(actor, &podMove); @@ -184,7 +184,7 @@ static void aiPodChase(DBloodActor* actor) aiChooseDirection(actor, nAngle); if (target->xspr.health == 0) { - switch (actor->spr.type) { + switch (actor->GetType()) { case kDudePodGreen: case kDudePodFire: aiNewState(actor, &podSearch); @@ -205,8 +205,8 @@ static void aiPodChase(DBloodActor* actor) if (nDist < pDudeInfo->SeeDist() && abs(nDeltaAngle) <= pDudeInfo->Periphery()) { aiSetTarget(actor, actor->GetTarget()); - if (nDeltaAngle < DAngle15 && target->spr.type != kDudePodGreen && target->spr.type != kDudePodFire) { - switch (actor->spr.type) { + if (nDeltaAngle < DAngle15 && target->GetType() != kDudePodGreen && target->GetType() != kDudePodFire) { + switch (actor->GetType()) { case kDudePodGreen: case kDudePodFire: aiNewState(actor, &podStartChase); @@ -222,7 +222,7 @@ static void aiPodChase(DBloodActor* actor) } } - switch (actor->spr.type) { + switch (actor->GetType()) { case kDudePodGreen: case kDudePodFire: aiNewState(actor, &podMove); diff --git a/source/games/blood/src/airat.cpp b/source/games/blood/src/airat.cpp index 5f92164e6..c82011be9 100644 --- a/source/games/blood/src/airat.cpp +++ b/source/games/blood/src/airat.cpp @@ -92,7 +92,7 @@ static void ratThinkChase(DBloodActor* actor) aiNewState(actor, &ratSearch); return; } - if (target->IsPlayerActor() && powerupCheck(&gPlayer[target->spr.type - kDudePlayer1], kPwUpShadowCloak) > 0) + if (target->IsPlayerActor() && powerupCheck(getPlayer(target), kPwUpShadowCloak) > 0) { aiNewState(actor, &ratSearch); return; diff --git a/source/games/blood/src/aispid.cpp b/source/games/blood/src/aispid.cpp index d27b620c6..bd6823e48 100644 --- a/source/games/blood/src/aispid.cpp +++ b/source/games/blood/src/aispid.cpp @@ -49,7 +49,7 @@ static void spidBlindEffect(DBloodActor* actor, int nBlind, int max) { nBlind <<= 4; max <<= 4; - PLAYER* pPlayer = &gPlayer[actor->spr.type - kDudePlayer1]; + PLAYER* pPlayer = getPlayer(actor); if (pPlayer->blindEffect < max) { pPlayer->blindEffect = ClipHigh(pPlayer->blindEffect + nBlind, max); @@ -74,8 +74,8 @@ void SpidBiteSeqCallback(int, DBloodActor* actor) if (hit == 3 && gHitInfo.actor()->IsPlayerActor()) { vec.Z += target->spr.pos.Z - actor->spr.pos.Z; - PLAYER* pPlayer = &gPlayer[target->spr.type - kDudePlayer1]; - switch (actor->spr.type) + PLAYER* pPlayer = getPlayer(target); + switch (actor->GetType()) { case kDudeSpiderBrown: actFireVector(actor, 0, 0, vec, kVectorSpiderBite); @@ -118,7 +118,7 @@ void SpidJumpSeqCallback(int, DBloodActor* actor) auto target = actor->GetTarget(); if (target->IsPlayerActor()) { vec.Z += target->spr.pos.Z - actor->spr.pos.Z; - switch (actor->spr.type) { + switch (actor->GetType()) { case kDudeSpiderBrown: case kDudeSpiderRed: case kDudeSpiderBlack: @@ -200,7 +200,7 @@ static void spidThinkChase(DBloodActor* actor) aiNewState(actor, &spidSearch); return; } - if (target->IsPlayerActor() && powerupCheck(&gPlayer[target->spr.type - kDudePlayer1], kPwUpShadowCloak) > 0) + if (target->IsPlayerActor() && powerupCheck(getPlayer(target), kPwUpShadowCloak) > 0) { aiNewState(actor, &spidSearch); return; @@ -216,7 +216,7 @@ static void spidThinkChase(DBloodActor* actor) { aiSetTarget(actor, actor->GetTarget()); - switch (actor->spr.type) { + switch (actor->GetType()) { case kDudeSpiderRed: if (nDist < 57.5625 && nDeltaAngle < DAngle15) aiNewState(actor, &spidBite); diff --git a/source/games/blood/src/aitchern.cpp b/source/games/blood/src/aitchern.cpp index 2cc45ab09..a710691f3 100644 --- a/source/games/blood/src/aitchern.cpp +++ b/source/games/blood/src/aitchern.cpp @@ -272,7 +272,7 @@ static void tchernobogThinkChase(DBloodActor* actor) aiNewState(actor, &tchernobogSearch); return; } - if (target->IsPlayerActor() && powerupCheck(&gPlayer[target->spr.type - kDudePlayer1], kPwUpShadowCloak) > 0) + if (target->IsPlayerActor() && powerupCheck(getPlayer(target), kPwUpShadowCloak) > 0) { aiNewState(actor, &tchernobogSearch); return; diff --git a/source/games/blood/src/aiunicult.cpp b/source/games/blood/src/aiunicult.cpp index ff670713a..cb53ab348 100644 --- a/source/games/blood/src/aiunicult.cpp +++ b/source/games/blood/src/aiunicult.cpp @@ -325,7 +325,7 @@ static void ThrowThing(DBloodActor* actor, bool impact) DBloodActor* spawned = nullptr; if ((spawned = actFireThing(actor, 0., 0., (dv.Z / 32768.) - zThrow, curWeapon, dist * (2048. / 64800))) == nullptr) return; - if (pThinkInfo->picno < 0 && spawned->spr.type != kModernThingThrowableRock) spawned->spr.setspritetexture(FNullTextureID()); + if (pThinkInfo->picno < 0 && spawned->GetType() != kModernThingThrowableRock) spawned->spr.setspritetexture(FNullTextureID()); spawned->SetOwner(actor); @@ -462,7 +462,7 @@ static void unicultThinkChase(DBloodActor* actor) if (target->xspr.health <= 0) // target is dead { PLAYER* pPlayer = NULL; - if ((!target->IsPlayerActor()) || ((pPlayer = getPlayerById(target->spr.type)) != NULL && pPlayer->fragger == actor)) + if ((!target->IsPlayerActor()) || ((pPlayer = getPlayerById(target->GetType())) != NULL && pPlayer->fragger == actor)) { playGenDudeSound(actor, kGenDudeSndTargetDead); if (spriteIsUnderwater(actor, false)) aiGenDudeNewState(actor, &genDudeSearchShortW); @@ -498,7 +498,7 @@ static void unicultThinkChase(DBloodActor* actor) } else if (target->IsPlayerActor()) { - PLAYER* pPlayer = &gPlayer[target->spr.type - kDudePlayer1]; + PLAYER* pPlayer = getPlayer(target); if (powerupCheck(pPlayer, kPwUpShadowCloak) > 0) { if (spriteIsUnderwater(actor, false)) aiGenDudeNewState(actor, &genDudeSearchShortW); @@ -808,7 +808,7 @@ static void unicultThinkChase(DBloodActor* actor) else if (inDuck(actor->xspr.aiState)) aiGenDudeNewState(actor, &genDudeDodgeShortD); else aiGenDudeNewState(actor, &genDudeDodgeShortL); - switch (hitactor->spr.type) + switch (hitactor->GetType()) { case kDudeModernCustom: // and make dude which could be hit to dodge too if (!dudeIsMelee(hitactor) && Chance(int(dist * 256))) @@ -1351,7 +1351,7 @@ void removeDudeStuff(DBloodActor* actor) while (auto actor2 = it.Next()) { if (actor2->GetOwner() != actor) continue; - switch (actor2->spr.type) { + switch (actor2->GetType()) { case kThingArmedProxBomb: case kThingArmedRemoteBomb: case kModernThingTNTProx: @@ -1758,12 +1758,12 @@ void dudeLeechOperate(DBloodActor* actor, const EVENT& event) { if (actTarget->IsPlayerActor()) { - PLAYER* pPlayer = &gPlayer[actTarget->spr.type - kDudePlayer1]; + PLAYER* pPlayer = getPlayer(actTarget); if (powerupCheck(pPlayer, kPwUpShadowCloak) > 0) return; } double top, bottom; GetActorExtents(actor, &top, &bottom); - int nType = actTarget->spr.type - kDudeBase; + int nType = actTarget->GetType() - kDudeBase; DUDEINFO* pDudeInfo = &dudeInfo[nType]; double z1 = (top - actor->spr.pos.Z) - 1; auto atpos = actTarget->spr.pos; @@ -1886,7 +1886,7 @@ DBloodActor* genDudeSpawn(DBloodActor* source, DBloodActor* actor, double nDist) if (source->spr.flags & kModernTypeFlag1) { - switch (source->spr.type) { + switch (source->GetType()) { case kModernCustomDudeSpawn: //inherit pal? if (spawned->spr.pal <= 0) spawned->spr.pal = source->spr.pal; @@ -1955,7 +1955,7 @@ void genDudeTransform(DBloodActor* actor) // trigger dude death before transform trTriggerSprite(actor, kCmdOff, actor); - actor->spr.inittype = actIncarnation->spr.type; + actor->spr.inittype = actIncarnation->GetType(); actor->ChangeType(actor->spr.inittype); actor->spr.flags = actIncarnation->spr.flags; actor->spr.pal = actIncarnation->spr.pal; @@ -1999,11 +1999,11 @@ void genDudeTransform(DBloodActor* actor) actIncarnation->xspr.key = actIncarnation->xspr.dropMsg = 0; // set hp - if (actor->xspr.sysData2 <= 0) actor->xspr.health = dudeInfo[actor->spr.type - kDudeBase].startHealth << 4; + if (actor->xspr.sysData2 <= 0) actor->xspr.health = dudeInfo[actor->GetType() - kDudeBase].startHealth << 4; else actor->xspr.health = ClipRange(actor->xspr.sysData2 << 4, 1, 65535); - int seqId = dudeInfo[actor->spr.type - kDudeBase].seqStartID; - switch (actor->spr.type) { + int seqId = dudeInfo[actor->GetType() - kDudeBase].seqStartID; + switch (actor->GetType()) { case kDudePodMother: // fake dude case kDudeTentacleMother: // fake dude break; @@ -2223,8 +2223,8 @@ bool genDudePrepare(DBloodActor* actor, int propId) { if (!actor || !actor->hasX()) return false; - if (actor->spr.type != kDudeModernCustom) { - Printf(PRINT_HIGH, "actor->spr.type != kDudeModernCustom"); + if (actor->GetType() != kDudeModernCustom) { + Printf(PRINT_HIGH, "actor->GetType() != kDudeModernCustom"); return false; } else if (propId < kGenDudePropertyAll || propId >= kGenDudePropertyMax) { @@ -2498,7 +2498,7 @@ void genDudePostDeath(DBloodActor* actor, DAMAGE_TYPE damageType, int damage) void aiGenDudeInitSprite(DBloodActor* actor) { - switch (actor->spr.type) + switch (actor->GetType()) { case kDudeModernCustom: { diff --git a/source/games/blood/src/aizomba.cpp b/source/games/blood/src/aizomba.cpp index 01ec7b5df..c47c38093 100644 --- a/source/games/blood/src/aizomba.cpp +++ b/source/games/blood/src/aizomba.cpp @@ -63,7 +63,7 @@ void HackSeqCallback(int, DBloodActor* actor) auto target = actor->GetTarget(); if (!target) return; DUDEINFO* pDudeInfo = getDudeInfo(actor); - DUDEINFO* pDudeInfoT = getDudeInfo(target->spr.type); + DUDEINFO* pDudeInfoT = getDudeInfo(target); DVector3 dv; dv.XY() = (actor->xspr.TargetPos.XY() - actor->spr.pos.XY()).Resized(64); @@ -121,7 +121,7 @@ static void zombaThinkChase(DBloodActor* actor) aiNewState(actor, &zombieASearch); return; } - if (target->IsPlayerActor() && (powerupCheck(&gPlayer[target->spr.type - kDudePlayer1], kPwUpShadowCloak) > 0 || powerupCheck(&gPlayer[target->spr.type - kDudePlayer1], kPwUpDeathMaskUseless) > 0)) + if (target->IsPlayerActor() && (powerupCheck(getPlayer(target), kPwUpShadowCloak) > 0 || powerupCheck(getPlayer(target), kPwUpDeathMaskUseless) > 0)) { aiNewState(actor, &zombieAGoto); return; @@ -172,7 +172,7 @@ static void zombaThinkPonder(DBloodActor* actor) aiNewState(actor, &zombieASearch); return; } - if (target->IsPlayerActor() && (powerupCheck(&gPlayer[target->spr.type - kDudePlayer1], kPwUpShadowCloak) > 0 || powerupCheck(&gPlayer[target->spr.type - kDudePlayer1], kPwUpDeathMaskUseless) > 0)) + if (target->IsPlayerActor() && (powerupCheck(getPlayer(target), kPwUpShadowCloak) > 0 || powerupCheck(getPlayer(target), kPwUpDeathMaskUseless) > 0)) { aiNewState(actor, &zombieAGoto); return; diff --git a/source/games/blood/src/aizombf.cpp b/source/games/blood/src/aizombf.cpp index 619c541d9..8d94e46dd 100644 --- a/source/games/blood/src/aizombf.cpp +++ b/source/games/blood/src/aizombf.cpp @@ -47,13 +47,13 @@ AISTATE zombieFTeslaRecoil = { kAiStateRecoil, 4, -1, 0, NULL, NULL, NULL, &zomb void zombfHackSeqCallback(int, DBloodActor* actor) { - if (actor->spr.type != kDudeZombieButcher) + if (actor->GetType() != kDudeZombieButcher) return; if (!actor->ValidateTarget(__FUNCTION__)) return; auto target = actor->GetTarget(); DUDEINFO* pDudeInfo = getDudeInfo(actor); double height = pDudeInfo->eyeHeight * actor->spr.scale.Y * 0.25; - DUDEINFO* pDudeInfoT = getDudeInfo(target->spr.type); + DUDEINFO* pDudeInfoT = getDudeInfo(target); double height2 = pDudeInfoT->eyeHeight * target->spr.scale.Y * 0.25; actFireVector(actor, 0, 0, DVector3(actor->spr.Angles.Yaw.ToVector() * 64, height - height2), kVectorCleaver); } @@ -63,7 +63,7 @@ void PukeSeqCallback(int, DBloodActor* actor) if (!actor->ValidateTarget(__FUNCTION__)) return; auto target = actor->GetTarget(); DUDEINFO* pDudeInfo = getDudeInfo(actor); - DUDEINFO* pDudeInfoT = getDudeInfo(target->spr.type); + DUDEINFO* pDudeInfoT = getDudeInfo(target); DVector2 dv = (actor->xspr.TargetPos.XY() - actor->spr.pos.XY()).Resized(64); @@ -119,7 +119,7 @@ static void zombfThinkChase(DBloodActor* actor) aiNewState(actor, &zombieFSearch); return; } - if (target->IsPlayerActor() && (powerupCheck(&gPlayer[target->spr.type - kDudePlayer1], kPwUpShadowCloak) > 0 || powerupCheck(&gPlayer[target->spr.type - kDudePlayer1], kPwUpDeathMaskUseless) > 0)) + if (target->IsPlayerActor() && (powerupCheck(getPlayer(target), kPwUpShadowCloak) > 0 || powerupCheck(getPlayer(target), kPwUpDeathMaskUseless) > 0)) { aiNewState(actor, &zombieFSearch); return; @@ -143,7 +143,7 @@ static void zombfThinkChase(DBloodActor* actor) aiNewState(actor, &zombieFThrow); break; case 3: - if (actor->spr.type != gHitInfo.actor()->spr.type) + if (actor->GetType() != gHitInfo.actor()->GetType()) aiNewState(actor, &zombieFThrow); else aiNewState(actor, &zombieFDodge); @@ -162,7 +162,7 @@ static void zombfThinkChase(DBloodActor* actor) aiNewState(actor, &zombieFPuke); break; case 3: - if (actor->spr.type != gHitInfo.actor()->spr.type) + if (actor->GetType() != gHitInfo.actor()->GetType()) aiNewState(actor, &zombieFPuke); else aiNewState(actor, &zombieFDodge); @@ -181,7 +181,7 @@ static void zombfThinkChase(DBloodActor* actor) aiNewState(actor, &zombieFHack); break; case 3: - if (actor->spr.type != gHitInfo.actor()->spr.type) + if (actor->GetType() != gHitInfo.actor()->GetType()) aiNewState(actor, &zombieFHack); else aiNewState(actor, &zombieFDodge); diff --git a/source/games/blood/src/blood.cpp b/source/games/blood/src/blood.cpp index 29072fc34..9099b9e8b 100644 --- a/source/games/blood/src/blood.cpp +++ b/source/games/blood/src/blood.cpp @@ -198,7 +198,7 @@ void PropagateMarkerReferences(void) BloodStatIterator it(kStatMarker); while (auto actor = it.Next()) { - switch (actor->spr.type) + switch (actor->GetType()) { case kMarkerOff: case kMarkerAxis: @@ -701,6 +701,11 @@ inline DUDEINFO* getDudeInfo(DBloodActor* actor) return getDudeInfo(actor->GetType()); } +inline PLAYER* getPlayer(DBloodActor* actor) +{ + return &gPlayer[actor->GetType() - kDudePlayer1]; +} + DEFINE_ACTION_FUNCTION(_Blood, OriginalLoadScreen) { diff --git a/source/games/blood/src/bloodactor.h b/source/games/blood/src/bloodactor.h index 75cba44a9..c9d8e1f9b 100644 --- a/source/games/blood/src/bloodactor.h +++ b/source/games/blood/src/bloodactor.h @@ -188,7 +188,7 @@ inline bool IsTargetTeammate(DBloodActor* pSource, DBloodActor* pTarget) { if (!pSource->IsPlayerActor()) return false; - PLAYER* pSourcePlayer = &gPlayer[pSource->spr.type - kDudePlayer1]; + PLAYER* pSourcePlayer = getPlayer(pSource); return IsTargetTeammate(pSourcePlayer, pTarget); } diff --git a/source/games/blood/src/callback.cpp b/source/games/blood/src/callback.cpp index abb223619..93d730ed9 100644 --- a/source/games/blood/src/callback.cpp +++ b/source/games/blood/src/callback.cpp @@ -282,11 +282,11 @@ void Respawn(DBloodActor* actor, sectortype*) // 9 actor->xspr.isTriggered = 0; if (actor->IsDudeActor()) { - int nType = actor->spr.type - kDudeBase; + int nType = actor->GetType() - kDudeBase; actor->spr.pos = actor->basePoint; actor->spr.cstat |= CSTAT_SPRITE_BLOOD_BIT1 | CSTAT_SPRITE_BLOCK_ALL; #ifdef NOONE_EXTENSIONS - if (!gModernMap || actor->xspr.sysData2 <= 0) actor->xspr.health = dudeInfo[actor->spr.type - kDudeBase].startHealth << 4; + 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) { @@ -337,7 +337,7 @@ void PlayerBubble(DBloodActor* actor, sectortype*) // 10 if (!actor) return; if (actor->IsPlayerActor()) { - PLAYER* pPlayer = &gPlayer[actor->spr.type - kDudePlayer1]; + PLAYER* pPlayer = getPlayer(actor); if (!pPlayer->bubbleTime) return; double top, bottom; @@ -436,7 +436,7 @@ void CounterCheck(DBloodActor*, sectortype* pSector) // 12 void FinishHim(DBloodActor* actor, sectortype*) // 13 { if (!actor) return; - if (actor->IsPlayerActor() && playerSeqPlaying(&gPlayer[actor->spr.type - kDudePlayer1], 16) && actor == gPlayer[myconnectindex].actor) + if (actor->IsPlayerActor() && playerSeqPlaying(getPlayer(actor), 16) && actor == gPlayer[myconnectindex].actor) sndStartSample(3313, -1, 1, 0); } @@ -728,7 +728,7 @@ void DropVoodooCb(DBloodActor* actor, sectortype*) // unused } PLAYER* pPlayer; if (Owner->IsPlayerActor()) - pPlayer = &gPlayer[Owner->spr.type - kDudePlayer1]; + pPlayer = getPlayer(Owner); else pPlayer = nullptr; if (!pPlayer) @@ -755,7 +755,7 @@ void DropVoodooCb(DBloodActor* actor, sectortype*) // unused { PLAYER* pPlayer2; if (actor2->IsPlayerActor()) - pPlayer2 = &gPlayer[actor2->spr.type - kDudePlayer1]; + pPlayer2 = getPlayer(actor2); else pPlayer2 = nullptr; diff --git a/source/games/blood/src/dude.h b/source/games/blood/src/dude.h index 29bf3018a..69e544ca4 100644 --- a/source/games/blood/src/dude.h +++ b/source/games/blood/src/dude.h @@ -100,5 +100,6 @@ inline DUDEINFO* getDudeInfo(int const nType) } DUDEINFO* getDudeInfo(DBloodActor* actor); +PLAYER* getPlayer(DBloodActor* actor); END_BLD_NS diff --git a/source/games/blood/src/hudsprites.cpp b/source/games/blood/src/hudsprites.cpp index ff7dc006e..b1046eee3 100644 --- a/source/games/blood/src/hudsprites.cpp +++ b/source/games/blood/src/hudsprites.cpp @@ -169,7 +169,7 @@ void hudDraw(PLAYER* pPlayer, sectortype* pSector, double bobx, double boby, dou } int zn = int(((pPlayer->zWeapon - pPlayer->zView - 12) * 2.) + 220); - PLAYER* pPSprite = &gPlayer[pPlayer->actor->spr.type - kDudePlayer1]; + PLAYER* pPSprite = getPlayer(pPlayer->actor); // ??? if (pPlayer->actor->IsPlayerActor() && pPSprite->hand == 1) { gChoke.animateChoke(160, zn, interpfrac); diff --git a/source/games/blood/src/nnexts.cpp b/source/games/blood/src/nnexts.cpp index f076564fe..07bf8c8bb 100644 --- a/source/games/blood/src/nnexts.cpp +++ b/source/games/blood/src/nnexts.cpp @@ -332,13 +332,13 @@ bool nnExtIsImmune(DBloodActor* actor, int dmgType, int minScale) { if (dmgType >= kDmgFall && dmgType < kDmgMax && actor->hasX() && actor->xspr.locked != 1) { - if (actor->spr.type >= kThingBase && actor->spr.type < kThingMax) + if (actor->GetType() >= kThingBase && actor->GetType() < kThingMax) { - return (thingInfo[actor->spr.type - kThingBase].dmgControl[dmgType] <= minScale); + return (thingInfo[actor->GetType() - kThingBase].dmgControl[dmgType] <= minScale); } else if (actor->IsDudeActor()) { - if (actor->IsPlayerActor()) return (gPlayer[actor->spr.type - kDudePlayer1].damageControl[dmgType]); + if (actor->IsPlayerActor()) return (gPlayer[actor->GetType() - kDudePlayer1].damageControl[dmgType]); else if (actor->GetType() == kDudeModernCustom) return (actor->genDudeExtra.dmgControl[dmgType] <= minScale); else return (getDudeInfo(actor)->damageVal[dmgType] <= minScale); } @@ -356,7 +356,7 @@ bool nnExtIsImmune(DBloodActor* actor, int dmgType, int minScale) bool nnExtEraseModernStuff(DBloodActor* actor) { bool erased = false; - switch (actor->spr.type) { + switch (actor->GetType()) { // erase all modern types if the map is not extended case kModernSpriteDamager: case kModernCustomDudeSpawn: @@ -525,7 +525,7 @@ void nnExtInitModernStuff(TArray& actors) { if (!actor->exists() || !actor->hasX()) continue; - switch (actor->spr.type) { + switch (actor->GetType()) { case kModernRandomTX: case kModernSequentialTX: if (actor->xspr.command == kCmdLink) gEventRedirectsUsed = true; @@ -559,23 +559,23 @@ void nnExtInitModernStuff(TArray& actors) switch (actor->spr.statnum) { case kStatModernStealthRegion: - sysStat = (actor->spr.type != kModernStealthRegion); + sysStat = (actor->GetType() != kModernStealthRegion); break; case kStatModernDudeTargetChanger: - sysStat = (actor->spr.type != kModernDudeTargetChanger); + sysStat = (actor->GetType() != kModernDudeTargetChanger); break; case kStatModernCondition: - sysStat = (actor->spr.type != kModernCondition && actor->spr.type != kModernConditionFalse); + sysStat = (actor->GetType() != kModernCondition && actor->GetType() != kModernConditionFalse); break; case kStatModernEventRedirector: - sysStat = (actor->spr.type != kModernRandomTX && actor->spr.type != kModernSequentialTX); + sysStat = (actor->GetType() != kModernRandomTX && actor->GetType() != kModernSequentialTX); break; case kStatModernWindGen: - sysStat = (actor->spr.type != kModernWindGenerator); + sysStat = (actor->GetType() != kModernWindGenerator); break; case kStatModernPlayerLinker: case kStatModernQavScene: - sysStat = (actor->spr.type != kModernPlayerControl); + sysStat = (actor->GetType() != kModernPlayerControl); break; } @@ -583,7 +583,7 @@ void nnExtInitModernStuff(TArray& actors) I_Error("Sprite statnum %d on sprite #%d is in a range of reserved (%d - %d)!", actor->spr.statnum, actor->GetIndex(), kStatModernBase, kStatModernMax); } - switch (actor->spr.type) + switch (actor->GetType()) { case kModernRandomTX: case kModernSequentialTX: @@ -602,7 +602,7 @@ void nnExtInitModernStuff(TArray& actors) case kModernStealthRegion: actor->spr.cstat &= ~CSTAT_SPRITE_BLOCK; actor->spr.cstat |= CSTAT_SPRITE_INVISIBLE; - switch (actor->spr.type) + switch (actor->GetType()) { // stealth regions for patrolling enemies case kModernStealthRegion: @@ -807,7 +807,7 @@ void nnExtInitModernStuff(TArray& actors) if (!iactor->exists() || !iactor2->hasX() || iactor2->xspr.txID != iactor->xspr.rxID || iactor2 == iactor) continue; - switch (iactor2->spr.type) + switch (iactor2->GetType()) { case kSwitchToggle: // exceptions case kSwitchOneWay: // exceptions @@ -953,7 +953,7 @@ static DBloodActor* randomDropPickupObject(DBloodActor* sourceactor, int prevIte spawned = actDropObject(sourceactor, selected); if (spawned) { - sourceactor->xspr.dropMsg = uint8_t(spawned->spr.type); // store dropped item type in dropMsg + sourceactor->xspr.dropMsg = uint8_t(spawned->GetType()); // store dropped item type in dropMsg spawned->spr.pos = sourceactor->spr.pos; if ((sourceactor->spr.flags & kModernTypeFlag1) && (sourceactor->xspr.txID > 0 || (sourceactor->xspr.txID != 3 && sourceactor->xspr.lockMsg > 0))) @@ -1396,7 +1396,7 @@ int getSpriteMassBySize(DBloodActor* actor) } else if (actor->IsDudeActor()) { - switch (actor->spr.type) + switch (actor->GetType()) { case kDudePodMother: // fake dude, no seq break; @@ -1555,7 +1555,7 @@ void debrisConcuss(DBloodActor* owneractor, int listIndex, const DVector3& pos, auto dv = actor->spr.pos - pos; dmg = int(dmg * (0x4000 / (0x4000 + dv.LengthSquared()))); - bool thing = (actor->spr.type >= kThingBase && actor->spr.type < kThingMax); + bool thing = (actor->GetType() >= kThingBase && actor->GetType() < kThingMax); auto tex = TexMan.GetGameTexture(actor->spr.spritetexture()); double size = (tex->GetDisplayWidth() * actor->spr.scale.X * tex->GetDisplayHeight() * actor->spr.scale.Y) * 2048; if (actor->xspr.physAttr & kPhysDebrisExplode) @@ -1821,7 +1821,7 @@ void debrisMove(int listIndex) } if (moveHit.type != kHitNone && actor->xspr.Impact && !actor->xspr.locked && !actor->xspr.isTriggered && (actor->xspr.state == actor->xspr.restState || actor->xspr.Interrutable)) { - if (actor->spr.type >= kThingBase && actor->spr.type < kThingMax) + if (actor->GetType() >= kThingBase && actor->GetType() < kThingMax) ChangeActorStat(actor, kStatThing); trTriggerSprite(actor, kCmdToggle, actor); @@ -1878,7 +1878,7 @@ bool ceilIsTooLow(DBloodActor* actor) void aiSetGenIdleState(DBloodActor* actor) { - switch (actor->spr.type) + switch (actor->GetType()) { case kDudeModernCustom: case kDudeModernCustomBurning: @@ -2844,11 +2844,11 @@ void usePropertiesChanger(DBloodActor* sourceactor, int objType, sectortype* pSe { if (pXSector->Underwater) { - switch (aLower->spr.type) + switch (aLower->GetType()) { case kMarkerLowStack: case kMarkerLowLink: - aLower->xspr.sysData1 = aLower->spr.type; + aLower->xspr.sysData1 = aLower->GetType(); aLower->ChangeType(kMarkerLowWater); break; default: @@ -2866,11 +2866,11 @@ void usePropertiesChanger(DBloodActor* sourceactor, int objType, sectortype* pSe { if (pXSector->Underwater) { - switch (aUpper->spr.type) + switch (aUpper->GetType()) { case kMarkerUpStack: case kMarkerUpLink: - aUpper->xspr.sysData1 = aUpper->spr.type; + aUpper->xspr.sysData1 = aUpper->GetType(); aUpper->ChangeType(kMarkerUpWater); break; default: @@ -2891,7 +2891,7 @@ void usePropertiesChanger(DBloodActor* sourceactor, int objType, sectortype* pSe if (iactor->spr.statnum != kStatDude || !iactor->IsDudeActor() || !iactor->hasX()) continue; - PLAYER* pPlayer = getPlayerById(iactor->spr.type); + PLAYER* pPlayer = getPlayerById(iactor->GetType()); if (pXSector->Underwater) { if (aLower) @@ -3138,7 +3138,7 @@ void useVelocityChanger(DBloodActor* actor, sectortype* sect, DBloodActor* initi void useTeleportTarget(DBloodActor* sourceactor, DBloodActor* actor) { - PLAYER* pPlayer = getPlayerById(actor->spr.type); + PLAYER* pPlayer = getPlayerById(actor->GetType()); XSECTOR* pXSector = (sourceactor->sector()->hasX()) ? &sourceactor->sector()->xs() : nullptr; bool isDude = (!pPlayer && actor->IsDudeActor()); @@ -3559,7 +3559,7 @@ void damageSprites(DBloodActor* sourceactor, DBloodActor* actor) int health = 0; - PLAYER* pPlayer = getPlayerById(actor->spr.type); + PLAYER* pPlayer = getPlayerById(actor->GetType()); int dmgType = (sourceactor->xspr.data2 >= kDmgFall) ? ClipHigh(sourceactor->xspr.data2, kDmgElectric) : -1; int dmg = actor->xspr.health << 4; int armor[3]; @@ -3597,7 +3597,7 @@ void damageSprites(DBloodActor* sourceactor, DBloodActor* actor) } else { - //Printf(PRINT_HIGH, "Dude type %d is immune to damage type %d!", actor->spr.type, dmgType); + //Printf(PRINT_HIGH, "Dude type %d is immune to damage type %d!", actor->GetType(), dmgType); } } else if (!pPlayer) actKillDude(sourceactor, actor, (DAMAGE_TYPE)dmgType, dmg); @@ -3944,7 +3944,7 @@ bool condCheckMixed(DBloodActor* aCond, const EVENT& event, int cmpOp, bool PUSH case 20: // type in a range? if (eob.isWall()) return condCmp(eob.wall()->type, arg1, arg2, cmpOp); if (eob.isSector()) return condCmp(eob.sector()->type, arg1, arg2, cmpOp); - if (eob.isActor()) return eob.actor() && condCmp(eob.actor()->spr.type, arg1, arg2, cmpOp); + if (eob.isActor()) return eob.actor() && condCmp(eob.actor()->GetType(), arg1, arg2, cmpOp); break; case 24: case 25: case 26: case 27: @@ -4189,7 +4189,7 @@ bool condCheckSector(DBloodActor* aCond, int cmpOp, bool PUSH) BloodSectIterator it(pSect); while (auto iactor = it.Next()) { - if (!condCmp(iactor->spr.type, arg1, arg2, cmpOp)) continue; + if (!condCmp(iactor->GetType(), arg1, arg2, cmpOp)) continue; else if (PUSH) condPush(aCond, iactor); return true; } @@ -4415,7 +4415,7 @@ bool condCheckDude(DBloodActor* aCond, int cmpOp, bool PUSH) default: break; case 0: // dude have any targets? if (!targ) return false; - else if (!targ->IsDudeActor() && targ->spr.type != kMarkerPath) return false; + else if (!targ->IsDudeActor() && targ->GetType() != kMarkerPath) return false; else if (PUSH) condPush(aCond, targ); return true; @@ -4428,7 +4428,7 @@ bool condCheckDude(DBloodActor* aCond, int cmpOp, bool PUSH) if (!targ) condError(aCond, "Dude #%d has no target!", objActor->GetIndex()); - DUDEINFO* pInfo = getDudeInfo(objActor->spr.type); + DUDEINFO* pInfo = getDudeInfo(objActor->GetType()); double height = (pInfo->eyeHeight * objActor->spr.scale.Y); auto delta = targ->spr.pos.XY() - objActor->spr.pos.XY(); @@ -4461,7 +4461,7 @@ bool condCheckDude(DBloodActor* aCond, int cmpOp, bool PUSH) case 9: return (objActor->xspr.unused1 & kDudeFlagStealth); case 10: // check if the marker is busy with another dude case 11: // check if the marker is reached - if (!objActor->xspr.dudeFlag4 || !targ || targ->spr.type != kMarkerPath) return false; + if (!objActor->xspr.dudeFlag4 || !targ || targ->GetType() != kMarkerPath) return false; switch (cond) { case 10: { @@ -4477,7 +4477,7 @@ bool condCheckDude(DBloodActor* aCond, int cmpOp, bool PUSH) } return true; case 12: // compare spot progress value in % - if (!objActor->xspr.dudeFlag4 || !targ || targ->spr.type != kMarkerPath) var = 0; + if (!objActor->xspr.dudeFlag4 || !targ || targ->GetType() != kMarkerPath) var = 0; 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); @@ -4489,7 +4489,7 @@ bool condCheckDude(DBloodActor* aCond, int cmpOp, bool PUSH) case 22: case 23: case 24: - switch (objActor->spr.type) + switch (objActor->GetType()) { case kDudeModernCustom: case kDudeModernCustomBurning: @@ -4626,7 +4626,7 @@ bool condCheckSprite(DBloodActor* aCond, int cmpOp, bool PUSH) } double range = arg3 * 2; - if ((pPlayer = getPlayerById(objActor->spr.type)) != NULL) + if ((pPlayer = getPlayerById(objActor->GetType())) != NULL) var = HitScan(objActor, pPlayer->zWeapon, pPlayer->aim, arg1, range); else if (objActor->IsDudeActor()) var = HitScan(objActor, objActor->spr.pos.Z, DVector3(objActor->spr.Angles.Yaw.ToVector(), (!objActor->hasX()) ? 0 : objActor->dudeSlope), arg1, range); @@ -4687,7 +4687,7 @@ bool condCheckSprite(DBloodActor* aCond, int cmpOp, bool PUSH) case 50: // compare hp (in %) 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; + else if (objActor->GetType() >= kThingBase && objActor->GetType() < kThingMax) var = thingInfo[objActor->GetType() - kThingBase].startHealth << 4; return condCmp((kPercFull * objActor->xspr.health) / ClipLow(var, 1), arg1, arg2, cmpOp); case 55: // touching ceil of sector? if (objActor->hit.ceilhit.type != kHitSector) return false; @@ -4901,12 +4901,12 @@ void modernTypeTrigger(int destObjType, sectortype* destSect, walltype* destWall // example: it allows to spawn FX effect if event was received from kModernEffectGen // on many TX channels instead of just one. DBloodActor* initiator = event.initiator; - switch (destactor->spr.type) + switch (destactor->GetType()) { case kModernRandomTX: case kModernSequentialTX: if (destactor->xspr.command != kCmdLink || destactor->xspr.locked) break; // no redirect mode detected - switch (destactor->spr.type) + switch (destactor->GetType()) { case kModernRandomTX: useRandomTx(destactor, (COMMAND_ID)sourceactor->xspr.command, false, initiator); // set random TX id @@ -4930,7 +4930,7 @@ void modernTypeTrigger(int destObjType, sectortype* destSect, walltype* destWall return; } - switch (sourceactor->spr.type) + switch (sourceactor->GetType()) { // allows teleport any sprite from any location to the source destination case kMarkerWarpDest: @@ -5313,13 +5313,13 @@ void aiFightAlarmDudesInSight(DBloodActor* actor, int max) bool aiFightUnitCanFly(DBloodActor* dude) { - return (dude->IsDudeActor() && gDudeInfoExtra[dude->spr.type - kDudeBase].flying); + return (dude->IsDudeActor() && gDudeInfoExtra[dude->GetType() - kDudeBase].flying); } bool aiFightIsMeleeUnit(DBloodActor* dude) { if (dude->GetType() == kDudeModernCustom) return (dude->hasX() && dudeIsMelee(dude)); - else return (dude->IsDudeActor() && gDudeInfoExtra[dude->spr.type - kDudeBase].melee); + else return (dude->IsDudeActor() && gDudeInfoExtra[dude->GetType() - kDudeBase].melee); } //--------------------------------------------------------------------------- @@ -5373,7 +5373,7 @@ void sectorKillSounds(sectortype* pSector) BloodSectIterator it(pSector); while (auto actor = it.Next()) { - if (actor->spr.type != kSoundSector) continue; + if (actor->GetType() != kSoundSector) continue; sfxKill3DSound(actor); } } @@ -5593,7 +5593,7 @@ bool modernTypeOperateSprite(DBloodActor* actor, EVENT& event) break; } - switch (actor->spr.type) + switch (actor->GetType()) { case kModernCondition: case kModernConditionFalse: @@ -5663,7 +5663,7 @@ bool modernTypeOperateSprite(DBloodActor* actor, EVENT& event) return true; } - switch (actor->spr.type) + switch (actor->GetType()) { default: return false; // no modern type found to work with, go normal OperateSprite(); @@ -5698,7 +5698,7 @@ bool modernTypeOperateSprite(DBloodActor* actor, EVENT& event) case kModernRandomTX: // random Event Switch takes random data field and uses it as TX ID case kModernSequentialTX: // sequential Switch takes values from data fields starting from data1 and uses it as TX ID if (actor->xspr.command == kCmdLink) return true; // work as event redirector - switch (actor->spr.type) + switch (actor->GetType()) { case kModernRandomTX: useRandomTx(actor, (COMMAND_ID)actor->xspr.command, true, initiator); @@ -5987,7 +5987,7 @@ bool modernTypeOperateSprite(DBloodActor* actor, EVENT& event) int playerID; if ((actor->xspr.txID == kChannelEventCauser || actor->xspr.data1 == 0) && initiator && initiator->IsPlayerActor()) - playerID = initiator->spr.type; + playerID = initiator->GetType(); else playerID = actor->xspr.data1; @@ -6442,7 +6442,7 @@ void useRandomItemGen(DBloodActor* actor) BloodStatIterator it(kStatItem); while (auto iactor = it.Next()) { - if ((unsigned int)iactor->spr.type == actor->xspr.dropMsg && iactor->spr.pos == actor->spr.pos) + if ((unsigned int)iactor->GetType() == actor->xspr.dropMsg && iactor->spr.pos == actor->spr.pos) { gFX.fxSpawnActor((FX_ID)29, actor->sector(), actor->spr.pos); iactor->ChangeType(kSpriteDecoration); @@ -6546,7 +6546,7 @@ void useUniMissileGen(DBloodActor* sourceactor, DBloodActor* actor) } // add bursting for missiles - if (missileactor->spr.type != kMissileFlareAlt && sourceactor->xspr.data4 > 0) + if (missileactor->GetType() != kMissileFlareAlt && sourceactor->xspr.data4 > 0) evPostActor(missileactor, ClipHigh(sourceactor->xspr.data4, 500), kCallbackMissileBurst); } @@ -6925,7 +6925,7 @@ void useTargetChanger(DBloodActor* sourceactor, DBloodActor* actor) { if (!actor->IsDudeActor() || actor->spr.statnum != kStatDude) { - switch (actor->spr.type) // can be dead dude turned in gib + switch (actor->GetType()) // can be dead dude turned in gib { // make current target and all other dudes not attack this dude anymore case kThingBloodBits: @@ -7425,7 +7425,7 @@ PLAYER* getPlayerById(int id) { for (int i = connecthead; i >= 0; i = connectpoint2[i]) { - if (id == gPlayer[i].actor->spr.type) + if (id == gPlayer[i].actor->GetType()) return &gPlayer[i]; } } @@ -7443,7 +7443,7 @@ PLAYER* getPlayerById(int id) bool IsBurningDude(DBloodActor* actor) { if (actor == NULL) return false; - switch (actor->spr.type) + switch (actor->GetType()) { case kDudeBurningInnocent: case kDudeBurningCultist: @@ -7460,7 +7460,7 @@ bool IsBurningDude(DBloodActor* actor) bool IsKillableDude(DBloodActor* actor) { - switch (actor->spr.type) + switch (actor->GetType()) { case kDudeGargoyleStatueFlesh: case kDudeGargoyleStatueStone: @@ -7473,14 +7473,14 @@ bool IsKillableDude(DBloodActor* actor) bool isGrown(DBloodActor* actor) { - if (powerupCheck(&gPlayer[actor->spr.type - kDudePlayer1], kPwUpGrowShroom) > 0) return true; + if (powerupCheck(getPlayer(actor), kPwUpGrowShroom) > 0) return true; else if (actor->hasX() && actor->xspr.scale >= 512) return true; else return false; } bool isShrinked(DBloodActor* actor) { - if (powerupCheck(&gPlayer[actor->spr.type - kDudePlayer1], kPwUpShrinkShroom) > 0) return true; + if (powerupCheck(getPlayer(actor), kPwUpShrinkShroom) > 0) return true; else if (actor->hasX() && actor->xspr.scale > 0 && actor->xspr.scale <= 128) return true; else return false; } @@ -7523,7 +7523,7 @@ int getDataFieldOfObject(EventObject& eob, int dataIndex) case 1: return actor->xspr.data1; case 2: return actor->xspr.data2; case 3: - switch (actor->spr.type) + switch (actor->GetType()) { case kDudeModernCustom: return actor->xspr.sysData1; default: return actor->xspr.data3; @@ -7555,7 +7555,7 @@ int getDataFieldOfObject(int objType, sectortype* sect, walltype* wal, DBloodAct case 1: return actor->xspr.data1; case 2: return actor->xspr.data2; case 3: - switch (actor->spr.type) + switch (actor->GetType()) { case kDudeModernCustom: return actor->xspr.sysData1; default: return actor->xspr.data3; @@ -7581,7 +7581,7 @@ bool setDataValueOfObject(int objType, sectortype* sect, walltype* wal, DBloodAc { case OBJ_SPRITE: { - int type = objActor->spr.type; + int type = objActor->GetType(); // exceptions if (objActor->IsDudeActor() && objActor->xspr.health <= 0) return true; @@ -7746,7 +7746,7 @@ void aiPatrolState(DBloodActor* actor, int state) bool nSeqOverride = false, crouch = false; int i, seq = -1, start = 0, end = kPatrolStateSize; - const DUDEINFO_EXTRA* pExtra = &gDudeInfoExtra[actor->spr.type - kDudeBase]; + const DUDEINFO_EXTRA* pExtra = &gDudeInfoExtra[actor->GetType() - kDudeBase]; switch (state) { case kAiStatePatrolWaitL: @@ -7818,7 +7818,7 @@ void aiPatrolState(DBloodActor* actor, int state) if (i == end) { - viewSetSystemMessage("No patrol state #%d found for dude #%d (type = %d)", state, actor->GetIndex(), actor->spr.type); + viewSetSystemMessage("No patrol state #%d found for dude #%d (type = %d)", state, actor->GetIndex(), actor->GetType()); aiPatrolStop(actor, nullptr); } } @@ -7854,7 +7854,7 @@ bool aiPatrolMarkerReached(DBloodActor* actor) { assert(actor->IsDudeActor()); - const DUDEINFO_EXTRA* pExtra = &gDudeInfoExtra[actor->spr.type - kDudeBase]; + const DUDEINFO_EXTRA* pExtra = &gDudeInfoExtra[actor->GetType() - kDudeBase]; auto markeractor = actor->GetTarget(); if (markeractor && markeractor->GetType() == kMarkerPath) { @@ -8127,8 +8127,8 @@ void aiPatrolMove(DBloodActor* actor) return; - int dudeIdx = actor->spr.type - kDudeBase; - switch (actor->spr.type) + int dudeIdx = actor->GetType() - kDudeBase; + switch (actor->GetType()) { case kDudeCultistShotgunProne: dudeIdx = kDudeCultistShotgun - kDudeBase; @@ -8186,7 +8186,7 @@ void aiPatrolMove(DBloodActor* actor) else { int frontSpeed = pDudeInfo->frontSpeed; - switch (actor->spr.type) + switch (actor->GetType()) { case kDudeModernCustom: case kDudeModernCustomBurning: @@ -8343,7 +8343,7 @@ bool spritesTouching(DBloodActor* actor1, DBloodActor* actor2) bool aiCanCrouch(DBloodActor* actor) { if (actor->GetType() >= kDudeBase && actor->GetType() < kDudeVanillaMax) - return (gDudeInfoExtra[actor->spr.type - kDudeBase].idlcseqofs >= 0 && gDudeInfoExtra[actor->spr.type - kDudeBase].mvecseqofs >= 0); + return (gDudeInfoExtra[actor->GetType() - kDudeBase].idlcseqofs >= 0 && gDudeInfoExtra[actor->GetType() - kDudeBase].mvecseqofs >= 0); else if (actor->GetType() == kDudeModernCustom || actor->GetType() == kDudeModernCustomBurning) return actor->genDudeExtra.canDuck; @@ -8780,7 +8780,7 @@ void aiPatrolThink(DBloodActor* actor) return; } - const DUDEINFO_EXTRA* pExtra = &gDudeInfoExtra[actor->spr.type - kDudeBase]; + const DUDEINFO_EXTRA* pExtra = &gDudeInfoExtra[actor->GetType() - kDudeBase]; bool isFinal = ((!actor->xspr.unused2 && markeractor->xspr.data2 == -1) || (actor->xspr.unused2 && markeractor->xspr.data1 == -1)); bool reached = false; @@ -9011,7 +9011,7 @@ DBloodActor* evrIsRedirector(DBloodActor* actor) { if (actor) { - switch (actor->spr.type) + switch (actor->GetType()) { case kModernRandomTX: case kModernSequentialTX: @@ -9135,7 +9135,7 @@ void seqSpawnerOffSameTx(DBloodActor* actor) BloodSectIterator it(§); while (auto iactor = it.Next()) { - if (iactor->spr.type != kModernSeqSpawner || !iactor->hasX() || iactor == actor) continue; + if (iactor->GetType() != kModernSeqSpawner || !iactor->hasX() || iactor == actor) continue; if (/*iactor->xspr.txID == actor->xspr.txID &&*/ iactor->xspr.state == 1) { evKillActor(iactor); @@ -9176,7 +9176,7 @@ void callbackUniMissileBurst(DBloodActor* actor, sectortype*) // 22 auto burstactor = actSpawnSprite(actor, 5); if (!burstactor) break; - burstactor->ChangeType(actor->spr.type); + burstactor->ChangeType(actor->GetType()); burstactor->spr.shade = actor->spr.shade; burstactor->spr.setspritetexture(actor->spr.spritetexture()); @@ -9194,7 +9194,7 @@ void callbackUniMissileBurst(DBloodActor* actor, sectortype*) // 22 burstactor->spr.scale = actor->spr.scale; burstactor->spr.scale *= 0.5; - burstactor->spr.Angles.Yaw = actor->spr.Angles.Yaw + mapangle(missileInfo[actor->spr.type - kMissileBase].angleOfs); + burstactor->spr.Angles.Yaw = actor->spr.Angles.Yaw + mapangle(missileInfo[actor->GetType() - kMissileBase].angleOfs); burstactor->SetOwner(actor); actBuildMissile(burstactor, actor); @@ -9286,7 +9286,7 @@ void changeSpriteAngle(DBloodActor* pSpr, DAngle nAng) pSpr->spr.Angles.Yaw = nAng; else { - PLAYER* pPlayer = getPlayerById(pSpr->spr.type); + PLAYER* pPlayer = getPlayerById(pSpr->GetType()); if (pPlayer) pPlayer->actor->spr.Angles.Yaw = nAng; else diff --git a/source/games/blood/src/player.cpp b/source/games/blood/src/player.cpp index 33fab10f0..789d55e09 100644 --- a/source/games/blood/src/player.cpp +++ b/source/games/blood/src/player.cpp @@ -238,7 +238,7 @@ inline bool IsTargetTeammate(PLAYER* pSourcePlayer, DBloodActor* target) return false; if (gGameOptions.nGameType == 1 || gGameOptions.nGameType == 3) { - PLAYER* pTargetPlayer = &gPlayer[target->spr.type - kDudePlayer1]; + PLAYER* pTargetPlayer = getPlayer(target); if (pSourcePlayer != pTargetPlayer) { if (gGameOptions.nGameType == 1) @@ -300,7 +300,7 @@ bool powerupActivate(PLAYER* pPlayer, int nPowerUp) else if (isShrinked(pPlayer->actor)) playerDeactivateShrooms(pPlayer); else { playerSizeGrow(pPlayer, 2); - if (powerupCheck(&gPlayer[pPlayer->actor->spr.type - kDudePlayer1], kPwUpShadowCloak) > 0) { + if (powerupCheck(&gPlayer[pPlayer->actor->GetType() - kDudePlayer1], kPwUpShadowCloak) > 0) { powerupDeactivate(pPlayer, kPwUpShadowCloak); pPlayer->pwUpTime[kPwUpShadowCloak] = 0; } @@ -1027,7 +1027,7 @@ bool PickupItem(PLAYER* pPlayer, DBloodActor* itemactor) { char buffer[80]; int pickupSnd = 775; - int nType = itemactor->spr.type - kItemBase; + int nType = itemactor->GetType() - kItemBase; auto plActor = pPlayer->actor; switch (itemactor->spr.type) { @@ -1187,7 +1187,7 @@ bool PickupItem(PLAYER* pPlayer, DBloodActor* itemactor) case kItemArmorFire: case kItemArmorSpirit: case kItemArmorSuper: { - ARMORDATA* pArmorData = &armorData[itemactor->spr.type - kItemArmorBasic]; bool pickedUp = false; + ARMORDATA* pArmorData = &armorData[itemactor->GetType() - kItemArmorBasic]; bool pickedUp = false; if (pPlayer->armor[1] < pArmorData->armor1max) { pPlayer->armor[1] = ClipHigh(pPlayer->armor[1] + pArmorData->armor1, pArmorData->armor1max); pickedUp = true; @@ -1258,7 +1258,7 @@ bool PickupItem(PLAYER* pPlayer, DBloodActor* itemactor) bool PickupAmmo(PLAYER* pPlayer, DBloodActor* ammoactor) { - const AMMOITEMDATA* pAmmoItemData = &gAmmoItemData[ammoactor->spr.type - kItemAmmoBase]; + const AMMOITEMDATA* pAmmoItemData = &gAmmoItemData[ammoactor->GetType() - kItemAmmoBase]; int nAmmoType = pAmmoItemData->type; if (pPlayer->ammoCount[nAmmoType] >= gAmmoInfo[nAmmoType].max) return 0; @@ -1282,7 +1282,7 @@ bool PickupAmmo(PLAYER* pPlayer, DBloodActor* ammoactor) bool PickupWeapon(PLAYER* pPlayer, DBloodActor* weaponactor) { - const WEAPONITEMDATA* pWeaponItemData = &gWeaponItemData[weaponactor->spr.type - kItemWeaponBase]; + const WEAPONITEMDATA* pWeaponItemData = &gWeaponItemData[weaponactor->GetType() - kItemWeaponBase]; int nWeaponType = pWeaponItemData->type; int nAmmoType = pWeaponItemData->ammoType; if (!pPlayer->hasWeapon[nWeaponType] || gGameOptions.nWeaponSettings == 2 || gGameOptions.nWeaponSettings == 3) { @@ -1914,9 +1914,9 @@ void playerFrag(PLAYER* pKiller, PLAYER* pVictim) assert(pVictim != NULL); char buffer[128] = ""; - int nKiller = pKiller->actor->spr.type - kDudePlayer1; + int nKiller = pKiller->actor->GetType() - kDudePlayer1; assert(nKiller >= 0 && nKiller < kMaxPlayers); - int nVictim = pVictim->actor->spr.type - kDudePlayer1; + int nVictim = pVictim->actor->GetType() - kDudePlayer1; assert(nVictim >= 0 && nVictim < kMaxPlayers); if (nKiller == nVictim) { @@ -1978,7 +1978,7 @@ void FragPlayer(PLAYER* pPlayer, DBloodActor* killer) { if (killer && killer->IsPlayerActor()) { - PLAYER* pKiller = &gPlayer[killer->spr.type - kDudePlayer1]; + PLAYER* pKiller = getPlayer(killer); playerFrag(pKiller, pPlayer); int nTeam1 = pKiller->teamId & 1; int nTeam2 = pPlayer->teamId & 1; @@ -2322,7 +2322,7 @@ void PlayerSurvive(int, DBloodActor* actor) sfxPlay3DSound(actor, 3009, 0, 6); if (actor->IsPlayerActor()) { - PLAYER* pPlayer = &gPlayer[actor->spr.type - kDudePlayer1]; + PLAYER* pPlayer = getPlayer(actor); if (pPlayer->nPlayer == myconnectindex) viewSetMessage(GStrings("TXT_LIVEAGAIM")); else @@ -2539,7 +2539,7 @@ void SerializePlayers(FSerializer& arc) { for (int i = 0; i < gNetPlayers; i++) { - gPlayer[i].pDudeInfo = &dudeInfo[gPlayer[i].actor->spr.type - kDudeBase]; + gPlayer[i].pDudeInfo = &dudeInfo[gPlayer[i].actor->GetType() - kDudeBase]; #ifdef NOONE_EXTENSIONS // load qav scene diff --git a/source/games/blood/src/triggers.cpp b/source/games/blood/src/triggers.cpp index 3cd13095b..a90e32934 100644 --- a/source/games/blood/src/triggers.cpp +++ b/source/games/blood/src/triggers.cpp @@ -265,7 +265,7 @@ void LifeLeechOperate(DBloodActor* actor, EVENT event) { double top, bottom; GetActorExtents(actor, &top, &bottom); - DUDEINFO* pDudeInfo = getDudeInfo(target->spr.type); + DUDEINFO* pDudeInfo = getDudeInfo(target); auto pos = target->spr.pos; auto nDist = (pos.XY() - actor->spr.pos.XY()).Length(); if (nDist != 0 && cansee(DVector3(actor->spr.pos.XY(), top), actor->sector(), pos, target->sector())) @@ -960,7 +960,7 @@ void TranslateSector(sectortype* pSector, double wave1, double wave2, const DVec viewBackupSpriteLoc(ac); ac->spr.pos.XY() = spot + pt_w2 - pivot; ac->spr.Angles.Yaw += angleofs; - if (!VanillaMode() && ac->IsPlayerActor()) gPlayer[ac->spr.type - kDudePlayer1].actor->spr.Angles.Yaw += angleofs; + if (!VanillaMode() && ac->IsPlayerActor()) gPlayer[ac->GetType() - kDudePlayer1].actor->spr.Angles.Yaw += angleofs; } else if (ac->spr.cstat & CSTAT_SPRITE_MOVE_REVERSE) { @@ -968,7 +968,7 @@ void TranslateSector(sectortype* pSector, double wave1, double wave2, const DVec viewBackupSpriteLoc(ac); ac->spr.pos.XY() = spot - pt_w2 + pivot; ac->spr.Angles.Yaw += angleofs; - if (!VanillaMode() && ac->IsPlayerActor()) gPlayer[ac->spr.type - kDudePlayer1].actor->spr.Angles.Yaw += angleofs; + if (!VanillaMode() && ac->IsPlayerActor()) gPlayer[ac->GetType() - kDudePlayer1].actor->spr.Angles.Yaw += angleofs; } } } @@ -1599,7 +1599,7 @@ void OperateTeleport(sectortype* pSector) PLAYER* pPlayer; bool bPlayer = actor->IsPlayerActor(); if (bPlayer) - pPlayer = &gPlayer[actor->spr.type - kDudePlayer1]; + pPlayer = getPlayer(actor); else pPlayer = NULL; if (bPlayer || !SectorContainsDudes(destactor->sector())) diff --git a/source/games/blood/src/view.cpp b/source/games/blood/src/view.cpp index 9f23a160b..a187328e5 100644 --- a/source/games/blood/src/view.cpp +++ b/source/games/blood/src/view.cpp @@ -111,7 +111,7 @@ void viewDrawAimedPlayerName(PLAYER* pPlayer) auto actor = gHitInfo.actor(); if (actor && actor->IsPlayerActor()) { - int nPlayer = actor->spr.type - kDudePlayer1; + int nPlayer = actor->GetType() - kDudePlayer1; const char* szName = PlayerName(nPlayer); int nPalette = (gPlayer[nPlayer].teamId & 3) + 11; viewDrawText(DigiFont, szName, 160, 125, -128, nPalette, 1, 1); diff --git a/source/games/blood/src/warp.cpp b/source/games/blood/src/warp.cpp index c4e506249..d2e3cf6d7 100644 --- a/source/games/blood/src/warp.cpp +++ b/source/games/blood/src/warp.cpp @@ -79,7 +79,7 @@ void warpInit(TArray& actors) { if (!actor->exists()) continue; if (actor->hasX()) { - switch (actor->spr.type) { + switch (actor->GetType()) { case kMarkerSPStart: if (gGameOptions.nGameType < 2 && actor->xspr.data1 >= 0 && actor->xspr.data1 < kMaxPlayers) { ZONE* pZone = &gStartZone[actor->xspr.data1]; @@ -219,7 +219,7 @@ int CheckLink(DBloodActor* actor) z2 = getceilzofslopeptr(actor->sector(), actor->spr.pos); actor->spr.pos.Z += z2 - z; actor->interpolated = false; - return aUpper->spr.type; + return aUpper->GetType(); } } if (aLower) @@ -243,7 +243,7 @@ int CheckLink(DBloodActor* actor) z2 = getflorzofslopeptr(actor->sector(), actor->spr.pos); actor->spr.pos.Z += z2 - z; actor->interpolated = false; - return aLower->spr.type; + return aLower->GetType(); } } return 0; @@ -279,7 +279,7 @@ int CheckLink(DVector3& cPos, sectortype** pSector) else z2 = getceilzofslopeptr(*pSector, cPos); cPos.Z += z2 - z1; - return aUpper->spr.type; + return aUpper->GetType(); } } if (aLower) @@ -301,7 +301,7 @@ int CheckLink(DVector3& cPos, sectortype** pSector) else z2 = getflorzofslopeptr(*pSector, cPos); cPos.Z += z2 - z1; - return aLower->spr.type; + return aLower->GetType(); } } return 0; diff --git a/source/games/blood/src/weapon.cpp b/source/games/blood/src/weapon.cpp index 86ef05c6e..f0f3e26eb 100644 --- a/source/games/blood/src/weapon.cpp +++ b/source/games/blood/src/weapon.cpp @@ -1356,7 +1356,7 @@ void ThrowRemote(int, PLAYER* pPlayer) auto spawned = playerFireThing(pPlayer, 0, -9460 / 65536., kThingArmedRemoteBomb, nSpeed); if (spawned) { - spawned->xspr.rxID = 90 + (pPlayer->actor->spr.type - kDudePlayer1); + spawned->xspr.rxID = 90 + (pPlayer->actor->GetType() - kDudePlayer1); UseAmmo(pPlayer, 11, 1); pPlayer->throwPower = 0; } @@ -1373,14 +1373,14 @@ void DropRemote(int, PLAYER* pPlayer) auto spawned = playerFireThing(pPlayer, 0, 0, kThingArmedRemoteBomb, 0); if (spawned) { - spawned->xspr.rxID = 90 + (pPlayer->actor->spr.type - kDudePlayer1); + spawned->xspr.rxID = 90 + (pPlayer->actor->GetType() - kDudePlayer1); UseAmmo(pPlayer, 11, 1); } } void FireRemote(int, PLAYER* pPlayer) { - evSendGame(90 + (pPlayer->actor->spr.type - kDudePlayer1), kCmdOn); + evSendGame(90 + (pPlayer->actor->GetType() - kDudePlayer1), kCmdOn); } //--------------------------------------------------------------------------- @@ -1694,7 +1694,7 @@ void FireVoodoo(int nTrigger, PLAYER* pPlayer) fxSpawnBlood(targetactor, 17 << 4); int nDamage = actDamageSprite(actor, targetactor, kDamageSpirit, 9 << 4); if (targetactor->IsPlayerActor()) - WeaponLower(&gPlayer[targetactor->spr.type - kDudePlayer1]); + WeaponLower(getPlayer(targetactor)); UseAmmo(pPlayer, 9, nDamage / 4); break; } @@ -1713,7 +1713,7 @@ void FireVoodoo(int nTrigger, PLAYER* pPlayer) int nDamage = actDamageSprite(actor, targetactor, kDamageSpirit, 11 << 4); if (targetactor->IsPlayerActor()) { - PLAYER* pOtherPlayer = &gPlayer[targetactor->spr.type - kDudePlayer1]; + PLAYER* pOtherPlayer = getPlayer(targetactor); pOtherPlayer->blindEffect = 128; } UseAmmo(pPlayer, 9, nDamage / 4); @@ -1756,7 +1756,7 @@ void AltFireVoodoo(int nTrigger, PLAYER* pPlayer) if (targetactor->IsPlayerActor()) { - PLAYER* pOtherPlayer = &gPlayer[targetactor->spr.type - kDudePlayer1]; + PLAYER* pOtherPlayer = getPlayer(targetactor); if (!pOtherPlayer->godMode || !powerupCheck(pOtherPlayer, kPwUpDeathMask)) powerupActivate(pOtherPlayer, kPwUpDeliriumShroom); } @@ -1794,7 +1794,7 @@ void AltFireVoodoo(int nTrigger, PLAYER* pPlayer) UseAmmo(pPlayer, 9, nDamage); if (targetactor->IsPlayerActor()) { - PLAYER* pOtherPlayer = &gPlayer[targetactor->spr.type - kDudePlayer1]; + PLAYER* pOtherPlayer = getPlayer(targetactor); if (!pOtherPlayer->godMode || !powerupCheck(pOtherPlayer, kPwUpDeathMask)) powerupActivate(pOtherPlayer, kPwUpDeliriumShroom); }