… | |
… | |
39 | maplore => "endmaplore", |
39 | maplore => "endmaplore", |
40 | ); |
40 | ); |
41 | |
41 | |
42 | # same as in server save routine, to (hopefully) be compatible |
42 | # same as in server save routine, to (hopefully) be compatible |
43 | # to the other editors. |
43 | # to the other editors. |
|
|
44 | our @FIELD_ORDER_MAP = (qw( |
|
|
45 | name swap_time reset_timeout fixed_resettime difficulty region |
|
|
46 | shopitems shopgreed shopmin shopmax shoprace |
|
|
47 | darkness width height enter_x enter_y msg maplore |
|
|
48 | unique template |
|
|
49 | outdoor temp pressure humid windspeed winddir sky nosmooth |
|
|
50 | tile_path_1 tile_path_2 tile_path_3 tile_path_4 |
|
|
51 | )); |
|
|
52 | |
44 | our @FIELD_ORDER = (qw( |
53 | our @FIELD_ORDER = (qw( |
|
|
54 | elevation |
|
|
55 | |
45 | name name_pl custom_name title race |
56 | name name_pl custom_name title race |
46 | slaying skill msg lore other_arch face |
57 | slaying skill msg lore other_arch face |
47 | #events |
58 | #todo-events |
48 | animation is_animated |
59 | animation is_animated |
49 | Str Dex Con Wis Pow Cha Int |
60 | Str Dex Con Wis Pow Cha Int |
50 | hp maxhp sp maxsp grace maxgrace |
61 | hp maxhp sp maxsp grace maxgrace |
51 | exp perm_exp expmul |
62 | exp perm_exp expmul |
52 | food dam luck wc ac x y speed speed_left move_state attack_movement |
63 | food dam luck wc ac x y speed speed_left move_state attack_movement |
… | |
… | |
221 | delete $ob->{$k}; |
232 | delete $ob->{$k}; |
222 | } |
233 | } |
223 | } |
234 | } |
224 | } |
235 | } |
225 | |
236 | |
|
|
237 | # a speciality for the editor |
|
|
238 | if (exists $ob->{attack_movement}) { |
|
|
239 | my $am = delete $ob->{attack_movement}; |
|
|
240 | $ob->{attack_movement_bits_0_3} = $am & 15; |
|
|
241 | $ob->{attack_movement_bits_4_7} = $am & 240; |
|
|
242 | } |
|
|
243 | |
226 | $ob |
244 | $ob |
227 | } |
245 | } |
228 | |
246 | |
229 | sub read_pak($) { |
247 | sub read_pak($) { |
230 | my ($path) = @_; |
248 | my ($path) = @_; |
… | |
… | |
259 | |
277 | |
260 | while (<$fh>) { |
278 | while (<$fh>) { |
261 | s/\s+$//; |
279 | s/\s+$//; |
262 | if (/^end$/i) { |
280 | if (/^end$/i) { |
263 | last; |
281 | last; |
264 | } elsif (/^arch (\S+)$/) { |
282 | } elsif (/^arch (\S+)$/i) { |
265 | push @{ $arc{inventory} }, normalize_arch $parse_block->(_name => $1); |
283 | push @{ $arc{inventory} }, normalize_arch $parse_block->(_name => $1); |
266 | } elsif (/^lore$/) { |
284 | } elsif (/^lore$/i) { |
267 | while (<$fh>) { |
285 | while (<$fh>) { |
268 | last if /^endlore\s*$/i; |
286 | last if /^endlore\s*$/i; |
269 | $arc{lore} .= $_; |
287 | $arc{lore} .= $_; |
270 | } |
288 | } |
271 | } elsif (/^msg$/) { |
289 | } elsif (/^msg$/i) { |
272 | while (<$fh>) { |
290 | while (<$fh>) { |
273 | last if /^endmsg\s*$/i; |
291 | last if /^endmsg\s*$/i; |
274 | $arc{msg} .= $_; |
292 | $arc{msg} .= $_; |
275 | } |
293 | } |
276 | } elsif (/^(\S+)\s*(.*)$/) { |
294 | } elsif (/^(\S+)\s*(.*)$/) { |
… | |
… | |
299 | $arc{$name} = $arc; |
317 | $arc{$name} = $arc; |
300 | } |
318 | } |
301 | $prev = $arc; |
319 | $prev = $arc; |
302 | $more = undef; |
320 | $more = undef; |
303 | } elsif (/^arch (\S+)$/i) { |
321 | } elsif (/^arch (\S+)$/i) { |
|
|
322 | my $name = $1; |
304 | push @{ $arc{arch} }, normalize_arch $parse_block->(_name => $1); |
323 | my $arc = normalize_arch $parse_block->(_name => $name); |
|
|
324 | |
|
|
325 | if ($more) { |
|
|
326 | $more->{more} = $arc; |
|
|
327 | } else { |
|
|
328 | push @{ $arc{arch} }, $arc; |
|
|
329 | } |
|
|
330 | $prev = $arc; |
|
|
331 | $more = undef; |
305 | } elsif (/^\s*($|#)/) { |
332 | } elsif (/^\s*($|#)/) { |
306 | # |
333 | # |
307 | } else { |
334 | } else { |
308 | warn "$path: unparseable top-level line '$_'"; |
335 | warn "$path: unparseable top-level line '$_'"; |
309 | } |
336 | } |