- CopySectorWalls

This commit is contained in:
Christoph Oelckers 2021-11-24 17:21:04 +01:00
parent 75d59196fc
commit 317aa3f217

View file

@ -40,21 +40,18 @@ BEGIN_SW_NS
extern int GlobSpeedSO; extern int GlobSpeedSO;
void CopySectorWalls(int dest_sectnum, int src_sectnum) void CopySectorWalls(sectortype* dest_sect, sectortype* src_sect)
{ {
int dest_wall_num, src_wall_num, start_wall;
SECTOR_OBJECTp sop; SECTOR_OBJECTp sop;
SECTORp *sectp; SECTORp *sectp;
dest_wall_num = sector[dest_sectnum].wallptr; auto dwall = dest_sect->firstWall();
src_wall_num = sector[src_sectnum].wallptr; auto swall = src_sect->firstWall();
auto firstwall = dwall;
start_wall = dest_wall_num;
// this looks broken.
do do
{ {
auto dwall = &wall[dest_wall_num];
auto swall = &wall[src_wall_num];
dwall->picnum = swall->picnum; dwall->picnum = swall->picnum;
dwall->xrepeat = swall->xrepeat; dwall->xrepeat = swall->xrepeat;
@ -87,10 +84,10 @@ void CopySectorWalls(int dest_sectnum, int src_sectnum)
dest_nextwall->extra = src_nextwall->extra; dest_nextwall->extra = src_nextwall->extra;
} }
dest_wall_num = dwall->point2; dwall = dwall->point2Wall();
src_wall_num = swall->point2; swall = swall->point2Wall();
} }
while (dest_wall_num != start_wall); while (dwall != firstwall);
// TODO: Mapping a sector to the sector object to which it belongs is better // TODO: Mapping a sector to the sector object to which it belongs is better
for (sop = SectorObject; sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++) for (sop = SectorObject; sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++)
@ -99,7 +96,7 @@ void CopySectorWalls(int dest_sectnum, int src_sectnum)
continue; continue;
for (sectp = sop->sectp; *sectp; sectp++) for (sectp = sop->sectp; *sectp; sectp++)
if (sectnum(*sectp) == dest_sectnum) if (*sectp == dest_sect)
{ {
so_setinterpolationtics(sop, 0); so_setinterpolationtics(sop, 0);
break; break;
@ -162,7 +159,7 @@ void CopySectorMatch(int match)
} }
#endif #endif
CopySectorWalls(dest_sp->sectnum, src_sp->sectnum); CopySectorWalls(dest_sp->sector(), src_sp->sector());
itsec.Reset(src_sp->sectnum); itsec.Reset(src_sp->sectnum);
while (auto itActor = itsec.Next()) while (auto itActor = itsec.Next())