1 | /* |
1 | /* |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | * |
3 | * |
|
|
4 | * Copyright (©) 2018 Marc Alexander Lehmann / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2001 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 2001 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992 Frank Tore Johansen |
7 | * Copyright (©) 1992 Frank Tore Johansen |
7 | * |
8 | * |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
9 | * Deliantra is free software: you can redistribute it and/or modify it under |
9 | * the terms of the Affero GNU General Public License as published by the |
10 | * the terms of the Affero GNU General Public License as published by the |
… | |
… | |
435 | // object op is trying to move in direction dir. |
436 | // object op is trying to move in direction dir. |
436 | // originator is typically the same as op, but |
437 | // originator is typically the same as op, but |
437 | // can be different if originator is causing op to |
438 | // can be different if originator is causing op to |
438 | // move (originator is pushing op) |
439 | // move (originator is pushing op) |
439 | // returns 0 if the object is not able to move to the |
440 | // returns 0 if the object is not able to move to the |
440 | // desired space, 1 otherwise (in which case we also |
441 | // desired space, 1 otherwise (in which case we also |
441 | // move the object accordingly. This function is |
442 | // move the object accordingly. This function is |
442 | // very similiar to move_object. |
443 | // very similiar to move_object. |
443 | int move (int dir, object *originator); |
444 | int move (int dir, object *originator); |
444 | |
445 | |
445 | int move (int dir) |
446 | int move (int dir) |
… | |
… | |
582 | |
583 | |
583 | static bool msg_has_dialogue (const char *msg) { return *msg == '@'; } |
584 | static bool msg_has_dialogue (const char *msg) { return *msg == '@'; } |
584 | |
585 | |
585 | MTH bool has_dialogue () const { return msg_has_dialogue (&msg); } |
586 | MTH bool has_dialogue () const { return msg_has_dialogue (&msg); } |
586 | |
587 | |
587 | /* need_identify returns true if the item should be identified. This |
588 | /* need_identify returns true if the item should be identified. This |
588 | * function really should not exist - by default, any item not identified |
589 | * function really should not exist - by default, any item not identified |
589 | * should need it. |
590 | * should need it. |
590 | */ |
591 | */ |
591 | MTH bool need_identify () const; |
592 | MTH bool need_identify () const; |
592 | |
593 | |
… | |
… | |
803 | * range from 0 through 7. |
804 | * range from 0 through 7. |
804 | */ |
805 | */ |
805 | MTH int anim_frames () const { return anim ().num_animations; } |
806 | MTH int anim_frames () const { return anim ().num_animations; } |
806 | MTH int anim_facings () const { return anim ().facings; } |
807 | MTH int anim_facings () const { return anim ().facings; } |
807 | |
808 | |
|
|
809 | // sets a new animation frame, if the object has animation frames, |
|
|
810 | // and updates the face |
|
|
811 | MTH void update_anim_frame (int frame); |
|
|
812 | |
808 | MTH utf8_string as_string (); |
813 | MTH utf8_string as_string (); |
809 | |
814 | |
810 | // low-level management, statistics, ... |
815 | // low-level management, statistics, ... |
811 | static uint32_t ACC (RW, object_count); |
816 | static uint32_t ACC (RW, object_count); |
812 | static uint32_t ACC (RW, free_count); |
817 | static uint32_t ACC (RW, free_count); |
… | |
… | |
943 | //+GPL |
948 | //+GPL |
944 | |
949 | |
945 | /* Used by update_object to know if the object being passed is |
950 | /* Used by update_object to know if the object being passed is |
946 | * being added or removed. |
951 | * being added or removed. |
947 | */ |
952 | */ |
948 | #define UP_OBJ_INSERT 1 |
953 | #define UP_OBJ_INSERT 1 // object was inserted |
949 | #define UP_OBJ_REMOVE 2 |
954 | #define UP_OBJ_REMOVE 2 // object was removed |
950 | #define UP_OBJ_CHANGE 3 |
955 | #define UP_OBJ_CHANGE 3 // object has changed in some unspecified way |
951 | #define UP_OBJ_FACE 4 /* Only thing that changed was the face */ |
956 | #define UP_OBJ_FACE 4 // only thing that changed was the face |
952 | |
957 | |
953 | /* These are flags passed to insert_ob_in_map and |
958 | /* These are flags passed to insert_ob_in_map and |
954 | * insert_ob_in_ob. Note that all flags may not be meaningful |
959 | * insert_ob_in_ob. Note that all flags may not be meaningful |
955 | * for both functions. |
960 | * for both functions. |
956 | * Most are fairly explanatory: |
961 | * Most are fairly explanatory: |
… | |
… | |
959 | * INS_ABOVE_FLOOR_ONLY: Put object immediatly above the floor. |
964 | * INS_ABOVE_FLOOR_ONLY: Put object immediatly above the floor. |
960 | * INS_NO_WALK_ON: Don't call check_walk_on against the |
965 | * INS_NO_WALK_ON: Don't call check_walk_on against the |
961 | * originator - saves cpu time if you know the inserted object |
966 | * originator - saves cpu time if you know the inserted object |
962 | * is not meaningful in terms of having an effect. |
967 | * is not meaningful in terms of having an effect. |
963 | * INS_ON_TOP: Always put object on top. Generally only needed when loading |
968 | * INS_ON_TOP: Always put object on top. Generally only needed when loading |
964 | * files from disk and ordering needs to be preserved. |
969 | * files from disk and ordering needs to be preserved. |
965 | * INS_BELOW_ORIGINATOR: Insert new object immediately below originator - |
970 | * INS_BELOW_ORIGINATOR: Insert new object immediately below originator - |
966 | * Use for treasure chests so the new object is the highest thing |
971 | * Use for treasure chests so the new object is the highest thing |
967 | * beneath the player, but not actually above it. Note - the |
972 | * beneath the player, but not actually above it. Note - the |
968 | * map and x,y coordinates for the object to be inserted must |
973 | * map and x,y coordinates for the object to be inserted must |
969 | * match the originator. |
974 | * match the originator. |