diff --git a/source/games/blood/src/actor.cpp b/source/games/blood/src/actor.cpp index 5f635a6d6..321cf739c 100644 --- a/source/games/blood/src/actor.cpp +++ b/source/games/blood/src/actor.cpp @@ -6223,7 +6223,7 @@ DBloodActor* actSpawnSprite(DBloodActor* source, int nStat) { DBloodActor* actor = InsertSprite(source->sector(), nStat); - actor->set_int_pos(source->int_pos()); + actor->spr.pos = source->spr.pos; actor->vel = source->vel; actor->spr.flags = 0; actor->addX(); @@ -6653,7 +6653,7 @@ bool actCheckRespawn(DBloodActor* actor) if (!(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax)) { actor->spr.cstat &= ~CSTAT_SPRITE_BLOCK_ALL; - actor->set_int_pos(actor->basePoint); + actor->spr.pos = actor->basePoint; } evPostActor(actor, nRespawnTime, kCallbackRespawn); } diff --git a/source/games/blood/src/ai.h b/source/games/blood/src/ai.h index 9bc1deb20..a3fdadd64 100644 --- a/source/games/blood/src/ai.h +++ b/source/games/blood/src/ai.h @@ -86,6 +86,10 @@ void aiMoveTurn(DBloodActor*pXSprite); void aiMoveDodge(DBloodActor *actor); void aiActivateDude(DBloodActor *actor); void aiSetTarget(DBloodActor* pXSprite, int x, int y, int z); +inline void aiSetTarget(DBloodActor* ac, const DVector3& pos) +{ + aiSetTarget(ac, int(pos.X * worldtoint), int(pos.Y * worldtoint), int(pos.Z * zworldtoint)); +} void aiSetTarget(DBloodActor* actor, DBloodActor* target); int aiDamageSprite(DBloodActor* source, DBloodActor* actor, DAMAGE_TYPE nDmgType, int nDamage); void aiThinkTarget(DBloodActor* actor); diff --git a/source/games/blood/src/aibat.cpp b/source/games/blood/src/aibat.cpp index 15a566662..8f3d5f8f4 100644 --- a/source/games/blood/src/aibat.cpp +++ b/source/games/blood/src/aibat.cpp @@ -86,8 +86,7 @@ static void batThinkTarget(DBloodActor* actor) { pDudeExtraE->thinkTime = 0; actor->xspr.goalAng += 256; - POINT3D* pTarget = &actor->basePoint; - aiSetTarget(actor, pTarget->X, pTarget->Y, pTarget->Z); + aiSetTarget(actor, actor->basePoint); aiNewState(actor, &batTurn); return; } diff --git a/source/games/blood/src/aiboneel.cpp b/source/games/blood/src/aiboneel.cpp index 6692fd906..7b65a1199 100644 --- a/source/games/blood/src/aiboneel.cpp +++ b/source/games/blood/src/aiboneel.cpp @@ -98,8 +98,7 @@ static void eelThinkTarget(DBloodActor* actor) { pDudeExtraE->thinkTime = 0; actor->xspr.goalAng += 256; - POINT3D* pTarget = &actor->basePoint; - aiSetTarget(actor, pTarget->X, pTarget->Y, pTarget->Z); + aiSetTarget(actor, actor->basePoint); aiNewState(actor, &eelTurn); return; } diff --git a/source/games/blood/src/aicerber.cpp b/source/games/blood/src/aicerber.cpp index 04d7c4f89..e80831519 100644 --- a/source/games/blood/src/aicerber.cpp +++ b/source/games/blood/src/aicerber.cpp @@ -244,8 +244,7 @@ static void cerberusThinkTarget(DBloodActor* actor) else if (pDudeExtraE->thinkTime >= 10 && pDudeExtraE->active) { actor->xspr.goalAng += 256; - POINT3D* pTarget = &actor->basePoint; - aiSetTarget(actor, pTarget->X, pTarget->Y, pTarget->Z); + aiSetTarget(actor, actor->basePoint); if (actor->spr.type == kDudeCerberusTwoHead) aiNewState(actor, &cerberus139890); else diff --git a/source/games/blood/src/aigarg.cpp b/source/games/blood/src/aigarg.cpp index 8d7199869..fcc57c2ba 100644 --- a/source/games/blood/src/aigarg.cpp +++ b/source/games/blood/src/aigarg.cpp @@ -207,8 +207,7 @@ static void gargThinkTarget(DBloodActor* actor) else if (pDudeExtraE->thinkTime >= 10 && pDudeExtraE->active) { actor->xspr.goalAng += 256; - POINT3D* pTarget = &actor->basePoint; - aiSetTarget(actor, pTarget->X, pTarget->Y, pTarget->Z); + aiSetTarget(actor, actor->basePoint); aiNewState(actor, &gargoyleTurn); return; } diff --git a/source/games/blood/src/aighost.cpp b/source/games/blood/src/aighost.cpp index e1a5f7972..d02daaaf3 100644 --- a/source/games/blood/src/aighost.cpp +++ b/source/games/blood/src/aighost.cpp @@ -187,8 +187,7 @@ static void ghostThinkTarget(DBloodActor* actor) else if (pDudeExtraE->thinkTime >= 10 && pDudeExtraE->active) { actor->xspr.goalAng += 256; - POINT3D* pTarget = &actor->basePoint; - aiSetTarget(actor, pTarget->X, pTarget->Y, pTarget->Z); + aiSetTarget(actor, actor->basePoint); aiNewState(actor, &ghostTurn); return; } diff --git a/source/games/blood/src/aitchern.cpp b/source/games/blood/src/aitchern.cpp index c1f444b41..8fce6b6dd 100644 --- a/source/games/blood/src/aitchern.cpp +++ b/source/games/blood/src/aitchern.cpp @@ -214,8 +214,7 @@ static void sub_725A4(DBloodActor* actor) else if (pDudeExtraE->thinkTime >= 10 && pDudeExtraE->active) { actor->xspr.goalAng += 256; - POINT3D* pTarget = &actor->basePoint; - aiSetTarget(actor, pTarget->X, pTarget->Y, pTarget->Z); + aiSetTarget(actor, actor->basePoint); aiNewState(actor, &tcherno13AA28); return; } diff --git a/source/games/blood/src/bloodactor.h b/source/games/blood/src/bloodactor.h index e7b483704..ad547b546 100644 --- a/source/games/blood/src/bloodactor.h +++ b/source/games/blood/src/bloodactor.h @@ -28,7 +28,7 @@ public: GENDUDEEXTRA genDudeExtra; TObjPtr prevmarker; // needed by the nnext marker code. This originally hijacked targetX in XSPRITE TObjPtr ownerActor; // was previously stored in the sprite's owner field. - POINT3D basePoint; + DVector3 basePoint; EventObject condition[2]; bool explosionhackflag; // this originally hijacked the target field which is not safe when working with pointers. diff --git a/source/games/blood/src/callback.cpp b/source/games/blood/src/callback.cpp index 160de04f7..19d79d428 100644 --- a/source/games/blood/src/callback.cpp +++ b/source/games/blood/src/callback.cpp @@ -298,7 +298,7 @@ void Respawn(DBloodActor* actor, sectortype*) // 9 if (actor->IsDudeActor()) { int nType = actor->spr.type - kDudeBase; - actor->set_int_pos(actor->basePoint); + 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; diff --git a/source/games/blood/src/triggers.cpp b/source/games/blood/src/triggers.cpp index 0d5245768..8e2b7a4d9 100644 --- a/source/games/blood/src/triggers.cpp +++ b/source/games/blood/src/triggers.cpp @@ -929,12 +929,12 @@ void TranslateSector(sectortype* pSector, int a2, int a3, int a4, int a5, int a6 break; } - x = actor->basePoint.X; - y = actor->basePoint.Y; + x = int(actor->basePoint.X * worldtoint); + y = int(actor->basePoint.Y * worldtoint); if (actor->spr.cstat & CSTAT_SPRITE_MOVE_FORWARD) { if (ang) - RotatePoint((int*)&x, (int*)&y, ang, a4, a5); + RotatePoint(&x, &y, ang, a4, a5); viewBackupSpriteLoc(actor); actor->spr.ang = (actor->spr.ang + v14) & 2047; actor->set_int_xy(x + vc - a4, y + v8 - a5); @@ -981,8 +981,8 @@ void TranslateSector(sectortype* pSector, int a2, int a3, int a4, int a5, int a6 if (ac == nullptr) continue; - x = ac->basePoint.X; - y = ac->basePoint.Y; + x = int(ac->basePoint.X * worldtoint); + y = int(ac->basePoint.Y * worldtoint); if (ac->spr.cstat & CSTAT_SPRITE_MOVE_FORWARD) { if (ang) @@ -1242,7 +1242,7 @@ int VSpriteBusy(sectortype* pSector, unsigned int a2, DBloodActor* initiator) if (actor->spr.cstat & CSTAT_SPRITE_MOVE_FORWARD) { viewBackupSpriteLoc(actor); - actor->set_int_z(actor->basePoint.Z + MulScale(dz1, GetWaveValue(a2, nWave), 16)); + actor->spr.pos.Z += actor->basePoint.Z + MulScale(dz1, GetWaveValue(a2, nWave), 16) * inttoworld; } } } @@ -1255,7 +1255,7 @@ int VSpriteBusy(sectortype* pSector, unsigned int a2, DBloodActor* initiator) if (actor->spr.cstat & CSTAT_SPRITE_MOVE_REVERSE) { viewBackupSpriteLoc(actor); - actor->set_int_z(actor->basePoint.Z + MulScale(dz2, GetWaveValue(a2, nWave), 16)); + actor->spr.pos.Z += actor->basePoint.Z + MulScale(dz2, GetWaveValue(a2, nWave), 16) * inttoworld; } } } @@ -2272,7 +2272,7 @@ static void UpdateBasePoints(sectortype* pSector) if (ptr1) { for (auto& ac : *ptr1) - ac->basePoint = ac->int_pos(); + ac->basePoint = ac->spr.pos; } } #endif @@ -2284,7 +2284,7 @@ static void UpdateBasePoints(sectortype* pSector) BloodSectIterator it(pSector); while (auto actor = it.Next()) { - actor->basePoint = actor->int_pos(); + actor->basePoint = actor->spr.pos; } } @@ -2309,7 +2309,7 @@ void trInit(TArray& actors) { if (!actor->exists()) continue; actor->spr.inittype = actor->spr.type; - actor->basePoint = actor->int_pos(); + actor->basePoint = actor->spr.pos; } for (auto& wal : wall) { diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index 5e79734d3..51020000c 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -2001,7 +2001,7 @@ inline int TEST_BOOL11(DSWActor* sp) { return sp->spr.extra & SPRX_BOOL11; } inline int16_t SP_TAG1(DSWActor* actor) { return actor->spr.hitag; } inline int16_t& SP_TAG2(DSWActor* actor) { return actor->spr.lotag; } inline uint8_t& SP_TAG3(DSWActor* actor) { return actor->spr.clipdist; } -inline int16_t& SP_TAG4(DSWActor* actor) { return actor->spr.ang; } +inline int16_t& SP_TAG4(DSWActor* actor) { return actor->spr. ang; } // this may not be transitioned to a real angular type inline int16_t& SP_TAG5(DSWActor* actor) { return actor->spr.xvel; } inline int16_t& SP_TAG6(DSWActor* actor) { return actor->spr.yvel; } inline uint8_t& SP_TAG7(DSWActor* actor) { return MSB_VAR(actor->spr.zvel); }