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,2013,2014,2015,2016 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 |
… | |
… | |
180 | struct oblnk *link; |
181 | struct oblnk *link; |
181 | struct oblinkpt *next; |
182 | struct oblinkpt *next; |
182 | shstr id; /* Used as connected value in buttons/gates */ |
183 | shstr id; /* Used as connected value in buttons/gates */ |
183 | } oblinkpt; |
184 | } oblinkpt; |
184 | |
185 | |
|
|
186 | // temporary hack to find the culprit who corrupts face numbers. maybe. hopefully. |
|
|
187 | struct faceidx_debug |
|
|
188 | { |
|
|
189 | faceidx x; |
|
|
190 | |
|
|
191 | operator faceidx () const |
|
|
192 | { |
|
|
193 | return x; |
|
|
194 | } |
|
|
195 | |
|
|
196 | faceidx operator =(faceidx i) |
|
|
197 | { |
|
|
198 | if (ecb_expect_false (i >= faces.size ())) |
|
|
199 | { |
|
|
200 | fork_abort ("illegal faceidx assignment"); |
|
|
201 | i = blank_face; |
|
|
202 | } |
|
|
203 | |
|
|
204 | return x = i; |
|
|
205 | } |
|
|
206 | }; |
|
|
207 | |
|
|
208 | #if CFPERL |
|
|
209 | static inline void sv_to (SV *sv, faceidx_debug &v) { v = SvIV (sv); } |
|
|
210 | #endif |
|
|
211 | |
185 | INTERFACE_CLASS (object) |
212 | INTERFACE_CLASS (object) |
186 | // these are being copied |
213 | // these are being copied |
187 | struct object_copy : attachable |
214 | struct object_copy : attachable |
188 | { |
215 | { |
189 | sint16 ACC (RW, x), ACC (RW, y); /* Position in the map for this object */ |
216 | sint16 ACC (RW, x), ACC (RW, y); /* Position in the map for this object */ |
… | |
… | |
252 | sint8 ACC (RW, glow_radius); /* indicates the glow radius of the object */ |
279 | sint8 ACC (RW, glow_radius); /* indicates the glow radius of the object */ |
253 | uint8 ACC (RW, weapontype); /* type of weapon */ |
280 | uint8 ACC (RW, weapontype); /* type of weapon */ |
254 | |
281 | |
255 | body_slot slot [NUM_BODY_LOCATIONS]; |
282 | body_slot slot [NUM_BODY_LOCATIONS]; |
256 | |
283 | |
257 | faceidx ACC (RW, face); /* the graphical face */ |
284 | faceidx_debug ACC (RW, face); /* the graphical face */ |
258 | |
285 | |
259 | faceidx ACC (RW, sound); /* the sound face */ |
286 | faceidx ACC (RW, sound); /* the sound face */ |
260 | faceidx ACC (RW, sound_destroy); /* played on destroy */ |
287 | faceidx ACC (RW, sound_destroy); /* played on destroy */ |
261 | |
288 | |
262 | sint32 ACC (RW, weight); /* Attributes of the object */ |
289 | sint32 ACC (RW, weight); /* Attributes of the object */ |
… | |
… | |
435 | // object op is trying to move in direction dir. |
462 | // object op is trying to move in direction dir. |
436 | // originator is typically the same as op, but |
463 | // originator is typically the same as op, but |
437 | // can be different if originator is causing op to |
464 | // can be different if originator is causing op to |
438 | // move (originator is pushing op) |
465 | // move (originator is pushing op) |
439 | // returns 0 if the object is not able to move to the |
466 | // returns 0 if the object is not able to move to the |
440 | // desired space, 1 otherwise (in which case we also |
467 | // desired space, 1 otherwise (in which case we also |
441 | // move the object accordingly. This function is |
468 | // move the object accordingly. This function is |
442 | // very similiar to move_object. |
469 | // very similiar to move_object. |
443 | int move (int dir, object *originator); |
470 | int move (int dir, object *originator); |
444 | |
471 | |
445 | int move (int dir) |
472 | int move (int dir) |
… | |
… | |
582 | |
609 | |
583 | static bool msg_has_dialogue (const char *msg) { return *msg == '@'; } |
610 | static bool msg_has_dialogue (const char *msg) { return *msg == '@'; } |
584 | |
611 | |
585 | MTH bool has_dialogue () const { return msg_has_dialogue (&msg); } |
612 | MTH bool has_dialogue () const { return msg_has_dialogue (&msg); } |
586 | |
613 | |
587 | /* need_identify returns true if the item should be identified. This |
614 | /* need_identify returns true if the item should be identified. This |
588 | * function really should not exist - by default, any item not identified |
615 | * function really should not exist - by default, any item not identified |
589 | * should need it. |
616 | * should need it. |
590 | */ |
617 | */ |
591 | MTH bool need_identify () const; |
618 | MTH bool need_identify () const; |
592 | |
619 | |
… | |
… | |
803 | * range from 0 through 7. |
830 | * range from 0 through 7. |
804 | */ |
831 | */ |
805 | MTH int anim_frames () const { return anim ().num_animations; } |
832 | MTH int anim_frames () const { return anim ().num_animations; } |
806 | MTH int anim_facings () const { return anim ().facings; } |
833 | MTH int anim_facings () const { return anim ().facings; } |
807 | |
834 | |
|
|
835 | // sets a new animation frame, if the object has animation frames, |
|
|
836 | // and updates the face |
|
|
837 | MTH void update_anim_frame (int frame); |
|
|
838 | |
808 | MTH utf8_string as_string (); |
839 | MTH utf8_string as_string (); |
809 | |
840 | |
810 | // low-level management, statistics, ... |
841 | // low-level management, statistics, ... |
811 | static uint32_t ACC (RW, object_count); |
842 | static uint32_t ACC (RW, object_count); |
812 | static uint32_t ACC (RW, free_count); |
843 | static uint32_t ACC (RW, free_count); |
… | |
… | |
943 | //+GPL |
974 | //+GPL |
944 | |
975 | |
945 | /* Used by update_object to know if the object being passed is |
976 | /* Used by update_object to know if the object being passed is |
946 | * being added or removed. |
977 | * being added or removed. |
947 | */ |
978 | */ |
948 | #define UP_OBJ_INSERT 1 |
979 | #define UP_OBJ_INSERT 1 // object was inserted |
949 | #define UP_OBJ_REMOVE 2 |
980 | #define UP_OBJ_REMOVE 2 // object was removed |
950 | #define UP_OBJ_CHANGE 3 |
981 | #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 */ |
982 | #define UP_OBJ_FACE 4 // only thing that changed was the face |
952 | |
983 | |
953 | /* These are flags passed to insert_ob_in_map and |
984 | /* These are flags passed to insert_ob_in_map and |
954 | * insert_ob_in_ob. Note that all flags may not be meaningful |
985 | * insert_ob_in_ob. Note that all flags may not be meaningful |
955 | * for both functions. |
986 | * for both functions. |
956 | * Most are fairly explanatory: |
987 | * Most are fairly explanatory: |
… | |
… | |
959 | * INS_ABOVE_FLOOR_ONLY: Put object immediatly above the floor. |
990 | * INS_ABOVE_FLOOR_ONLY: Put object immediatly above the floor. |
960 | * INS_NO_WALK_ON: Don't call check_walk_on against the |
991 | * INS_NO_WALK_ON: Don't call check_walk_on against the |
961 | * originator - saves cpu time if you know the inserted object |
992 | * originator - saves cpu time if you know the inserted object |
962 | * is not meaningful in terms of having an effect. |
993 | * is not meaningful in terms of having an effect. |
963 | * INS_ON_TOP: Always put object on top. Generally only needed when loading |
994 | * INS_ON_TOP: Always put object on top. Generally only needed when loading |
964 | * files from disk and ordering needs to be preserved. |
995 | * files from disk and ordering needs to be preserved. |
965 | * INS_BELOW_ORIGINATOR: Insert new object immediately below originator - |
996 | * INS_BELOW_ORIGINATOR: Insert new object immediately below originator - |
966 | * Use for treasure chests so the new object is the highest thing |
997 | * Use for treasure chests so the new object is the highest thing |
967 | * beneath the player, but not actually above it. Note - the |
998 | * beneath the player, but not actually above it. Note - the |
968 | * map and x,y coordinates for the object to be inserted must |
999 | * map and x,y coordinates for the object to be inserted must |
969 | * match the originator. |
1000 | * match the originator. |