From 76f0724d24e09bc2b308c3c19b638e41dd86caea Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 30 Oct 2021 13:16:40 +0200 Subject: [PATCH] - global search & replace for all occurences of tgt_sp where it is only used to access a field in the sprite. --- source/games/sw/src/actor.cpp | 4 +- source/games/sw/src/ai.cpp | 18 ++++---- source/games/sw/src/coolie.cpp | 2 +- source/games/sw/src/miscactr.cpp | 24 +++++----- source/games/sw/src/ripper2.cpp | 2 +- source/games/sw/src/skull.cpp | 12 ++--- source/games/sw/src/track.cpp | 6 +-- source/games/sw/src/weapon.cpp | 78 ++++++++++++++++---------------- 8 files changed, 73 insertions(+), 73 deletions(-) diff --git a/source/games/sw/src/actor.cpp b/source/games/sw/src/actor.cpp index e03617efe..9f055b1c7 100644 --- a/source/games/sw/src/actor.cpp +++ b/source/games/sw/src/actor.cpp @@ -222,7 +222,7 @@ int DoActorDie(DSWActor* actor, DSWActor* weapActor, int meansofdeath) } u->ActorActionFunc = nullptr; // Get angle to player - sp->ang = NORM_ANGLE(getangle(u->tgt_sp()->x - sp->x, u->tgt_sp()->y - sp->y) + 1024); + sp->ang = NORM_ANGLE(getangle(u->targetActor->s().x - sp->x, u->targetActor->s().y - sp->y) + 1024); break; case UZI_SMOKE+1: // Shotgun @@ -245,7 +245,7 @@ int DoActorDie(DSWActor* actor, DSWActor* weapActor, int meansofdeath) DoActorBeginJump(actor); u->ActorActionFunc = nullptr; // Get angle to player - sp->ang = NORM_ANGLE(getangle(u->tgt_sp()->x - sp->x, u->tgt_sp()->y - sp->y) + 1024); + sp->ang = NORM_ANGLE(getangle(u->targetActor->s().x - sp->x, u->targetActor->s().y - sp->y) + 1024); break; default: diff --git a/source/games/sw/src/ai.cpp b/source/games/sw/src/ai.cpp index 8f33fb3e1..0c8553088 100644 --- a/source/games/sw/src/ai.cpp +++ b/source/games/sw/src/ai.cpp @@ -291,7 +291,7 @@ bool CanSeePlayer(DSWActor* actor) //if (FAF_Sector(sp->sectnum)) // return(true); - if (u->tgt_sp() && FAFcansee(sp->x, sp->y, look_height, sp->sectnum, u->tgt_sp()->x, u->tgt_sp()->y, SPRITEp_UPPER(u->tgt_sp()), u->tgt_sp()->sectnum)) + if (u->tgt_sp() && FAFcansee(sp->x, sp->y, look_height, sp->sectnum, u->targetActor->s().x, u->targetActor->s().y, SPRITEp_UPPER(u->tgt_sp()), u->targetActor->s().sectnum)) return true; else return false; @@ -662,7 +662,7 @@ DoActorActionDecide(short SpriteNum) DoActorOperate(SpriteNum); // if far enough away and cannot see the player - dist = Distance(sp->x, sp->y, u->tgt_sp()->x, u->tgt_sp()->y); + dist = Distance(sp->x, sp->y, u->targetActor->s().x, u->targetActor->s().y); if (dist > 30000 && !ICanSee) { @@ -753,7 +753,7 @@ DoActorActionDecide(short SpriteNum) DoActorPickClosePlayer(actor); // if close by - dist = Distance(sp->x, sp->y, u->tgt_sp()->x, u->tgt_sp()->y); + dist = Distance(sp->x, sp->y, u->targetActor->s().x, u->targetActor->s().y); if (dist < 15000 || ICanSee) { if ((FACING(sp, u->tgt_sp()) && dist < 10000) || ICanSee) @@ -1161,7 +1161,7 @@ DoActorMoveCloser(DSWActor* actor) else { // turn to face player - sp->ang = getangle(u->tgt_sp()->x - sp->x, u->tgt_sp()->y - sp->y); + sp->ang = getangle(u->targetActor->s().x - sp->x, u->targetActor->s().y - sp->y); } } @@ -1462,7 +1462,7 @@ InitActorAttack(DSWActor* actor) //NewStateGroup(SpriteNum, u->ActorActionSet->Stand); // face player when attacking - sp->ang = NORM_ANGLE(getangle(u->tgt_sp()->x - sp->x, u->tgt_sp()->y - sp->y)); + sp->ang = NORM_ANGLE(getangle(u->targetActor->s().x - sp->x, u->targetActor->s().y - sp->y)); // If it's your own kind, lay off! if (u->ID == User[u->tgt_sp() - sprite]->ID && !User[u->tgt_sp() - sprite]->PlayerP) @@ -1524,7 +1524,7 @@ DoActorAttack(DSWActor* actor) DoActorNoise(ChooseAction(u->Personality->Broadcast),actor); - DISTANCE(sp->x, sp->y, u->tgt_sp()->x, u->tgt_sp()->y, dist, a, b, c); + DISTANCE(sp->x, sp->y, u->targetActor->s().x, u->targetActor->s().y, dist, a, b, c); pu = User[GetPlayerSpriteNum(SpriteNum)].Data(); if ((u->ActorActionSet->CloseAttack[0] && dist < CloseRangeDist(sp, u->tgt_sp())) || @@ -1659,7 +1659,7 @@ InitActorDuck(DSWActor* actor) u->ActorActionFunc = DoActorDuck; NewStateGroup(SpriteNum, u->ActorActionSet->Duck); - dist = Distance(sp->x, sp->y, u->tgt_sp()->x, u->tgt_sp()->y); + dist = Distance(sp->x, sp->y, u->targetActor->s().x, u->targetActor->s().y); if (dist > 8000) { @@ -1824,7 +1824,7 @@ FindNewAngle(short SpriteNum, signed char dir, int DistToMove) DistToMove = DIV4(DistToMove) + DIV8(DistToMove); // Find angle to from the player - oang = NORM_ANGLE(getangle(u->tgt_sp()->x - sp->x, u->tgt_sp()->y - sp->y)); + oang = NORM_ANGLE(getangle(u->targetActor->s().x - sp->x, u->targetActor->s().y - sp->y)); // choose a random angle array switch (dir) @@ -1974,7 +1974,7 @@ InitActorReposition(DSWActor* actor) u->Dist = 0; rnum = RANDOM_P2(8<<8)>>8; - dist = Distance(sp->x, sp->y, u->tgt_sp()->x, u->tgt_sp()->y); + dist = Distance(sp->x, sp->y, u->targetActor->s().x, u->targetActor->s().y); if (dist < PlayerDist[rnum] || TEST(u->Flags, SPR_RUN_AWAY)) { diff --git a/source/games/sw/src/coolie.cpp b/source/games/sw/src/coolie.cpp index 7c77e083d..86abf6666 100644 --- a/source/games/sw/src/coolie.cpp +++ b/source/games/sw/src/coolie.cpp @@ -633,7 +633,7 @@ int DoCoolieMove(DSWActor* actor) return 0; } - if (Distance(sp->x, sp->y, u->tgt_sp()->x, u->tgt_sp()->y) < 1200) + if (Distance(sp->x, sp->y, u->targetActor->s().x, u->targetActor->s().y) < 1200) { //DoActorDie(SpriteNum, -3); UpdateSinglePlayKills(SpriteNum); diff --git a/source/games/sw/src/miscactr.cpp b/source/games/sw/src/miscactr.cpp index 0f70bee9a..2681541ce 100644 --- a/source/games/sw/src/miscactr.cpp +++ b/source/games/sw/src/miscactr.cpp @@ -157,7 +157,7 @@ int DoToiletGirl(DSWActor* actor) bool ICanSee = false; DoActorPickClosePlayer(actor); - ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->tgt_sp()->x,u->tgt_sp()->y,SPRITEp_MID(u->tgt_sp()),u->tgt_sp()->sectnum); + ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->targetActor->s().x,u->targetActor->s().y,SPRITEp_MID(u->tgt_sp()),u->targetActor->s().sectnum); if (u->FlagOwner != 1) { @@ -216,7 +216,7 @@ int NullToiletGirl(DSWActor* actor) bool ICanSee = false; DoActorPickClosePlayer(actor); - ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->tgt_sp()->x,u->tgt_sp()->y,u->tgt_sp()->z,u->tgt_sp()->sectnum); + ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->targetActor->s().x,u->targetActor->s().y,u->targetActor->s().z,u->targetActor->s().sectnum); if (!TEST(u->Flags,SPR_CLIMBING)) KeepActorOnFloor(actor); @@ -400,7 +400,7 @@ int DoWashGirl(DSWActor* actor) bool ICanSee = false; DoActorPickClosePlayer(actor); - ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->tgt_sp()->x,u->tgt_sp()->y,SPRITEp_MID(u->tgt_sp()),u->tgt_sp()->sectnum); + ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->targetActor->s().x,u->targetActor->s().y,SPRITEp_MID(u->tgt_sp()),u->targetActor->s().sectnum); if (RandomRange(1000) > 980 && u->ShellNum <= 0) { @@ -465,7 +465,7 @@ int NullWashGirl(DSWActor* actor) bool ICanSee = false; DoActorPickClosePlayer(actor); - ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->tgt_sp()->x,u->tgt_sp()->y,u->tgt_sp()->z,u->tgt_sp()->sectnum); + ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->targetActor->s().x,u->targetActor->s().y,u->targetActor->s().z,u->targetActor->s().sectnum); if (!TEST(u->Flags,SPR_CLIMBING)) KeepActorOnFloor(actor); @@ -1280,7 +1280,7 @@ int DoCarGirl(DSWActor* actor) bool ICanSee = false; DoActorPickClosePlayer(actor); - ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->tgt_sp()->x,u->tgt_sp()->y,SPRITEp_MID(u->tgt_sp()),u->tgt_sp()->sectnum); + ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->targetActor->s().x,u->targetActor->s().y,SPRITEp_MID(u->tgt_sp()),u->targetActor->s().sectnum); if (u->FlagOwner == 1) { @@ -1330,7 +1330,7 @@ int NullCarGirl(DSWActor* actor) bool ICanSee = false; DoActorPickClosePlayer(actor); - ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->tgt_sp()->x,u->tgt_sp()->y,u->tgt_sp()->z,u->tgt_sp()->sectnum); + ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->targetActor->s().x,u->targetActor->s().y,u->targetActor->s().z,u->targetActor->s().sectnum); if (!TEST(u->Flags,SPR_CLIMBING)) KeepActorOnFloor(actor); @@ -1502,7 +1502,7 @@ int DoMechanicGirl(DSWActor* actor) bool ICanSee = false; DoActorPickClosePlayer(actor); - ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->tgt_sp()->x,u->tgt_sp()->y,SPRITEp_MID(u->tgt_sp()),u->tgt_sp()->sectnum); + ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->targetActor->s().x,u->targetActor->s().y,SPRITEp_MID(u->tgt_sp()),u->targetActor->s().sectnum); if (u->FlagOwner == 1) { @@ -1552,7 +1552,7 @@ int NullMechanicGirl(DSWActor* actor) bool ICanSee = false; DoActorPickClosePlayer(actor); - ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->tgt_sp()->x,u->tgt_sp()->y,u->tgt_sp()->z,u->tgt_sp()->sectnum); + ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->targetActor->s().x,u->targetActor->s().y,u->targetActor->s().z,u->targetActor->s().sectnum); if (!TEST(u->Flags,SPR_CLIMBING)) KeepActorOnFloor(actor); @@ -1725,7 +1725,7 @@ int DoSailorGirl(DSWActor* actor) bool ICanSee = false; DoActorPickClosePlayer(actor); - ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->tgt_sp()->x,u->tgt_sp()->y,SPRITEp_MID(u->tgt_sp()),u->tgt_sp()->sectnum); + ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->targetActor->s().x,u->targetActor->s().y,SPRITEp_MID(u->tgt_sp()),u->targetActor->s().sectnum); if (u->FlagOwner == 1) { @@ -1780,7 +1780,7 @@ int NullSailorGirl(DSWActor* actor) static short alreadythrew = 0; DoActorPickClosePlayer(actor); - ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->tgt_sp()->x,u->tgt_sp()->y,u->tgt_sp()->z,u->tgt_sp()->sectnum); + ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->targetActor->s().x,u->targetActor->s().y,u->targetActor->s().z,u->targetActor->s().sectnum); if (!TEST(u->Flags,SPR_CLIMBING)) KeepActorOnFloor(actor); @@ -1940,7 +1940,7 @@ int DoPruneGirl(DSWActor* actor) bool ICanSee = false; DoActorPickClosePlayer(actor); - ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->tgt_sp()->x,u->tgt_sp()->y,SPRITEp_MID(u->tgt_sp()),u->tgt_sp()->sectnum); + ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->targetActor->s().x,u->targetActor->s().y,SPRITEp_MID(u->tgt_sp()),u->targetActor->s().sectnum); if (u->FlagOwner == 1) { @@ -2006,7 +2006,7 @@ int NullPruneGirl(DSWActor* actor) bool ICanSee = false; DoActorPickClosePlayer(actor); - ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->tgt_sp()->x,u->tgt_sp()->y,u->tgt_sp()->z,u->tgt_sp()->sectnum); + ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->targetActor->s().x,u->targetActor->s().y,u->targetActor->s().z,u->targetActor->s().sectnum); if (!TEST(u->Flags,SPR_CLIMBING)) KeepActorOnFloor(actor); diff --git a/source/games/sw/src/ripper2.cpp b/source/games/sw/src/ripper2.cpp index 290a656db..9e48f3c94 100644 --- a/source/games/sw/src/ripper2.cpp +++ b/source/games/sw/src/ripper2.cpp @@ -1035,7 +1035,7 @@ DoRipper2MoveHang(DSWActor* actor) short w, nw; // Don't keep clinging and going ever higher! - if (abs(sp->z - u->tgt_sp()->z) > (4000<<4)) + if (abs(sp->z - u->targetActor->s().z) > (4000<<4)) break; hit_wall = NORM_WALL(u->ret); diff --git a/source/games/sw/src/skull.cpp b/source/games/sw/src/skull.cpp index d83c776d7..5872dc3bf 100644 --- a/source/games/sw/src/skull.cpp +++ b/source/games/sw/src/skull.cpp @@ -394,7 +394,7 @@ int DoSkullJump(DSWActor* actor) int dist,a,b,c; - DISTANCE(sp->x, sp->y, u->tgt_sp()->x, u->tgt_sp()->y, dist, a, b, c); + DISTANCE(sp->x, sp->y, u->targetActor->s().x, u->targetActor->s().y, dist, a, b, c); if (dist < 1000 && SpriteOverlapZ(SpriteNum, short(u->tgt_sp() - sprite), Z(32))) @@ -467,7 +467,7 @@ int DoSkullWait(DSWActor* actor) SPRITEp sp = &sprite[SpriteNum]; int a,b,c,dist; - DISTANCE(sp->x, sp->y, u->tgt_sp()->x, u->tgt_sp()->y, dist, a, b, c); + DISTANCE(sp->x, sp->y, u->targetActor->s().x, u->targetActor->s().y, dist, a, b, c); DoActorPickClosePlayer(actor); @@ -501,7 +501,7 @@ int DoSkullWait(DSWActor* actor) if (dist < 8000) { - sp->ang = getangle(u->tgt_sp()->x - sp->x, u->tgt_sp()->y - sp->y); + sp->ang = getangle(u->targetActor->s().x - sp->x, u->targetActor->s().y - sp->y); sp->xvel = 128 + (RANDOM_P2(256<<8)>>8); u->jump_speed = -700; NewStateGroup(SpriteNum, sg_SkullJump); @@ -813,7 +813,7 @@ int DoBettyJump(DSWActor* actor) { int dist,a,b,c; - DISTANCE(sp->x, sp->y, u->tgt_sp()->x, u->tgt_sp()->y, dist, a, b, c); + DISTANCE(sp->x, sp->y, u->targetActor->s().x, u->targetActor->s().y, dist, a, b, c); if (dist < 1000 && SpriteOverlapZ(SpriteNum, short(u->tgt_sp() - sprite), Z(32))) @@ -882,7 +882,7 @@ int DoBettyWait(DSWActor* actor) SPRITEp sp = &sprite[SpriteNum]; int a,b,c,dist; - DISTANCE(sp->x, sp->y, u->tgt_sp()->x, u->tgt_sp()->y, dist, a, b, c); + DISTANCE(sp->x, sp->y, u->targetActor->s().x, u->targetActor->s().y, dist, a, b, c); DoActorPickClosePlayer(actor); @@ -916,7 +916,7 @@ int DoBettyWait(DSWActor* actor) if (dist < 8000) { - sp->ang = getangle(u->tgt_sp()->x - sp->x, u->tgt_sp()->y - sp->y); + sp->ang = getangle(u->targetActor->s().x - sp->x, u->targetActor->s().y - sp->y); sp->xvel = 128 + (RANDOM_P2(256<<8)>>8); u->jump_speed = -700; NewStateGroup(SpriteNum, sg_BettyJump); diff --git a/source/games/sw/src/track.cpp b/source/games/sw/src/track.cpp index 72b384a5e..d1f7e87d5 100644 --- a/source/games/sw/src/track.cpp +++ b/source/games/sw/src/track.cpp @@ -2949,7 +2949,7 @@ DoAutoTurretObject(SECTOR_OBJECTp sop) shootp = &sprite[sop->sp_num[i]]; if (!FAFcansee(shootp->x, shootp->y, shootp->z-Z(4), shootp->sectnum, - u->tgt_sp()->x, u->tgt_sp()->y, SPRITEp_UPPER(u->tgt_sp()), u->tgt_sp()->sectnum)) + u->targetActor->s().x, u->targetActor->s().y, SPRITEp_UPPER(u->tgt_sp()), u->targetActor->s().sectnum)) { return; } @@ -2983,8 +2983,8 @@ DoAutoTurretObject(SECTOR_OBJECTp sop) } } - //sop->ang_tgt = getangle(sop->xmid - u->tgt_sp()->x, sop->ymid - u->tgt_sp()->y); - sop->ang_tgt = getangle(u->tgt_sp()->x - sop->xmid, u->tgt_sp()->y - sop->ymid); + //sop->ang_tgt = getangle(sop->xmid - u->targetActor->s().x, sop->ymid - u->targetActor->s().y); + sop->ang_tgt = getangle(u->targetActor->s().x - sop->xmid, u->targetActor->s().y - sop->ymid); // get delta to target angle delta_ang = getincangle(sop->ang, sop->ang_tgt); diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index 56a7fe17c..35bec96b2 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -5346,7 +5346,7 @@ ActorHealth(short SpriteNum, short amt) PlaySound(DIGI_NINJACHOKE, sp, v3df_follow); InitPlasmaFountain(nullptr, sp); InitBloodSpray(SpriteNum,false,105); - sp->ang = NORM_ANGLE(getangle(u->tgt_sp()->x - sp->x, u->tgt_sp()->y - sp->y) + 1024); + sp->ang = NORM_ANGLE(getangle(u->targetActor->s().x - sp->x, u->targetActor->s().y - sp->y) + 1024); RESET(sp->cstat, CSTAT_SPRITE_YFLIP); if (sw_ninjahack) NewStateGroup(SpriteNum, sg_NinjaHariKari); @@ -10149,7 +10149,7 @@ DoRocket(DSWActor* actor) if ((u->FlagOwner -= ACTORMOVETICS)<=0 && u->spal == 20) { - DISTANCE(sp->x, sp->y, u->tgt_sp()->x, u->tgt_sp()->y, dist, a, b, c); + DISTANCE(sp->x, sp->y, u->targetActor->s().x, u->targetActor->s().y, dist, a, b, c); u->FlagOwner = dist>>6; // Special warn sound attached to each seeker spawned PlaySound(DIGI_MINEBEEP, sp, v3df_follow); @@ -12815,7 +12815,7 @@ DoSerpRing(DSWActor* actor) !TEST(User[ou->tgt_sp()-sprite]->PlayerP->Flags, PF_DEAD)) { u->targetActor = ou->targetActor; - DISTANCE(sp->x, sp->y, u->tgt_sp()->x, u->tgt_sp()->y, dist, a,b,c); + DISTANCE(sp->x, sp->y, u->targetActor->s().x, u->targetActor->s().y, dist, a,b,c); // if ((dist ok and random ok) OR very few skulls left) if ((dist < 18000 && (RANDOM_P2(2048<<5)>>5) < 16) || User[sp->owner]->Counter < 4) @@ -12828,7 +12828,7 @@ DoSerpRing(DSWActor* actor) { extern STATEp sg_SkullJump[]; u->ID = SKULL_R0; - sp->ang = getangle(u->tgt_sp()->x - sp->x, u->tgt_sp()->y - sp->y); + sp->ang = getangle(u->targetActor->s().x - sp->x, u->targetActor->s().y - sp->y); sp->xvel = dist>>5; sp->xvel += DIV2(sp->xvel); sp->xvel += (RANDOM_P2(128<<8)>>8); @@ -12878,7 +12878,7 @@ InitLavaThrow(DSWActor* actor) //PlaySound(DIGI_NINJAROCKETATTACK, sp, v3df_none); // get angle to player and also face player when attacking - sp->ang = nang = getangle(u->tgt_sp()->x - sp->x, u->tgt_sp()->y - sp->y); + sp->ang = nang = getangle(u->targetActor->s().x - sp->x, u->targetActor->s().y - sp->y); nx = sp->x; ny = sp->y; @@ -12917,7 +12917,7 @@ InitLavaThrow(DSWActor* actor) MissileSetPos(w, DoLavaBoulder, 1200); // find the distance to the target (player) - dist = Distance(wp->x, wp->y, u->tgt_sp()->x, u->tgt_sp()->y); + dist = Distance(wp->x, wp->y, u->targetActor->s().x, u->targetActor->s().y); if (dist != 0) wu->zchange = wp->zvel = (wp->xvel * (SPRITEp_UPPER(u->tgt_sp()) - wp->z)) / dist; @@ -13243,7 +13243,7 @@ InitEnemyNapalm(DSWActor* actor) } // find the distance to the target (player) - dist = Distance(wp->x, wp->y, u->tgt_sp()->x, u->tgt_sp()->y); + dist = Distance(wp->x, wp->y, u->targetActor->s().x, u->targetActor->s().y); if (dist != 0) wp->zvel = (wp->xvel * (SPRITEp_UPPER(u->tgt_sp()) - wp->z)) / dist; @@ -13352,7 +13352,7 @@ InitEnemyMirv(DSWActor* actor) MissileSetPos(w, DoMirv, 600); // find the distance to the target (player) - dist = Distance(wp->x, wp->y, u->tgt_sp()->x, u->tgt_sp()->y); + dist = Distance(wp->x, wp->y, u->targetActor->s().x, u->targetActor->s().y); if (dist != 0) wu->zchange = wp->zvel = (wp->xvel * (SPRITEp_UPPER(u->tgt_sp()) - wp->z)) / dist; @@ -13812,7 +13812,7 @@ InitSumoNapalm(short SpriteNum) } // find the distance to the target (player) - dist = Distance(wp->x, wp->y, u->tgt_sp()->x, u->tgt_sp()->y); + dist = Distance(wp->x, wp->y, u->targetActor->s().x, u->targetActor->s().y); if (dist != 0) wp->zvel = (wp->xvel * (SPRITEp_UPPER(u->tgt_sp()) - wp->z)) / dist; @@ -13943,7 +13943,7 @@ InitMiniSumoClap(short SpriteNum) if (!u->tgt_sp()) return 0; - dist = Distance(sp->x, sp->y, u->tgt_sp()->x, u->tgt_sp()->y); + dist = Distance(sp->x, sp->y, u->targetActor->s().x, u->targetActor->s().y); reach = 10000; @@ -13951,7 +13951,7 @@ InitMiniSumoClap(short SpriteNum) { if (SpriteOverlapZ(SpriteNum, short(u->tgt_sp() - sprite), Z(20))) { - if (FAFcansee(u->tgt_sp()->x,u->tgt_sp()->y,SPRITEp_MID(u->tgt_sp()),u->tgt_sp()->sectnum,sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum)) + if (FAFcansee(u->targetActor->s().x,u->targetActor->s().y,SPRITEp_MID(u->tgt_sp()),u->targetActor->s().sectnum,sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum)) { PlaySound(DIGI_CGTHIGHBONE, sp, v3df_follow|v3df_dontpan); DoDamage(short(u->tgt_sp() - sprite), SpriteNum); @@ -13960,7 +13960,7 @@ InitMiniSumoClap(short SpriteNum) } else if (dist < CLOSE_RANGE_DIST_FUDGE(u->tgt_sp(), sp, reach)) { - if (FAFcansee(u->tgt_sp()->x,u->tgt_sp()->y,SPRITEp_MID(u->tgt_sp()),u->tgt_sp()->sectnum,sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum)) + if (FAFcansee(u->targetActor->s().x,u->targetActor->s().y,SPRITEp_MID(u->tgt_sp()),u->targetActor->s().sectnum,sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum)) { PlaySound(DIGI_30MMEXPLODE, sp, v3df_none); SpawnFireballFlames(SpriteNum, short(u->tgt_sp() - sprite)); @@ -16033,7 +16033,7 @@ InitSerpSpell(DSWActor* actor) for (i = 0; i < 2; i++) { - sp->ang = getangle(u->tgt_sp()->x - sp->x, u->tgt_sp()->y - sp->y); + sp->ang = getangle(u->targetActor->s().x - sp->x, u->targetActor->s().y - sp->y); New = SpawnSprite(STAT_MISSILE, SERP_METEOR, &sg_SerpMeteor[0][0], sp->sectnum, sp->x, sp->y, sp->z, sp->ang, 1500); @@ -16070,7 +16070,7 @@ InitSerpSpell(DSWActor* actor) np->ang = NORM_ANGLE(np->ang - lat_ang[i]); // find the distance to the target (player) - dist = Distance(np->x, np->y, u->tgt_sp()->x, u->tgt_sp()->y); + dist = Distance(np->x, np->y, u->targetActor->s().x, u->targetActor->s().y); if (dist != 0) np->zvel = (np->xvel * (SPRITEp_UPPER(u->tgt_sp()) - np->z)) / dist; @@ -16153,7 +16153,7 @@ InitSerpMonstSpell(DSWActor* actor) for (i = 0; i < 1; i++) { - sp->ang = getangle(u->tgt_sp()->x - sp->x, u->tgt_sp()->y - sp->y); + sp->ang = getangle(u->targetActor->s().x - sp->x, u->targetActor->s().y - sp->y); New = SpawnSprite(STAT_MISSILE, SERP_METEOR, &sg_SerpMeteor[0][0], sp->sectnum, sp->x, sp->y, sp->z, sp->ang, 500); @@ -16190,7 +16190,7 @@ InitSerpMonstSpell(DSWActor* actor) np->ang = NORM_ANGLE(np->ang - lat_ang[i]); // find the distance to the target (player) - dist = Distance(np->x, np->y, u->tgt_sp()->x, u->tgt_sp()->y); + dist = Distance(np->x, np->y, u->targetActor->s().x, u->targetActor->s().y); if (dist != 0) np->zvel = (np->xvel * (SPRITEp_UPPER(u->tgt_sp()) - np->z)) / dist; @@ -16239,7 +16239,7 @@ InitEnemyRocket(DSWActor* actor) PlaySound(DIGI_NINJARIOTATTACK, sp, v3df_none); // get angle to player and also face player when attacking - sp->ang = nang = getangle(u->tgt_sp()->x - sp->x, u->tgt_sp()->y - sp->y); + sp->ang = nang = getangle(u->targetActor->s().x - sp->x, u->targetActor->s().y - sp->y); nx = sp->x; ny = sp->y; @@ -16247,9 +16247,9 @@ InitEnemyRocket(DSWActor* actor) // Spawn a shot // wp = &sprite[w = SpawnSprite(STAT_MISSILE, STAR1, s_Star, sp->sectnum, - // nx, ny, nz, u->tgt_sp()->ang, 250)]; + // nx, ny, nz, u->targetActor->s().ang, 250)]; w = SpawnSprite(STAT_MISSILE, BOLT_THINMAN_R2, &s_Rocket[0][0], sp->sectnum, - nx, ny, nz-Z(8), u->tgt_sp()->ang, NINJA_BOLT_VELOCITY); + nx, ny, nz-Z(8), u->targetActor->s().ang, NINJA_BOLT_VELOCITY); wp = &sprite[w]; wu = User[w].Data(); @@ -16285,7 +16285,7 @@ InitEnemyRocket(DSWActor* actor) MissileSetPos(w, DoBoltThinMan, 400); // find the distance to the target (player) - dist = Distance(wp->x, wp->y, u->tgt_sp()->x, u->tgt_sp()->y); + dist = Distance(wp->x, wp->y, u->targetActor->s().x, u->targetActor->s().y); if (dist != 0) wu->zchange = wp->zvel = (wp->xvel * (SPRITEp_UPPER(u->tgt_sp()) - wp->z)) / dist; @@ -16327,7 +16327,7 @@ InitEnemyRail(DSWActor* actor) PlaySound(DIGI_RAILFIRE, sp, v3df_dontpan|v3df_doppler); // get angle to player and also face player when attacking - sp->ang = nang = getangle(u->tgt_sp()->x - sp->x, u->tgt_sp()->y - sp->y); + sp->ang = nang = getangle(u->targetActor->s().x - sp->x, u->targetActor->s().y - sp->y); // add a bit of randomness if (RANDOM_P2(1024) < 512) @@ -16380,7 +16380,7 @@ InitEnemyRail(DSWActor* actor) } // find the distance to the target (player) - dist = Distance(wp->x, wp->y, u->tgt_sp()->x, u->tgt_sp()->y); + dist = Distance(wp->x, wp->y, u->targetActor->s().x, u->targetActor->s().y); if (dist != 0) wu->zchange = wp->zvel = (wp->xvel * (SPRITEp_UPPER(u->tgt_sp()) - wp->z)) / dist; @@ -16418,7 +16418,7 @@ InitZillaRocket(DSWActor* actor) PlaySound(DIGI_NINJARIOTATTACK, sp, v3df_none); // get angle to player and also face player when attacking - sp->ang = nang = getangle(u->tgt_sp()->x - sp->x, u->tgt_sp()->y - sp->y); + sp->ang = nang = getangle(u->targetActor->s().x - sp->x, u->targetActor->s().y - sp->y); for (i = 0; i < (int)SIZ(mp); i++) { @@ -16428,9 +16428,9 @@ InitZillaRocket(DSWActor* actor) // Spawn a shot // wp = &sprite[w = SpawnSprite(STAT_MISSILE, STAR1, s_Star, sp->sectnum, - // nx, ny, nz, u->tgt_sp()->ang, 250)]; + // nx, ny, nz, u->targetActor->s().ang, 250)]; w = SpawnSprite(STAT_MISSILE, BOLT_THINMAN_R2, &s_Rocket[0][0], sp->sectnum, - nx, ny, nz-Z(8), u->tgt_sp()->ang, NINJA_BOLT_VELOCITY); + nx, ny, nz-Z(8), u->targetActor->s().ang, NINJA_BOLT_VELOCITY); wp = &sprite[w]; wu = User[w].Data(); @@ -16470,7 +16470,7 @@ InitZillaRocket(DSWActor* actor) MissileSetPos(w, DoBoltThinMan, mp[i].dist_out); // find the distance to the target (player) - dist = Distance(wp->x, wp->y, u->tgt_sp()->x, u->tgt_sp()->y); + dist = Distance(wp->x, wp->y, u->targetActor->s().x, u->targetActor->s().y); if (dist != 0) wu->zchange = wp->zvel = (wp->xvel * (SPRITEp_UPPER(u->tgt_sp()) - wp->z)) / dist; @@ -16490,7 +16490,7 @@ InitEnemyStar(DSWActor* actor) short w; // get angle to player and also face player when attacking - sp->ang = nang = NORM_ANGLE(getangle(u->tgt_sp()->x - sp->x, u->tgt_sp()->y - sp->y)); + sp->ang = nang = NORM_ANGLE(getangle(u->targetActor->s().x - sp->x, u->targetActor->s().y - sp->y)); nx = sp->x; ny = sp->y; @@ -16498,7 +16498,7 @@ InitEnemyStar(DSWActor* actor) // Spawn a shot wp = &sprite[w = SpawnSprite(STAT_MISSILE, STAR1, s_Star, sp->sectnum, - nx, ny, nz, u->tgt_sp()->ang, NINJA_STAR_VELOCITY)]; + nx, ny, nz, u->targetActor->s().ang, NINJA_STAR_VELOCITY)]; wu = User[w].Data(); @@ -16518,7 +16518,7 @@ InitEnemyStar(DSWActor* actor) MissileSetPos(w, DoStar, 400); // find the distance to the target (player) - dist = Distance(wp->x, wp->y, u->tgt_sp()->x, u->tgt_sp()->y); + dist = Distance(wp->x, wp->y, u->targetActor->s().x, u->targetActor->s().y); if (dist != 0) wu->zchange = wp->zvel = (wp->xvel * (SPRITEp_UPPER(u->tgt_sp()) - wp->z)) / dist; @@ -16581,7 +16581,7 @@ InitEnemyCrossbow(DSWActor* actor) short w; // get angle to player and also face player when attacking - sp->ang = nang = NORM_ANGLE(getangle(u->tgt_sp()->x - sp->x, u->tgt_sp()->y - sp->y)); + sp->ang = nang = NORM_ANGLE(getangle(u->targetActor->s().x - sp->x, u->targetActor->s().y - sp->y)); nx = sp->x; ny = sp->y; @@ -16589,7 +16589,7 @@ InitEnemyCrossbow(DSWActor* actor) // Spawn a shot wp = &sprite[w = SpawnSprite(STAT_MISSILE, CROSSBOLT, &s_CrossBolt[0][0], sp->sectnum, - nx, ny, nz, u->tgt_sp()->ang, 800)]; + nx, ny, nz, u->targetActor->s().ang, 800)]; wu = User[w].Data(); @@ -16614,7 +16614,7 @@ InitEnemyCrossbow(DSWActor* actor) MissileSetPos(w, DoStar, 400); // find the distance to the target (player) - dist = Distance(wp->x, wp->y, u->tgt_sp()->x, u->tgt_sp()->y); + dist = Distance(wp->x, wp->y, u->targetActor->s().x, u->targetActor->s().y); if (dist != 0) wu->zchange = wp->zvel = (wp->xvel * (SPRITEp_UPPER(u->tgt_sp()) - wp->z)) / dist; @@ -16680,7 +16680,7 @@ InitSkelSpell(DSWActor* actor) PlaySound(DIGI_SPELEC, sp, v3df_none); // get angle to player and also face player when attacking - sp->ang = nang = NORM_ANGLE(getangle(u->tgt_sp()->x - sp->x, u->tgt_sp()->y - sp->y)); + sp->ang = nang = NORM_ANGLE(getangle(u->targetActor->s().x - sp->x, u->targetActor->s().y - sp->y)); nx = sp->x; ny = sp->y; @@ -16688,7 +16688,7 @@ InitSkelSpell(DSWActor* actor) // Spawn a shot w = SpawnSprite(STAT_MISSILE, ELECTRO_ENEMY, s_Electro, sp->sectnum, - nx, ny, nz, u->tgt_sp()->ang, SKEL_ELECTRO_VELOCITY); + nx, ny, nz, u->targetActor->s().ang, SKEL_ELECTRO_VELOCITY); wp = &sprite[w]; wu = User[w].Data(); @@ -16703,7 +16703,7 @@ InitSkelSpell(DSWActor* actor) SET(wp->cstat, CSTAT_SPRITE_YCENTER); // find the distance to the target (player) - dist = Distance(nx, ny, u->tgt_sp()->x, u->tgt_sp()->y); + dist = Distance(nx, ny, u->targetActor->s().x, u->targetActor->s().y); if (dist != 0) wp->zvel = (wp->xvel * (SPRITEp_UPPER(u->tgt_sp()) - nz)) / dist; @@ -16729,7 +16729,7 @@ InitCoolgFire(DSWActor* actor) short w; // get angle to player and also face player when attacking - sp->ang = nang = NORM_ANGLE(getangle(u->tgt_sp()->x - sp->x, u->tgt_sp()->y - sp->y)); + sp->ang = nang = NORM_ANGLE(getangle(u->targetActor->s().x - sp->x, u->targetActor->s().y - sp->y)); nx = sp->x; ny = sp->y; @@ -16742,7 +16742,7 @@ InitCoolgFire(DSWActor* actor) PlaySound(DIGI_CGMAGIC, sp, v3df_follow); w = SpawnSprite(STAT_MISSILE, COOLG_FIRE, s_CoolgFire, sp->sectnum, - nx, ny, nz, u->tgt_sp()->ang, COOLG_FIRE_VELOCITY); + nx, ny, nz, u->targetActor->s().ang, COOLG_FIRE_VELOCITY); wp = &sprite[w]; wu = User[w].Data(); @@ -16766,7 +16766,7 @@ InitCoolgFire(DSWActor* actor) PlaySound(DIGI_MAGIC1, wp, v3df_follow|v3df_doppler); // find the distance to the target (player) - dist = Distance(nx, ny, u->tgt_sp()->x, u->tgt_sp()->y); + dist = Distance(nx, ny, u->targetActor->s().x, u->targetActor->s().y); if (dist != 0) // (velocity * difference between the target and the throwing star) / @@ -17055,7 +17055,7 @@ InitSpearTrap(short SpriteNum) //MissileSetPos(w, DoStar, 400); // find the distance to the target (player) - //int dist = Distance(wp->x, wp->y, u->tgt_sp()->x, u->tgt_sp()->y); + //int dist = Distance(wp->x, wp->y, u->targetActor->s().x, u->targetActor->s().y); //if (dist != 0) //wu->zchange = wp->zvel = (wp->xvel * (SPRITEp_UPPER(u->tgt_sp()) - wp->z)) / dist;