diff --git a/source/games/sw/src/actor.cpp b/source/games/sw/src/actor.cpp index ff4e2d5e7..61a77cd91 100644 --- a/source/games/sw/src/actor.cpp +++ b/source/games/sw/src/actor.cpp @@ -416,7 +416,7 @@ int DoActorDebris(DSWActor* actor) KillActor(actor); return 0; case ZILLA_RUN_R0: - getzsofslope(sp->sectnum, sp->x, sp->y, &u->hiz, &u->loz); + getzsofslopeptr(sp->sector(), sp->x, sp->y, &u->hiz, &u->loz); u->lo_sectp = sp->sector(); u->hi_sectp = sp->sector(); u->lowActor = nullptr; diff --git a/source/games/sw/src/bunny.cpp b/source/games/sw/src/bunny.cpp index 91dde8ee0..980235195 100644 --- a/source/games/sw/src/bunny.cpp +++ b/source/games/sw/src/bunny.cpp @@ -1158,7 +1158,7 @@ void BunnyHatch(DSWActor* actor) auto actorNew = InsertActor(sp->sector(), STAT_DEFAULT); np = &actorNew->s(); np->clear(); - np->sectnum = sp->sectnum; + np->setsector(sp->sector()); np->statnum = STAT_DEFAULT; np->x = sp->x; np->y = sp->y; @@ -1223,7 +1223,7 @@ DSWActor* BunnyHatch2(DSWActor* actor) auto actorNew = InsertActor(wp->sector(), STAT_DEFAULT); auto np = &actorNew->s(); np->clear(); - np->sectnum = wp->sectnum; + np->setsector(wp->sector()); np->statnum = STAT_DEFAULT; np->x = wp->x; np->y = wp->y; diff --git a/source/games/sw/src/draw.cpp b/source/games/sw/src/draw.cpp index cdccbbae2..f88ae9246 100644 --- a/source/games/sw/src/draw.cpp +++ b/source/games/sw/src/draw.cpp @@ -493,7 +493,7 @@ void WarpCopySprite(spritetype* tsprite, int& spritesortcnt) newTSpr->x = sp2->x - xoff; newTSpr->y = sp2->y - yoff; newTSpr->z = sp2->z - zoff; - newTSpr->sectnum = sp2->sectnum; + newTSpr->setsector(sp2->sector()); } it.Reset(sect2); @@ -617,7 +617,7 @@ void analyzesprites(spritetype* tsprite, int& spritesortcnt, int viewx, int view if (tsp->picnum == BETTY_R0 || tsp->picnum == FLOORBLOOD1) { auto sp = &tActor->s(); - int32_t const floorz = getflorzofslope(sp->sectnum, sp->x, sp->y); + int32_t const floorz = getflorzofslopeptr(sp->sector(), sp->x, sp->y); if (sp->z > floorz) tsp->z = floorz; } diff --git a/source/games/sw/src/jweapon.cpp b/source/games/sw/src/jweapon.cpp index edcc17c8b..7db18a4e8 100644 --- a/source/games/sw/src/jweapon.cpp +++ b/source/games/sw/src/jweapon.cpp @@ -382,7 +382,7 @@ int DoBloodSpray(DSWActor* actor) // special stuff for blood worm sp->z += (u->zchange >> 1); - getzsofslope(sp->sectnum, sp->x, sp->y, &cz, &fz); + getzsofslopeptr(sp->sector(), sp->x, sp->y, &cz, &fz); // pretend like we hit a sector if (sp->z >= fz) { diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index 88f9c3c29..65f916468 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -1287,7 +1287,7 @@ void DoPlayerTeleportToSprite(PLAYERp pp, vec3_t* sp, int ang) pp->posx = pp->oposx = pp->oldposx = sp->x; pp->posy = pp->oposy = pp->oldposy = sp->y; - //getzsofslope(sp->sectnum, pp->posx, pp->posy, &cz, &fz); + //getzsofslopeptr(sp->sector(), pp->posx, pp->posy, &cz, &fz); //pp->posz = pp->oposz = fz - PLAYER_HEIGHT; pp->posz = pp->oposz = sp->z - PLAYER_HEIGHT; diff --git a/source/games/sw/src/quake.cpp b/source/games/sw/src/quake.cpp index d310f5217..987298cac 100644 --- a/source/games/sw/src/quake.cpp +++ b/source/games/sw/src/quake.cpp @@ -59,8 +59,7 @@ void CopyQuakeSpotToOn(SPRITEp sp) memcpy(np, sp, sizeof(SPRITE)); - np->sectnum = sp->sectnum; - np->statnum = sp->statnum; + np->setsector(sp->sector()); np->cstat = 0; np->extra = 0; diff --git a/source/games/sw/src/ripper.cpp b/source/games/sw/src/ripper.cpp index d78500b44..c93977cf8 100644 --- a/source/games/sw/src/ripper.cpp +++ b/source/games/sw/src/ripper.cpp @@ -1221,7 +1221,7 @@ void RipperHatch(DSWActor* actor) np = &actorNew->s(); np->clear(); ClearOwner(actorNew); - np->sectnum = wp->sectnum; + np->setsector(wp->sector()); np->statnum = STAT_DEFAULT; np->x = wp->x; np->y = wp->y; diff --git a/source/games/sw/src/ripper2.cpp b/source/games/sw/src/ripper2.cpp index 77699c9d2..71e5a7fe0 100644 --- a/source/games/sw/src/ripper2.cpp +++ b/source/games/sw/src/ripper2.cpp @@ -1238,7 +1238,7 @@ void Ripper2Hatch(DSWActor* actor) np = &actorNew->s(); np->clear(); ClearOwner(actorNew); - np->sectnum = wp->sectnum; + np->setsector(wp->sector()); np->statnum = STAT_DEFAULT; np->x = wp->x; np->y = wp->y; diff --git a/source/games/sw/src/sector.cpp b/source/games/sw/src/sector.cpp index d89a51276..d40127979 100644 --- a/source/games/sw/src/sector.cpp +++ b/source/games/sw/src/sector.cpp @@ -908,7 +908,7 @@ void SectorExp(DSWActor* actor, short sectnum, short orig_ang, int zh) // setup vars needed by SectorExp ChangeActorSect(actor, sectnum); - getzsofslope(sp->sectnum, sp->x, sp->y, &u->hiz, &u->loz); + getzsofslopeptr(sp->sector(), sp->x, sp->y, &u->hiz, &u->loz); // spawn explosion auto explosion = SpawnSectorExp(actor); diff --git a/source/games/sw/src/slidor.cpp b/source/games/sw/src/slidor.cpp index b67eed124..3245421e3 100644 --- a/source/games/sw/src/slidor.cpp +++ b/source/games/sw/src/slidor.cpp @@ -524,7 +524,7 @@ int DoSlidor(DSWActor* actor) USERp bu; bool found = false; - SWSectIterator it(sp->sectnum); + SWSectIterator it(sp->sector()); while (auto itActor = it.Next()) { bsp = &itActor->s(); diff --git a/source/games/sw/src/spike.cpp b/source/games/sw/src/spike.cpp index cdb8fd348..0adddfcf3 100644 --- a/source/games/sw/src/spike.cpp +++ b/source/games/sw/src/spike.cpp @@ -98,9 +98,9 @@ void SetSpikeActive(DSWActor* actor) SECTORp sectp = sp->sector(); if (TEST(sp->cstat, CSTAT_SPRITE_YFLIP)) - StartInterpolation(sp->sectnum, Interp_Sect_Ceilingheinum); + StartInterpolation(sp->sector(), Interp_Sect_Ceilingheinum); else - StartInterpolation(sp->sectnum, Interp_Sect_Floorheinum); + StartInterpolation(sp->sector(), Interp_Sect_Floorheinum); InterpSectorSprites(sp->sectnum, true); @@ -126,9 +126,9 @@ void SetSpikeInactive(DSWActor* actor) SECTORp sectp = sp->sector(); if (TEST(sp->cstat, CSTAT_SPRITE_YFLIP)) - StopInterpolation(sp->sectnum, Interp_Sect_Ceilingheinum); + StopInterpolation(sp->sector(), Interp_Sect_Ceilingheinum); else - StopInterpolation(sp->sectnum, Interp_Sect_Floorheinum); + StopInterpolation(sp->sector(), Interp_Sect_Floorheinum); InterpSectorSprites(sp->sectnum, false); @@ -381,7 +381,7 @@ int DoSpike(DSWActor* actor) USERp bu; bool found = false; - SWSectIterator it(sp->sectnum); + SWSectIterator it(sp->sector()); while (auto itActor = it.Next()) { bsp = &actor->s(); diff --git a/source/games/sw/src/sprite.cpp b/source/games/sw/src/sprite.cpp index a098910e9..38c16d57d 100644 --- a/source/games/sw/src/sprite.cpp +++ b/source/games/sw/src/sprite.cpp @@ -1700,7 +1700,7 @@ void SpriteSetup(void) SPRITEp sp = &actor->s(); // not used yetv - getzsofslope(sp->sectnum, sp->x, sp->y, &cz, &fz); + getzsofslopeptr(sp->sector(), sp->x, sp->y, &cz, &fz); if (sp->z > DIV2(cz + fz)) { // closer to a floor @@ -1974,8 +1974,8 @@ void SpriteSetup(void) else sp->xvel = sp->lotag; - StartInterpolation(sp->sectnum, Interp_Sect_FloorPanX); - StartInterpolation(sp->sectnum, Interp_Sect_FloorPanY); + StartInterpolation(sp->sector(), Interp_Sect_FloorPanX); + StartInterpolation(sp->sector(), Interp_Sect_FloorPanY); change_actor_stat(actor, STAT_FLOOR_PAN); break; } @@ -1987,8 +1987,8 @@ void SpriteSetup(void) sp->xvel = 0; else sp->xvel = sp->lotag; - StartInterpolation(sp->sectnum, Interp_Sect_CeilingPanX); - StartInterpolation(sp->sectnum, Interp_Sect_CeilingPanY); + StartInterpolation(sp->sector(), Interp_Sect_CeilingPanX); + StartInterpolation(sp->sector(), Interp_Sect_CeilingPanY); change_actor_stat(actor, STAT_CEILING_PAN); break; } @@ -3705,7 +3705,7 @@ int ActorCoughItem(DSWActor* actor) switch (u->ID) { case SAILORGIRL_R0: - ASSERT(sp->sectnum >= 0); + ASSERT(sp->insector()); actorNew = InsertActor(sp->sector(), STAT_SPAWN_ITEMS); np = &actorNew->s(); np->cstat = np->extra = 0; @@ -3746,7 +3746,7 @@ int ActorCoughItem(DSWActor* actor) if (RANDOM_P2(1024) < 700) return 0; - ASSERT(sp->sectnum >= 0); + ASSERT(sp->insector()); actorNew = InsertActor(sp->sector(), STAT_SPAWN_ITEMS); np = &actorNew->s(); np->cstat = np->extra = 0; @@ -3774,7 +3774,7 @@ int ActorCoughItem(DSWActor* actor) if (RANDOM_P2(1024) < 700) return 0; - ASSERT(sp->sectnum >= 0); + ASSERT(sp->insector()); actorNew = InsertActor(sp->sector(), STAT_SPAWN_ITEMS); np = &actorNew->s(); np->cstat = np->extra = 0; @@ -3805,7 +3805,7 @@ int ActorCoughItem(DSWActor* actor) if (RANDOM_P2(1024) > 200) return 0; - ASSERT(sp->sectnum >= 0); + ASSERT(sp->insector()); actorNew = InsertActor(sp->sector(), STAT_SPAWN_ITEMS); np = &actorNew->s(); np->cstat = 0; @@ -3868,7 +3868,7 @@ int ActorCoughItem(DSWActor* actor) if (RANDOM_P2(1024) < 512) return 0; - ASSERT(sp->sectnum >= 0); + ASSERT(sp->insector()); actorNew = InsertActor(sp->sector(), STAT_SPAWN_ITEMS); np = &actorNew->s(); np->cstat = np->extra = 0; @@ -3926,7 +3926,7 @@ int ActorCoughItem(DSWActor* actor) case PACHINKO3: case PACHINKO4: - ASSERT(sp->sectnum >= 0); + ASSERT(sp->insector()); actorNew = InsertActor(sp->sector(), STAT_SPAWN_ITEMS); np = &actorNew->s(); np->cstat = np->extra = 0; @@ -4876,7 +4876,7 @@ int move_actor(DSWActor* actor, int xchange, int ychange, int zchange) u->coll = move_sprite(actor, xchange, ychange, zchange, u->ceiling_dist, u->floor_dist, cliptype, ACTORMOVETICS); - ASSERT(sp->sectnum >= 0); + ASSERT(sp->insector()); // try and determine whether you moved > lo_step in the z direction if (!TEST(u->Flags, SPR_NO_SCAREDZ | SPR_JUMPING | SPR_CLIMBING | SPR_FALLING | SPR_DEAD | SPR_SWIMMING)) @@ -6946,7 +6946,7 @@ Collision move_ground_missile(DSWActor* actor, int xchange, int ychange, int cei ChangeActorSect(actor, dasectnum); } - getzsofslope(sp->sectnum, sp->x, sp->y, &u->hiz, &u->loz); + getzsofslopeptr(sp->sector(), sp->x, sp->y, &u->hiz, &u->loz); u->hi_sectp = u->lo_sectp = sp->sector(); u->highActor = nullptr; u->lowActor = nullptr; diff --git a/source/games/sw/src/vator.cpp b/source/games/sw/src/vator.cpp index 98e532fa8..8c4b2985d 100644 --- a/source/games/sw/src/vator.cpp +++ b/source/games/sw/src/vator.cpp @@ -103,9 +103,9 @@ void SetVatorActive(DSWActor* actor) SECTORp sectp = sp->sector(); if (TEST(sp->cstat, CSTAT_SPRITE_YFLIP)) - StartInterpolation(sp->sectnum, Interp_Sect_Ceilingz); + StartInterpolation(sp->sector(), Interp_Sect_Ceilingz); else - StartInterpolation(sp->sectnum, Interp_Sect_Floorz); + StartInterpolation(sp->sector(), Interp_Sect_Floorz); InterpSectorSprites(sp->sectnum, true); @@ -131,9 +131,9 @@ void SetVatorInactive(DSWActor* actor) SECTORp sectp = sp->sector(); if (TEST(sp->cstat, CSTAT_SPRITE_YFLIP)) - StopInterpolation(sp->sectnum, Interp_Sect_Ceilingz); + StopInterpolation(sp->sector(), Interp_Sect_Ceilingz); else - StopInterpolation(sp->sectnum, Interp_Sect_Floorz); + StopInterpolation(sp->sector(), Interp_Sect_Floorz); InterpSectorSprites(sp->sectnum, false); @@ -492,7 +492,7 @@ int DoVator(DSWActor* actor) USERp bu; bool found = false; - SWSectIterator it(sp->sectnum); + SWSectIterator it(sp->sector()); while (auto itActor = it.Next()) { bsp = &itActor->s(); @@ -543,7 +543,7 @@ int DoVator(DSWActor* actor) { SPRITEp bsp; - SWSectIterator it(sp->sectnum); + SWSectIterator it(sp->sector()); while (auto itActor = it.Next()) { bsp = &itActor->s(); diff --git a/source/games/sw/src/vis.cpp b/source/games/sw/src/vis.cpp index f8996bcdf..8dcef7824 100644 --- a/source/games/sw/src/vis.cpp +++ b/source/games/sw/src/vis.cpp @@ -135,10 +135,10 @@ void SpawnVis(DSWActor* parentActor, short sectnum, int x, int y, int z, int amt auto psp = &parentActor->s(); auto pu = parentActor->u(); - if (sector[psp->sectnum].floorpal == PALETTE_FOG) + if (psp->sector()->floorpal == PALETTE_FOG) return; - if (sector[psp->sectnum].floorpal == PALETTE_DIVE_LAVA) + if (psp->sector()->floorpal == PALETTE_DIVE_LAVA) return; // kill any others with the same parent @@ -151,7 +151,7 @@ void SpawnVis(DSWActor* parentActor, short sectnum, int x, int y, int z, int amt } } - auto actorNew = InsertActor(psp->sectnum, STAT_VIS_ON); + auto actorNew = InsertActor(psp->sector(), STAT_VIS_ON); sp = &actorNew->s(); SetOwner(parentActor, actorNew); diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index 5e8c4370e..8f7bff4a3 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -11802,9 +11802,9 @@ int DoRing(DSWActor* actor) SetActor(actor, &sp->pos); - ASSERT(sp->sectnum >= 0); + ASSERT(sp->insector()); - getzsofslope(sp->sectnum, sp->x, sp->y, &cz, &fz); + getzsofslopeptr(sp->sector(), sp->x, sp->y, &cz, &fz); // bound the sprite by the sectors ceiling and floor if (sp->z > fz) @@ -11941,9 +11941,9 @@ int DoSerpRing(DSWActor* actor) SetActor(actor, &sp->pos); - ASSERT(sp->sectnum >= 0); + ASSERT(sp->insector()); - getzsofslope(sp->sectnum, sp->x, sp->y, &cz, &fz); + getzsofslopeptr(sp->sector(), sp->x, sp->y, &cz, &fz); // bound the sprite by the sectors ceiling and floor if (sp->z > fz) diff --git a/source/games/sw/src/zilla.cpp b/source/games/sw/src/zilla.cpp index c3d80e640..dd446a8fb 100644 --- a/source/games/sw/src/zilla.cpp +++ b/source/games/sw/src/zilla.cpp @@ -681,16 +681,14 @@ int NullZilla(DSWActor* actor) #if 0 if (u->State == s_ZillaDie) { - getzsofslope(sp->sectnum, sp->x, sp->y, &u->hiz, &u->loz); + getzsofslopeptr(sp->sector(), sp->x, sp->y, &u->hiz, &u->loz); u->lo_sectp = sp->sector(); u->hi_sectp = sp->sector(); sp->z = u->loz; } #endif - //if (!TEST(u->Flags,SPR_CLIMBING)) - // KeepActorOnFloor(actor); - getzsofslope(sp->sectnum, sp->x, sp->y, &u->hiz, &u->loz); + getzsofslopeptr(sp->sector(), sp->x, sp->y, &u->hiz, &u->loz); u->lo_sectp = sp->sector(); u->hi_sectp = sp->sector(); u->lowActor = nullptr; @@ -764,7 +762,7 @@ int DoZillaDeathMelt(DSWActor* actor) } //KeepActorOnFloor(actor); - getzsofslope(sp->sectnum, sp->x, sp->y, &u->hiz, &u->loz); + getzsofslopeptr(sp->sector(), sp->x, sp->y, &u->hiz, &u->loz); u->lo_sectp = sp->sector(); u->hi_sectp = sp->sector(); u->lowActor = nullptr;