… | |
… | |
29 | |
29 | |
30 | #include "cfperl.h" |
30 | #include "cfperl.h" |
31 | #include "shstr.h" |
31 | #include "shstr.h" |
32 | |
32 | |
33 | typedef int tag_t; |
33 | typedef int tag_t; |
|
|
34 | |
34 | #define NUM_BODY_LOCATIONS 12 |
35 | #define NUM_BODY_LOCATIONS 12 |
35 | #define BODY_ARMS 1 |
36 | #define BODY_ARMS 1 |
36 | |
37 | |
37 | /* See common/item.c */ |
38 | /* See common/item.c */ |
38 | |
39 | |
… | |
… | |
273 | && can_merge_slow (op1, op2); |
274 | && can_merge_slow (op1, op2); |
274 | } |
275 | } |
275 | |
276 | |
276 | MTH void set_owner (object *owner); |
277 | MTH void set_owner (object *owner); |
277 | MTH void set_speed (float speed); |
278 | MTH void set_speed (float speed); |
|
|
279 | MTH void set_weapon (object *ob); |
278 | |
280 | |
279 | MTH void open_container (object *new_container); |
281 | MTH void open_container (object *new_container); |
280 | MTH void close_container () |
282 | MTH void close_container () |
281 | { |
283 | { |
282 | open_container (0); |
284 | open_container (0); |
… | |
… | |
294 | MTH void drain_specific_stat (int deplete_stats); |
296 | MTH void drain_specific_stat (int deplete_stats); |
295 | MTH void change_luck (int value); |
297 | MTH void change_luck (int value); |
296 | |
298 | |
297 | // info must hold 256 * 3 bytes currently |
299 | // info must hold 256 * 3 bytes currently |
298 | const char *debug_desc (char *info) const; |
300 | const char *debug_desc (char *info) const; |
299 | MTH const char *debug_desc () const; |
301 | MTH const char *debug_desc () const; // uses at least 3 round-robin buffers |
300 | const char *debug_desc2 () const; // another debug_desc, pure convinience function |
|
|
301 | const char *flag_desc (char *desc, int len) const; |
302 | const char *flag_desc (char *desc, int len) const; |
302 | |
303 | |
303 | int number_of () const |
304 | int number_of () const |
304 | { |
305 | { |
305 | return nrof ? nrof : 1; |
306 | return nrof ? nrof : 1; |
… | |
… | |
331 | || (flag [FLAG_ALIVE] && !flag [FLAG_GENERATOR] && type != DOOR)) |
332 | || (flag [FLAG_ALIVE] && !flag [FLAG_GENERATOR] && type != DOOR)) |
332 | && !flag [FLAG_IS_A_TEMPLATE]; } |
333 | && !flag [FLAG_IS_A_TEMPLATE]; } |
333 | MTH bool is_arrow () const { return type == ARROW |
334 | MTH bool is_arrow () const { return type == ARROW |
334 | || (type == SPELL_EFFECT |
335 | || (type == SPELL_EFFECT |
335 | && (subtype == SP_BULLET || subtype == SP_MAGIC_MISSILE)); } |
336 | && (subtype == SP_BULLET || subtype == SP_MAGIC_MISSILE)); } |
|
|
337 | MTH bool is_range () const { return type == BOW || type == ROD || type == WAND || type == HORN; } |
336 | |
338 | |
337 | MTH bool has_active_speed () const { return FABS(speed) >= MIN_ACTIVE_SPEED; } |
339 | MTH bool has_active_speed () const { return FABS(speed) >= MIN_ACTIVE_SPEED; } |
338 | |
340 | |
339 | // temporary: wether the object can be saved in a map file |
341 | // temporary: wether the object can be saved in a map file |
340 | // contr => is a player |
342 | // contr => is a player |
… | |
… | |
361 | MTH object *head_ () |
363 | MTH object *head_ () |
362 | { |
364 | { |
363 | return head ? head : this; |
365 | return head ? head : this; |
364 | } |
366 | } |
365 | |
367 | |
|
|
368 | MTH std::string long_desc (object *who = 0); |
|
|
369 | MTH std::string describe_monster (object *who = 0); |
|
|
370 | MTH std::string describe_item (object *who = 0); |
|
|
371 | MTH std::string describe (object *who = 0); |
|
|
372 | |
|
|
373 | // If this object has no extra parts but should have them, |
|
|
374 | // add them, effectively expanding heads into multipart |
|
|
375 | // objects. This method only works on objects not inserted |
|
|
376 | // anywhere. |
|
|
377 | MTH void expand_tail (); |
|
|
378 | |
|
|
379 | MTH void create_treasure (treasurelist *tl, int flags = 0); |
|
|
380 | |
366 | // insert object at same map position as 'where' |
381 | // insert object at same map position as 'where' |
367 | // handles both inventory and map "positions" |
382 | // handles both inventory and map "positions" |
368 | MTH object *insert_at (object *where, object *originator = 0, int flags = 0); |
383 | MTH object *insert_at (object *where, object *originator = 0, int flags = 0); |
369 | |
384 | |
370 | MTH void activate (); |
385 | MTH void activate (); |
… | |
… | |
373 | MTH void deactivate_recursive (); |
388 | MTH void deactivate_recursive (); |
374 | |
389 | |
375 | // set the givne flag on all objects in the inventory recursively |
390 | // set the givne flag on all objects in the inventory recursively |
376 | MTH void set_flag_inv (int flag, int value = 1); |
391 | MTH void set_flag_inv (int flag, int value = 1); |
377 | |
392 | |
378 | void enter_exit (object *exit);//PERL |
393 | void enter_exit (object *exit);//Perl |
379 | MTH void enter_map (maptile *newmap, int x, int y); |
394 | MTH void enter_map (maptile *newmap, int x, int y); |
380 | |
395 | |
381 | // returns the mapspace this object is in |
396 | // returns the mapspace this object is in |
382 | mapspace &ms () const; |
397 | mapspace &ms () const; |
383 | |
398 | |
… | |
… | |
482 | { |
497 | { |
483 | archetype (); |
498 | archetype (); |
484 | ~archetype (); |
499 | ~archetype (); |
485 | void gather_callbacks (AV *&callbacks, event_type event) const; |
500 | void gather_callbacks (AV *&callbacks, event_type event) const; |
486 | |
501 | |
487 | static archetype *get (const char *name); // find or create |
|
|
488 | static archetype *read (object_thawer &f); |
502 | static archetype *read (object_thawer &f); |
|
|
503 | static archetype *get (const char *name); // find or create |
489 | static archetype *find (const char *name); |
504 | static archetype *find (const char *name); |
490 | |
505 | |
491 | void hash_add (); // add to hashtable |
506 | void hash_add (); // add to hashtable |
492 | void hash_del (); // remove from hashtable |
507 | void hash_del (); // remove from hashtable |
493 | |
508 | |
… | |
… | |
495 | struct archetype *ACC (RW, next); /* Next archetype in a linked list */ |
510 | struct archetype *ACC (RW, next); /* Next archetype in a linked list */ |
496 | struct archetype *ACC (RW, head); /* The main part of a linked object */ |
511 | struct archetype *ACC (RW, head); /* The main part of a linked object */ |
497 | struct archetype *ACC (RW, more); /* Next part of a linked object */ |
512 | struct archetype *ACC (RW, more); /* Next part of a linked object */ |
498 | object ACC (RO, clone); /* An object from which to do ->copy_to () */ |
513 | object ACC (RO, clone); /* An object from which to do ->copy_to () */ |
499 | uint32 ACC (RW, editable); /* editable flags (mainly for editor) */ |
514 | uint32 ACC (RW, editable); /* editable flags (mainly for editor) */ |
|
|
515 | bool ACC (RW, linked); // linked into list of heads |
500 | sint8 ACC (RW, tail_x), ACC (RW, tail_y); /* Where the lower right most portion of the object is |
516 | sint8 ACC (RW, tail_x), ACC (RW, tail_y); /* Where the lower right most portion of the object is |
501 | * in comparison to the head. |
517 | * in comparison to the head. |
502 | */ |
518 | */ |
503 | }; |
519 | }; |
504 | |
520 | |
… | |
… | |
543 | #define INS_ON_TOP 0x0008 |
559 | #define INS_ON_TOP 0x0008 |
544 | #define INS_BELOW_ORIGINATOR 0x0010 |
560 | #define INS_BELOW_ORIGINATOR 0x0010 |
545 | #define INS_MAP_LOAD 0x0020 |
561 | #define INS_MAP_LOAD 0x0020 |
546 | |
562 | |
547 | #define ARCH_SINGULARITY "singularity" |
563 | #define ARCH_SINGULARITY "singularity" |
548 | #define ARCH_SINGULARITY_LEN 11 |
|
|
549 | #define ARCH_DETECT_MAGIC "detect_magic" |
564 | #define ARCH_DETECT_MAGIC "detect_magic" |
550 | #define ARCH_DEPLETION "depletion" |
565 | #define ARCH_DEPLETION "depletion" |
551 | #define ARCH_SYMPTOM "symptom" |
566 | #define ARCH_SYMPTOM "symptom" |
552 | |
567 | |
553 | #endif |
568 | #endif |