3 {$INCLUDE ../shared/a_modes.inc}
5 interface
7 uses
11 type
16 // Сохранить в:
20 // Имя карты:
23 // Текстуры:
27 // Небо:
31 // Музыка:
35 // Дополнительно:
43 private
44 { Private declarations }
45 public
46 { Public declarations }
49 var
52 implementation
54 uses
58 {$R *.lfm}
60 const
66 begin
73 function ProcessResource(wad_to: TWADEditor_1; section_to, filename, section, resource: String): Boolean;
74 var
78 //s: string;
80 begin
85 else
88 // Читаем ресурс из WAD-файла карты или какого-то другого:
92 begin
93 Application.MessageBox(PChar(Format(MsgMsgWadError, [ExtractFileName(filename)])), PChar(MsgMsgError), MB_OK + MB_ICONERROR);
95 Exit;
99 begin
100 Application.MessageBox(PChar(Format(MsgMsgResError, [filename, section, resource])), PChar(MsgMsgError), MB_OK + MB_ICONERROR);
102 Exit;
107 {if wad_to.HaveResource(utf2win(section_to), utf2win(resource)) then
108 begin
109 for a := 2 to 256 do
110 begin
111 s := IntToStr(a);
112 if not wad_to.HaveResource(utf2win(section_to), utf2win(resource+s)) then Break;
113 end;
114 resource := resource+s;
115 end;}
117 // Если такого ресурса нет в WAD-файле-назначении, то копируем:
119 begin
131 var
142 begin
144 Exit;
146 Exit;
152 // Сохраняем карту в память:
155 Exit;
159 // Не перезаписывать WAD, а дополнить:
164 // Читаем карту из памяти:
169 // Получаем текстуры:
172 // Нужно копировать текстуры:
175 begin
178 Continue;
182 // Не записывать стандартные текстуры:
186 begin
187 // Копируем ресурс текстуры:
189 begin
192 Exit;
195 // Переименовываем ресурс текстуры:
202 // Получаем заголовок карты:
205 // Нужно копировать небо:
207 begin
211 // Не записывать стандартное небо:
215 begin
216 // Копируем ресурс неба:
218 begin
221 Exit;
224 // Переименовываем ресурс неба:
231 // Нужно копировать музыку:
233 begin
237 // Не записывать стандартную музыку:
241 begin
242 // Копируем ресурс музыки:
244 begin
247 Exit;
250 // Переименовываем ресурс музыки:
257 {
258 // Нужно копировать дополнительные текстуры:
259 if cbTextrures.Checked and (textures <> nil) and
260 (gPanels <> nil) and (gTriggers <> nil) then
261 begin
262 for a := 0 to High(gPanels) do
263 begin
264 ok := False;
266 // Ссылаются ли на эту панель триггеры:
267 for b := 0 to High(gTriggers) do
268 if ( (gTriggers[b].TriggerType in [TRIGGER_OPENDOOR,
269 TRIGGER_CLOSEDOOR, TRIGGER_DOOR, TRIGGER_DOOR5,
270 TRIGGER_CLOSETRAP, TRIGGER_TRAP, TRIGGER_LIFTUP,
271 TRIGGER_LIFTDOWN, TRIGGER_LIFT]) and
272 (gTriggers[b].Data.PanelID = a) ) or
273 (gTriggers[b].TexturePanel = a) then
274 begin
275 ok := True;
276 Break;
277 end;
279 // Есть триггеры на эту панель:
280 if ok and (gPanels[a].TextureName <> '') and
281 (not IsSpecialTexture(gPanels[a].TextureName) and
282 g_Texture_NumNameFindStart(gPanels[a].TextureName) then
283 begin
284 while True do
285 begin
286 r := g_Texture_NumNameFindNext(res);
287 case r of
288 NNF_NAME_FOUND: ;
289 NNF_NAME_EQUALS: Continue;
290 else Break;
291 end;
293 if res = '' then
294 Break;
296 g_ProcessResourceStr(res, @filename, @section, @resource);
298 // Не записывать стандартные дополнительные текстуры:
299 if (not cbNonStandart.Checked) or
300 ( (AnsiLowerCase(filename) <> STANDART_WAD) and
301 (AnsiLowerCase(filename) <> SHRSHADE_WAD) ) then
302 begin
303 // Копируем ресурс дополнительной текстуры:
304 if f_packmap.ProcessResource(WAD, tsection, filename, section, resource) then
305 begin
307 Нужно проверять есть такая текстура textures и есть ли она вообще?
308 // Переименовываем ресурс текстуры:
309 res := utf2win(Format(':%s\%s', [tsection, resource]));
310 ZeroMemory(@textures[a].Resource[0], 64);
311 CopyMemory(@textures[a].Resource[0], @res[1], Min(Length(res), 64));
315 end;
316 end;
317 end; // while True
318 end;
319 end;
320 end;
321 }
323 // Записываем изменения карты:
334 // Сохраняем карту из памяти под новым именем в WAD-файл:
343 MessageDlg(Format(MsgMsgPacked, [eResource.Text, ExtractFileName(eWAD.Text)]), mtInformation, [mbOK], 0);
348 begin