diff --git a/src/game/g_map.pas b/src/game/g_map.pas
index 227835321cad0e6916b103de085d75eb0bafef5f..f6921131b3be776cfa1b30f8d248b8fc5593e760 100644 (file)
--- a/src/game/g_map.pas
+++ b/src/game/g_map.pas
gCurrentMap: TDynRecord = nil;
gCurrentMapFileName: AnsiString = ''; // so we can skip texture reloading
+ gTestMap: String = '';
function panelTypeToTag (panelType: Word): Integer; // returns GridTagXXX
actPanel: TDynRecord;
end;
var
- WAD: TWADFile;
+ WAD, TestWAD: TWADFile;
//mapReader: TDynRecord = nil;
mapTextureList: TDynField = nil; //TTexturesRec1Array; tagInt: texture index
panels: TDynField = nil; //TPanelsRec1Array;
begin
mapGrid.Free();
mapGrid := nil;
+ TestWAD := nil;
+ Data := nil;
//gCurrentMap.Free();
//gCurrentMap := nil;
Exit;
end;
- //k8: why loader ignores path here?
- mapResName := g_ExtractFileName(Res);
- if not WAD.GetMapResource(mapResName, Data, Len) then
+ if gTestMap <> '' then
begin
- g_FatalError(Format(_lc[I_GAME_ERROR_MAP_RES], [mapResName]));
- WAD.Free();
- Exit;
+ s := g_ExtractWadName(gTestMap);
+ TestWAD := TWADFile.Create();
+ if not TestWAD.ReadFile(s) then
+ begin
+ g_SimpleError(Format(_lc[I_GAME_ERROR_MAP_WAD], [s]));
+ TestWAD.Free();
+ TestWAD := nil;
+ end;
+ end;
+
+ if TestWAD <> nil then
+ begin
+ mapResName := g_ExtractFileName(gTestMap);
+ if not TestWAD.GetMapResource(mapResName, Data, Len) then
+ begin
+ g_SimpleError(Format(_lc[I_GAME_ERROR_MAP_RES], [mapResName]));
+ Data := nil;
+ end else
+ e_WriteLog('Using test map: '+gTestMap, TMsgType.Notify);
+ TestWAD.Free();
+ TestWAD := nil;
+ end;
+
+ if Data = nil then
+ begin
+ //k8: why loader ignores path here?
+ mapResName := g_ExtractFileName(Res);
+ if not WAD.GetMapResource(mapResName, Data, Len) then
+ begin
+ g_FatalError(Format(_lc[I_GAME_ERROR_MAP_RES], [mapResName]));
+ WAD.Free();
+ Exit;
+ end;
end;
WAD.Free();