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.18 by root, Wed Feb 22 22:41:22 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 $data = 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
289=cut
290
291sub arch_attr($) {
292 my ($arch) = @_;
293
294 require Crossfire::Data;
295
296 my $attr;
297
298 if ($arch->{type} > 0) {
299 $attr = $Crossfire::Data::ATTR{$arch->{type}+0};
300 } else {
301 $attr = $Crossfire::Data::TYPE{Misc};
302
303 type:
304 for (@Crossfire::Data::ATTR0) {
305 my $req = $_->{required}
306 or die "internal error: ATTR0 without 'required'";
307
308 while (my ($k, $v) = each %$req) {
309 next type
310 unless $arch->{$k} == $v;
311 }
312
313 $attr = $_;
314 }
315 }
316
317 use PApp::Util;
318 warn PApp::Util::dumpval $attr;
319}
320
321sub arch_edit_sections {
322# if (edit_type == IGUIConstants.TILE_EDIT_NONE)
323# edit_type = 0;
324# else if (edit_type != 0) {
325# // all flags from 'check_type' must be unset in this arch because they get recalculated now
326# edit_type &= ~check_type;
327# }
328#
329# }
330# if ((check_type & IGUIConstants.TILE_EDIT_MONSTER) != 0 &&
331# getAttributeValue("alive", defarch) == 1 &&
332# (getAttributeValue("monster", defarch) == 1 ||
333# getAttributeValue("generator", defarch) == 1)) {
334# // Monster: monsters/npcs/generators
335# edit_type |= IGUIConstants.TILE_EDIT_MONSTER;
336# }
337# if ((check_type & IGUIConstants.TILE_EDIT_WALL) != 0 &&
338# arch_type == 0 && getAttributeValue("no_pass", defarch) == 1) {
339# // Walls
340# edit_type |= IGUIConstants.TILE_EDIT_WALL;
341# }
342# if ((check_type & IGUIConstants.TILE_EDIT_CONNECTED) != 0 &&
343# getAttributeValue("connected", defarch) != 0) {
344# // Connected Objects
345# edit_type |= IGUIConstants.TILE_EDIT_CONNECTED;
346# }
347# if ((check_type & IGUIConstants.TILE_EDIT_EXIT) != 0 &&
348# arch_type == 66 || arch_type == 41 || arch_type == 95) {
349# // Exit: teleporter/exit/trapdoors
350# edit_type |= IGUIConstants.TILE_EDIT_EXIT;
351# }
352# if ((check_type & IGUIConstants.TILE_EDIT_TREASURE) != 0 &&
353# getAttributeValue("no_pick", defarch) == 0 && (arch_type == 4 ||
354# arch_type == 5 || arch_type == 36 || arch_type == 60 ||
355# arch_type == 85 || arch_type == 111 || arch_type == 123 ||
356# arch_type == 124 || arch_type == 130)) {
357# // Treasure: randomtreasure/money/gems/potions/spellbooks/scrolls
358# edit_type |= IGUIConstants.TILE_EDIT_TREASURE;
359# }
360# if ((check_type & IGUIConstants.TILE_EDIT_DOOR) != 0 &&
361# arch_type == 20 || arch_type == 23 || arch_type == 26 ||
362# arch_type == 91 || arch_type == 21 || arch_type == 24) {
363# // Door: door/special door/gates + keys
364# edit_type |= IGUIConstants.TILE_EDIT_DOOR;
365# }
366# if ((check_type & IGUIConstants.TILE_EDIT_EQUIP) != 0 &&
367# getAttributeValue("no_pick", defarch) == 0 && ((arch_type >= 13 &&
368# arch_type <= 16) || arch_type == 33 || arch_type == 34 ||
369# arch_type == 35 || arch_type == 39 || arch_type == 70 ||
370# arch_type == 87 || arch_type == 99 || arch_type == 100 ||
371# arch_type == 104 || arch_type == 109 || arch_type == 113 ||
372# arch_type == 122 || arch_type == 3)) {
373# // Equipment: weapons/armour/wands/rods
374# edit_type |= IGUIConstants.TILE_EDIT_EQUIP;
375# }
376#
377# return(edit_type);
378#
379#
380}
381
272$CACHEDIR ||= "$ENV{HOME}/.crossfire"; 382$CACHEDIR ||= "$ENV{HOME}/.crossfire";
273 383
274init $CACHEDIR; 384init $CACHEDIR;
275 385
276=head1 AUTHOR 386=head1 AUTHOR

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines