summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b322398)
raw | patch | inline | side by side (parent: b322398)
author | binarymaster <x86corez@gmail.com> | |
Wed, 27 Sep 2017 15:13:19 +0000 (18:13 +0300) | ||
committer | binarymaster <x86corez@gmail.com> | |
Wed, 27 Sep 2017 15:13:19 +0000 (18:13 +0300) |
src/game/g_console.pas | patch | blob | history | |
src/game/g_game.pas | patch | blob | history | |
src/game/g_map.pas | patch | blob | history |
diff --git a/src/game/g_console.pas b/src/game/g_console.pas
index 9e6f4d5de4776bd505e2499b4a384cfff3a6862a..fb0b9eb66abf0a78e6ec32ff519ab0c350426463 100644 (file)
--- a/src/game/g_console.pas
+++ b/src/game/g_console.pas
cp: PCommand;
pv: PVarSingle;
begin
- GetMem(pv, sizeof(pv^));
+ GetMem(pv, sizeof(TVarSingle));
pv.val := pvar;
pv.min := amin;
pv.max := amax;
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index eaccccca74e1523f2ecabebfd34367f9a8f64ef0..53280381f8b390f9e16819f49786a3fd90e0cfc0 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
if (s <> '') then
gMapOnce := True;
+ // Override map to test:
+ s := LowerCase(Find_Param_Value(pars, '-testmap'));
+ if s <> '' then
+ gTestMap := MapsDir + s;
+
// Delete test map after play:
s := Find_Param_Value(pars, '--testdelete');
if (s <> '') then
// Delete temporary WAD after play:
s := Find_Param_Value(pars, '--tempdelete');
- if (s <> '') then
+ if (s <> '') and (gTestMap <> '') then
begin
- gMapToDelete := MapsDir + map;
+ gMapToDelete := gTestMap;
gTempDelete := True;
end;
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();