diff --git a/src/commandlets/lightmapcmd.cpp b/src/commandlets/lightmapcmd.cpp index 031eff9b0..adb84b1c2 100644 --- a/src/commandlets/lightmapcmd.cpp +++ b/src/commandlets/lightmapcmd.cpp @@ -110,8 +110,36 @@ LightmapDeleteCmdlet::LightmapDeleteCmdlet() void LightmapDeleteCmdlet::OnCommand(FArgs args) { - RunInGame([]() { - Printf("Deleting LIGHTMAP lump!\n"); + // Pretty lame that we have to load the map here, but cba to figure out how to deal with map loading outside the engine... + + RunInGame([&]() { + FString mapname; + if (args.NumArgs() > 0 && args.GetArg(0)[0] != '-') + mapname = args.GetArg(0); + else + mapname = "map01"; + + G_SetMap(mapname.GetChars(), 0); + for (int i = 0; i < 100; i++) + { + D_SingleTick(); + if (gameaction == ga_nothing) + break; + } + + if (!level.levelMesh) + { + Printf("No level mesh. Perhaps your level has no lightmap loaded?\n"); + return; + } + + if (!level.lightmaps) + { + Printf("Lightmap is not enabled in this level.\n"); + } + + level.levelMesh->DeleteLightmapLump(level); + }); } diff --git a/src/rendering/hwrenderer/doom_levelmesh.cpp b/src/rendering/hwrenderer/doom_levelmesh.cpp index 200c5996c..ebddf1f1c 100644 --- a/src/rendering/hwrenderer/doom_levelmesh.cpp +++ b/src/rendering/hwrenderer/doom_levelmesh.cpp @@ -127,20 +127,6 @@ CCMD(invalidatelightmap) Printf("Marked %d out of %d tiles for update.\n", count, level.levelMesh->Lightmap.Tiles.Size()); } -CCMD(savelightmap) -{ - if (!RequireLightmap()) return; - - level.levelMesh->SaveLightmapLump(level); -} - -CCMD(deletelightmap) -{ - if (!RequireLightmap()) return; - - level.levelMesh->DeleteLightmapLump(level); -} - CCMD(cpublasinfo) { if (!level.levelMesh || !level.levelMesh->Collision)