From 12351ae9bb1ea746d2c119b1c2d0d3b8ad5f53cd Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 29 Jan 2019 20:23:18 +0100 Subject: [PATCH] - made dumpportals CCMD multi-level aware. --- src/r_data/portalgroups.cpp | 51 ++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/src/r_data/portalgroups.cpp b/src/r_data/portalgroups.cpp index 25bbdd198..2560ce3d9 100644 --- a/src/r_data/portalgroups.cpp +++ b/src/r_data/portalgroups.cpp @@ -468,36 +468,39 @@ void InitPortalGroups(FLevelLocals *Level) CCMD(dumpportals) { - auto Level = &level; - for(unsigned i=0;iportalGroups.Size(); i++) + for (auto Level : AllLevels()) { - auto p = Level->portalGroups[i]; - double xdisp = p->mDisplacement.X; - double ydisp = p->mDisplacement.Y; - Printf(PRINT_LOG, "Portal #%d, %s, displacement = (%f,%f)\n", i, p->plane==0? "floor":"ceiling", - xdisp, ydisp); - Printf(PRINT_LOG, "Coverage:\n"); - for(auto &sub : Level->subsectors) + Printf("Portal groups for %s\n", Level->MapName.GetChars()); + for (unsigned i = 0; i < Level->portalGroups.Size(); i++) { - auto port = sub.render_sector->GetPortalGroup(p->plane); - if (port == p) + auto p = Level->portalGroups[i]; + double xdisp = p->mDisplacement.X; + double ydisp = p->mDisplacement.Y; + Printf(PRINT_LOG, "Portal #%d, %s, displacement = (%f,%f)\n", i, p->plane == 0 ? "floor" : "ceiling", + xdisp, ydisp); + Printf(PRINT_LOG, "Coverage:\n"); + for (auto &sub : Level->subsectors) { - Printf(PRINT_LOG, "\tSubsector %d (%d):\n\t\t", sub.Index(), sub.render_sector->sectornum); - for(unsigned k = 0;k< sub.numlines; k++) + auto port = sub.render_sector->GetPortalGroup(p->plane); + if (port == p) { - Printf(PRINT_LOG, "(%.3f,%.3f), ", sub.firstline[k].v1->fX() + xdisp, sub.firstline[k].v1->fY() + ydisp); - } - Printf(PRINT_LOG, "\n\t\tCovered by subsectors:\n"); - FPortalCoverage *cov = &sub.portalcoverage[p->plane]; - for(int l = 0;l< cov->sscount; l++) - { - subsector_t *csub = &Level->subsectors[cov->subsectors[l]]; - Printf(PRINT_LOG, "\t\t\t%5d (%4d): ", cov->subsectors[l], csub->render_sector->sectornum); - for(unsigned m = 0;m< csub->numlines; m++) + Printf(PRINT_LOG, "\tSubsector %d (%d):\n\t\t", sub.Index(), sub.render_sector->sectornum); + for (unsigned k = 0; k < sub.numlines; k++) { - Printf(PRINT_LOG, "(%.3f,%.3f), ", csub->firstline[m].v1->fX(), csub->firstline[m].v1->fY()); + Printf(PRINT_LOG, "(%.3f,%.3f), ", sub.firstline[k].v1->fX() + xdisp, sub.firstline[k].v1->fY() + ydisp); + } + Printf(PRINT_LOG, "\n\t\tCovered by subsectors:\n"); + FPortalCoverage *cov = &sub.portalcoverage[p->plane]; + for (int l = 0; l < cov->sscount; l++) + { + subsector_t *csub = &Level->subsectors[cov->subsectors[l]]; + Printf(PRINT_LOG, "\t\t\t%5d (%4d): ", cov->subsectors[l], csub->render_sector->sectornum); + for (unsigned m = 0; m < csub->numlines; m++) + { + Printf(PRINT_LOG, "(%.3f,%.3f), ", csub->firstline[m].v1->fX(), csub->firstline[m].v1->fY()); + } + Printf(PRINT_LOG, "\n"); } - Printf(PRINT_LOG, "\n"); } } }