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
74 var
78 begin
82 else
84 e_WriteLog('ProcessResource: "' + wad_to + '" "' + section_to + '" "' + filename + '" "' + section + '" "' + resource + '"', MSG_NOTIFY);
90 begin
91 (* Write resource only if it does not exists *)
94 begin
99 end
100 else
101 begin
102 //MessageBox(0, PChar(Format(_lc[I_MSG_WAD_ERROR], [ExtractFileName(filename)])), PChar(_lc[I_MSG_ERROR]), MB_OK + MB_ICONERROR);
103 MessageBox(0, PChar(Format(_lc[I_MSG_RES_ERROR], [filename, section, resource])), PChar(_lc[I_MSG_ERROR]), MB_OK + MB_ICONERROR);
105 end
109 var
119 begin
121 Exit;
123 Exit;
129 // Сохраняем карту в память:
132 Exit;
137 // Читаем карту из памяти:
142 // Получаем текстуры:
145 // Нужно копировать текстуры:
148 begin
151 Continue;
155 // Не записывать стандартные текстуры:
159 begin
160 // Копируем ресурс текстуры:
162 begin
164 Exit;
167 // Переименовываем ресурс текстуры:
174 // Получаем заголовок карты:
177 // Нужно копировать небо:
179 begin
183 // Не записывать стандартное небо:
187 begin
188 // Копируем ресурс неба:
190 begin
192 Exit;
195 // Переименовываем ресурс неба:
202 // Нужно копировать музыку:
204 begin
208 // Не записывать стандартную музыку:
212 begin
213 // Копируем ресурс музыки:
215 begin
217 Exit;
220 // Переименовываем ресурс музыки:
227 {
228 // Нужно копировать дополнительные текстуры:
229 if cbTextrures.Checked and (textures <> nil) and
230 (gPanels <> nil) and (gTriggers <> nil) then
231 begin
232 for a := 0 to High(gPanels) do
233 begin
234 ok := False;
236 // Ссылаются ли на эту панель триггеры:
237 for b := 0 to High(gTriggers) do
238 if ( (gTriggers[b].TriggerType in [TRIGGER_OPENDOOR,
239 TRIGGER_CLOSEDOOR, TRIGGER_DOOR, TRIGGER_DOOR5,
240 TRIGGER_CLOSETRAP, TRIGGER_TRAP, TRIGGER_LIFTUP,
241 TRIGGER_LIFTDOWN, TRIGGER_LIFT]) and
242 (gTriggers[b].Data.PanelID = a) ) or
243 (gTriggers[b].TexturePanel = a) then
244 begin
245 ok := True;
246 Break;
247 end;
249 // Есть триггеры на эту панель:
250 if ok and (gPanels[a].TextureName <> '') and
251 (not IsSpecialTexture(gPanels[a].TextureName) and
252 g_Texture_NumNameFindStart(gPanels[a].TextureName) then
253 begin
254 while True do
255 begin
256 r := g_Texture_NumNameFindNext(res);
257 case r of
258 NNF_NAME_FOUND: ;
259 NNF_NAME_EQUALS: Continue;
260 else Break;
261 end;
263 if res = '' then
264 Break;
266 g_GetResourceSection(res, @filename, @section, @resource);
268 // Не записывать стандартные дополнительные текстуры:
269 if (not cbNonStandart.Checked) or
270 ( (AnsiLowerCase(filename) <> STANDART_WAD) and
271 (AnsiLowerCase(filename) <> SHRSHADE_WAD) ) then
272 begin
273 // Копируем ресурс дополнительной текстуры:
274 if f_packmap.ProcessResource(eWAD.Text, tsection, filename, section, resource) then
275 begin
277 Нужно проверять есть такая текстура textures и есть ли она вообще?
278 // Переименовываем ресурс текстуры:
279 res := utf2win(Format(':%s\%s', [tsection, resource]));
280 ZeroMemory(@textures[a].Resource[0], 64);
281 CopyMemory(@textures[a].Resource[0], @res[1], Min(Length(res), 64));
285 end;
286 end;
287 end; // while True
288 end;
289 end;
290 end;
291 }
293 // Записываем изменения карты:
304 // Сохраняем карту из памяти под новым именем в WAD-файл:
312 MessageDlg(Format(_lc[I_MSG_PACKED], [eResource.Text, ExtractFileName(eWAD.Text)]), mtInformation, [mbOK], 0);
316 begin