summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fa51b0a)
raw | patch | inline | side by side (parent: fa51b0a)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Mon, 11 Sep 2017 22:20:04 +0000 (01:20 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Mon, 11 Sep 2017 22:20:26 +0000 (01:20 +0300) |
src/game/g_map.pas | patch | blob | history | |
src/game/g_window.pas | patch | blob | history | |
src/shared/a_modes.inc | patch | blob | history |
diff --git a/src/game/g_map.pas b/src/game/g_map.pas
index 1b92a967f0c31115b5101b3db1be3c003c1ae070..ad9c68ddbb5265a3c5619febfb53e696bc53d607 100644 (file)
--- a/src/game/g_map.pas
+++ b/src/game/g_map.pas
end;
var
WAD: TWADFile;
- mapReader: TDynRecord = nil;
+ //mapReader: TDynRecord = nil;
mapTextureList: TDynField = nil; //TTexturesRec1Array; tagInt: texture index
panels: TDynField = nil; //TPanelsRec1Array;
items: TDynField = nil; //TItemsRec1Array;
mapGrid.Free();
mapGrid := nil;
- gCurrentMap.Free();
- gCurrentMap := nil;
+ //gCurrentMap.Free();
+ //gCurrentMap := nil;
panByGUID := nil;
Result := False;
gMapInfo.Map := Res;
TriggersTable := nil;
- mapReader := nil;
+ //mapReader := nil;
sfsGCDisable(); // temporary disable removing of temporary volumes
try
- // Çàãðóçêà WAD:
- FileName := g_ExtractWadName(Res);
- e_WriteLog('Loading map WAD: '+FileName, MSG_NOTIFY);
- g_Game_SetLoadingText(_lc[I_LOAD_WAD_FILE], 0, False);
-
- WAD := TWADFile.Create();
- if not WAD.ReadFile(FileName) then
+ // Çàãðóçêà WAD (åñëè ó íàñ íåò óæå çàãðóæåíîé êàðòû)
+ if (gCurrentMap = nil) then
begin
- g_FatalError(Format(_lc[I_GAME_ERROR_MAP_WAD], [FileName]));
- WAD.Free();
- Exit;
- end;
+ FileName := g_ExtractWadName(Res);
+ e_WriteLog('Loading map WAD: '+FileName, MSG_NOTIFY);
+ g_Game_SetLoadingText(_lc[I_LOAD_WAD_FILE], 0, False);
+
+ WAD := TWADFile.Create();
+ if not WAD.ReadFile(FileName) then
+ begin
+ g_FatalError(Format(_lc[I_GAME_ERROR_MAP_WAD], [FileName]));
+ WAD.Free();
+ Exit;
+ end;
+
+ //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;
- //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;
- WAD.Free();
+ if (Len < 4) then
+ begin
+ e_LogWritefln('invalid map file: ''%s''', [mapResName]);
+ FreeMem(Data);
+ exit;
+ end;
- if (Len < 4) then
- begin
- e_LogWritefln('invalid map file: ''%s''', [mapResName]);
- FreeMem(Data);
- exit;
- end;
+ // Çàãðóçêà êàðòû:
+ e_LogWritefln('Loading map: %s', [mapResName], MSG_NOTIFY);
+ g_Game_SetLoadingText(_lc[I_LOAD_MAP], 0, False);
- // Çàãðóçêà êàðòû:
- e_LogWritefln('Loading map: %s', [mapResName], MSG_NOTIFY);
- g_Game_SetLoadingText(_lc[I_LOAD_MAP], 0, False);
+ stt := getTimeMicro();
- stt := getTimeMicro();
+ try
+ gCurrentMap := g_Map_ParseMap(Data, Len);
+ except
+ gCurrentMap.Free();
+ g_FatalError(Format(_lc[I_GAME_ERROR_MAP_LOAD], [Res]));
+ FreeMem(Data);
+ gCurrentMapFileName := '';
+ Exit;
+ end;
- try
- mapReader := g_Map_ParseMap(Data, Len);
- except
- mapReader.Free();
- g_FatalError(Format(_lc[I_GAME_ERROR_MAP_LOAD], [Res]));
FreeMem(Data);
- Exit;
- end;
- FreeMem(Data);
-
- if (mapReader = nil) then
+ if (gCurrentMap = nil) then
+ begin
+ e_LogWritefln('invalid map file: ''%s''', [mapResName]);
+ gCurrentMapFileName := '';
+ exit;
+ end;
+ end
+ else
begin
- e_LogWritefln('invalid map file: ''%s''', [mapResName]);
- exit;
+ stt := getTimeMicro();
end;
- gCurrentMap := mapReader;
+ //gCurrentMap := mapReader;
- generateExternalResourcesList(mapReader);
- mapTextureList := mapReader['texture'];
+ generateExternalResourcesList(gCurrentMap);
+ mapTextureList := gCurrentMap['texture'];
// get all other lists here too
- panels := mapReader['panel'];
- triggers := mapReader['trigger'];
- items := mapReader['item'];
- areas := mapReader['area'];
- monsters := mapReader['monster'];
+ panels := gCurrentMap['panel'];
+ triggers := gCurrentMap['trigger'];
+ items := gCurrentMap['item'];
+ areas := gCurrentMap['area'];
+ monsters := gCurrentMap['monster'];
// Çàãðóçêà îïèñàíèÿ êàðòû:
e_WriteLog(' Reading map info...', MSG_NOTIFY);
with gMapInfo do
begin
- Name := mapReader.MapName;
- Description := mapReader.MapDesc;
- Author := mapReader.MapAuthor;
- MusicName := mapReader.MusicName;
- SkyName := mapReader.SkyName;
- Height := mapReader.Height;
- Width := mapReader.Width;
+ Name := gCurrentMap.MapName;
+ Description := gCurrentMap.MapDesc;
+ Author := gCurrentMap.MapAuthor;
+ MusicName := gCurrentMap.MusicName;
+ SkyName := gCurrentMap.SkyName;
+ Height := gCurrentMap.Height;
+ Width := gCurrentMap.Width;
end;
// Çàãðóçêà òåêñòóð:
begin
e_WriteLog('error loading map: invalid texture index for panel', MSG_FATALERROR);
result := false;
+ gCurrentMap.Free();
gCurrentMap := nil;
gCurrentMapFileName := '';
exit;
for rec in monsters do CreateMonster(rec);
end;
- gCurrentMap := mapReader; // this will be our current map now
+ //gCurrentMap := mapReader; // this will be our current map now
gCurrentMapFileName := Res;
- mapReader := nil;
+ //mapReader := nil;
// Çàãðóçêà íåáà
if (gMapInfo.SkyName <> '') then
mapOk := true;
finally
sfsGCEnable(); // enable releasing unused volumes
- mapReader.Free();
+ //mapReader.Free();
e_ClearInputBuffer(); // why not?
if not mapOk then
begin
+ gCurrentMap.Free();
gCurrentMap := nil;
gCurrentMapFileName := '';
end;
begin
e_LogWritefln('g_Map_Free: no previous map.', []);
end;
+
if freeTextures then
begin
e_LogWritefln('g_Map_Free: clearing textures...', []);
TextNameHash := nil;
BadTextNameHash.Free();
BadTextNameHash := nil;
+ gCurrentMapFileName := '';
+ gCurrentMap.Free();
+ gCurrentMap := nil;
end;
panByGUID := nil;
diff --git a/src/game/g_window.pas b/src/game/g_window.pas
index 46ec6df528d540fa7b985c8ce5b58f78104284aa..71ec201bb1f9722cf39354213938eec54b9736d9 100644 (file)
--- a/src/game/g_window.pas
+++ b/src/game/g_window.pas
end;
end;
- {$IF DEFINED(D2F_DEBUG)}
if (arg = '--game-scale') or (arg = '-game-scale') then
begin
if (idx <= ParamCount) then
Inc(idx);
end;
end;
- {$ENDIF}
if (arg = '--write-mapdef') or (arg = '-write-mapdef') then
begin
diff --git a/src/shared/a_modes.inc b/src/shared/a_modes.inc
index 7e14a8bb81ad8745d769c514c47996db1eb6cedb..9a17a826784a4ad9ce948730fff2bf6b1eed5f67 100644 (file)
--- a/src/shared/a_modes.inc
+++ b/src/shared/a_modes.inc
{$POINTERMATH ON}
{$RANGECHECKS OFF}
{$SAFEFPUEXCEPTIONS OFF}
-{$SCOPEDENUMS OFF} // this will possibly be changed later
+{$SCOPEDENUMS OFF} // this may be changed later
{$SMARTLINK ON}
{$TYPEDADDRESS ON}
{$TYPEINFO ON}