From f091a72db13d76088bbf04b46a3e140b7f2949b9 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Thu, 30 Dec 2021 21:24:43 +1100 Subject: [PATCH] - Blood: Replace `XSPRITE` `targetz` with `TargetPos.Z` calls. --- source/games/blood/src/actor.cpp | 4 ++-- source/games/blood/src/ai.cpp | 8 ++++---- source/games/blood/src/aibat.cpp | 2 +- source/games/blood/src/aiboneel.cpp | 2 +- source/games/blood/src/db.cpp | 2 +- source/games/blood/src/loadsave.cpp | 2 +- source/games/blood/src/mapstructs.h | 1 - source/games/blood/src/nnexts.cpp | 10 +++++----- 8 files changed, 15 insertions(+), 16 deletions(-) diff --git a/source/games/blood/src/actor.cpp b/source/games/blood/src/actor.cpp index 1fcc06031..99133d11c 100644 --- a/source/games/blood/src/actor.cpp +++ b/source/games/blood/src/actor.cpp @@ -3970,7 +3970,7 @@ static void actImpactMissile(DBloodActor* missileActor, int hitCode) { missileActor->spr.picnum = 2123; missileActor->SetTarget(actorHit); - missileActor->xspr.targetZ = missileActor->spr.pos.Z - actorHit->spr.pos.Z; + missileActor->xspr.TargetPos.Z = missileActor->spr.pos.Z - actorHit->spr.pos.Z; missileActor->xspr.goalAng = getangle(missileActor->spr.pos.X - actorHit->spr.pos.X, missileActor->spr.pos.Y - actorHit->spr.pos.Y) - actorHit->spr.ang; missileActor->xspr.state = 1; actPostSprite(missileActor, kStatFlare); @@ -6149,7 +6149,7 @@ void actCheckFlares() { int x = target->spr.pos.X + mulscale30r(Cos(actor->xspr.goalAng + target->spr.ang), target->spr.clipdist * 2); int y = target->spr.pos.Y + mulscale30r(Sin(actor->xspr.goalAng + target->spr.ang), target->spr.clipdist * 2); - int z = target->spr.pos.Z + actor->xspr.targetZ; + int z = target->spr.pos.Z + actor->xspr.TargetPos.Z; vec3_t pos = { x, y, z }; SetActor(actor, &pos); actor->vel.X = target->vel.X; diff --git a/source/games/blood/src/ai.cpp b/source/games/blood/src/ai.cpp index 3c0cdc351..afc00623b 100644 --- a/source/games/blood/src/ai.cpp +++ b/source/games/blood/src/ai.cpp @@ -918,7 +918,7 @@ void aiSetTarget(DBloodActor* actor, int x, int y, int z) actor->SetTarget(nullptr); actor->xspr.TargetPos.X = x; actor->xspr.TargetPos.Y = y; - actor->xspr.targetZ = z; + actor->xspr.TargetPos.Z = z; } void aiSetTarget(DBloodActor* actor, DBloodActor* target) @@ -936,7 +936,7 @@ void aiSetTarget(DBloodActor* actor, DBloodActor* target) DUDEINFO* pDudeInfo = getDudeInfo(target->spr.type); actor->xspr.TargetPos.X = target->spr.pos.X; actor->xspr.TargetPos.Y = target->spr.pos.Y; - actor->xspr.targetZ = target->spr.pos.Z - ((pDudeInfo->eyeHeight * target->spr.yrepeat) << 2); + actor->xspr.TargetPos.Z = target->spr.pos.Z - ((pDudeInfo->eyeHeight * target->spr.yrepeat) << 2); } } } @@ -1708,7 +1708,7 @@ void aiInitSprite(DBloodActor* actor) pTargetMarker = actor->GetTarget(); targetX = actor->xspr.TargetPos.X; targetY = actor->xspr.TargetPos.Y; - targetZ = actor->xspr.targetZ; + targetZ = actor->xspr.TargetPos.Z; } } #endif @@ -1928,7 +1928,7 @@ void aiInitSprite(DBloodActor* actor) actor->SetTarget(pTargetMarker); actor->xspr.TargetPos.X = targetX; actor->xspr.TargetPos.Y = targetY; - actor->xspr.targetZ = targetZ; + actor->xspr.TargetPos.Z = targetZ; } // reset target spot progress diff --git a/source/games/blood/src/aibat.cpp b/source/games/blood/src/aibat.cpp index 8f75e6b06..a209c38c8 100644 --- a/source/games/blood/src/aibat.cpp +++ b/source/games/blood/src/aibat.cpp @@ -403,7 +403,7 @@ void batMoveToCeil(DBloodActor* actor) int x = actor->spr.pos.X; int y = actor->spr.pos.Y; int z = actor->spr.pos.Z; - if (z - actor->xspr.targetZ < 0x1000) + if (z - actor->xspr.TargetPos.Z < 0x1000) { DUDEEXTRA_STATS* pDudeExtraE = &actor->dudeExtra.stats; pDudeExtraE->thinkTime = 0; diff --git a/source/games/blood/src/aiboneel.cpp b/source/games/blood/src/aiboneel.cpp index 55694a223..0d0a20e22 100644 --- a/source/games/blood/src/aiboneel.cpp +++ b/source/games/blood/src/aiboneel.cpp @@ -407,7 +407,7 @@ void eelMoveToCeil(DBloodActor* actor) int x = actor->spr.pos.X; int y = actor->spr.pos.Y; int z = actor->spr.pos.Z; - if (z - actor->xspr.targetZ < 0x1000) + if (z - actor->xspr.TargetPos.Z < 0x1000) { DUDEEXTRA_STATS* pDudeExtraE = &actor->dudeExtra.stats; pDudeExtraE->active = 0; diff --git a/source/games/blood/src/db.cpp b/source/games/blood/src/db.cpp index ad9473596..160e9cc48 100644 --- a/source/games/blood/src/db.cpp +++ b/source/games/blood/src/db.cpp @@ -575,7 +575,7 @@ void dbLoadMap(const char* pPath, int* pX, int* pY, int* pZ, short* pAngle, sect /*pXSprite->target_i = */ bitReader.readSigned(16); pXSprite->TargetPos.X = bitReader.readSigned(32); pXSprite->TargetPos.Y = bitReader.readSigned(32); - pXSprite->targetZ = bitReader.readSigned(32); + pXSprite->TargetPos.Z = bitReader.readSigned(32); pXSprite->burnTime = bitReader.readUnsigned(16); /*pXSprite->burnSource =*/ bitReader.readSigned(16); pXSprite->height = bitReader.readUnsigned(16); diff --git a/source/games/blood/src/loadsave.cpp b/source/games/blood/src/loadsave.cpp index 87cd5aa47..faff73190 100644 --- a/source/games/blood/src/loadsave.cpp +++ b/source/games/blood/src/loadsave.cpp @@ -625,7 +625,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, XSPRITE& w, XSPRIT ("data4", w.data4, def->data4) ("targetX", w.TargetPos.X, def->TargetPos.X) ("targetY", w.TargetPos.Y, def->TargetPos.Y) - ("targetZ", w.targetZ, def->targetZ) + ("targetZ", w.TargetPos.Z, def->TargetPos.Z) ("target", w.target, def->target) ("sysdata1", w.sysData1, def->sysData1) ("sysdata2", w.sysData2, def->sysData2) diff --git a/source/games/blood/src/mapstructs.h b/source/games/blood/src/mapstructs.h index 002b29a2e..1a05155f7 100644 --- a/source/games/blood/src/mapstructs.h +++ b/source/games/blood/src/mapstructs.h @@ -101,7 +101,6 @@ struct XSPRITE { TObjPtr target; // target sprite TObjPtr burnSource; - int32_t targetZ; // target z vec3_t TargetPos; int32_t sysData1; // used to keep here various system data, so user can't change it in map editor int32_t sysData2; // diff --git a/source/games/blood/src/nnexts.cpp b/source/games/blood/src/nnexts.cpp index 0870b8b5d..3c9dd4b9f 100644 --- a/source/games/blood/src/nnexts.cpp +++ b/source/games/blood/src/nnexts.cpp @@ -689,7 +689,7 @@ void nnExtInitModernStuff(TArray& actors) actor->xspr.Proximity = actor->xspr.Push = actor->xspr.Vector = actor->xspr.triggerOn = false; actor->xspr.state = actor->xspr.restState = 0; - actor->xspr.TargetPos.X = actor->xspr.TargetPos.Y = actor->xspr.targetZ = actor->xspr.sysData2 = -1; + actor->xspr.TargetPos.X = actor->xspr.TargetPos.Y = actor->xspr.TargetPos.Z = actor->xspr.sysData2 = -1; actor->SetTarget(nullptr); ChangeActorStat(actor, kStatModernCondition); auto oldStat = actor->spr.cstat; @@ -3010,7 +3010,7 @@ void useTeleportTarget(DBloodActor* sourceactor, DBloodActor* actor) { int x = actor->xspr.TargetPos.X; int y = actor->xspr.TargetPos.Y; - int z = actor->xspr.targetZ; + int z = actor->xspr.TargetPos.Z; auto target = actor->GetTarget(); aiInitSprite(actor); @@ -3019,7 +3019,7 @@ void useTeleportTarget(DBloodActor* sourceactor, DBloodActor* actor) { actor->xspr.TargetPos.X = x; actor->xspr.TargetPos.Y = y; - actor->xspr.targetZ = z; + actor->xspr.TargetPos.Z = z; actor->SetTarget(target); aiActivateDude(actor); } @@ -6826,7 +6826,7 @@ void useTargetChanger(DBloodActor* sourceactor, DBloodActor* actor) auto pMate = pMateTargetActor->GetTarget(); actor->xspr.TargetPos.X = pMate->spr.pos.X; actor->xspr.TargetPos.Y = pMate->spr.pos.Y; - actor->xspr.targetZ = pMate->spr.pos.Z; + actor->xspr.TargetPos.Z = pMate->spr.pos.Z; if (!isActive(actor)) aiActivateDude(actor); return; @@ -7720,7 +7720,7 @@ void aiPatrolStop(DBloodActor* actor, DBloodActor* targetactor, bool alarm) else { aiInitSprite(actor); - aiSetTarget(actor, actor->xspr.TargetPos.X, actor->xspr.TargetPos.Y, actor->xspr.targetZ); + aiSetTarget(actor, actor->xspr.TargetPos.X, actor->xspr.TargetPos.Y, actor->xspr.TargetPos.Z); } actor->xspr.dudeFlag4 = patrol; // this must be kept so enemy can patrol after respawn again