X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_map.pas;h=f6921131b3be776cfa1b30f8d248b8fc5593e760;hb=8ef4762ff23dd290f3db936eafb12b247b5a9ac6;hp=227835321cad0e6916b103de085d75eb0bafef5f;hpb=b322398c72a50c7b8003f5da515d496505d5aefb;p=d2df-sdl.git diff --git a/src/game/g_map.pas b/src/game/g_map.pas index 2278353..f692113 100644 --- a/src/game/g_map.pas +++ b/src/game/g_map.pas @@ -236,6 +236,7 @@ var gCurrentMap: TDynRecord = nil; gCurrentMapFileName: AnsiString = ''; // so we can skip texture reloading + gTestMap: String = ''; function panelTypeToTag (panelType: Word): Integer; // returns GridTagXXX @@ -1613,7 +1614,7 @@ type actPanel: TDynRecord; end; var - WAD: TWADFile; + WAD, TestWAD: TWADFile; //mapReader: TDynRecord = nil; mapTextureList: TDynField = nil; //TTexturesRec1Array; tagInt: texture index panels: TDynField = nil; //TPanelsRec1Array; @@ -1642,6 +1643,8 @@ var begin mapGrid.Free(); mapGrid := nil; + TestWAD := nil; + Data := nil; //gCurrentMap.Free(); //gCurrentMap := nil; @@ -1670,13 +1673,41 @@ begin 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();