From 65f3fec283ab72661cf34fce082a4d7deddaea34 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 31 Jan 2019 03:03:56 +0100 Subject: [PATCH] - copied a few more map information CCMDs to g_ccmd. --- src/g_cvars.cpp | 2 + src/g_dumpinfo.cpp | 113 ++++++++++++++++++++++++++++++++ src/maploader/compatibility.cpp | 50 -------------- src/maploader/glnodes.cpp | 4 +- src/r_data/portalgroups.cpp | 40 ----------- src/r_data/r_interpolate.cpp | 10 --- src/r_data/r_sections.cpp | 9 --- 7 files changed, 117 insertions(+), 111 deletions(-) diff --git a/src/g_cvars.cpp b/src/g_cvars.cpp index 31d224ccc..3fc48ff86 100644 --- a/src/g_cvars.cpp +++ b/src/g_cvars.cpp @@ -38,6 +38,8 @@ CVAR (Bool, cl_spreaddecals, true, CVAR_ARCHIVE) CVAR(Bool, var_pushers, true, CVAR_SERVERINFO); +CVAR(Bool, gl_cachenodes, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) +CVAR(Float, gl_cachetime, 0.6f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CUSTOM_CVAR (Bool, gl_lights, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL) diff --git a/src/g_dumpinfo.cpp b/src/g_dumpinfo.cpp index 94f450621..8223e13c9 100644 --- a/src/g_dumpinfo.cpp +++ b/src/g_dumpinfo.cpp @@ -126,4 +126,117 @@ CCMD (spray) Net_WriteString (argv[1]); } +//========================================================================== +// +// CCMD mapchecksum +// +//========================================================================== + +CCMD (mapchecksum) +{ + MapData *map; + uint8_t cksum[16]; + + if (argv.argc() < 2) + { + Printf("Usage: mapchecksum ...\n"); + } + for (int i = 1; i < argv.argc(); ++i) + { + map = P_OpenMapData(argv[i], true); + if (map == NULL) + { + Printf("Cannot load %s as a map\n", argv[i]); + } + else + { + map->GetChecksum(cksum); + const char *wadname = Wads.GetWadName(Wads.GetLumpFile(map->lumpnum)); + delete map; + for (size_t j = 0; j < sizeof(cksum); ++j) + { + Printf("%02X", cksum[j]); + } + Printf(" // %s %s\n", wadname, argv[i]); + } + } +} + +//========================================================================== +// +// CCMD hiddencompatflags +// +//========================================================================== + +CCMD (hiddencompatflags) +{ + for(auto Level : AllLevels()) + { + Printf("%s: %08x %08x %08x\n", Level->MapName.GetChars(), Level->ii_compatflags, Level->ii_compatflags2, Level->ib_compatflags); + } +} + +CCMD(dumpportals) +{ + for (auto Level : AllLevels()) + { + Printf("Portal groups for %s\n", Level->MapName.GetChars()); + for (unsigned i = 0; i < Level->portalGroups.Size(); i++) + { + 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) + { + auto port = sub.render_sector->GetPortalGroup(p->plane); + if (port == p) + { + 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), ", 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"); + } + } + } + } + } +} + +ADD_STAT (interpolations) +{ + FString out; + for (auto Level : AllLevels()) + { + if (out.Len() > 0) out << '\n'; + out.AppendFormat("%s: %d interpolations", Level->MapName.GetChars(), Level->interpolator.CountInterpolations ()); + + } + return out; +} + +CCMD(printsections) +{ + void PrintSections(FLevelLocals *Level); + for (auto Level : AllLevels()) + { + PrintSections(Level); + } +} + + diff --git a/src/maploader/compatibility.cpp b/src/maploader/compatibility.cpp index f3a424cac..ad792dc5a 100644 --- a/src/maploader/compatibility.cpp +++ b/src/maploader/compatibility.cpp @@ -530,53 +530,3 @@ DEFINE_ACTION_FUNCTION(DLevelCompatibility, GetDefaultActor) DEFINE_FIELD(DLevelCompatibility, Level); -//========================================================================== -// -// CCMD mapchecksum -// -//========================================================================== - -CCMD (mapchecksum) -{ - MapData *map; - uint8_t cksum[16]; - - if (argv.argc() < 2) - { - Printf("Usage: mapchecksum ...\n"); - } - for (int i = 1; i < argv.argc(); ++i) - { - map = P_OpenMapData(argv[i], true); - if (map == NULL) - { - Printf("Cannot load %s as a map\n", argv[i]); - } - else - { - map->GetChecksum(cksum); - const char *wadname = Wads.GetWadName(Wads.GetLumpFile(map->lumpnum)); - delete map; - for (size_t j = 0; j < sizeof(cksum); ++j) - { - Printf("%02X", cksum[j]); - } - Printf(" // %s %s\n", wadname, argv[i]); - } - } -} - -//========================================================================== -// -// CCMD hiddencompatflags -// -//========================================================================== - -CCMD (hiddencompatflags) -{ - for(auto Level : AllLevels()) - { - Printf("%s: %08x %08x %08x\n", Level->MapName.GetChars(), Level->ii_compatflags, Level->ii_compatflags2, Level->ib_compatflags); - } -} - diff --git a/src/maploader/glnodes.cpp b/src/maploader/glnodes.cpp index 7d16eb92e..fa6246952 100644 --- a/src/maploader/glnodes.cpp +++ b/src/maploader/glnodes.cpp @@ -61,8 +61,8 @@ #include "i_time.h" #include "maploader.h" -CVAR(Bool, gl_cachenodes, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) -CVAR(Float, gl_cachetime, 0.6f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) +EXTERN_CVAR(Bool, gl_cachenodes) +EXTERN_CVAR(Float, gl_cachetime) // fixed 32 bit gl_vert format v2.0+ (glBsp 1.91) struct mapglvertex_t diff --git a/src/r_data/portalgroups.cpp b/src/r_data/portalgroups.cpp index 2560ce3d9..8d682b78e 100644 --- a/src/r_data/portalgroups.cpp +++ b/src/r_data/portalgroups.cpp @@ -466,43 +466,3 @@ void InitPortalGroups(FLevelLocals *Level) GroupLinePortals(Level); } -CCMD(dumpportals) -{ - for (auto Level : AllLevels()) - { - Printf("Portal groups for %s\n", Level->MapName.GetChars()); - for (unsigned i = 0; i < Level->portalGroups.Size(); i++) - { - 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) - { - auto port = sub.render_sector->GetPortalGroup(p->plane); - if (port == p) - { - 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), ", 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"); - } - } - } - } - } -} diff --git a/src/r_data/r_interpolate.cpp b/src/r_data/r_interpolate.cpp index b3a8e08b2..b4ab89b12 100644 --- a/src/r_data/r_interpolate.cpp +++ b/src/r_data/r_interpolate.cpp @@ -186,8 +186,6 @@ IMPLEMENT_CLASS(DPolyobjInterpolation, false, false) // //========================================================================== -FInterpolator interpolator; - //========================================================================== // // @@ -989,11 +987,3 @@ void FPolyObj::StopInterpolation() } -ADD_STAT (interpolations) -{ - FString out; - out.Format ("%d interpolations", interpolator.CountInterpolations ()); - return out; -} - - diff --git a/src/r_data/r_sections.cpp b/src/r_data/r_sections.cpp index 79790a6cd..29b518966 100644 --- a/src/r_data/r_sections.cpp +++ b/src/r_data/r_sections.cpp @@ -875,12 +875,3 @@ void CreateSections(FLevelLocals *Level) creat.FixMissingReferences(); } -CCMD(printsections) -{ - for (auto Level : AllLevels()) - { - PrintSections(Level); - } -} - -