Load a map
This commit is contained in:
parent
794cfd78c8
commit
bddf1a2548
4 changed files with 90 additions and 43 deletions
|
|
@ -2,9 +2,12 @@
|
|||
#include "commandlet.h"
|
||||
#include "lightmapcmd.h"
|
||||
#include "version.h"
|
||||
#include "v_draw.h"
|
||||
#include "v_video.h"
|
||||
#include <functional>
|
||||
|
||||
int D_DoomMain_Game();
|
||||
void D_BeginDoomLoop();
|
||||
static std::function<void()>* ToolCallback;
|
||||
extern bool DisableLogging;
|
||||
|
||||
|
|
@ -17,8 +20,11 @@ int ToolMain()
|
|||
|
||||
void Commandlet::RunInGame(std::function<void()> action)
|
||||
{
|
||||
std::function<void()> callback = [=]() {
|
||||
std::function<void()> callback = [&]() {
|
||||
DisableLogging = false;
|
||||
|
||||
D_BeginDoomLoop();
|
||||
twod->Begin(screen->GetWidth(), screen->GetHeight());
|
||||
action();
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
|
||||
#include "lightmapcmd.h"
|
||||
#include "g_levellocals.h"
|
||||
#include "d_event.h"
|
||||
|
||||
void G_SetMap(const char* mapname, int mode);
|
||||
void D_SingleTick();
|
||||
|
||||
LightmapCmdletGroup::LightmapCmdletGroup()
|
||||
{
|
||||
|
|
@ -20,8 +25,24 @@ LightmapBuildCmdlet::LightmapBuildCmdlet()
|
|||
|
||||
void LightmapBuildCmdlet::OnCommand(FArgs args)
|
||||
{
|
||||
RunInGame([]() {
|
||||
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;
|
||||
}
|
||||
|
||||
Printf("Baking LIGHTMAP lump!\n");
|
||||
Printf("Current map is %s", level.LevelName.GetChars());
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue