… | |
… | |
521 | /* This return true if object has still randomitems which |
521 | /* This return true if object has still randomitems which |
522 | * could be expanded. |
522 | * could be expanded. |
523 | */ |
523 | */ |
524 | MTH bool has_random_items () const { return randomitems && !flag [FLAG_IS_A_TEMPLATE]; } |
524 | MTH bool has_random_items () const { return randomitems && !flag [FLAG_IS_A_TEMPLATE]; } |
525 | |
525 | |
526 | MTH bool has_dialogue () const { return *&msg == '@'; } |
526 | static bool msg_has_dialogue (const char *msg) { return *msg == '@'; } |
|
|
527 | |
|
|
528 | MTH bool has_dialogue () const { return msg_has_dialogue (&msg); } |
527 | |
529 | |
528 | // returns the outermost owner, never returns 0 |
530 | // returns the outermost owner, never returns 0 |
529 | MTH object *outer_owner () |
531 | MTH object *outer_owner () |
530 | { |
532 | { |
531 | object *op; |
533 | object *op; |
… | |
… | |
707 | // currently only used for players to make them temporarily visible |
709 | // currently only used for players to make them temporarily visible |
708 | // when they are invisible. |
710 | // when they are invisible. |
709 | MTH void make_noise (); |
711 | MTH void make_noise (); |
710 | |
712 | |
711 | /* animation */ |
713 | /* animation */ |
712 | bool has_anim () { return animation_id; } |
714 | MTH bool has_anim () const { return animation_id; } |
713 | const animation &anim () const { return animations [animation_id]; } |
715 | const animation &anim () const { return animations [animation_id]; } |
714 | faceidx get_anim_frame (int frame) const { return anim ().faces [frame]; } |
716 | MTH faceidx get_anim_frame (int frame) const { return anim ().faces [frame]; } |
715 | void set_anim_frame (int frame) { face = get_anim_frame (frame); } |
717 | MTH void set_anim_frame (int frame) { face = get_anim_frame (frame); } |
716 | /* anim_frames () returns the number of animations allocated. The last |
718 | /* anim_frames () returns the number of animations allocated. The last |
717 | * usuable animation will be anim_frames () - 1 (for example, if an object |
719 | * usuable animation will be anim_frames () - 1 (for example, if an object |
718 | * has 8 animations, anim_frames () will return 8, but the values will |
720 | * has 8 animations, anim_frames () will return 8, but the values will |
719 | * range from 0 through 7. |
721 | * range from 0 through 7. |
720 | */ |
722 | */ |
721 | int anim_frames () const { return anim ().num_animations; } |
723 | MTH int anim_frames () const { return anim ().num_animations; } |
722 | int anim_facings () const { return anim ().facings; } |
724 | MTH int anim_facings () const { return anim ().facings; } |
|
|
725 | |
|
|
726 | MTH char *as_string (); |
723 | |
727 | |
724 | protected: |
728 | protected: |
725 | void link (); |
729 | void link (); |
726 | void unlink (); |
730 | void unlink (); |
727 | |
731 | |
… | |
… | |
736 | // move this object to the top of its env's inventory to speed up |
740 | // move this object to the top of its env's inventory to speed up |
737 | // searches for it. |
741 | // searches for it. |
738 | static object * |
742 | static object * |
739 | splay (object *ob) |
743 | splay (object *ob) |
740 | { |
744 | { |
741 | if (ob->env && ob->env->inv != ob) |
745 | if (ob->above && ob->env) |
742 | { |
746 | { |
743 | if (ob->above) ob->above->below = ob->below; |
747 | if (ob->above) ob->above->below = ob->below; |
744 | if (ob->below) ob->below->above = ob->above; |
748 | if (ob->below) ob->below->above = ob->above; |
745 | |
749 | |
746 | ob->above = 0; |
750 | ob->above = 0; |