diff --git a/source/build/src/clip.cpp b/source/build/src/clip.cpp index b3eee4ccd..eccf4bbc2 100644 --- a/source/build/src/clip.cpp +++ b/source/build/src/clip.cpp @@ -571,7 +571,7 @@ CollisionBase clipmove_(vec3_t * const pos, int * const sectnum, int32_t xvect, { auto sectp = §or[*sectnum]; updatesector(DVector2(pos->X * inttoworld, pos->Y * inttoworld), §p); - *sectnum = sectp ? ::sectnum(sectp) : -1; + *sectnum = sectp ? ::sectindex(sectp) : -1; } return clipReturn; } @@ -591,7 +591,7 @@ CollisionBase clipmove_(vec3_t * const pos, int * const sectnum, int32_t xvect, DVector2 v(vec.X* inttoworld, vec.Y* inttoworld); sectortype* sect = §or[*sectnum]; updatesector(v, §, rad * inttoworld); - *sectnum = ::sectnum(sect); + *sectnum = ::sectindex(sect); } pos->X = vec.X; diff --git a/source/core/automap.cpp b/source/core/automap.cpp index 84243cc53..31ec6e8f2 100644 --- a/source/core/automap.cpp +++ b/source/core/automap.cpp @@ -271,7 +271,7 @@ void MarkSectorSeen(sectortype* sec) { if (sec) { - show2dsector.Set(sectnum(sec)); + show2dsector.Set(sectindex(sec)); for (auto& wal : wallsofsector(sec)) { if (!wal.twoSided()) continue; @@ -281,7 +281,7 @@ void MarkSectorSeen(sectortype* sec) auto osec = wal.nextSector(); if (osec->lotag == 32767) continue; if (osec->ceilingz >= osec->floorz) continue; - show2dsector.Set(sectnum(osec)); + show2dsector.Set(sectindex(osec)); } } } @@ -404,7 +404,7 @@ static void drawredlines(const DVector2& cpos, const DVector2& cangvect, const D if (osec->ceilingz == z1 && osec->floorz == z2) if (((wal.cstat | wal.nextWall()->cstat) & (CSTAT_WALL_MASKED | CSTAT_WALL_1WAY)) == 0) continue; - if (ShowRedLine(wallnum(&wal), i)) + if (ShowRedLine(wallindex(&wal), i)) { auto v1 = OutAutomapVector(wal.pos - cpos, cangvect, gZoom, xydim); auto v2 = OutAutomapVector(wal.point2Wall()->pos - cpos, cangvect, gZoom, xydim); @@ -431,7 +431,7 @@ static void drawwhitelines(const DVector2& cpos, const DVector2& cangvect, const if (wal.nextwall >= 0) continue; if (!gFullMap && !tileGetTexture(wal.picnum)->isValid()) continue; - if (isSWALL() && !gFullMap && !show2dwall[wallnum(&wal)]) + if (isSWALL() && !gFullMap && !show2dwall[wallindex(&wal)]) continue; auto v1 = OutAutomapVector(wal.pos - cpos, cangvect, gZoom, xydim); diff --git a/source/core/gamefuncs.h b/source/core/gamefuncs.h index b1d531905..8e1d72d88 100644 --- a/source/core/gamefuncs.h +++ b/source/core/gamefuncs.h @@ -474,12 +474,12 @@ inline TArrayView wallsofsector(int sec) } // these are mainly meant as refactoring aids to mark function calls to work on. -inline int wallnum(const walltype* wal) +inline int wallindex(const walltype* wal) { return wall.IndexOf(wal); } -inline int sectnum(const sectortype* sect) +inline int sectindex(const sectortype* sect) { return sector.IndexOf(sect); } diff --git a/source/core/interpolate.h b/source/core/interpolate.h index ee15b5b9a..401c4ae75 100644 --- a/source/core/interpolate.h +++ b/source/core/interpolate.h @@ -41,25 +41,25 @@ void setsectinterpolate(sectortype* sectnum); inline void StartInterpolation(walltype* wall, int type) { assert(type == Interp_Wall_X || type == Interp_Wall_Y || type == Interp_Wall_PanX || type == Interp_Wall_PanY); - return StartInterpolation(wallnum(wall), type); + return StartInterpolation(wallindex(wall), type); } inline void StartInterpolation(sectortype* sect, int type) { assert(type == Interp_Sect_Floorz || type == Interp_Sect_Ceilingz || type == Interp_Sect_Floorheinum || type == Interp_Sect_Ceilingheinum || type == Interp_Sect_FloorPanX || type == Interp_Sect_FloorPanY || type == Interp_Sect_CeilingPanX || type == Interp_Sect_CeilingPanY); - return StartInterpolation(sectnum(sect), type); + return StartInterpolation(sectindex(sect), type); } inline void StopInterpolation(walltype* wall, int type) { assert(type == Interp_Wall_X || type == Interp_Wall_Y || type == Interp_Wall_PanX || type == Interp_Wall_PanY); - return StopInterpolation(wallnum(wall), type); + return StopInterpolation(wallindex(wall), type); } inline void StopInterpolation(sectortype* sect, int type) { assert(type == Interp_Sect_Floorz || type == Interp_Sect_Ceilingz || type == Interp_Sect_Floorheinum || type == Interp_Sect_Ceilingheinum || type == Interp_Sect_FloorPanX || type == Interp_Sect_FloorPanY || type == Interp_Sect_CeilingPanX || type == Interp_Sect_CeilingPanY); - return StopInterpolation(sectnum(sect), type); + return StopInterpolation(sectindex(sect), type); } diff --git a/source/core/maploader.cpp b/source/core/maploader.cpp index 66e639f7d..72f1b0acf 100644 --- a/source/core/maploader.cpp +++ b/source/core/maploader.cpp @@ -281,7 +281,7 @@ void validateSprite(spritetype& spri, int sectnum, int index) updatesector(pos.XY(), §p); bugged = sectp == nullptr; - if (!DPrintf(DMSG_WARNING, "Sprite #%d (%.0f,%.0f) with invalid sector %d was corrected to sector %d\n", index, pos.X, pos.Y, sectnum, ::sectnum(sectp))) + if (!DPrintf(DMSG_WARNING, "Sprite #%d (%.0f,%.0f) with invalid sector %d was corrected to sector %d\n", index, pos.X, pos.Y, sectnum, ::sectindex(sectp))) { if (bugged) Printf("Sprite #%d (%.0f,%.0f) with invalid sector %d\n", index, pos.X, pos.Y, sectnum); } @@ -445,12 +445,12 @@ void validateStartSector(const char* filename, const DVector3& pos, sectortype** if (!sect) updatesector(pos, §); if (sect || noabort) { - Printf(PRINT_HIGH, "Error in map %s: Start sector %d out of range. Max. sector is %d\n", filename, sectnum(*cursect), numsectors); + Printf(PRINT_HIGH, "Error in map %s: Start sector %d out of range. Max. sector is %d\n", filename, sectindex(*cursect), numsectors); *cursect = sect? sect : §or[0]; } else { - I_Error("Unable to start map %s: Start sector %d out of range. Max. sector is %d. No valid location at start spot\n", filename, sectnum(*cursect), numsectors); + I_Error("Unable to start map %s: Start sector %d out of range. Max. sector is %d. No valid location at start spot\n", filename, sectindex(*cursect), numsectors); } } diff --git a/source/core/rendering/hw_entrypoint.cpp b/source/core/rendering/hw_entrypoint.cpp index 1ee9e8680..abcc4b3fd 100644 --- a/source/core/rendering/hw_entrypoint.cpp +++ b/source/core/rendering/hw_entrypoint.cpp @@ -319,7 +319,7 @@ void render_drawrooms(DCoreActor* playersprite, const DVector3& position, sector ResetProfilingData(); // Get this before everything else - FRenderViewpoint r_viewpoint = SetupViewpoint(playersprite, position, sectnum(sect), angle, horizon, rollang, fov); + FRenderViewpoint r_viewpoint = SetupViewpoint(playersprite, position, sectindex(sect), angle, horizon, rollang, fov); r_viewpoint.TicFrac = !cl_capfps ? interpfrac : 1.; screen->mLights->Clear(); @@ -369,7 +369,7 @@ void render_camtex(DCoreActor* playersprite, const DVector3& position, sectortyp // now render the main view float ratio = camtex->GetDisplayWidth() / camtex->GetDisplayHeight(); - FRenderViewpoint r_viewpoint = SetupViewpoint(playersprite, position, sectnum(sect), angle, horizon, rollang); + FRenderViewpoint r_viewpoint = SetupViewpoint(playersprite, position, sectindex(sect), angle, horizon, rollang); r_viewpoint.TicFrac = !cl_capfps ? interpfrac : 1.; RenderViewpoint(r_viewpoint, &rect, r_viewpoint.FieldOfView.Degrees(), ratio, ratio, false, false); diff --git a/source/core/rendering/hw_vertexmap.cpp b/source/core/rendering/hw_vertexmap.cpp index b2bdb0a83..1947e973e 100644 --- a/source/core/rendering/hw_vertexmap.cpp +++ b/source/core/rendering/hw_vertexmap.cpp @@ -67,7 +67,7 @@ void CreateVertexMap() vertexscan(&wall[i], [&](walltype* wal) { - int w = wallnum(wal); + int w = wallindex(wal); if (processed[w]) return; // broken wall setups can trigger this. walls.Push(w); processed.Set(w); diff --git a/source/core/rendering/scene/hw_drawinfo.cpp b/source/core/rendering/scene/hw_drawinfo.cpp index 859fdd5c9..62e00aa3e 100644 --- a/source/core/rendering/scene/hw_drawinfo.cpp +++ b/source/core/rendering/scene/hw_drawinfo.cpp @@ -421,7 +421,7 @@ void HWDrawInfo::CreateScene(bool portal) if (a1 != 0xffffffff) mDrawer.Init(this, mClipper, vp.Pos, vp.RotAngle - a1, vp.RotAngle + a1); else mDrawer.Init(this, mClipper, vp.Pos, 0, 0); - int drawsect = sectnum(drawsectp); + int drawsect = sectindex(drawsectp); mDrawer.RenderScene(&drawsect, 1, false); for (int i = 0; i < eff.geocnt; i++) @@ -452,7 +452,7 @@ void HWDrawInfo::CreateScene(bool portal) if (a1 != 0xffffffff) mDrawer.Init(this, mClipper, vp.Pos, vp.RotAngle - a1, vp.RotAngle + a1); else mDrawer.Init(this, mClipper, vp.Pos, 0, 0); - drawsect = sectnum(drawsectp); + drawsect = sectindex(drawsectp); mDrawer.RenderScene(&drawsect, 1, false); for (int i = 0; i < eff.geocnt; i++) diff --git a/source/core/rendering/scene/hw_flats.cpp b/source/core/rendering/scene/hw_flats.cpp index af90ea42e..d6720f00a 100644 --- a/source/core/rendering/scene/hw_flats.cpp +++ b/source/core/rendering/scene/hw_flats.cpp @@ -223,7 +223,7 @@ void HWFlat::DrawFlat(HWDrawInfo *di, FRenderState &state, bool translucent) } #ifdef _DEBUG - if (sectnum(sec) == gl_breaksec) + if (sectindex(sec) == gl_breaksec) { int a = 0; } @@ -303,7 +303,7 @@ void HWFlat::PutFlat(HWDrawInfo *di, int whichplane) void HWFlat::ProcessSector(HWDrawInfo *di, sectortype * frontsector, int section_, int which) { #ifdef _DEBUG - if (sectnum(sec) == gl_breaksec) + if (sectindex(sec) == gl_breaksec) { int a = 0; } diff --git a/source/core/rendering/scene/hw_walls.cpp b/source/core/rendering/scene/hw_walls.cpp index 51bc96d58..28ee78c30 100644 --- a/source/core/rendering/scene/hw_walls.cpp +++ b/source/core/rendering/scene/hw_walls.cpp @@ -923,7 +923,7 @@ void HWWall::Process(HWDrawInfo* di, walltype* wal, sectortype* frontsector, sec #ifdef _DEBUG - if (wallnum(wal) == 34) + if (wallindex(wal) == 34) { int a = 0; } @@ -955,7 +955,7 @@ void HWWall::Process(HWDrawInfo* di, walltype* wal, sectortype* frontsector, sec if (gl_seamless) { - auto v = &vertices[vertexMap[wallnum(wal)]]; + auto v = &vertices[vertexMap[wallindex(wal)]]; if (v->dirty) v->RecalcVertexHeights(); v = &vertices[vertexMap[wal->point2]]; if (v->dirty) v->RecalcVertexHeights(); diff --git a/source/core/rendering/scene/hw_walls_vertex.cpp b/source/core/rendering/scene/hw_walls_vertex.cpp index fe35c7c13..e6f92be08 100644 --- a/source/core/rendering/scene/hw_walls_vertex.cpp +++ b/source/core/rendering/scene/hw_walls_vertex.cpp @@ -41,7 +41,7 @@ EXTERN_CVAR(Bool, gl_seamless) void HWWall::SplitLeftEdge(FFlatVertex *&ptr) { if (seg == nullptr) return; - vertex_t* vi = &vertices[vertexMap[wallnum(seg)]]; + vertex_t* vi = &vertices[vertexMap[wallindex(seg)]]; if (vi->numheights) { @@ -129,7 +129,7 @@ int HWWall::CreateVertices(FFlatVertex *&ptr, bool split) void HWWall::CountLeftEdge(unsigned &ptr) { - vertex_t* vi = &vertices[vertexMap[wallnum(seg)]]; + vertex_t* vi = &vertices[vertexMap[wallindex(seg)]]; if (vi->numheights) { diff --git a/source/core/savegamehelp.h b/source/core/savegamehelp.h index f6d970083..3fc88e6ee 100644 --- a/source/core/savegamehelp.h +++ b/source/core/savegamehelp.h @@ -21,7 +21,7 @@ void M_Autosave(); template<> inline FSerializer& Serialize(FSerializer& arc, const char* keyname, sectortype*& w, sectortype** def) { assert(arc.isReading() || w == nullptr || (w >= §or[0] && w <= §or.Last())); - int ndx = w ? sectnum(w) : -1; + int ndx = w ? sectindex(w) : -1; arc(keyname, ndx); w = !validSectorIndex(ndx) ? nullptr : §or[ndx]; return arc; @@ -29,7 +29,7 @@ template<> inline FSerializer& Serialize(FSerializer& arc, const char* keyname, template<> inline FSerializer& Serialize(FSerializer& arc, const char* keyname, walltype*& w, walltype** def) { - int ndx = w ? wallnum(w) : -1; + int ndx = w ? wallindex(w) : -1; arc(keyname, ndx); w = !validWallIndex(ndx) ? nullptr : &wall[ndx]; return arc; diff --git a/source/core/sectorgeometry.cpp b/source/core/sectorgeometry.cpp index be54b3ff6..27e7d1778 100644 --- a/source/core/sectorgeometry.cpp +++ b/source/core/sectorgeometry.cpp @@ -475,7 +475,7 @@ void SectionGeometry::CreatePlaneMesh(Section* section, int plane, const FVector void SectionGeometry::MarkDirty(sectortype* sector) { - for (auto section : sectionsPerSector[sectnum(sector)]) + for (auto section : sectionsPerSector[sectindex(sector)]) { sections[section].dirty = sector->dirty; } diff --git a/source/games/blood/src/eventq.h b/source/games/blood/src/eventq.h index 8f6164e1e..2711ab622 100644 --- a/source/games/blood/src/eventq.h +++ b/source/games/blood/src/eventq.h @@ -44,8 +44,8 @@ public: EventObject() = default; explicit EventObject(std::nullptr_t) { index = -1; } explicit EventObject(DBloodActor* actor_) { ActorP = actor_; assert(isActor()); } - explicit EventObject(sectortype* sect) { index = (sectnum(sect) << 8) | Sector; } - explicit EventObject(walltype* wall) { index = (wallnum(wall) << 8) | Wall; } + explicit EventObject(sectortype* sect) { index = (sectindex(sect) << 8) | Sector; } + explicit EventObject(walltype* wall) { index = (wallindex(wall) << 8) | Wall; } bool isActor() const { return (index & 7) == Actor; } bool isSector() const { return (index & 7) == Sector; } diff --git a/source/games/blood/src/gameutil.cpp b/source/games/blood/src/gameutil.cpp index fa10f4084..ce0ed268b 100644 --- a/source/games/blood/src/gameutil.cpp +++ b/source/games/blood/src/gameutil.cpp @@ -547,7 +547,7 @@ BitArray GetClosestSpriteSectors(sectortype* pSector, const DVector2& pos, int n BitArray sectorMap(sector.Size()); // this gets returned to the caller. sectorMap.Zero(); - sectorMap.Set(sectnum(pSector)); + sectorMap.Set(sectindex(pSector)); double nDist4sq = nDist * nDist; // (nDist * 16)^2 - * 16 to account for Build's 28.4 fixed point format. BFSSectorSearch search(pSector); @@ -573,7 +573,7 @@ BitArray GetClosestSpriteSectors(sectortype* pSector, const DVector2& pos, int n } if (withinRange) // if new sector is within range, add it to the processing queue { - sectorMap.Set(sectnum(pNextSector)); + sectorMap.Set(sectindex(pNextSector)); search.Add(pNextSector); if (pWalls && wal.hasX()) { diff --git a/source/games/blood/src/mirrors.cpp b/source/games/blood/src/mirrors.cpp index 294c6892e..ceb4d09b1 100644 --- a/source/games/blood/src/mirrors.cpp +++ b/source/games/blood/src/mirrors.cpp @@ -124,7 +124,7 @@ void InitMirrors(void) continue; auto sectj = link2->sector(); - int j = sectnum(sectj); + int j = sectindex(sectj); if (sectj->ceilingpicnum != 504) I_Error("Lower link sector %d doesn't have mirror picnum\n", j); mirror[mirrorcnt].type = 2; diff --git a/source/games/blood/src/nnsprinsect.cpp b/source/games/blood/src/nnsprinsect.cpp index 3c502bebd..72da90462 100644 --- a/source/games/blood/src/nnsprinsect.cpp +++ b/source/games/blood/src/nnsprinsect.cpp @@ -129,7 +129,7 @@ void SPRINSECT::Init(double nDist) pEntry.pActors.Resize(collected.Size()); for (unsigned ii = 0; ii < collected.Size(); ii++) pEntry.pActors[ii] = collected[ii]; - pEntry.nSector = sectnum(§); + pEntry.nSector = sectindex(§); } } } diff --git a/source/games/blood/src/sfx.cpp b/source/games/blood/src/sfx.cpp index ecb196d5d..8b4d8e3d2 100644 --- a/source/games/blood/src/sfx.cpp +++ b/source/games/blood/src/sfx.cpp @@ -183,7 +183,7 @@ void sfxPlay3DSound(const DVector3& pos, int soundId, sectortype* pSector) if (sfx && sfx->LoopStart >= 0) flags |= CHANF_LOOP; auto chan = soundEngine->StartSound(SOURCE_Unattached, nullptr, &svec, -1, flags, sid, (0.8f / 80.f) * relvol, attenuation, nullptr, pitch / 65536.f); - if (chan) chan->UserData = sectnum(pSector); + if (chan) chan->UserData = sectindex(pSector); } //--------------------------------------------------------------------------- diff --git a/source/games/blood/src/triggers.cpp b/source/games/blood/src/triggers.cpp index eb29503f3..7dbfb34db 100644 --- a/source/games/blood/src/triggers.cpp +++ b/source/games/blood/src/triggers.cpp @@ -949,7 +949,7 @@ void TranslateSector(sectortype* pSector, double wave1, double wave2, const DVec if (gModernMap) { - auto ptr = gSprNSect.GetSprPtr(sectnum(pSector)); + auto ptr = gSprNSect.GetSprPtr(sectindex(pSector)); if (ptr) { for (auto& ac : *ptr) @@ -997,7 +997,7 @@ void ZTranslateSector(sectortype* pSector, XSECTOR* pXSector, int a3, int a4) #ifdef NOONE_EXTENSIONS // get pointer to sprites near outside walls before translation /////////////////////////////////////////////////////////////// - auto ptr1 = (gModernMap && (dfz || dcz))? gSprNSect.GetSprPtr(sectnum(pSector)) : nullptr; + auto ptr1 = (gModernMap && (dfz || dcz))? gSprNSect.GetSprPtr(sectindex(pSector)) : nullptr; #endif if (dfz != 0) @@ -2247,7 +2247,7 @@ static void UpdateBasePoints(sectortype* pSector) if (gModernMap) { // must set basepoint for outside sprites as well - auto ptr1 = gSprNSect.GetSprPtr(sectnum(pSector)); + auto ptr1 = gSprNSect.GetSprPtr(sectindex(pSector)); if (ptr1) { for (auto& ac : *ptr1) diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index f36c3c2fd..8a2c530f5 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -102,7 +102,7 @@ sectortype* toSect(int index) int fromSect(sectortype* sect) { - return sect ? sectnum(sect) : -1; + return sect ? sectindex(sect) : -1; } walltype* toWall(int index) @@ -112,7 +112,7 @@ walltype* toWall(int index) int fromWall(walltype* sect) { - return sect ? wallnum(sect) : -1; + return sect ? wallindex(sect) : -1; } static void DoUserDef(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, int sPlayer, int lParm2) diff --git a/source/games/duke/src/prediction.cpp b/source/games/duke/src/prediction.cpp index 34d1edafc..12fb1ef33 100644 --- a/source/games/duke/src/prediction.cpp +++ b/source/games/duke/src/prediction.cpp @@ -56,7 +56,7 @@ void resetmys() myang = ps[myconnectindex].angle.ang; myhoriz = omyhoriz = ps[myconnectindex].horizon.horiz; myhorizoff = omyhorizoff = ps[myconnectindex].horizon.horizoff; - mycursectnum = sectnum(ps[myconnectindex].cursector); + mycursectnum = sectindex(ps[myconnectindex].cursector); myjumpingcounter = ps[myconnectindex].jumping_counter; myjumpingtoggle = ps[myconnectindex].jumping_toggle; myonground = ps[myconnectindex].on_ground; diff --git a/source/games/duke/src/premap.cpp b/source/games/duke/src/premap.cpp index 9f453c688..5d3146045 100644 --- a/source/games/duke/src/premap.cpp +++ b/source/games/duke/src/premap.cpp @@ -868,8 +868,8 @@ static void SpawnPortals() s1->portalflags = PORTAL_SECTOR_FLOOR; s2->portalflags = PORTAL_SECTOR_CEILING; DVector2 diff = act->spr.pos.XY() - act2->spr.pos.XY(); - s1->portalnum = portalAdd(PORTAL_SECTOR_FLOOR, sectnum(s2), DVector3(-diff, hitag)); // uses delta.Z as temporary storage, not a real coordinate. - s2->portalnum = portalAdd(PORTAL_SECTOR_CEILING, sectnum(s1), DVector3(diff, hitag)); + s1->portalnum = portalAdd(PORTAL_SECTOR_FLOOR, sectindex(s2), DVector3(-diff, hitag)); // uses delta.Z as temporary storage, not a real coordinate. + s2->portalnum = portalAdd(PORTAL_SECTOR_CEILING, sectindex(s1), DVector3(diff, hitag)); processedTags.Push(act->spr.hitag); } else diff --git a/source/games/duke/src/premap_r.cpp b/source/games/duke/src/premap_r.cpp index 4daf49134..5a2590a55 100644 --- a/source/games/duke/src/premap_r.cpp +++ b/source/games/duke/src/premap_r.cpp @@ -475,7 +475,7 @@ void prelevel_r(int g, TArray& actors) if (dist == 0) { // Oh no, we got an incomplete definition. - if (sectnum(sectp) == 534 && currentLevel->levelNumber == 2007) // fix for bug in RR E2L7 Beaudry Mansion. + if (sectindex(sectp) == 534 && currentLevel->levelNumber == 2007) // fix for bug in RR E2L7 Beaudry Mansion. { dist = 48; speed = 32; diff --git a/source/games/duke/src/sectors.cpp b/source/games/duke/src/sectors.cpp index c305f1c86..c59d3038e 100644 --- a/source/games/duke/src/sectors.cpp +++ b/source/games/duke/src/sectors.cpp @@ -413,7 +413,7 @@ int getanimationindex(int animtype, sectortype* animtargetp) int i, j; j = -1; - int animtarget = sectnum(animtargetp); + int animtarget = sectindex(animtargetp); for (i = animates.Size() - 1; i >= 0; i--) if (animtype == animates[i].type && animtarget == animates[i].target) { @@ -459,13 +459,13 @@ static int dosetanimation(sectortype* animsect, int animtype, int animtarget, do int setanimation(sectortype* animsect, int animtype, walltype* animtarget, double thegoal, double thevel) { assert(animtype == anim_vertexx || animtype == anim_vertexy); - return dosetanimation(animsect, animtype, wallnum(animtarget), thegoal, thevel); + return dosetanimation(animsect, animtype, wallindex(animtarget), thegoal, thevel); } int setanimation(sectortype* animsect, int animtype, sectortype* animtarget, double thegoal, double thevel) { assert(animtype == anim_ceilingz || animtype == anim_floorz); - return dosetanimation(animsect, animtype, sectnum(animtarget), thegoal, thevel); + return dosetanimation(animsect, animtype, sectindex(animtarget), thegoal, thevel); } //--------------------------------------------------------------------------- @@ -712,7 +712,7 @@ static void handle_st29(sectortype* sptr, DDukeActor* actor) { act2->sector()->extra = -act2->sector()->extra; - act2->temp_data[0] = sectnum(sptr); + act2->temp_data[0] = sectindex(sptr); act2->temp_data[1] = 1; } } diff --git a/source/games/duke/src/sectors_d.cpp b/source/games/duke/src/sectors_d.cpp index d8b190404..fde94be5b 100644 --- a/source/games/duke/src/sectors_d.cpp +++ b/source/games/duke/src/sectors_d.cpp @@ -1477,7 +1477,7 @@ void checksectors_d(int snum) p->cursector->lotag = 0; FTA(9, p); p->secret_rooms++; - SECRET_Trigger(sectnum(p->cursector)); + SECRET_Trigger(sectindex(p->cursector)); return; case -1: p->cursector->lotag = 0; diff --git a/source/games/duke/src/sectors_r.cpp b/source/games/duke/src/sectors_r.cpp index c504eaece..74f68cae1 100644 --- a/source/games/duke/src/sectors_r.cpp +++ b/source/games/duke/src/sectors_r.cpp @@ -2385,7 +2385,7 @@ void checksectors_r(int snum) p->cursector->lotag = 0; FTA(9, p); p->secret_rooms++; - SECRET_Trigger(sectnum(p->cursector)); + SECRET_Trigger(sectindex(p->cursector)); return; case -1: p->cursector->lotag = 0; diff --git a/source/games/duke/src/spawn.cpp b/source/games/duke/src/spawn.cpp index bc58e8051..bc4ea1fc3 100644 --- a/source/games/duke/src/spawn.cpp +++ b/source/games/duke/src/spawn.cpp @@ -53,7 +53,7 @@ BEGIN_DUKE_NS DDukeActor* CreateActor(sectortype* whatsectp, const DVector3& pos, PClassActor* clstype, int s_pn, int8_t s_shd, const DVector2& scale, DAngle s_ang, double s_vel, double s_zvel, DDukeActor* s_ow, int8_t s_stat) { // sector pointer must be strictly validated here or the engine will crash. - if (whatsectp == nullptr || !validSectorIndex(sectnum(whatsectp))) return nullptr; + if (whatsectp == nullptr || !validSectorIndex(sectindex(whatsectp))) return nullptr; // spawning out of range sprites will also crash. if (clstype == nullptr && (s_pn < 0 || s_pn >= MAXTILES)) return nullptr; @@ -917,7 +917,7 @@ void spawneffector(DDukeActor* actor, TArray* actors) } actor->SetOwner(nullptr); - actor->temp_data[0] = sectnum(s); + actor->temp_data[0] = sectindex(s); if (actor->spr.lotag != SE_30_TWO_WAY_TRAIN) actor->temp_data[3] = actor->spr.hitag; diff --git a/source/games/exhumed/src/gun.cpp b/source/games/exhumed/src/gun.cpp index fe58b7b5b..e18c4d720 100644 --- a/source/games/exhumed/src/gun.cpp +++ b/source/games/exhumed/src/gun.cpp @@ -324,7 +324,7 @@ Collision CheckCloseRange(int nPlayer, DVector3& pos, sectortype* *ppSector) c.setSprite(hit.actor()); } if (hit.hitWall) { - c.setWall(wallnum(hit.hitWall)); + c.setWall(wallindex(hit.hitWall)); } return c; diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index 743305bd1..188c9b325 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -1612,7 +1612,7 @@ short AnimGetGoal(int animtype, int animindex, DSWActor*); int AnimSet(int animtype, int animindex, DSWActor* animactor, double thegoal, double thevel); int AnimSet(int animtype, sectortype* animindex, double thegoal, double thevel) { - return AnimSet(animtype, sectnum(animindex), nullptr, thegoal, thevel); + return AnimSet(animtype, sectindex(animindex), nullptr, thegoal, thevel); } short AnimSetCallback(short anim_ndx, ANIM_CALLBACKp call, SECTOR_OBJECT* data); diff --git a/source/games/sw/src/interpso.cpp b/source/games/sw/src/interpso.cpp index a4e548fc2..538235921 100644 --- a/source/games/sw/src/interpso.cpp +++ b/source/games/sw/src/interpso.cpp @@ -281,14 +281,14 @@ void so_addinterpolation(SECTOR_OBJECT* sop) { for (auto& wal : wallsofsector(*sectp)) { - so_setpointinterpolation(interp, wallnum(&wal) | soi_wallx); - so_setpointinterpolation(interp, wallnum(&wal) | soi_wally); + so_setpointinterpolation(interp, wallindex(&wal) | soi_wallx); + so_setpointinterpolation(interp, wallindex(&wal) | soi_wally); if (wal.twoSided()) { auto nextWall = wal.nextWall()->point2Wall(); - so_setpointinterpolation(interp, wallnum(nextWall) | soi_wallx); - so_setpointinterpolation(interp, wallnum(nextWall) | soi_wally); + so_setpointinterpolation(interp, wallindex(nextWall) | soi_wallx); + so_setpointinterpolation(interp, wallindex(nextWall) | soi_wally); } } @@ -305,8 +305,8 @@ void so_addinterpolation(SECTOR_OBJECT* sop) if (!interp->hasvator) for (sectp = sop->sectp; *sectp; sectp++) { - so_setpointinterpolation(interp, sectnum(*sectp) | soi_floor); - so_setpointinterpolation(interp, sectnum(*sectp) | soi_ceil); + so_setpointinterpolation(interp, sectindex(*sectp) | soi_floor); + so_setpointinterpolation(interp, sectindex(*sectp) | soi_ceil); } // interpolate midpoint, for aiming at a remote controlled SO diff --git a/source/games/sw/src/jsector.cpp b/source/games/sw/src/jsector.cpp index 0d0f01bbb..bf2aa3898 100644 --- a/source/games/sw/src/jsector.cpp +++ b/source/games/sw/src/jsector.cpp @@ -359,7 +359,7 @@ void JS_InitMirrors(void) if (!Found_Cam) { Printf("Did not find drawtotile for camera number %d\n", mirrorcnt); - Printf("wall(%d).hitag == %d\n", wallnum(&wal), wal.hitag); + Printf("wall(%d).hitag == %d\n", wallindex(&wal), wal.hitag); Printf("Map Coordinates: x = %d, y = %d\n", int(wal.pos.X), int(wal.pos.Y)); RESET_BOOL1(mirror[mirrorcnt].cameraActor); } diff --git a/source/games/sw/src/osdcmds.cpp b/source/games/sw/src/osdcmds.cpp index 0dfb54e78..40644a399 100644 --- a/source/games/sw/src/osdcmds.cpp +++ b/source/games/sw/src/osdcmds.cpp @@ -93,8 +93,8 @@ static int osdcmd_mirror(CCmdFuncPtr parm) Printf("camspic is the tile number of the drawtotile in editart"); Printf("iscamera is whether or not this mirror is a camera type"); Printf(" "); - Printf("mirror[%d].mirrorwall = %d", op1, wallnum(mirror[op1].mirrorWall)); - Printf("mirror[%d].mirrorsector = %d", op1, sectnum(mirror[op1].mirrorSector)); + Printf("mirror[%d].mirrorwall = %d", op1, wallindex(mirror[op1].mirrorWall)); + Printf("mirror[%d].mirrorsector = %d", op1, sectindex(mirror[op1].mirrorSector)); Printf("mirror[%d].camera = %d", op1, mirror[op1].cameraActor->GetIndex()); Printf("mirror[%d].camsprite = %d", op1, mirror[op1].camspriteActor->GetIndex()); Printf("mirror[%d].campic = %d", op1, mirror[op1].campic); diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index fb0c642cb..68e9c62f0 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -2746,7 +2746,7 @@ void DoPlayerMoveVehicle(PLAYER* pp) if ((hit.hitpos.XY() - hitpos.XY()).LengthSquared() < 50 * 50) { if (hit.hitWall) - actor->user.coll.setWall(wallnum(hit.hitWall)); + actor->user.coll.setWall(wallindex(hit.hitWall)); else if (hit.actor()) actor->user.coll.setSprite(hit.actor()); else diff --git a/source/games/sw/src/rooms.cpp b/source/games/sw/src/rooms.cpp index e577d4d6f..d488ab9b5 100644 --- a/source/games/sw/src/rooms.cpp +++ b/source/games/sw/src/rooms.cpp @@ -919,7 +919,7 @@ void CollectPortals() { if (!wal.twoSided()) continue; auto nsec = wal.nextSector(); - auto ns = sectnum(nsec); + auto ns = sectindex(nsec); if (floordone[ns] || nsec->floorpicnum != FAF_MIRROR_PIC) continue; fp.sectors.Push(ns); floordone.Set(ns); @@ -937,7 +937,7 @@ void CollectPortals() { if (!wal.twoSided()) continue; auto nsec = wal.nextSector(); - auto ns = sectnum(nsec); + auto ns = sectindex(nsec); if (ceilingdone[ns] || nsec->ceilingpicnum != FAF_MIRROR_PIC) continue; fp.sectors.Push(ns); ceilingdone.Set(ns); @@ -964,7 +964,7 @@ void CollectPortals() if (tsect != nullptr &&tsect->floorpicnum == FAF_MIRROR_PIC) { // got something! - fp.othersector = sectnum(tsect); + fp.othersector = sectindex(tsect); fp.offset = tpos - actor->spr.pos; goto nextfg; } @@ -991,7 +991,7 @@ void CollectPortals() if (tsect != nullptr && tsect->ceilingpicnum == FAF_MIRROR_PIC) { // got something! - fp.othersector = sectnum(tsect); + fp.othersector = sectindex(tsect); fp.offset = tpos - actor->spr.pos; goto nextcg; } diff --git a/source/games/sw/src/sector.cpp b/source/games/sw/src/sector.cpp index b18eaaf60..5d8113b89 100644 --- a/source/games/sw/src/sector.cpp +++ b/source/games/sw/src/sector.cpp @@ -224,7 +224,7 @@ void WallSetup(void) } else { - Printf(PRINT_HIGH, "one-sided wall %d in loop setup\n", wallnum(&wal)); + Printf(PRINT_HIGH, "one-sided wall %d in loop setup\n", wallindex(&wal)); } break; } @@ -238,7 +238,7 @@ void WallSetup(void) } else { - Printf(PRINT_HIGH, "one-sided wall %d in loop setup\n", wallnum(&wal)); + Printf(PRINT_HIGH, "one-sided wall %d in loop setup\n", wallindex(&wal)); } wal.lotag = 0; break; @@ -1939,7 +1939,7 @@ void TriggerSecret(sectortype* sectp, PLAYER* pp) if (pp == Player + myconnectindex) PlayerSound(DIGI_ANCIENTSECRET, v3df_dontpan | v3df_doppler | v3df_follow, pp); - SECRET_Trigger(sectnum(pp->cursector)); + SECRET_Trigger(sectindex(pp->cursector)); PutStringInfo(pp, GStrings("TXTS_SECRET")); // always give to the first player diff --git a/source/games/sw/src/track.cpp b/source/games/sw/src/track.cpp index 2ee206da8..c5e6d1d03 100644 --- a/source/games/sw/src/track.cpp +++ b/source/games/sw/src/track.cpp @@ -2051,7 +2051,7 @@ void CallbackSOsink(ANIM* ap, void *data) for (i = 0; sop->sectp[i] != nullptr; i++) { - if (ap->animtype == ANIM_Floorz && ap->animindex == sectnum(sop->sectp[i])) + if (ap->animtype == ANIM_Floorz && ap->animindex == sectindex(sop->sectp[i])) { destsect = sop->sectp[i]; break;