From a581a1646afd7753ba5c36a68be107d206bab45c Mon Sep 17 00:00:00 2001 From: DeaDDooMER Date: Mon, 22 May 2023 21:37:47 +0300 Subject: [PATCH] opts: add option --wads-dir --- src/editor/Editor.lpr | 9 +++++++++ src/editor/f_addresource.pas | 8 ++++---- src/editor/f_main.pas | 2 +- src/editor/f_packmap.pas | 2 +- src/editor/g_map.pas | 8 ++++---- src/editor/g_options.pas | 1 + 6 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/editor/Editor.lpr b/src/editor/Editor.lpr index 171c856..18f997c 100644 --- a/src/editor/Editor.lpr +++ b/src/editor/Editor.lpr @@ -113,6 +113,14 @@ uses Inc(i); EditorWad := ParamStr(i); end; + end + else if p = '--wads-dir' then + begin + if i + 1 <= ParamCount then + begin + Inc(i); + WadsDir := ParamStr(i); + end; end; Inc(i); end; @@ -152,6 +160,7 @@ begin CfgFileName := EditorDir + DirectorySeparator + 'Editor.cfg'; GameWad := EditorDir + DirectorySeparator + 'data' + DirectorySeparator + 'game.wad'; EditorWad := EditorDir + DirectorySeparator + 'data' + DirectorySeparator + 'editor.wad'; + WadsDir := EditorDir + DirectorySeparator + 'wads'; CheckParamOptions; InitLogs; diff --git a/src/editor/f_addresource.pas b/src/editor/f_addresource.pas index 24c9f83..d67765e 100644 --- a/src/editor/f_addresource.pas +++ b/src/editor/f_addresource.pas @@ -64,7 +64,7 @@ begin FFullResourceName := ''; FResourceSelected := False; - if FindFirst(EditorDir + 'wads/*.*', faAnyFile, SR) = 0 then + if FindFirst(WadsDir + DirectorySeparator + '*.*', faAnyFile, SR) = 0 then repeat if (SR.name <> '.') and (SR.name <> '..') then cbWADList.Items.Add(SR.Name); @@ -108,7 +108,7 @@ procedure TAddResourceForm.cbWADListChange(Sender: TObject); FileName, Section, sn, rn: String; begin if cbWADList.Text <> _lc[I_WAD_SPECIAL_MAP] then - FileName := EditorDir + 'wads/' + cbWADList.Text (* Resource wad *) + FileName := WadsDir + DirectorySeparator + cbWADList.Text (* Resource wad *) else g_ProcessResourceStr(OpenedMap, FileName, sn, rn); (* Map wad *) @@ -138,7 +138,7 @@ procedure TAddResourceForm.cbSectionsListChange(Sender: TObject); FileName, Section, SectionName, sn, rn: String; begin if cbWADList.Text <> _lc[I_WAD_SPECIAL_MAP] then - FileName := EditorDir + 'wads/' + cbWADList.Text (* Resource wad *) + FileName := WadsDir + DirectorySeparator + cbWADList.Text (* Resource wad *) else g_ProcessResourceStr(OpenedMap, FileName, sn, rn); (* Map wad *) @@ -179,7 +179,7 @@ begin g_ProcessResourceStr(OpenedMap, @fn, nil, nil); if FileName <> '' then - FFullResourceName := EditorDir + 'wads/' + FResourceName + FFullResourceName := WadsDir + DirectorySeparator + FResourceName else FFullResourceName := fn + FResourceName end; diff --git a/src/editor/f_main.pas b/src/editor/f_main.pas index be9dee3..e3c6288 100644 --- a/src/editor/f_main.pas +++ b/src/editor/f_main.pas @@ -1946,7 +1946,7 @@ begin end else begin // Внешний WAD - FileName := EditorDir+'wads/'+aWAD; + FileName := WadsDir + DirectorySeparator + aWAD; ResourceName := aWAD+':'+SectionName+'\'+aTex; end; diff --git a/src/editor/f_packmap.pas b/src/editor/f_packmap.pas index fbfe473..1fce2c2 100644 --- a/src/editor/f_packmap.pas +++ b/src/editor/f_packmap.pas @@ -80,7 +80,7 @@ begin if filename = '' then g_GetResourceSection(OpenedMap, filename, us, un) else - filename := EditorDir + 'wads/' + filename; + filename := WadsDir + DirectorySeparator + filename; e_WriteLog('ProcessResource: "' + wad_to + '" "' + section_to + '" "' + filename + '" "' + section + '" "' + resource + '"', MSG_NOTIFY); if resource = '' then Exit; diff --git a/src/editor/g_map.pas b/src/editor/g_map.pas index d6e71a0..3f3b58d 100644 --- a/src/editor/g_map.pas +++ b/src/editor/g_map.pas @@ -366,7 +366,7 @@ begin fn := fn + Res; end else - fn := EditorDir + 'wads/' + Res; + fn := WadsDir + DirectorySeparator + Res; g_CreateTextureWAD(SKY_TEXTURE, fn); end; @@ -1445,7 +1445,7 @@ begin if _fn = '' then TextureRes := FileName + ustr else - TextureRes := EditorDir+'wads/'+ustr; + TextureRes := WadsDir + DirectorySeparator + ustr; Error := False; @@ -1735,13 +1735,13 @@ begin Continue; // Нет такой текстуры - ищем в WAD карты: - if not g_CreateTextureWAD(s, EditorDir+'wads/'+s) then + if not g_CreateTextureWAD(s, WadsDir + DirectorySeparator + s) then begin s := ExtractFileName(_FileName); Delete(s, Length(s)-3, 4); s := UpperCase(s) + '.WAD:TEXTURES\'+ UpperCase(win2utf(map.ReadStr('Textures', 'TextureName'+IntToStr(a), ''))); - if not g_CreateTextureWAD(s, EditorDir+'wads/'+s) then + if not g_CreateTextureWAD(s, WadsDir + DirectorySeparator + s) then Continue; end; diff --git a/src/editor/g_options.pas b/src/editor/g_options.pas index acb5de9..19141ad 100644 --- a/src/editor/g_options.pas +++ b/src/editor/g_options.pas @@ -9,6 +9,7 @@ interface CfgFileName: AnsiString; GameWad: AnsiString; EditorWad: AnsiString; + WadsDir: AnsiString; implementation -- 2.29.2