ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra/Deliantra.pm
(Generate patch)

Comparing deliantra/Deliantra/Deliantra.pm (file contents):
Revision 1.15 by root, Sun Feb 12 04:50:24 2006 UTC vs.
Revision 1.19 by root, Wed Feb 22 23:02:59 2006 UTC

224 } 224 }
225 225
226 \%paths 226 \%paths
227} 227}
228 228
229=item ($minx, $miny, $maxx, $maxy) = arch_extents $arch
230
229# arch_extents determines the extents of a given arch 231arch_extents determines the extents of the given arch's face(s), linked
230# bigfaces, linked faces and single faces are handled here 232faces and single faces are handled here it returns (minx, miny, maxx,
231# it returns (minx, miny, maxx, maxy) 233maxy)
234
235=cut
236
232sub arch_extents { 237sub arch_extents {
233 my ($a) = @_; 238 my ($a) = @_;
234 239
235 my $o = $ARCH{$a->{_name}} 240 my $o = $ARCH{$a->{_name}}
236 or return; 241 or return;
267 return if %ARCH; 272 return if %ARCH;
268 273
269 *ARCH = read_arch "$LIB/archetypes", "$cachedir/archetypes.pst"; 274 *ARCH = read_arch "$LIB/archetypes", "$cachedir/archetypes.pst";
270} 275}
271 276
277=item $type = arch_attr $arch
278
279Returns a hashref describing the object and its attributes. It can contain
280the following keys:
281
282 name the name, suitable for display purposes
283 ignore
284 attr
285 desc
286 use
287 section => [name => \%attr, name => \%attr]
288 import
289
290=cut
291
292sub arch_attr($) {
293 my ($arch) = @_;
294
295 require Crossfire::Data;
296
297 my $attr;
298
299 if ($arch->{type} > 0) {
300 $attr = $Crossfire::Data::ATTR{$arch->{type}+0};
301 } else {
302 $attr = $Crossfire::Data::TYPE{Misc};
303
304 type:
305 for (@Crossfire::Data::ATTR0) {
306 my $req = $_->{required}
307 or die "internal error: ATTR0 without 'required'";
308
309 while (my ($k, $v) = each %$req) {
310 next type
311 unless $arch->{$k} == $v;
312 }
313
314 $attr = $_;
315 }
316 }
317
318 use PApp::Util;
319 warn PApp::Util::dumpval $attr;
320
321 $attr || \%Crossfire::Data::DEFAULT_ATTR;
322}
323
324sub arch_edit_sections {
325# if (edit_type == IGUIConstants.TILE_EDIT_NONE)
326# edit_type = 0;
327# else if (edit_type != 0) {
328# // all flags from 'check_type' must be unset in this arch because they get recalculated now
329# edit_type &= ~check_type;
330# }
331#
332# }
333# if ((check_type & IGUIConstants.TILE_EDIT_MONSTER) != 0 &&
334# getAttributeValue("alive", defarch) == 1 &&
335# (getAttributeValue("monster", defarch) == 1 ||
336# getAttributeValue("generator", defarch) == 1)) {
337# // Monster: monsters/npcs/generators
338# edit_type |= IGUIConstants.TILE_EDIT_MONSTER;
339# }
340# if ((check_type & IGUIConstants.TILE_EDIT_WALL) != 0 &&
341# arch_type == 0 && getAttributeValue("no_pass", defarch) == 1) {
342# // Walls
343# edit_type |= IGUIConstants.TILE_EDIT_WALL;
344# }
345# if ((check_type & IGUIConstants.TILE_EDIT_CONNECTED) != 0 &&
346# getAttributeValue("connected", defarch) != 0) {
347# // Connected Objects
348# edit_type |= IGUIConstants.TILE_EDIT_CONNECTED;
349# }
350# if ((check_type & IGUIConstants.TILE_EDIT_EXIT) != 0 &&
351# arch_type == 66 || arch_type == 41 || arch_type == 95) {
352# // Exit: teleporter/exit/trapdoors
353# edit_type |= IGUIConstants.TILE_EDIT_EXIT;
354# }
355# if ((check_type & IGUIConstants.TILE_EDIT_TREASURE) != 0 &&
356# getAttributeValue("no_pick", defarch) == 0 && (arch_type == 4 ||
357# arch_type == 5 || arch_type == 36 || arch_type == 60 ||
358# arch_type == 85 || arch_type == 111 || arch_type == 123 ||
359# arch_type == 124 || arch_type == 130)) {
360# // Treasure: randomtreasure/money/gems/potions/spellbooks/scrolls
361# edit_type |= IGUIConstants.TILE_EDIT_TREASURE;
362# }
363# if ((check_type & IGUIConstants.TILE_EDIT_DOOR) != 0 &&
364# arch_type == 20 || arch_type == 23 || arch_type == 26 ||
365# arch_type == 91 || arch_type == 21 || arch_type == 24) {
366# // Door: door/special door/gates + keys
367# edit_type |= IGUIConstants.TILE_EDIT_DOOR;
368# }
369# if ((check_type & IGUIConstants.TILE_EDIT_EQUIP) != 0 &&
370# getAttributeValue("no_pick", defarch) == 0 && ((arch_type >= 13 &&
371# arch_type <= 16) || arch_type == 33 || arch_type == 34 ||
372# arch_type == 35 || arch_type == 39 || arch_type == 70 ||
373# arch_type == 87 || arch_type == 99 || arch_type == 100 ||
374# arch_type == 104 || arch_type == 109 || arch_type == 113 ||
375# arch_type == 122 || arch_type == 3)) {
376# // Equipment: weapons/armour/wands/rods
377# edit_type |= IGUIConstants.TILE_EDIT_EQUIP;
378# }
379#
380# return(edit_type);
381#
382#
383}
384
272$CACHEDIR ||= "$ENV{HOME}/.crossfire"; 385$CACHEDIR ||= "$ENV{HOME}/.crossfire";
273 386
274init $CACHEDIR; 387init $CACHEDIR;
275 388
276=head1 AUTHOR 389=head1 AUTHOR

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines