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
77 begin
80 else
85 begin
86 (* Write resource only if it does not exists *)
88 begin
95 end
96 else
97 begin
98 //MessageBox(0, PChar(Format(_lc[I_MSG_WAD_ERROR], [ExtractFileName(filename)])), PChar(_lc[I_MSG_ERROR]), MB_OK + MB_ICONERROR);
99 MessageBox(0, PChar(Format(_lc[I_MSG_RES_ERROR], [filename, section, resource])), PChar(_lc[I_MSG_ERROR]), MB_OK + MB_ICONERROR);
101 end
105 var
116 begin
118 Exit;
120 Exit;
126 // Сохраняем карту в память:
129 Exit;
133 // Не перезаписывать WAD, а дополнить:
138 // Читаем карту из памяти:
143 // Получаем текстуры:
146 // Нужно копировать текстуры:
149 begin
152 Continue;
156 // Не записывать стандартные текстуры:
160 begin
161 // Копируем ресурс текстуры:
163 begin
166 Exit;
169 // Переименовываем ресурс текстуры:
176 // Получаем заголовок карты:
179 // Нужно копировать небо:
181 begin
185 // Не записывать стандартное небо:
189 begin
190 // Копируем ресурс неба:
192 begin
195 Exit;
198 // Переименовываем ресурс неба:
205 // Нужно копировать музыку:
207 begin
211 // Не записывать стандартную музыку:
215 begin
216 // Копируем ресурс музыки:
218 begin
221 Exit;
224 // Переименовываем ресурс музыки:
231 {
232 // Нужно копировать дополнительные текстуры:
233 if cbTextrures.Checked and (textures <> nil) and
234 (gPanels <> nil) and (gTriggers <> nil) then
235 begin
236 for a := 0 to High(gPanels) do
237 begin
238 ok := False;
240 // Ссылаются ли на эту панель триггеры:
241 for b := 0 to High(gTriggers) do
242 if ( (gTriggers[b].TriggerType in [TRIGGER_OPENDOOR,
243 TRIGGER_CLOSEDOOR, TRIGGER_DOOR, TRIGGER_DOOR5,
244 TRIGGER_CLOSETRAP, TRIGGER_TRAP, TRIGGER_LIFTUP,
245 TRIGGER_LIFTDOWN, TRIGGER_LIFT]) and
246 (gTriggers[b].Data.PanelID = a) ) or
247 (gTriggers[b].TexturePanel = a) then
248 begin
249 ok := True;
250 Break;
251 end;
253 // Есть триггеры на эту панель:
254 if ok and (gPanels[a].TextureName <> '') and
255 (not IsSpecialTexture(gPanels[a].TextureName) and
256 g_Texture_NumNameFindStart(gPanels[a].TextureName) then
257 begin
258 while True do
259 begin
260 r := g_Texture_NumNameFindNext(res);
261 case r of
262 NNF_NAME_FOUND: ;
263 NNF_NAME_EQUALS: Continue;
264 else Break;
265 end;
267 if res = '' then
268 Break;
270 g_ProcessResourceStr(res, @filename, @section, @resource);
272 // Не записывать стандартные дополнительные текстуры:
273 if (not cbNonStandart.Checked) or
274 ( (AnsiLowerCase(filename) <> STANDART_WAD) and
275 (AnsiLowerCase(filename) <> SHRSHADE_WAD) ) then
276 begin
277 // Копируем ресурс дополнительной текстуры:
278 if f_packmap.ProcessResource(WAD, tsection, filename, section, resource) then
279 begin
281 Нужно проверять есть такая текстура textures и есть ли она вообще?
282 // Переименовываем ресурс текстуры:
283 res := utf2win(Format(':%s\%s', [tsection, resource]));
284 ZeroMemory(@textures[a].Resource[0], 64);
285 CopyMemory(@textures[a].Resource[0], @res[1], Min(Length(res), 64));
289 end;
290 end;
291 end; // while True
292 end;
293 end;
294 end;
295 }
297 // Записываем изменения карты:
308 // Сохраняем карту из памяти под новым именем в WAD-файл:
325 begin