From 11aea1c5d4512e3f1f35f5b8be3452fdec8db6cf Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 5 May 2021 10:22:26 +0200 Subject: [PATCH] - more target replacements. --- source/games/blood/src/aibat.cpp | 10 +++++----- source/games/blood/src/aibeast.cpp | 14 +++++++------- source/games/blood/src/aiboneel.cpp | 10 +++++----- source/games/blood/src/aiburn.cpp | 4 ++-- source/games/blood/src/aicaleb.cpp | 12 ++++++------ source/games/blood/src/aicerber.cpp | 6 +++--- source/games/blood/src/aicult.cpp | 8 ++++---- source/games/blood/src/aigarg.cpp | 8 ++++---- source/games/blood/src/aighost.cpp | 8 ++++---- source/games/blood/src/aigilbst.cpp | 14 +++++++------- source/games/blood/src/aihand.cpp | 6 +++--- source/games/blood/src/aihound.cpp | 6 +++--- source/games/blood/src/aiinnoc.cpp | 4 ++-- source/games/blood/src/aipod.cpp | 13 ++++--------- source/games/blood/src/airat.cpp | 6 +++--- source/games/blood/src/aispid.cpp | 12 ++++++------ source/games/blood/src/aitchern.cpp | 8 ++++---- source/games/blood/src/aizomba.cpp | 10 +++++----- source/games/blood/src/aizombf.cpp | 8 ++++---- 19 files changed, 81 insertions(+), 86 deletions(-) diff --git a/source/games/blood/src/aibat.cpp b/source/games/blood/src/aibat.cpp index 20ce2289b..a2f4f9a4b 100644 --- a/source/games/blood/src/aibat.cpp +++ b/source/games/blood/src/aibat.cpp @@ -67,7 +67,7 @@ void batBiteSeqCallback(int, DBloodActor* actor) XSPRITE* pXSprite = &actor->x(); spritetype *pSprite = &actor->s(); if (!actor->ValidateTarget(__FUNCTION__)) return; - spritetype *pTarget = &sprite[pXSprite->target_i]; + spritetype *pTarget = &actor->GetTarget()->s(); int dx = CosScale16(pSprite->ang); int dy = SinScale16(pSprite->ang); assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); @@ -168,8 +168,8 @@ static void batThinkPonder(DBloodActor* actor) assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); if (!actor->ValidateTarget(__FUNCTION__)) return; - spritetype *pTarget = &sprite[pXSprite->target_i]; - XSPRITE *pXTarget = &xsprite[pTarget->extra]; + spritetype *pTarget = &actor->GetTarget()->s(); + XSPRITE *pXTarget = &actor->GetTarget()->x(); int dx = pTarget->x-pSprite->x; int dy = pTarget->y-pSprite->y; aiChooseDirection(actor, getangle(dx, dy)); @@ -276,8 +276,8 @@ static void batThinkChase(DBloodActor* actor) assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); if (!actor->ValidateTarget(__FUNCTION__)) return; - spritetype *pTarget = &sprite[pXSprite->target_i]; - XSPRITE *pXTarget = &xsprite[pTarget->extra]; + spritetype *pTarget = &actor->GetTarget()->s(); + XSPRITE* pXTarget = &actor->GetTarget()->x(); int dx = pTarget->x-pSprite->x; int dy = pTarget->y-pSprite->y; aiChooseDirection(actor, getangle(dx, dy)); diff --git a/source/games/blood/src/aibeast.cpp b/source/games/blood/src/aibeast.cpp index 032c41d0a..586306219 100644 --- a/source/games/blood/src/aibeast.cpp +++ b/source/games/blood/src/aibeast.cpp @@ -68,7 +68,7 @@ void SlashSeqCallback(int, DBloodActor* actor) XSPRITE* pXSprite = &actor->x(); spritetype *pSprite = &actor->s(); if (!actor->ValidateTarget(__FUNCTION__)) return; - spritetype *pTarget = &sprite[pXSprite->target_i]; + spritetype *pTarget = &actor->GetTarget()->s(); int dx = CosScale16(pSprite->ang); int dy = SinScale16(pSprite->ang); // Correct ? @@ -240,8 +240,8 @@ static void beastThinkChase(DBloodActor* actor) assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); if (!actor->ValidateTarget(__FUNCTION__)) return; - spritetype *pTarget = &sprite[pXSprite->target_i]; - XSPRITE *pXTarget = &xsprite[pTarget->extra]; + spritetype *pTarget = &actor->GetTarget()->s(); + XSPRITE* pXTarget = &actor->GetTarget()->x(); int dx = pTarget->x-pSprite->x; int dy = pTarget->y-pSprite->y; aiChooseDirection(actor,getangle(dx, dy)); @@ -410,8 +410,8 @@ static void beastThinkSwimChase(DBloodActor* actor) assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); if (!actor->ValidateTarget(__FUNCTION__)) return; - spritetype *pTarget = &sprite[pXSprite->target_i]; - XSPRITE *pXTarget = &xsprite[pTarget->extra]; + spritetype *pTarget = &actor->GetTarget()->s(); + XSPRITE* pXTarget = &actor->GetTarget()->x(); int dx = pTarget->x-pSprite->x; int dy = pTarget->y-pSprite->y; aiChooseDirection(actor,getangle(dx, dy)); @@ -514,7 +514,7 @@ static void sub_62AE0(DBloodActor* actor) assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); if (!actor->ValidateTarget(__FUNCTION__)) return; - spritetype *pTarget = &sprite[pXSprite->target_i]; + spritetype *pTarget = &actor->GetTarget()->s(); int z = pSprite->z + getDudeInfo(pSprite->type)->eyeHeight; int z2 = pTarget->z + getDudeInfo(pTarget->type)->eyeHeight; int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024; @@ -552,7 +552,7 @@ static void sub_62D7C(DBloodActor* actor) assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); if (!actor->ValidateTarget(__FUNCTION__)) return; - spritetype *pTarget = &sprite[pXSprite->target_i]; + spritetype *pTarget = &actor->GetTarget()->s(); int z = pSprite->z + getDudeInfo(pSprite->type)->eyeHeight; int z2 = pTarget->z + getDudeInfo(pTarget->type)->eyeHeight; int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024; diff --git a/source/games/blood/src/aiboneel.cpp b/source/games/blood/src/aiboneel.cpp index 791bfb0fd..0bcd01db6 100644 --- a/source/games/blood/src/aiboneel.cpp +++ b/source/games/blood/src/aiboneel.cpp @@ -79,7 +79,7 @@ void eelBiteSeqCallback(int, DBloodActor* actor) return; } - spritetype *pTarget = &sprite[pXSprite->target_i]; + spritetype *pTarget = &actor->GetTarget()->s(); int dx = CosScale16(pSprite->ang); int dy = SinScale16(pSprite->ang); assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); @@ -181,8 +181,8 @@ static void eelThinkPonder(DBloodActor* actor) } assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); - spritetype *pTarget = &sprite[pXSprite->target_i]; - XSPRITE *pXTarget = &xsprite[pTarget->extra]; + spritetype *pTarget = &actor->GetTarget()->s(); + XSPRITE* pXTarget = &actor->GetTarget()->x(); int dx = pTarget->x-pSprite->x; int dy = pTarget->y-pSprite->y; aiChooseDirection(actor,getangle(dx, dy)); @@ -288,8 +288,8 @@ static void eelThinkChase(DBloodActor* actor) } assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); - spritetype *pTarget = &sprite[pXSprite->target_i]; - XSPRITE *pXTarget = &xsprite[pTarget->extra]; + spritetype *pTarget = &actor->GetTarget()->s(); + XSPRITE* pXTarget = &actor->GetTarget()->x(); int dx = pTarget->x-pSprite->x; int dy = pTarget->y-pSprite->y; aiChooseDirection(actor,getangle(dx, dy)); diff --git a/source/games/blood/src/aiburn.cpp b/source/games/blood/src/aiburn.cpp index e6e24a76f..35ac4bf7a 100644 --- a/source/games/blood/src/aiburn.cpp +++ b/source/games/blood/src/aiburn.cpp @@ -162,8 +162,8 @@ static void burnThinkChase(DBloodActor* actor) } assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); - spritetype *pTarget = &sprite[pXSprite->target_i]; - XSPRITE *pXTarget = &xsprite[pTarget->extra]; + spritetype *pTarget = &actor->GetTarget()->s(); + XSPRITE* pXTarget = &actor->GetTarget()->x(); int dx = pTarget->x-pSprite->x; int dy = pTarget->y-pSprite->y; aiChooseDirection(actor,getangle(dx, dy)); diff --git a/source/games/blood/src/aicaleb.cpp b/source/games/blood/src/aicaleb.cpp index 9034ec1e9..5c50f6c83 100644 --- a/source/games/blood/src/aicaleb.cpp +++ b/source/games/blood/src/aicaleb.cpp @@ -137,8 +137,8 @@ static void calebThinkChase(DBloodActor* actor) } assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); - spritetype *pTarget = &sprite[pXSprite->target_i]; - XSPRITE *pXTarget = &xsprite[pTarget->extra]; + spritetype *pTarget = &actor->GetTarget()->s(); + XSPRITE* pXTarget = &actor->GetTarget()->x(); int dx = pTarget->x-pSprite->x; int dy = pTarget->y-pSprite->y; aiChooseDirection(actor,getangle(dx, dy)); @@ -272,8 +272,8 @@ static void calebThinkSwimChase(DBloodActor* actor) } assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); - spritetype *pTarget = &sprite[pXSprite->target_i]; - XSPRITE *pXTarget = &xsprite[pTarget->extra]; + spritetype *pTarget = &actor->GetTarget()->s(); + XSPRITE* pXTarget = &actor->GetTarget()->x(); int dx = pTarget->x-pSprite->x; int dy = pTarget->y-pSprite->y; aiChooseDirection(actor,getangle(dx, dy)); @@ -353,7 +353,7 @@ static void sub_65F44(DBloodActor* actor) assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); if (!actor->ValidateTarget(__FUNCTION__)) return; - spritetype *pTarget = &sprite[pXSprite->target_i]; + spritetype *pTarget = &actor->GetTarget()->s(); int z = pSprite->z + getDudeInfo(pSprite->type)->eyeHeight; int z2 = pTarget->z + getDudeInfo(pTarget->type)->eyeHeight; int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024; @@ -391,7 +391,7 @@ static void sub_661E0(DBloodActor* actor) assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); if (!actor->ValidateTarget(__FUNCTION__)) return; - spritetype *pTarget = &sprite[pXSprite->target_i]; + spritetype *pTarget = &actor->GetTarget()->s(); int z = pSprite->z + getDudeInfo(pSprite->type)->eyeHeight; int z2 = pTarget->z + getDudeInfo(pTarget->type)->eyeHeight; int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024; diff --git a/source/games/blood/src/aicerber.cpp b/source/games/blood/src/aicerber.cpp index 694ef1219..9e0bbb137 100644 --- a/source/games/blood/src/aicerber.cpp +++ b/source/games/blood/src/aicerber.cpp @@ -68,7 +68,7 @@ void cerberusBiteSeqCallback(int, DBloodActor* actor) return; } if (!actor->ValidateTarget(__FUNCTION__)) return; - spritetype *pTarget = &sprite[pXSprite->target_i]; + spritetype *pTarget = &actor->GetTarget()->s(); int dz = pTarget->z-pSprite->z; actFireVector(actor, 350, -100, dx, dy, dz, kVectorCerberusHack); actFireVector(actor, -350, 0, dx, dy, dz, kVectorCerberusHack); @@ -372,8 +372,8 @@ static void cerberusThinkChase(DBloodActor* actor) Printf(PRINT_HIGH, "pXSprite->target >= 0 && pXSprite->target < kMaxSprites"); return; } - spritetype *pTarget = &sprite[pXSprite->target_i]; - XSPRITE *pXTarget = &xsprite[pTarget->extra]; + spritetype *pTarget = &actor->GetTarget()->s(); + XSPRITE* pXTarget = &actor->GetTarget()->x(); int dx = pTarget->x-pSprite->x; int dy = pTarget->y-pSprite->y; aiChooseDirection(actor,getangle(dx, dy)); diff --git a/source/games/blood/src/aicult.cpp b/source/games/blood/src/aicult.cpp index 41b2567d5..db9845272 100644 --- a/source/games/blood/src/aicult.cpp +++ b/source/games/blood/src/aicult.cpp @@ -137,7 +137,7 @@ void cultThrowSeqCallback(int, DBloodActor* actor) char v4 = Chance(0x6000); sfxPlay3DSound(pSprite, 455, -1, 0); if (!actor->ValidateTarget(__FUNCTION__)) return; - spritetype *pTarget = &sprite[pXSprite->target_i]; + spritetype *pTarget = &actor->GetTarget()->s(); assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); int dx = pTarget->x - pSprite->x; int dy = pTarget->y - pSprite->y; @@ -174,7 +174,7 @@ void sub_68230(int, DBloodActor* actor) nMissile = kThingArmedTNTBundle; sfxPlay3DSound(pSprite, 455, -1, 0); if (!actor->ValidateTarget(__FUNCTION__)) return; - spritetype *pTarget = &sprite[pXSprite->target_i]; + spritetype *pTarget = &actor->GetTarget()->s(); assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); int dx = pTarget->x - pSprite->x; int dy = pTarget->y - pSprite->y; @@ -252,8 +252,8 @@ static void cultThinkChase(DBloodActor* actor) } assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); - spritetype *pTarget = &sprite[pXSprite->target_i]; - XSPRITE *pXTarget = &xsprite[pTarget->extra]; + spritetype *pTarget = &actor->GetTarget()->s(); + XSPRITE* pXTarget = &actor->GetTarget()->x(); int dx = pTarget->x-pSprite->x; int dy = pTarget->y-pSprite->y; aiChooseDirection(actor,getangle(dx, dy)); diff --git a/source/games/blood/src/aigarg.cpp b/source/games/blood/src/aigarg.cpp index f1f872547..b864146bc 100644 --- a/source/games/blood/src/aigarg.cpp +++ b/source/games/blood/src/aigarg.cpp @@ -82,7 +82,7 @@ void SlashFSeqCallback(int, DBloodActor* actor) XSPRITE* pXSprite = &actor->x(); spritetype* pSprite = &actor->s(); if (!actor->ValidateTarget(__FUNCTION__)) return; - spritetype *pTarget = &sprite[pXSprite->target_i]; + spritetype *pTarget = &actor->GetTarget()->s(); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); DUDEINFO *pDudeInfoT = getDudeInfo(pTarget->type); int height = (pSprite->yrepeat*pDudeInfo->eyeHeight)<<2; @@ -112,7 +112,7 @@ void BlastSSeqCallback(int, DBloodActor* actor) spritetype* pSprite = &actor->s(); wrand(); // ??? if (!actor->ValidateTarget(__FUNCTION__)) return; - spritetype *pTarget = &sprite[pXSprite->target_i]; + spritetype *pTarget = &actor->GetTarget()->s(); int height = (pSprite->yrepeat*getDudeInfo(pSprite->type)->eyeHeight) << 2; int dx = pXSprite->targetX-pSprite->x; int dy = pXSprite->targetY-pSprite->y; @@ -368,8 +368,8 @@ static void gargThinkChase(DBloodActor* actor) return; } DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); - spritetype *pTarget = &sprite[pXSprite->target_i]; - XSPRITE *pXTarget = &xsprite[pTarget->extra]; + spritetype *pTarget = &actor->GetTarget()->s(); + XSPRITE* pXTarget = &actor->GetTarget()->x(); int dx = pTarget->x-pSprite->x; int dy = pTarget->y-pSprite->y; aiChooseDirection(actor,getangle(dx, dy)); diff --git a/source/games/blood/src/aighost.cpp b/source/games/blood/src/aighost.cpp index 5f9d77c89..ea31277a0 100644 --- a/source/games/blood/src/aighost.cpp +++ b/source/games/blood/src/aighost.cpp @@ -66,7 +66,7 @@ void ghostSlashSeqCallback(int, DBloodActor* actor) XSPRITE* pXSprite = &actor->x(); spritetype* pSprite = &actor->s(); if (!actor->ValidateTarget(__FUNCTION__)) return; - spritetype *pTarget = &sprite[pXSprite->target_i]; + spritetype *pTarget = &actor->GetTarget()->s(); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); DUDEINFO *pDudeInfoT = getDudeInfo(pTarget->type); int height = (pSprite->yrepeat*pDudeInfo->eyeHeight)<<2; @@ -95,7 +95,7 @@ void ghostBlastSeqCallback(int, DBloodActor* actor) spritetype* pSprite = &actor->s(); wrand(); // ??? if (!actor->ValidateTarget(__FUNCTION__)) return; - spritetype *pTarget = &sprite[pXSprite->target_i]; + spritetype *pTarget = &actor->GetTarget()->s(); int height = (pSprite->yrepeat*getDudeInfo(pSprite->type)->eyeHeight) << 2; int dx = pXSprite->targetX-pSprite->x; int dy = pXSprite->targetY-pSprite->y; @@ -346,8 +346,8 @@ static void ghostThinkChase(DBloodActor* actor) return; } DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); - spritetype *pTarget = &sprite[pXSprite->target_i]; - XSPRITE *pXTarget = &xsprite[pTarget->extra]; + spritetype *pTarget = &actor->GetTarget()->s(); + XSPRITE* pXTarget = &actor->GetTarget()->x(); int dx = pTarget->x-pSprite->x; int dy = pTarget->y-pSprite->y; aiChooseDirection(actor,getangle(dx, dy)); diff --git a/source/games/blood/src/aigilbst.cpp b/source/games/blood/src/aigilbst.cpp index 8bd7ebfb7..2de4b9fe0 100644 --- a/source/games/blood/src/aigilbst.cpp +++ b/source/games/blood/src/aigilbst.cpp @@ -63,7 +63,7 @@ void GillBiteSeqCallback(int, DBloodActor* actor) XSPRITE* pXSprite = &actor->x(); spritetype* pSprite = &actor->s(); if (!actor->ValidateTarget(__FUNCTION__)) return; - spritetype *pTarget = &sprite[pXSprite->target_i]; + spritetype *pTarget = &actor->GetTarget()->s(); int dx = CosScale16(pSprite->ang); int dy = SinScale16(pSprite->ang); int dz = pSprite->z-pTarget->z; @@ -130,8 +130,8 @@ static void gillThinkChase(DBloodActor* actor) assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); if (!actor->ValidateTarget(__FUNCTION__)) return; - spritetype *pTarget = &sprite[pXSprite->target_i]; - XSPRITE *pXTarget = &xsprite[pTarget->extra]; + spritetype *pTarget = &actor->GetTarget()->s(); + XSPRITE* pXTarget = &actor->GetTarget()->x(); int dx = pTarget->x-pSprite->x; int dy = pTarget->y-pSprite->y; aiChooseDirection(actor,getangle(dx, dy)); @@ -262,8 +262,8 @@ static void gillThinkSwimChase(DBloodActor* actor) assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); if (!actor->ValidateTarget(__FUNCTION__)) return; - spritetype *pTarget = &sprite[pXSprite->target_i]; - XSPRITE *pXTarget = &xsprite[pTarget->extra]; + spritetype *pTarget = &actor->GetTarget()->s(); + XSPRITE* pXTarget = &actor->GetTarget()->x(); int dx = pTarget->x-pSprite->x; int dy = pTarget->y-pSprite->y; aiChooseDirection(actor,getangle(dx, dy)); @@ -347,7 +347,7 @@ static void sub_6CD74(DBloodActor* actor) assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); if (!actor->ValidateTarget(__FUNCTION__)) return; - spritetype *pTarget = &sprite[pXSprite->target_i]; + spritetype *pTarget = &actor->GetTarget()->s(); int z = pSprite->z + getDudeInfo(pSprite->type)->eyeHeight; int z2 = pTarget->z + getDudeInfo(pTarget->type)->eyeHeight; int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024; @@ -384,7 +384,7 @@ static void sub_6D03C(DBloodActor* actor) assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); if (!actor->ValidateTarget(__FUNCTION__)) return; - spritetype *pTarget = &sprite[pXSprite->target_i]; + spritetype *pTarget = &actor->GetTarget()->s(); int z = pSprite->z + getDudeInfo(pSprite->type)->eyeHeight; int z2 = pTarget->z + getDudeInfo(pTarget->type)->eyeHeight; int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024; diff --git a/source/games/blood/src/aihand.cpp b/source/games/blood/src/aihand.cpp index 10c4af8ba..ff4971185 100644 --- a/source/games/blood/src/aihand.cpp +++ b/source/games/blood/src/aihand.cpp @@ -47,7 +47,7 @@ void HandJumpSeqCallback(int, DBloodActor* actor) XSPRITE* pXSprite = &actor->x(); spritetype* pSprite = &actor->s(); if (!actor->ValidateTarget(__FUNCTION__)) return; - spritetype *pTarget = &sprite[pXSprite->target_i]; + spritetype *pTarget = &actor->GetTarget()->s(); if (IsPlayerSprite(pTarget)) { PLAYER *pPlayer = &gPlayer[pTarget->type-kDudePlayer1]; @@ -95,8 +95,8 @@ static void handThinkChase(DBloodActor* actor) assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); if (!actor->ValidateTarget(__FUNCTION__)) return; - spritetype *pTarget = &sprite[pXSprite->target_i]; - XSPRITE *pXTarget = &xsprite[pTarget->extra]; + spritetype *pTarget = &actor->GetTarget()->s(); + XSPRITE* pXTarget = &actor->GetTarget()->x(); int dx = pTarget->x-pSprite->x; int dy = pTarget->y-pSprite->y; aiChooseDirection(actor,getangle(dx, dy)); diff --git a/source/games/blood/src/aihound.cpp b/source/games/blood/src/aihound.cpp index ca827ec16..b833fc078 100644 --- a/source/games/blood/src/aihound.cpp +++ b/source/games/blood/src/aihound.cpp @@ -56,7 +56,7 @@ void houndBiteSeqCallback(int, DBloodActor* actor) } if (!actor->ValidateTarget(__FUNCTION__)) return; - spritetype *pTarget = &sprite[pXSprite->target_i]; + spritetype *pTarget = &actor->GetTarget()->s(); #ifdef NOONE_EXTENSIONS if (IsPlayerSprite(pTarget) || gModernMap) // allow to hit non-player targets actFireVector(actor, 0, 0, dx, dy, pTarget->z - pSprite->z, kVectorHoundBite); @@ -116,8 +116,8 @@ static void houndThinkChase(DBloodActor* actor) return; } DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); - spritetype *pTarget = &sprite[pXSprite->target_i]; - XSPRITE *pXTarget = &xsprite[pTarget->extra]; + spritetype *pTarget = &actor->GetTarget()->s(); + XSPRITE* pXTarget = &actor->GetTarget()->x(); int dx = pTarget->x-pSprite->x; int dy = pTarget->y-pSprite->y; aiChooseDirection(actor,getangle(dx, dy)); diff --git a/source/games/blood/src/aiinnoc.cpp b/source/games/blood/src/aiinnoc.cpp index 36db8f211..c0220a8a6 100644 --- a/source/games/blood/src/aiinnoc.cpp +++ b/source/games/blood/src/aiinnoc.cpp @@ -77,8 +77,8 @@ static void innocThinkChase(DBloodActor* actor) assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); if (!actor->ValidateTarget(__FUNCTION__)) return; - spritetype *pTarget = &sprite[pXSprite->target_i]; - XSPRITE *pXTarget = &xsprite[pTarget->extra]; + spritetype *pTarget = &actor->GetTarget()->s(); + XSPRITE* pXTarget = &actor->GetTarget()->x(); int dx = pTarget->x-pSprite->x; int dy = pTarget->y-pSprite->y; aiChooseDirection(actor,getangle(dx, dy)); diff --git a/source/games/blood/src/aipod.cpp b/source/games/blood/src/aipod.cpp index 3e17473c9..905c819c8 100644 --- a/source/games/blood/src/aipod.cpp +++ b/source/games/blood/src/aipod.cpp @@ -65,15 +65,10 @@ void podAttack(int, DBloodActor* actor) { XSPRITE* pXSprite = &actor->x(); spritetype* pSprite = &actor->s(); - ///assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites); - if (!(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites)) { - Printf(PRINT_HIGH, "pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites"); - return; - } - - spritetype *pTarget = &sprite[pXSprite->target_i]; if (!actor->ValidateTarget(__FUNCTION__)) return; + spritetype *pTarget = &actor->GetTarget()->s(); + DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); int x = pTarget->x-pSprite->x; int y = pTarget->y-pSprite->y; @@ -197,8 +192,8 @@ static void aiPodChase(DBloodActor* actor) return; } DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); - spritetype *pTarget = &sprite[pXSprite->target_i]; - XSPRITE *pXTarget = &xsprite[pTarget->extra]; + spritetype *pTarget = &actor->GetTarget()->s(); + XSPRITE* pXTarget = &actor->GetTarget()->x(); int dx = pTarget->x-pSprite->x; int dy = pTarget->y-pSprite->y; aiChooseDirection(actor,getangle(dx, dy)); diff --git a/source/games/blood/src/airat.cpp b/source/games/blood/src/airat.cpp index 0f1687b4c..4799b550d 100644 --- a/source/games/blood/src/airat.cpp +++ b/source/games/blood/src/airat.cpp @@ -50,7 +50,7 @@ void ratBiteSeqCallback(int, DBloodActor* actor) int dy = SinScale16(pSprite->ang); assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); if (!actor->ValidateTarget(__FUNCTION__)) return; - spritetype *pTarget = &sprite[pXSprite->target_i]; + spritetype *pTarget = &actor->GetTarget()->s(); if (IsPlayerSprite(pTarget)) actFireVector(actor, 0, 0, dx, dy, pTarget->z-pSprite->z, kVectorRatBite); } @@ -90,8 +90,8 @@ static void ratThinkChase(DBloodActor* actor) } assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); - spritetype *pTarget = &sprite[pXSprite->target_i]; - XSPRITE *pXTarget = &xsprite[pTarget->extra]; + spritetype *pTarget = &actor->GetTarget()->s(); + XSPRITE* pXTarget = &actor->GetTarget()->x(); int dx = pTarget->x-pSprite->x; int dy = pTarget->y-pSprite->y; aiChooseDirection(actor,getangle(dx, dy)); diff --git a/source/games/blood/src/aispid.cpp b/source/games/blood/src/aispid.cpp index e51d5aa78..35c3d22c5 100644 --- a/source/games/blood/src/aispid.cpp +++ b/source/games/blood/src/aispid.cpp @@ -74,8 +74,8 @@ void SpidBiteSeqCallback(int, DBloodActor* actor) int dz = Random2(2000); assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); if (!actor->ValidateTarget(__FUNCTION__)) return; - spritetype *pTarget = &sprite[pXSprite->target_i]; - XSPRITE *pXTarget = &xsprite[pTarget->extra]; + spritetype *pTarget = &actor->GetTarget()->s(); + XSPRITE* pXTarget = &actor->GetTarget()->x(); if (IsPlayerSprite(pTarget)) { int hit = HitScan(pSprite, pSprite->z, dx, dy, 0, CLIPMASK1, 0); @@ -123,7 +123,7 @@ void SpidJumpSeqCallback(int, DBloodActor* actor) int dz = Random2(200); assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); if (!actor->ValidateTarget(__FUNCTION__)) return; - spritetype *pTarget = &sprite[pXSprite->target_i]; + spritetype *pTarget = &actor->GetTarget()->s(); if (IsPlayerSprite(pTarget)) { dz += pTarget->z-pSprite->z; switch (pSprite->type) { @@ -145,7 +145,7 @@ void SpidBirthSeqCallback(int, DBloodActor* actor) assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); if (!actor->ValidateTarget(__FUNCTION__)) return; - spritetype *pTarget = &sprite[pXSprite->target_i]; + spritetype *pTarget = &actor->GetTarget()->s(); DUDEEXTRA_at6_u1 *pDudeExtraE = &actor->dudeExtra.at6.u1; int dx = pXSprite->targetX-pSprite->x; int dy = pXSprite->targetY-pSprite->y; @@ -207,8 +207,8 @@ static void spidThinkChase(DBloodActor* actor) } assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); - spritetype *pTarget = &sprite[pXSprite->target_i]; - XSPRITE *pXTarget = &xsprite[pTarget->extra]; + spritetype *pTarget = &actor->GetTarget()->s(); + XSPRITE* pXTarget = &actor->GetTarget()->x(); int dx = pTarget->x-pSprite->x; int dy = pTarget->y-pSprite->y; aiChooseDirection(actor,getangle(dx, dy)); diff --git a/source/games/blood/src/aitchern.cpp b/source/games/blood/src/aitchern.cpp index 482ce45b8..954812bdb 100644 --- a/source/games/blood/src/aitchern.cpp +++ b/source/games/blood/src/aitchern.cpp @@ -51,8 +51,8 @@ void sub_71A90(int, DBloodActor* actor) XSPRITE* pXSprite = &actor->x(); spritetype* pSprite = &actor->s(); if (!actor->ValidateTarget(__FUNCTION__)) return; - spritetype *pTarget = &sprite[pXSprite->target_i]; - XSPRITE *pXTarget = &xsprite[pTarget->extra]; + spritetype *pTarget = &actor->GetTarget()->s(); + XSPRITE* pXTarget = &actor->GetTarget()->x(); int nTarget = pTarget->index; int nOwner = pSprite->owner; if (pXTarget->burnTime == 0) @@ -319,8 +319,8 @@ static void sub_72934(DBloodActor* actor) } DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); if (!actor->ValidateTarget(__FUNCTION__)) return; - spritetype *pTarget = &sprite[pXSprite->target_i]; - XSPRITE *pXTarget = &xsprite[pTarget->extra]; + spritetype *pTarget = &actor->GetTarget()->s(); + XSPRITE* pXTarget = &actor->GetTarget()->x(); int dx = pTarget->x-pSprite->x; int dy = pTarget->y-pSprite->y; aiChooseDirection(actor,getangle(dx, dy)); diff --git a/source/games/blood/src/aizomba.cpp b/source/games/blood/src/aizomba.cpp index 48b9c9d9b..291b6adee 100644 --- a/source/games/blood/src/aizomba.cpp +++ b/source/games/blood/src/aizomba.cpp @@ -64,7 +64,7 @@ void HackSeqCallback(int, DBloodActor* actor) XSPRITE* pXSprite = &actor->x(); spritetype* pSprite = &actor->s(); if (!actor->ValidateTarget(__FUNCTION__)) return; - spritetype *pTarget = &sprite[pXSprite->target_i]; + spritetype *pTarget = &actor->GetTarget()->s(); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); DUDEINFO *pDudeInfoT = getDudeInfo(pTarget->type); int tx = pXSprite->targetX-pSprite->x; @@ -120,8 +120,8 @@ static void zombaThinkChase(DBloodActor* actor) assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); if (!actor->ValidateTarget(__FUNCTION__)) return; - spritetype *pTarget = &sprite[pXSprite->target_i]; - XSPRITE *pXTarget = &xsprite[pTarget->extra]; + spritetype *pTarget = &actor->GetTarget()->s(); + XSPRITE* pXTarget = &actor->GetTarget()->x(); int dx = pTarget->x-pSprite->x; int dy = pTarget->y-pSprite->y; aiChooseDirection(actor,getangle(dx, dy)); @@ -172,8 +172,8 @@ static void zombaThinkPonder(DBloodActor* actor) assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); if (!actor->ValidateTarget(__FUNCTION__)) return; - spritetype *pTarget = &sprite[pXSprite->target_i]; - XSPRITE *pXTarget = &xsprite[pTarget->extra]; + spritetype *pTarget = &actor->GetTarget()->s(); + XSPRITE* pXTarget = &actor->GetTarget()->x(); int dx = pTarget->x-pSprite->x; int dy = pTarget->y-pSprite->y; aiChooseDirection(actor,getangle(dx, dy)); diff --git a/source/games/blood/src/aizombf.cpp b/source/games/blood/src/aizombf.cpp index 268de4a8f..6e30a7390 100644 --- a/source/games/blood/src/aizombf.cpp +++ b/source/games/blood/src/aizombf.cpp @@ -53,7 +53,7 @@ void zombfHackSeqCallback(int, DBloodActor* actor) if (pSprite->type != kDudeZombieButcher) return; if (!actor->ValidateTarget(__FUNCTION__)) return; - spritetype *pTarget = &sprite[pXSprite->target_i]; + spritetype *pTarget = &actor->GetTarget()->s(); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); int height = (pDudeInfo->eyeHeight*pSprite->yrepeat); DUDEINFO *pDudeInfoT = getDudeInfo(pTarget->type); @@ -66,7 +66,7 @@ void PukeSeqCallback(int, DBloodActor* actor) XSPRITE* pXSprite = &actor->x(); spritetype* pSprite = &actor->s(); if (!actor->ValidateTarget(__FUNCTION__)) return; - spritetype *pTarget = &sprite[pXSprite->target_i]; + spritetype *pTarget = &actor->GetTarget()->s(); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); DUDEINFO *pDudeInfoT = getDudeInfo(pTarget->type); int height = (pDudeInfo->eyeHeight*pSprite->yrepeat); @@ -122,8 +122,8 @@ static void zombfThinkChase(DBloodActor* actor) assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); if (!actor->ValidateTarget(__FUNCTION__)) return; - spritetype *pTarget = &sprite[pXSprite->target_i]; - XSPRITE *pXTarget = &xsprite[pTarget->extra]; + spritetype *pTarget = &actor->GetTarget()->s(); + XSPRITE* pXTarget = &actor->GetTarget()->x(); int dx = pTarget->x-pSprite->x; int dy = pTarget->y-pSprite->y; aiChooseDirection(actor,getangle(dx, dy));