diff --git a/source/games/sw/src/coolg.cpp b/source/games/sw/src/coolg.cpp index b05d7976e..27925d3ba 100644 --- a/source/games/sw/src/coolg.cpp +++ b/source/games/sw/src/coolg.cpp @@ -628,7 +628,7 @@ int DoCoolgMatchPlayerZ(DSWActor* actor) // actor does a sine wave about u->sz - this is the z mid point - zdiff = (ActorMid(u->targetActor)) - u->sz; + zdiff = (ActorZOfMiddle(u->targetActor)) - u->sz; // check z diff of the player and the sprite zdist = Z(20 + RandomRange(100)); // put a random amount diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index 39d36c0c6..d4ec1379d 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -2214,9 +2214,7 @@ inline int ActorSizeY(DSWActor* sp) inline int Facing(DSWActor* actor1, DSWActor* actor2) { - auto sp1 = &actor1->s(); - auto sp2 = &actor2->s(); - return (abs(getincangle(getangle((sp1)->pos.X - (sp2)->pos.X, (sp1)->pos.Y - (sp2)->pos.Y), (sp2)->ang)) < 512); + return (abs(getincangle(getangle(actor1->spr.pos.X - actor2->spr.pos.X, actor1->spr.pos.Y - actor2->spr.pos.Y), actor2->spr.ang)) < 512); } // Given a z height and sprite return the correct y repeat value diff --git a/source/games/sw/src/hornet.cpp b/source/games/sw/src/hornet.cpp index b043d12af..a0d3e3cfa 100644 --- a/source/games/sw/src/hornet.cpp +++ b/source/games/sw/src/hornet.cpp @@ -566,14 +566,13 @@ int DoCheckSwarm(DSWActor* actor) SWStatIterator it(STAT_ENEMY); while (auto itActor = it.Next()) { - tsp = &itActor->s(); tu = itActor->u(); if (!tu) continue; - if (tsp->hitag != TAG_SWARMSPOT || tsp->lotag != 2) continue; + if (itActor->spr.hitag != TAG_SWARMSPOT || itActor->spr.lotag != 2) continue; - DISTANCE(actor->spr.pos.X, actor->spr.pos.Y, tsp->pos.X, tsp->pos.Y, dist, a, b, c); + DISTANCE(actor->spr.pos.X, actor->spr.pos.Y, itActor->spr.pos.X, itActor->spr.pos.Y, dist, a, b, c); if (dist < pdist && u->ID == tu->ID) // Only flock to your own kind { diff --git a/source/games/sw/src/inv.cpp b/source/games/sw/src/inv.cpp index e07492848..4b03324ba 100644 --- a/source/games/sw/src/inv.cpp +++ b/source/games/sw/src/inv.cpp @@ -285,7 +285,7 @@ void UseInventoryRepairKit(PLAYERp pp) void UseInventoryCloak(PLAYERp pp) { - SPRITEp sp = &pp->Actor()->s(); + DSWActor* plActor = pp->actor; if (pp->InventoryActive[pp->InventoryNum]) { @@ -300,18 +300,17 @@ void UseInventoryCloak(PLAYERp pp) // on/off PlayerUpdateInventory(pp, pp->InventoryNum); - SET(sp->cstat, CSTAT_SPRITE_TRANSLUCENT); - sp->shade = 100; + SET(plActor->spr.cstat, CSTAT_SPRITE_TRANSLUCENT); + plActor->spr.shade = 100; PlaySound(DIGI_GASPOP, pp, v3df_none); - //if(RandomRange(1000) > 950) if (pp == Player+myconnectindex) PlayerSound(DIGI_IAMSHADOW, v3df_follow|v3df_dontpan,pp); } void StopInventoryCloak(PLAYERp pp, short InventoryNum) { - SPRITEp sp = &pp->Actor()->s(); + DSWActor* plActor = pp->actor; pp->InventoryActive[InventoryNum] = false; @@ -325,8 +324,8 @@ void StopInventoryCloak(PLAYERp pp, short InventoryNum) // on/off PlayerUpdateInventory(pp, InventoryNum); - RESET(sp->cstat, CSTAT_SPRITE_TRANSLUCENT); - sp->shade = 0; + RESET(plActor->spr.cstat, CSTAT_SPRITE_TRANSLUCENT); + plActor->spr.shade = 0; PlaySound(DIGI_GASPOP, pp, v3df_none); } diff --git a/source/games/sw/src/jweapon.cpp b/source/games/sw/src/jweapon.cpp index a95e61a3e..71f0dad03 100644 --- a/source/games/sw/src/jweapon.cpp +++ b/source/games/sw/src/jweapon.cpp @@ -2188,8 +2188,8 @@ int DoCarryFlagNoDet(DSWActor* actor) } // if in score box, score. - if (ap->sector()->hitag == 9000 && ap->sector()->lotag == ap->pal - && ap->pal != actor->spr.pal) + if (attached->spr.sector()->hitag == 9000 && attached->spr.sector()->lotag == attached->spr.pal + && attached->spr.pal != actor->spr.pal) { if (u->flagOwnerActor != nullptr) { @@ -2200,7 +2200,7 @@ int DoCarryFlagNoDet(DSWActor* actor) if (!TEST_BOOL1(fp)) { PlaySound(DIGI_BIGITEM, u->attachActor, v3df_none); - DoFlagScore(ap->pal); + DoFlagScore(attached->spr.pal); if (SP_TAG5(fp) > 0) { fu->filler++; diff --git a/source/games/sw/src/miscactr.cpp b/source/games/sw/src/miscactr.cpp index 165afe7f2..c501b9ad0 100644 --- a/source/games/sw/src/miscactr.cpp +++ b/source/games/sw/src/miscactr.cpp @@ -153,7 +153,7 @@ int DoToiletGirl(DSWActor* actor) bool ICanSee = false; DoActorPickClosePlayer(actor); - ICanSee = FAFcansee(actor->spr.pos.X,actor->spr.pos.Y,ActorZOfMiddle(actor),actor->spr.sector(),u->targetActor->spr.pos.X,u->targetActor->spr.pos.Y,ActorMid(u->targetActor),u->targetActor->spr.sector()); + ICanSee = FAFcansee(actor->spr.pos.X,actor->spr.pos.Y,ActorZOfMiddle(actor),actor->spr.sector(),u->targetActor->spr.pos.X,u->targetActor->spr.pos.Y,ActorZOfMiddle(u->targetActor),u->targetActor->spr.sector()); if (u->FlagOwner != 1) { @@ -385,7 +385,7 @@ int DoWashGirl(DSWActor* actor) bool ICanSee = false; DoActorPickClosePlayer(actor); - ICanSee = FAFcansee(actor->spr.pos.X,actor->spr.pos.Y,ActorZOfMiddle(actor),actor->spr.sector(),u->targetActor->spr.pos.X,u->targetActor->spr.pos.Y,ActorMid(u->targetActor),u->targetActor->spr.sector()); + ICanSee = FAFcansee(actor->spr.pos.X,actor->spr.pos.Y,ActorZOfMiddle(actor),actor->spr.sector(),u->targetActor->spr.pos.X,u->targetActor->spr.pos.Y,ActorZOfMiddle(u->targetActor),u->targetActor->spr.sector()); if (RandomRange(1000) > 980 && u->ShellNum <= 0) { @@ -1234,7 +1234,7 @@ int DoCarGirl(DSWActor* actor) bool ICanSee = false; DoActorPickClosePlayer(actor); - ICanSee = FAFcansee(actor->spr.pos.X,actor->spr.pos.Y,ActorZOfMiddle(actor),actor->spr.sector(),u->targetActor->spr.pos.X,u->targetActor->spr.pos.Y,ActorMid(u->targetActor),u->targetActor->spr.sector()); + ICanSee = FAFcansee(actor->spr.pos.X,actor->spr.pos.Y,ActorZOfMiddle(actor),actor->spr.sector(),u->targetActor->spr.pos.X,u->targetActor->spr.pos.Y,ActorZOfMiddle(u->targetActor),u->targetActor->spr.sector()); if (u->FlagOwner == 1) { @@ -1445,7 +1445,7 @@ int DoMechanicGirl(DSWActor* actor) bool ICanSee = false; DoActorPickClosePlayer(actor); - ICanSee = FAFcansee(actor->spr.pos.X,actor->spr.pos.Y,ActorZOfMiddle(actor),actor->spr.sector(),u->targetActor->spr.pos.X,u->targetActor->spr.pos.Y,ActorMid(u->targetActor),u->targetActor->spr.sector()); + ICanSee = FAFcansee(actor->spr.pos.X,actor->spr.pos.Y,ActorZOfMiddle(actor),actor->spr.sector(),u->targetActor->spr.pos.X,u->targetActor->spr.pos.Y,ActorZOfMiddle(u->targetActor),u->targetActor->spr.sector()); if (u->FlagOwner == 1) { @@ -1658,7 +1658,7 @@ int DoSailorGirl(DSWActor* actor) bool ICanSee = false; DoActorPickClosePlayer(actor); - ICanSee = FAFcansee(actor->spr.pos.X,actor->spr.pos.Y,ActorZOfMiddle(actor),actor->spr.sector(),u->targetActor->spr.pos.X,u->targetActor->spr.pos.Y,ActorMid(u->targetActor),u->targetActor->spr.sector()); + ICanSee = FAFcansee(actor->spr.pos.X,actor->spr.pos.Y,ActorZOfMiddle(actor),actor->spr.sector(),u->targetActor->spr.pos.X,u->targetActor->spr.pos.Y,ActorZOfMiddle(u->targetActor),u->targetActor->spr.sector()); if (u->FlagOwner == 1) { @@ -1862,7 +1862,7 @@ int DoPruneGirl(DSWActor* actor) bool ICanSee = false; DoActorPickClosePlayer(actor); - ICanSee = FAFcansee(actor->spr.pos.X,actor->spr.pos.Y,ActorZOfMiddle(actor),actor->spr.sector(),u->targetActor->spr.pos.X,u->targetActor->spr.pos.Y,ActorMid(u->targetActor),u->targetActor->spr.sector()); + ICanSee = FAFcansee(actor->spr.pos.X,actor->spr.pos.Y,ActorZOfMiddle(actor),actor->spr.sector(),u->targetActor->spr.pos.X,u->targetActor->spr.pos.Y,ActorZOfMiddle(u->targetActor),u->targetActor->spr.sector()); if (u->FlagOwner == 1) { diff --git a/source/games/sw/src/rotator.cpp b/source/games/sw/src/rotator.cpp index 5150a94ea..e8a677aa9 100644 --- a/source/games/sw/src/rotator.cpp +++ b/source/games/sw/src/rotator.cpp @@ -74,15 +74,12 @@ void ReverseRotator(DSWActor* actor) bool RotatorSwitch(short match, short setting) { - SPRITEp sp; bool found = false; SWStatIterator it(STAT_DEFAULT); while (auto actor = it.Next()) { - sp = &actor->s(); - - if (sp->lotag == TAG_SPRITE_SWITCH_VATOR && sp->hitag == match) + if (actor->spr.lotag == TAG_SPRITE_SWITCH_VATOR && actor->spr.hitag == match) { found = true; AnimateSwitch(actor, setting); @@ -95,7 +92,6 @@ bool RotatorSwitch(short match, short setting) void SetRotatorActive(DSWActor* actor) { USERp u = actor->u(); - SPRITEp sp = &actor->s(); ROTATORp r; r = u->rotator.Data(); @@ -230,9 +226,7 @@ bool TestRotatorMatchActive(short match) void DoRotatorSetInterp(DSWActor* actor) { - SPRITEp sp = &actor->s(); - - for(auto& wal : wallsofsector(sp->sector())) + for(auto& wal : wallsofsector(actor->spr.sector())) { StartInterpolation(&wal, Interp_Wall_X); StartInterpolation(&wal, Interp_Wall_Y); @@ -248,8 +242,7 @@ void DoRotatorSetInterp(DSWActor* actor) void DoRotatorStopInterp(DSWActor* actor) { - SPRITEp sp = &actor->s(); - for (auto& wal : wallsofsector(sp->sector())) + for (auto& wal : wallsofsector(actor->spr.sector())) { StopInterpolation(&wal, Interp_Wall_X); StopInterpolation(&wal, Interp_Wall_Y); @@ -266,7 +259,6 @@ void DoRotatorStopInterp(DSWActor* actor) int DoRotator(DSWActor* actor) { USERp u = actor->u(); - SPRITEp sp = &actor->s(); ROTATORp r; short ndx,w,startwall,endwall; SPRITEp pivot = nullptr; @@ -311,8 +303,8 @@ int DoRotator(DSWActor* actor) r->vel = -r->vel; SetRotatorInactive(actor); - if (SP_TAG6(sp)) - DoMatchEverything(nullptr, SP_TAG6(sp), -1); + if (SP_TAG6(actor)) + DoMatchEverything(nullptr, SP_TAG6(actor), -1); // wait a bit and close it if (u->WaitTics) @@ -338,11 +330,11 @@ int DoRotator(DSWActor* actor) //RotatorSwitch(match, OFF); } - if (SP_TAG6(sp) && TEST_BOOL5(sp)) - DoMatchEverything(nullptr, SP_TAG6(sp), -1); + if (SP_TAG6(actor) && TEST_BOOL5(actor)) + DoMatchEverything(nullptr, SP_TAG6(actor), -1); } - if (TEST_BOOL2(sp)) + if (TEST_BOOL2(actor)) kill = true; } @@ -351,9 +343,9 @@ int DoRotator(DSWActor* actor) while (auto itActor = it.Next()) { auto itsp = &itActor->s(); - if (itsp->lotag == sp->lotag) + if (itsp->lotag == actor->spr.lotag) { - dist = Distance(sp->pos.X, sp->pos.Y, itsp->pos.X, itsp->pos.Y); + dist = Distance(actor->spr.pos.X, actor->spr.pos.Y, itsp->pos.X, itsp->pos.Y); if (dist < closest) { closest = dist; @@ -367,7 +359,7 @@ int DoRotator(DSWActor* actor) // move points ndx = 0; - for(auto& wal : wallsofsector(sp->sector())) + for(auto& wal : wallsofsector(actor->spr.sector())) { vec2_t const orig = { r->origX[ndx], r->origY[ndx] }; rotatepoint(pivot->pos.vec2, orig, r->pos, &nxy); diff --git a/source/games/sw/src/slidor.cpp b/source/games/sw/src/slidor.cpp index 8afb3dd70..de8f0a0ac 100644 --- a/source/games/sw/src/slidor.cpp +++ b/source/games/sw/src/slidor.cpp @@ -70,15 +70,12 @@ void ReverseSlidor(DSWActor* actor) bool SlidorSwitch(short match, short setting) { - SPRITEp sp; bool found = false; SWStatIterator it(STAT_DEFAULT); while (auto actor = it.Next()) { - sp = &actor->s(); - - if (sp->lotag == TAG_SPRITE_SWITCH_VATOR && sp->hitag == match) + if (actor->spr.lotag == TAG_SPRITE_SWITCH_VATOR && actor->spr.hitag == match) { found = true; AnimateSwitch(actor, setting); @@ -91,7 +88,6 @@ bool SlidorSwitch(short match, short setting) void SetSlidorActive(DSWActor* actor) { USERp u = actor->u(); - SPRITEp sp = &actor->s(); ROTATORp r; r = u->rotator.Data(); @@ -222,11 +218,11 @@ bool TestSlidorMatchActive(short match) void DoSlidorInterp(DSWActor* actor, INTERP_FUNC interp_func) { - auto sp = actor->spr.sector(); + auto sect = actor->spr.sector(); // this code is just weird. - auto startWall = sp->firstWall(); - auto endWall = sp->lastWall(); + auto startWall = sect->firstWall(); + auto endWall = sect->lastWall(); auto wal = startWall; do { @@ -274,11 +270,11 @@ void DoSlidorInterp(DSWActor* actor, INTERP_FUNC interp_func) int DoSlidorMoveWalls(DSWActor* actor, int amt) { - auto sp = actor->spr.sector(); + auto sect = actor->spr.sector(); // this code is just weird. - auto startWall = sp->firstWall(); - auto endWall = sp->lastWall(); + auto startWall = sect->firstWall(); + auto endWall = sect->lastWall(); auto wal = startWall; walltype* pwal; @@ -394,10 +390,9 @@ int DoSlidorMoveWalls(DSWActor* actor, int amt) int DoSlidorInstantClose(DSWActor* actor) { - SPRITEp sp = &actor->s(); int diff; - auto startwall = sp->sector()->firstWall(); + auto startwall = actor->spr.sector()->firstWall(); auto wal = startwall; do @@ -405,22 +400,22 @@ int DoSlidorInstantClose(DSWActor* actor) switch (wal->lotag) { case TAG_WALL_SLIDOR_LEFT: - diff = wal->pos.X - sp->pos.X; + diff = wal->pos.X - actor->spr.pos.X; DoSlidorMoveWalls(actor, diff); break; case TAG_WALL_SLIDOR_RIGHT: - diff = wal->pos.X - sp->pos.X; + diff = wal->pos.X - actor->spr.pos.X; DoSlidorMoveWalls(actor, -diff); break; case TAG_WALL_SLIDOR_UP: - diff = wal->pos.Y - sp->pos.Y; + diff = wal->pos.Y - actor->spr.pos.Y; DoSlidorMoveWalls(actor, diff); break; case TAG_WALL_SLIDOR_DOWN: - diff = wal->pos.Y - sp->pos.Y; + diff = wal->pos.Y - actor->spr.pos.Y; DoSlidorMoveWalls(actor, -diff); break; } @@ -436,7 +431,6 @@ int DoSlidorInstantClose(DSWActor* actor) int DoSlidor(DSWActor* actor) { USERp u = actor->u(); - SPRITEp sp = &actor->s(); ROTATORp r; int old_pos; bool kill = false; @@ -480,8 +474,8 @@ int DoSlidor(DSWActor* actor) r->vel = -r->vel; SetSlidorInactive(actor); - if (SP_TAG6(sp) && !TEST_BOOL8(sp)) - DoMatchEverything(nullptr, SP_TAG6(sp), -1); + if (SP_TAG6(actor) && !TEST_BOOL8(actor)) + DoMatchEverything(nullptr, SP_TAG6(actor), -1); // wait a bit and close it if (u->WaitTics) @@ -500,7 +494,7 @@ int DoSlidor(DSWActor* actor) r->tgt = r->open_dest; SetSlidorInactive(actor); - RESET_BOOL8(sp); + RESET_BOOL8(actor); // set Owner swith back to OFF // only if ALL vators are inactive @@ -509,22 +503,22 @@ int DoSlidor(DSWActor* actor) //SlidorSwitch(match, OFF); } - if (SP_TAG6(sp) && TEST_BOOL8(sp)) - DoMatchEverything(nullptr, SP_TAG6(sp), -1); + if (SP_TAG6(actor) && TEST_BOOL8(actor)) + DoMatchEverything(nullptr, SP_TAG6(actor), -1); } - if (TEST_BOOL2(sp)) + if (TEST_BOOL2(actor)) kill = true; } else { // if heading for the OFF (original) position and should NOT CRUSH - if (TEST_BOOL3(sp) && r->tgt == 0) + if (TEST_BOOL3(actor) && r->tgt == 0) { USERp bu; bool found = false; - SWSectIterator it(sp->sector()); + SWSectIterator it(actor->spr.sector()); while (auto itActor = it.Next()) { bu = itActor->u(); @@ -533,7 +527,7 @@ int DoSlidor(DSWActor* actor) { // found something blocking so reverse to ON position ReverseSlidor(actor); - SET_BOOL8(sp); // tell vator that something blocking door + SET_BOOL8(actor); // tell vator that something blocking door found = true; break; } @@ -548,8 +542,8 @@ int DoSlidor(DSWActor* actor) { pp = Player + pnum; - if (pp->lo_sectp == sp->sector() || - pp->hi_sectp == sp->sector()) + if (pp->lo_sectp == actor->spr.sector() || + pp->hi_sectp == actor->spr.sector()) { ReverseSlidor(actor); diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index e75ee800b..8cac639d7 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -12814,7 +12814,7 @@ int InitMiniSumoClap(DSWActor* actor) { if (SpriteOverlapZ(actor, targetActor, Z(20))) { - if (FAFcansee(tsp->pos.X, tsp->pos.Y, ActorMid(targetActor), tsp->sector(), actor->spr.pos.X, actor->spr.pos.Y, ActorZOfMiddle(actor), actor->spr.sector())) + if (FAFcansee(tsp->pos.X, tsp->pos.Y, ActorZOfMiddle(targetActor), tsp->sector(), actor->spr.pos.X, actor->spr.pos.Y, ActorZOfMiddle(actor), actor->spr.sector())) { PlaySound(DIGI_CGTHIGHBONE, actor, v3df_follow | v3df_dontpan); DoDamage(targetActor, actor); @@ -12823,7 +12823,7 @@ int InitMiniSumoClap(DSWActor* actor) } else if (dist < CloseRangeDist(targetActor, actor, reach)) { - if (FAFcansee(tsp->pos.X, tsp->pos.Y, ActorMid(targetActor), tsp->sector(), actor->spr.pos.X, actor->spr.pos.Y, ActorZOfMiddle(actor), actor->spr.sector())) + if (FAFcansee(tsp->pos.X, tsp->pos.Y, ActorZOfMiddle(targetActor), tsp->sector(), actor->spr.pos.X, actor->spr.pos.Y, ActorZOfMiddle(actor), actor->spr.sector())) { PlaySound(DIGI_30MMEXPLODE, actor, v3df_none); SpawnFireballFlames(actor, targetActor);