From 212386359ea0af4e0a861f9bf92c45a1516ac87c Mon Sep 17 00:00:00 2001 From: Ketmar Dark Date: Fri, 25 Aug 2017 20:16:35 +0300 Subject: [PATCH] changed some backslashes to forward slashes --- src/editor/f_addresource.pas | 8 +- src/editor/f_main.pas | 20 ++--- src/editor/f_maptest.pas | 6 +- src/editor/f_options.pas | 4 +- src/editor/f_packmap.pas | 2 +- src/editor/g_map.pas | 154 +++++++++++++++++------------------ src/shared/BinEditor.pas | 6 +- src/shared/CONFIGSIMPLE.pas | 2 +- src/shared/WADEDITOR.pas | 10 +-- src/shared/utils.pas | 26 +++++- 10 files changed, 130 insertions(+), 108 deletions(-) diff --git a/src/editor/f_addresource.pas b/src/editor/f_addresource.pas index 71e1c1d..60fd18f 100644 --- a/src/editor/f_addresource.pas +++ b/src/editor/f_addresource.pas @@ -66,7 +66,7 @@ begin FResourceSelected := False; ChDir(EditorDir); - if FindFirst(EditorDir+'wads\*.wad', faAnyFile, SR) = 0 then + if FindFirst(EditorDir+'wads/*.wad', faAnyFile, SR) = 0 then repeat cbWADList.Items.Add(SR.Name); until FindNext(SR) <> 0; @@ -114,7 +114,7 @@ begin // Внешний WAD: if cbWADList.Text <> _lc[I_WAD_SPECIAL_MAP] then - FileName := EditorDir+'wads\'+cbWADList.Text + FileName := EditorDir+'wads/'+cbWADList.Text else // WAD карты: begin g_ProcessResourceStr(OpenedMap, fn, sn, rn); @@ -149,7 +149,7 @@ begin // Внешний WAD: if cbWADList.Text <> _lc[I_WAD_SPECIAL_MAP] then - FileName := EditorDir+'wads\'+cbWADList.Text + FileName := EditorDir+'wads/'+cbWADList.Text else // WAD карты: begin g_ProcessResourceStr(OpenedMap, fn, sn, rn); @@ -204,7 +204,7 @@ begin FResourceName := FileName+':'+SectionName+'\'+lbResourcesList.Items[lbResourcesList.ItemIndex]; if FileName <> '' then - FFullResourceName := EditorDir+'wads\'+FResourceName + FFullResourceName := EditorDir+'wads/'+FResourceName else begin g_ProcessResourceStr(OpenedMap, @fn, nil, nil); diff --git a/src/editor/f_main.pas b/src/editor/f_main.pas index 645e4c1..9a976f6 100644 --- a/src/editor/f_main.pas +++ b/src/editor/f_main.pas @@ -1906,7 +1906,7 @@ begin end else begin // Внешний WAD - FileName := EditorDir+'wads\'+aWAD; + FileName := EditorDir+'wads/'+aWAD; ResourceName := aWAD+':'+SectionName+'\'+aTex; end; @@ -2540,13 +2540,13 @@ begin cfglen := 0; wad := TWADEditor_1.Create; - if wad.ReadFile(EditorDir+'data\Game.wad') then + if wad.ReadFile(EditorDir+'data/Game.wad') then wad.GetResource('FONTS', cfgres, cfgdata, cfglen); wad.Free(); if cfglen <> 0 then begin - if not g_CreateTextureWAD('FONT_STD', EditorDir+'data\Game.wad:FONTS\'+texture) then + if not g_CreateTextureWAD('FONT_STD', EditorDir+'data/Game.wad:FONTS\'+texture) then e_WriteLog('ERROR ERROR ERROR', MSG_WARNING); config := TConfig.CreateMem(cfgdata, cfglen); @@ -2595,7 +2595,7 @@ begin OpenedMap := ''; OpenedWAD := ''; - config := TConfig.CreateFile(EditorDir+'\Editor.cfg'); + config := TConfig.CreateFile(EditorDir+'/Editor.cfg'); if config.ReadBool('Editor', 'Maximize', False) then WindowState := wsMaximized; @@ -4020,7 +4020,7 @@ var config: TConfig; i: Integer; begin - config := TConfig.CreateFile(EditorDir+'\Editor.cfg'); + config := TConfig.CreateFile(EditorDir+'/Editor.cfg'); config.WriteBool('Editor', 'Maximize', WindowState = wsMaximized); config.WriteBool('Editor', 'Minimap', ShowMap); @@ -4043,7 +4043,7 @@ begin config.WriteStr('RecentFiles', IntToStr(i+1), ''); RecentFiles.Free(); - config.SaveFile(EditorDir+'\Editor.cfg'); + config.SaveFile(EditorDir+'/Editor.cfg'); config.Free(); slInvalidTextures.Free; @@ -5751,9 +5751,9 @@ begin else gLanguage := LANGUAGE_RUSSIAN; end; - config := TConfig.CreateFile(EditorDir+'\Editor.cfg'); + config := TConfig.CreateFile(EditorDir+'/Editor.cfg'); config.WriteStr('Editor', 'Language', gLanguage); - config.SaveFile(EditorDir+'\Editor.cfg'); + config.SaveFile(EditorDir+'/Editor.cfg'); config.Free(); end; @@ -6231,13 +6231,13 @@ begin // Сохраняем временную карту: time := 0; repeat - mapWAD := ExtractFilePath(TestD2dExe) + Format('maps\temp%.4d.wad', [time]); + mapWAD := ExtractFilePath(TestD2dExe) + Format('maps/temp%.4d.wad', [time]); Inc(time); until not FileExists(mapWAD); mapToRun := mapWAD + ':\' + TEST_MAP_NAME; SaveMap(mapToRun); - mapToRun := ExtractRelativePath(ExtractFilePath(TestD2dExe) + 'maps\', mapToRun); + mapToRun := ExtractRelativePath(ExtractFilePath(TestD2dExe) + 'maps/', mapToRun); // Опции игры: opt := 32 + 64; diff --git a/src/editor/f_maptest.pas b/src/editor/f_maptest.pas index 4276659..470da17 100644 --- a/src/editor/f_maptest.pas +++ b/src/editor/f_maptest.pas @@ -70,7 +70,7 @@ var n: Integer; begin - config := TConfig.CreateFile(EditorDir+'\Editor.cfg'); + config := TConfig.CreateFile(EditorDir+'/Editor.cfg'); if rbTDM.Checked then s := 'TDM' @@ -114,7 +114,7 @@ begin config.WriteStr('TestRun', 'Exe', edD2dExe.Text); TestD2dExe := edD2dExe.Text; - config.SaveFile(EditorDir+'\Editor.cfg'); + config.SaveFile(EditorDir+'/Editor.cfg'); config.Free(); Close(); end; @@ -153,7 +153,7 @@ var config: TConfig; begin - config := TConfig.CreateFile(EditorDir+'\Editor.cfg'); + config := TConfig.CreateFile(EditorDir+'/Editor.cfg'); TestGameMode := config.ReadStr('TestRun', 'GameMode', 'DM'); TestLimTime := config.ReadStr('TestRun', 'LimTime', '0'); diff --git a/src/editor/f_options.pas b/src/editor/f_options.pas index 0b2e703..99be376 100644 --- a/src/editor/f_options.pas +++ b/src/editor/f_options.pas @@ -195,7 +195,7 @@ begin else DotSize := 1; - config := TConfig.CreateFile(EditorDir+'\Editor.cfg'); + config := TConfig.CreateFile(EditorDir+'/Editor.cfg'); config.WriteInt('Editor', 'DotColor', DotColor); config.WriteBool('Editor', 'DotEnable', DotEnable); @@ -217,7 +217,7 @@ begin MainForm.RefreshRecentMenu(); end; - config.SaveFile(EditorDir+'\Editor.cfg'); + config.SaveFile(EditorDir+'/Editor.cfg'); config.Free(); Close(); end; diff --git a/src/editor/f_packmap.pas b/src/editor/f_packmap.pas index f094d3e..c9e093e 100644 --- a/src/editor/f_packmap.pas +++ b/src/editor/f_packmap.pas @@ -84,7 +84,7 @@ begin if filename = '' then g_ProcessResourceStr(OpenedMap, @filename, nil, nil) else - filename := EditorDir+'wads\'+filename; + filename := EditorDir+'wads/'+filename; // Читаем ресурс из WAD-файла карты или какого-то другого: wad2 := TWADEditor_1.Create(); diff --git a/src/editor/g_map.pas b/src/editor/g_map.pas index a1e9bab..b5bf888 100644 --- a/src/editor/g_map.pas +++ b/src/editor/g_map.pas @@ -365,7 +365,7 @@ begin fn := fn + Res; end else - fn := EditorDir + 'wads\' + Res; + fn := EditorDir + 'wads/' + Res; g_CreateTextureWAD(SKY_TEXTURE, fn); end; @@ -1442,7 +1442,7 @@ begin if _fn = '' then TextureRes := FileName + textures[a].Resource else - TextureRes := EditorDir+'wads\'+textures[a].Resource; + TextureRes := EditorDir+'wads/'+textures[a].Resource; Error := False; @@ -1731,13 +1731,13 @@ begin Continue; // Нет такой текстуры - ищем в WAD карты: - if not g_CreateTextureWAD(s, EditorDir+'\wads\'+s) then + if not g_CreateTextureWAD(s, EditorDir+'/wads/'+s) then begin s := ExtractFileName(_FileName); Delete(s, Length(s)-3, 4); s := UpperCase(s) + '.WAD:TEXTURES\'+ UpperCase(map.ReadStr('Textures', 'TextureName'+IntToStr(a), '')); - if not g_CreateTextureWAD(s, EditorDir+'\wads\'+s) then + if not g_CreateTextureWAD(s, EditorDir+'/wads/'+s) then Continue; end; @@ -2722,79 +2722,79 @@ end; procedure LoadData(); begin - g_CreateTextureWAD('PREVIEW', EditorDir+'\data\Editor.wad:TEXTURES\CHECKERS'); - g_CreateTextureWAD('NOTEXTURE', EditorDir+'\data\Game.wad:TEXTURES\NOTEXTURE'); - - g_CreateTextureWADSize('AREA_REDFLAG', EditorDir+'\data\Game.wad:TEXTURES\FLAGRED', 0, 0, 64, 64); - g_CreateTextureWADSize('AREA_BLUEFLAG', EditorDir+'\data\Game.wad:TEXTURES\FLAGBLUE', 0, 0, 64, 64); - g_CreateTextureWADSize('AREA_DOMFLAG', EditorDir+'\data\Game.wad:TEXTURES\FLAGDOM', 0, 0, 64, 64); - - g_CreateTextureWADSize('MONSTER_DEMON', EditorDir+'\data\Game.wad:MTEXTURES\DEMON_SLEEP', 0, 0, 64, 64); - g_CreateTextureWADSize('MONSTER_IMP', EditorDir+'\data\Game.wad:MTEXTURES\IMP_SLEEP', 0, 0, 64, 64); - g_CreateTextureWADSize('MONSTER_ZOMBY', EditorDir+'\data\Game.wad:MTEXTURES\ZOMBY_SLEEP', 0, 0, 64, 64); - g_CreateTextureWADSize('MONSTER_SERG', EditorDir+'\data\Game.wad:MTEXTURES\SERG_SLEEP', 0, 0, 64, 64); - g_CreateTextureWADSize('MONSTER_CYBER', EditorDir+'\data\Game.wad:MTEXTURES\CYBER_SLEEP', 0, 0, 128, 128); - g_CreateTextureWADSize('MONSTER_CGUN', EditorDir+'\data\Game.wad:MTEXTURES\CGUN_SLEEP', 0, 0, 64, 64); - g_CreateTextureWADSize('MONSTER_BARON', EditorDir+'\data\Game.wad:MTEXTURES\BARON_SLEEP', 0, 0, 128, 128); - g_CreateTextureWADSize('MONSTER_KNIGHT', EditorDir+'\data\Game.wad:MTEXTURES\KNIGHT_SLEEP', 0, 0, 128, 128); - g_CreateTextureWADSize('MONSTER_CACO', EditorDir+'\data\Game.wad:MTEXTURES\CACO_SLEEP', 0, 0, 128, 128); - g_CreateTextureWADSize('MONSTER_SOUL', EditorDir+'\data\Game.wad:MTEXTURES\SOUL_SLEEP', 0, 0, 64, 64); - g_CreateTextureWADSize('MONSTER_PAIN', EditorDir+'\data\Game.wad:MTEXTURES\PAIN_SLEEP', 0, 0, 128, 128); - g_CreateTextureWADSize('MONSTER_SPIDER', EditorDir+'\data\Game.wad:MTEXTURES\SPIDER_SLEEP', 0, 0, 256, 128); - g_CreateTextureWADSize('MONSTER_BSP', EditorDir+'\data\Game.wad:MTEXTURES\BSP_SLEEP', 0, 0, 128, 64); - g_CreateTextureWADSize('MONSTER_MANCUB', EditorDir+'\data\Game.wad:MTEXTURES\MANCUB_SLEEP', 0, 0, 128, 128); - g_CreateTextureWADSize('MONSTER_SKEL', EditorDir+'\data\Game.wad:MTEXTURES\SKEL_SLEEP', 0, 0, 128, 128); - g_CreateTextureWADSize('MONSTER_VILE', EditorDir+'\data\Game.wad:MTEXTURES\VILE_SLEEP', 0, 0, 128, 128); - g_CreateTextureWADSize('MONSTER_FISH', EditorDir+'\data\Game.wad:MTEXTURES\FISH_SLEEP', 0, 0, 32, 32); - g_CreateTextureWADSize('MONSTER_BARREL', EditorDir+'\data\Game.wad:MTEXTURES\BARREL_SLEEP', 0, 0, 64, 64); - g_CreateTextureWADSize('MONSTER_ROBO', EditorDir+'\data\Game.wad:MTEXTURES\ROBO_SLEEP', 0, 0, 128, 128); - g_CreateTextureWADSize('MONSTER_MAN', EditorDir+'\data\Game.wad:MTEXTURES\MAN_SLEEP', 0, 0, 64, 64); - - g_CreateTextureWADSize('ITEM_BLUESPHERE', EditorDir+'\data\Game.wad:TEXTURES\SBLUE', 0, 0, 32, 32); - g_CreateTextureWADSize('ITEM_WHITESPHERE', EditorDir+'\data\Game.wad:TEXTURES\SWHITE', 0, 0, 32, 32); - g_CreateTextureWADSize('ITEM_ARMORGREEN', EditorDir+'\data\Game.wad:TEXTURES\ARMORGREEN', 0, 0, 32, 16); - g_CreateTextureWADSize('ITEM_ARMORBLUE', EditorDir+'\data\Game.wad:TEXTURES\ARMORBLUE', 0, 0, 32, 16); - g_CreateTextureWADSize('ITEM_INVUL', EditorDir+'\data\Game.wad:TEXTURES\INVUL', 0, 0, 32, 32); - g_CreateTextureWADSize('ITEM_BOTTLE', EditorDir+'\data\Game.wad:TEXTURES\BOTTLE', 0, 0, 16, 32); - g_CreateTextureWADSize('ITEM_HELMET', EditorDir+'\data\Game.wad:TEXTURES\HELMET', 0, 0, 16, 16); - g_CreateTextureWADSize('ITEM_INVIS', EditorDir+'\data\Game.wad:TEXTURES\INVIS', 0, 0, 32, 32); - g_CreateTextureWADSize('ITEM_WEAPON_FLAMETHROWER', EditorDir+'\data\Game.wad:TEXTURES\FLAMETHROWER', 0, 0, 64, 32); - g_CreateTextureWADSize('ITEM_AMMO_FUELCAN', EditorDir+'\data\Game.wad:TEXTURES\FUELCAN', 0, 0, 16, 32); - - g_CreateTextureWAD('ITEM_MEDKIT_SMALL', EditorDir+'\data\Game.wad:TEXTURES\MED1'); - g_CreateTextureWAD('ITEM_MEDKIT_LARGE', EditorDir+'\data\Game.wad:TEXTURES\MED2'); - g_CreateTextureWAD('ITEM_WEAPON_SAW', EditorDir+'\data\Game.wad:TEXTURES\SAW'); - g_CreateTextureWAD('ITEM_WEAPON_PISTOL', EditorDir+'\data\Game.wad:TEXTURES\PISTOL'); - g_CreateTextureWAD('ITEM_WEAPON_KASTET', EditorDir+'\data\Game.wad:TEXTURES\KASTET'); - g_CreateTextureWAD('ITEM_WEAPON_SHOTGUN1', EditorDir+'\data\Game.wad:TEXTURES\SHOTGUN1'); - g_CreateTextureWAD('ITEM_WEAPON_SHOTGUN2', EditorDir+'\data\Game.wad:TEXTURES\SHOTGUN2'); - g_CreateTextureWAD('ITEM_WEAPON_CHAINGUN', EditorDir+'\data\Game.wad:TEXTURES\MGUN'); - g_CreateTextureWAD('ITEM_WEAPON_ROCKETLAUNCHER', EditorDir+'\data\Game.wad:TEXTURES\RLAUNCHER'); - g_CreateTextureWAD('ITEM_WEAPON_PLASMA', EditorDir+'\data\Game.wad:TEXTURES\PGUN'); - g_CreateTextureWAD('ITEM_WEAPON_BFG', EditorDir+'\data\Game.wad:TEXTURES\BFG'); - g_CreateTextureWAD('ITEM_WEAPON_SUPERPULEMET', EditorDir+'\data\Game.wad:TEXTURES\SPULEMET'); - g_CreateTextureWAD('ITEM_AMMO_BULLETS', EditorDir+'\data\Game.wad:TEXTURES\CLIP'); - g_CreateTextureWAD('ITEM_AMMO_BULLETS_BOX', EditorDir+'\data\Game.wad:TEXTURES\AMMO'); - g_CreateTextureWAD('ITEM_AMMO_SHELLS', EditorDir+'\data\Game.wad:TEXTURES\SHELL1'); - g_CreateTextureWAD('ITEM_AMMO_SHELLS_BOX', EditorDir+'\data\Game.wad:TEXTURES\SHELL2'); - g_CreateTextureWAD('ITEM_AMMO_ROCKET', EditorDir+'\data\Game.wad:TEXTURES\ROCKET'); - g_CreateTextureWAD('ITEM_AMMO_ROCKET_BOX', EditorDir+'\data\Game.wad:TEXTURES\ROCKETS'); - g_CreateTextureWAD('ITEM_AMMO_CELL', EditorDir+'\data\Game.wad:TEXTURES\CELL'); - g_CreateTextureWAD('ITEM_AMMO_CELL_BIG', EditorDir+'\data\Game.wad:TEXTURES\CELL2'); - g_CreateTextureWAD('ITEM_AMMO_BACKPACK', EditorDir+'\data\Game.wad:TEXTURES\BPACK'); - g_CreateTextureWAD('ITEM_KEY_RED', EditorDir+'\data\Game.wad:TEXTURES\KEYR'); - g_CreateTextureWAD('ITEM_KEY_GREEN', EditorDir+'\data\Game.wad:TEXTURES\KEYG'); - g_CreateTextureWAD('ITEM_KEY_BLUE', EditorDir+'\data\Game.wad:TEXTURES\KEYB'); - g_CreateTextureWAD('ITEM_OXYGEN', EditorDir+'\data\Game.wad:TEXTURES\OXYGEN'); - g_CreateTextureWAD('ITEM_SUIT', EditorDir+'\data\Game.wad:TEXTURES\SUIT'); - g_CreateTextureWAD('ITEM_MEDKIT_BLACK', EditorDir+'\data\Game.wad:TEXTURES\BMED'); - g_CreateTextureWAD('ITEM_JETPACK', EditorDir+'\data\Game.wad:TEXTURES\JETPACK'); - - g_CreateTextureWAD('AREA_PLAYERPOINT1', EditorDir+'\data\Editor.wad:TEXTURES\P1POINT'); - g_CreateTextureWAD('AREA_PLAYERPOINT2', EditorDir+'\data\Editor.wad:TEXTURES\P2POINT'); - g_CreateTextureWAD('AREA_DMPOINT', EditorDir+'\data\Editor.wad:TEXTURES\DMPOINT'); - g_CreateTextureWAD('AREA_REDPOINT', EditorDir+'\data\Editor.wad:TEXTURES\REDPOINT'); - g_CreateTextureWAD('AREA_BLUEPOINT', EditorDir+'\data\Editor.wad:TEXTURES\BLUEPOINT'); + g_CreateTextureWAD('PREVIEW', EditorDir+'/data/Editor.wad:TEXTURES\CHECKERS'); + g_CreateTextureWAD('NOTEXTURE', EditorDir+'/data/Game.wad:TEXTURES\NOTEXTURE'); + + g_CreateTextureWADSize('AREA_REDFLAG', EditorDir+'/data/Game.wad:TEXTURES\FLAGRED', 0, 0, 64, 64); + g_CreateTextureWADSize('AREA_BLUEFLAG', EditorDir+'/data/Game.wad:TEXTURES\FLAGBLUE', 0, 0, 64, 64); + g_CreateTextureWADSize('AREA_DOMFLAG', EditorDir+'/data/Game.wad:TEXTURES\FLAGDOM', 0, 0, 64, 64); + + g_CreateTextureWADSize('MONSTER_DEMON', EditorDir+'/data/Game.wad:MTEXTURES\DEMON_SLEEP', 0, 0, 64, 64); + g_CreateTextureWADSize('MONSTER_IMP', EditorDir+'/data/Game.wad:MTEXTURES\IMP_SLEEP', 0, 0, 64, 64); + g_CreateTextureWADSize('MONSTER_ZOMBY', EditorDir+'/data/Game.wad:MTEXTURES\ZOMBY_SLEEP', 0, 0, 64, 64); + g_CreateTextureWADSize('MONSTER_SERG', EditorDir+'/data/Game.wad:MTEXTURES\SERG_SLEEP', 0, 0, 64, 64); + g_CreateTextureWADSize('MONSTER_CYBER', EditorDir+'/data/Game.wad:MTEXTURES\CYBER_SLEEP', 0, 0, 128, 128); + g_CreateTextureWADSize('MONSTER_CGUN', EditorDir+'/data/Game.wad:MTEXTURES\CGUN_SLEEP', 0, 0, 64, 64); + g_CreateTextureWADSize('MONSTER_BARON', EditorDir+'/data/Game.wad:MTEXTURES\BARON_SLEEP', 0, 0, 128, 128); + g_CreateTextureWADSize('MONSTER_KNIGHT', EditorDir+'/data/Game.wad:MTEXTURES\KNIGHT_SLEEP', 0, 0, 128, 128); + g_CreateTextureWADSize('MONSTER_CACO', EditorDir+'/data/Game.wad:MTEXTURES\CACO_SLEEP', 0, 0, 128, 128); + g_CreateTextureWADSize('MONSTER_SOUL', EditorDir+'/data/Game.wad:MTEXTURES\SOUL_SLEEP', 0, 0, 64, 64); + g_CreateTextureWADSize('MONSTER_PAIN', EditorDir+'/data/Game.wad:MTEXTURES\PAIN_SLEEP', 0, 0, 128, 128); + g_CreateTextureWADSize('MONSTER_SPIDER', EditorDir+'/data/Game.wad:MTEXTURES\SPIDER_SLEEP', 0, 0, 256, 128); + g_CreateTextureWADSize('MONSTER_BSP', EditorDir+'/data/Game.wad:MTEXTURES\BSP_SLEEP', 0, 0, 128, 64); + g_CreateTextureWADSize('MONSTER_MANCUB', EditorDir+'/data/Game.wad:MTEXTURES\MANCUB_SLEEP', 0, 0, 128, 128); + g_CreateTextureWADSize('MONSTER_SKEL', EditorDir+'/data/Game.wad:MTEXTURES\SKEL_SLEEP', 0, 0, 128, 128); + g_CreateTextureWADSize('MONSTER_VILE', EditorDir+'/data/Game.wad:MTEXTURES\VILE_SLEEP', 0, 0, 128, 128); + g_CreateTextureWADSize('MONSTER_FISH', EditorDir+'/data/Game.wad:MTEXTURES\FISH_SLEEP', 0, 0, 32, 32); + g_CreateTextureWADSize('MONSTER_BARREL', EditorDir+'/data/Game.wad:MTEXTURES\BARREL_SLEEP', 0, 0, 64, 64); + g_CreateTextureWADSize('MONSTER_ROBO', EditorDir+'/data/Game.wad:MTEXTURES\ROBO_SLEEP', 0, 0, 128, 128); + g_CreateTextureWADSize('MONSTER_MAN', EditorDir+'/data/Game.wad:MTEXTURES\MAN_SLEEP', 0, 0, 64, 64); + + g_CreateTextureWADSize('ITEM_BLUESPHERE', EditorDir+'/data/Game.wad:TEXTURES\SBLUE', 0, 0, 32, 32); + g_CreateTextureWADSize('ITEM_WHITESPHERE', EditorDir+'/data/Game.wad:TEXTURES\SWHITE', 0, 0, 32, 32); + g_CreateTextureWADSize('ITEM_ARMORGREEN', EditorDir+'/data/Game.wad:TEXTURES\ARMORGREEN', 0, 0, 32, 16); + g_CreateTextureWADSize('ITEM_ARMORBLUE', EditorDir+'/data/Game.wad:TEXTURES\ARMORBLUE', 0, 0, 32, 16); + g_CreateTextureWADSize('ITEM_INVUL', EditorDir+'/data/Game.wad:TEXTURES\INVUL', 0, 0, 32, 32); + g_CreateTextureWADSize('ITEM_BOTTLE', EditorDir+'/data/Game.wad:TEXTURES\BOTTLE', 0, 0, 16, 32); + g_CreateTextureWADSize('ITEM_HELMET', EditorDir+'/data/Game.wad:TEXTURES\HELMET', 0, 0, 16, 16); + g_CreateTextureWADSize('ITEM_INVIS', EditorDir+'/data/Game.wad:TEXTURES\INVIS', 0, 0, 32, 32); + g_CreateTextureWADSize('ITEM_WEAPON_FLAMETHROWER', EditorDir+'/data/Game.wad:TEXTURES\FLAMETHROWER', 0, 0, 64, 32); + g_CreateTextureWADSize('ITEM_AMMO_FUELCAN', EditorDir+'/data/Game.wad:TEXTURES\FUELCAN', 0, 0, 16, 32); + + g_CreateTextureWAD('ITEM_MEDKIT_SMALL', EditorDir+'/data/Game.wad:TEXTURES\MED1'); + g_CreateTextureWAD('ITEM_MEDKIT_LARGE', EditorDir+'/data/Game.wad:TEXTURES\MED2'); + g_CreateTextureWAD('ITEM_WEAPON_SAW', EditorDir+'/data/Game.wad:TEXTURES\SAW'); + g_CreateTextureWAD('ITEM_WEAPON_PISTOL', EditorDir+'/data/Game.wad:TEXTURES\PISTOL'); + g_CreateTextureWAD('ITEM_WEAPON_KASTET', EditorDir+'/data/Game.wad:TEXTURES\KASTET'); + g_CreateTextureWAD('ITEM_WEAPON_SHOTGUN1', EditorDir+'/data/Game.wad:TEXTURES\SHOTGUN1'); + g_CreateTextureWAD('ITEM_WEAPON_SHOTGUN2', EditorDir+'/data/Game.wad:TEXTURES\SHOTGUN2'); + g_CreateTextureWAD('ITEM_WEAPON_CHAINGUN', EditorDir+'/data/Game.wad:TEXTURES\MGUN'); + g_CreateTextureWAD('ITEM_WEAPON_ROCKETLAUNCHER', EditorDir+'/data/Game.wad:TEXTURES\RLAUNCHER'); + g_CreateTextureWAD('ITEM_WEAPON_PLASMA', EditorDir+'/data/Game.wad:TEXTURES\PGUN'); + g_CreateTextureWAD('ITEM_WEAPON_BFG', EditorDir+'/data/Game.wad:TEXTURES\BFG'); + g_CreateTextureWAD('ITEM_WEAPON_SUPERPULEMET', EditorDir+'/data/Game.wad:TEXTURES\SPULEMET'); + g_CreateTextureWAD('ITEM_AMMO_BULLETS', EditorDir+'/data/Game.wad:TEXTURES\CLIP'); + g_CreateTextureWAD('ITEM_AMMO_BULLETS_BOX', EditorDir+'/data/Game.wad:TEXTURES\AMMO'); + g_CreateTextureWAD('ITEM_AMMO_SHELLS', EditorDir+'/data/Game.wad:TEXTURES\SHELL1'); + g_CreateTextureWAD('ITEM_AMMO_SHELLS_BOX', EditorDir+'/data/Game.wad:TEXTURES\SHELL2'); + g_CreateTextureWAD('ITEM_AMMO_ROCKET', EditorDir+'/data/Game.wad:TEXTURES\ROCKET'); + g_CreateTextureWAD('ITEM_AMMO_ROCKET_BOX', EditorDir+'/data/Game.wad:TEXTURES\ROCKETS'); + g_CreateTextureWAD('ITEM_AMMO_CELL', EditorDir+'/data/Game.wad:TEXTURES\CELL'); + g_CreateTextureWAD('ITEM_AMMO_CELL_BIG', EditorDir+'/data/Game.wad:TEXTURES\CELL2'); + g_CreateTextureWAD('ITEM_AMMO_BACKPACK', EditorDir+'/data/Game.wad:TEXTURES\BPACK'); + g_CreateTextureWAD('ITEM_KEY_RED', EditorDir+'/data/Game.wad:TEXTURES\KEYR'); + g_CreateTextureWAD('ITEM_KEY_GREEN', EditorDir+'/data/Game.wad:TEXTURES\KEYG'); + g_CreateTextureWAD('ITEM_KEY_BLUE', EditorDir+'/data/Game.wad:TEXTURES\KEYB'); + g_CreateTextureWAD('ITEM_OXYGEN', EditorDir+'/data/Game.wad:TEXTURES\OXYGEN'); + g_CreateTextureWAD('ITEM_SUIT', EditorDir+'/data/Game.wad:TEXTURES\SUIT'); + g_CreateTextureWAD('ITEM_MEDKIT_BLACK', EditorDir+'/data/Game.wad:TEXTURES\BMED'); + g_CreateTextureWAD('ITEM_JETPACK', EditorDir+'/data/Game.wad:TEXTURES\JETPACK'); + + g_CreateTextureWAD('AREA_PLAYERPOINT1', EditorDir+'/data/Editor.wad:TEXTURES\P1POINT'); + g_CreateTextureWAD('AREA_PLAYERPOINT2', EditorDir+'/data/Editor.wad:TEXTURES\P2POINT'); + g_CreateTextureWAD('AREA_DMPOINT', EditorDir+'/data/Editor.wad:TEXTURES\DMPOINT'); + g_CreateTextureWAD('AREA_REDPOINT', EditorDir+'/data/Editor.wad:TEXTURES\REDPOINT'); + g_CreateTextureWAD('AREA_BLUEPOINT', EditorDir+'/data/Editor.wad:TEXTURES\BLUEPOINT'); end; procedure FreeData(); diff --git a/src/shared/BinEditor.pas b/src/shared/BinEditor.pas index f59d4f3..43fa78f 100644 --- a/src/shared/BinEditor.pas +++ b/src/shared/BinEditor.pas @@ -99,7 +99,7 @@ procedure ZeroMemory(Dest: Pointer; Len: Cardinal); Implementation Uses - Math, e_log; + Math, e_log, utils; Const MAX_BIN_SIZE = 4 * 1024 * 1024; // 4 MB @@ -536,7 +536,7 @@ begin if (not FileExists(aFileName)) or (aOverWrite) then begin - AssignFile(FHandle, aFileName); + AssignFile(FHandle, findFileCIStr(aFileName)); ReWrite(FHandle, 1); // Ñèãíàòóðà: @@ -607,7 +607,7 @@ begin if FileExists(aFileName) then begin - AssignFile(FHandle, aFileName); + AssignFile(FHandle, findFileCIStr(aFileName)); ReSet(FHandle, 1); // Ñèãíàòóðà: diff --git a/src/shared/CONFIGSIMPLE.pas b/src/shared/CONFIGSIMPLE.pas index 05960de..b2977e8 100644 --- a/src/shared/CONFIGSIMPLE.pas +++ b/src/shared/CONFIGSIMPLE.pas @@ -65,7 +65,7 @@ begin if cfg_data <> nil then config_close(); - AssignFile(f, FileName); + AssignFile(f, findFileCIStr(FileName)); {$I-} Reset(f); diff --git a/src/shared/WADEDITOR.pas b/src/shared/WADEDITOR.pas index 3c6c1a3..2611009 100644 --- a/src/shared/WADEDITOR.pas +++ b/src/shared/WADEDITOR.pas @@ -75,7 +75,7 @@ const implementation uses - SysUtils, BinEditor, ZLib; + SysUtils, BinEditor, ZLib, utils; const DFWAD_OPENED_NONE = 0; @@ -291,7 +291,7 @@ var begin Result := False; - AssignFile(ResourceFile, FileName); + AssignFile(ResourceFile, findFileCIStr(FileName)); try Reset(ResourceFile, 1); @@ -421,7 +421,7 @@ begin if FResData <> nil then FreeMem(FResData); try - AssignFile(WADFile, FFileName); + AssignFile(WADFile, findFileCIStr(FFileName)); Reset(WADFile, 1); b := 6+SizeOf(TWADHeaderRec_1)+SizeOf(TResourceTableRec_1)*Length(FResTable); @@ -578,7 +578,7 @@ begin if FWADOpened = DFWAD_OPENED_FILE then begin try - AssignFile(WADFile, FFileName); + AssignFile(WADFile, findFileCIStr(FFileName)); Reset(WADFile, 1); Seek(WADFile, FResTable[i].Address+6+ @@ -695,7 +695,7 @@ begin FFileName := FileName; - AssignFile(WADFile, FFileName); + AssignFile(WADFile, findFileCIStr(FFileName)); try Reset(WADFile, 1); diff --git a/src/shared/utils.pas b/src/shared/utils.pas index 253e838..9bb12ec 100644 --- a/src/shared/utils.pas +++ b/src/shared/utils.pas @@ -49,6 +49,9 @@ function utf8to1251 (s: AnsiString): AnsiString; // nobody cares about shitdoze, so i'll use the same code path for it function findFileCI (var pathname: AnsiString; lastIsDir: Boolean=false): Boolean; +// returns name (the same if no file found) +function findFileCIStr (pathname: AnsiString; lastIsDir: Boolean=false): AnsiString; + // they throws function openDiskFileRO (pathname: AnsiString): TStream; function createDiskFile (pathname: AnsiString): TStream; @@ -354,7 +357,7 @@ begin // remove trailing slashes again while (length(npt) > 0) and ((npt[1] = '/') or (npt[1] = '\')) do Delete(npt, 1, 1); wantdir := lastIsDir or (length(npt) > 0); // do we want directory here? - //writeln(Format('npt=[%s]; newname=[%s]; curname=[%s]; wantdir=%d', [npt, newname, curname, Integer(wantdir)])); + writeln(Format('0: npt=[%s]; newname=[%s]; curname=[%s]; wantdir=%d', [npt, newname, curname, Integer(wantdir)])); // try the easiest case first attr := FileGetAttr(newname+curname); if attr <> -1 then @@ -362,12 +365,13 @@ begin if wantdir = ((attr and faDirectory) <> 0) then begin // i found her! + writeln(Format('3: npt=[%s]; newname=[%s]; curname=[%s]; wantdir=%d; found=tan', [npt, newname, curname, Integer(wantdir)])); newname := newname+curname; if wantdir then newname := newname+'/'; continue; end; end; - //writeln(Format('npt=[%s]; newname=[%s]; curname=[%s]; wantdir=%d', [npt, newname, curname, Integer(wantdir)])); + writeln(Format('1: npt=[%s]; newname=[%s]; curname=[%s]; wantdir=%d', [npt, newname, curname, Integer(wantdir)])); // alas, either not found, or invalid attributes foundher := false; try @@ -385,11 +389,29 @@ begin finally FindClose(sr); end; + if (foundher) then + begin + writeln(Format('2: npt=[%s]; newname=[%s]; curname=[%s]; wantdir=%d; found=tan', [npt, newname, curname, Integer(wantdir)])); + end + else + begin + writeln(Format('2: npt=[%s]; newname=[%s]; curname=[%s]; wantdir=%d; found=ona', [npt, newname, curname, Integer(wantdir)])); + end; if not foundher then begin newname := ''; result := false; break; end; end; + writeln(Format('4: npt=[%s]; newname=[%s]; curname=[%s]; wantdir=%d; found=ona', [npt, newname, curname, Integer(wantdir)])); if result then pathname := newname; end; +function findFileCIStr (pathname: AnsiString; lastIsDir: Boolean=false): AnsiString; +var + s: AnsiString; +begin + s := pathname; + if not findFileCI(s, lastIsDir) then s := pathname; + writeln(Format('***: pathname=[%s]; s=[%s]', [pathname, s])); + result := s; +end; function openDiskFileRO (pathname: AnsiString): TStream; begin -- 2.29.2