ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/object.h
(Generate patch)

Comparing deliantra/server/include/object.h (file contents):
Revision 1.8 by root, Sun Aug 27 16:15:12 2006 UTC vs.
Revision 1.13 by root, Thu Aug 31 09:19:34 2006 UTC

1/* 1/*
2 * static char *rcsid_object_h = 2 * static char *rcsid_object_h =
3 * "$Id: object.h,v 1.8 2006/08/27 16:15:12 root Exp $"; 3 * "$Id: object.h,v 1.13 2006/08/31 09:19:34 root Exp $";
4 */ 4 */
5 5
6/* 6/*
7 CrossFire, A Multiplayer game for X-windows 7 CrossFire, A Multiplayer game for X-windows
8 8
99 * related ones, etc. 99 * related ones, etc.
100 * This structure is best viewed with about a 100 width screen. 100 * This structure is best viewed with about a 100 width screen.
101 * MSW 2002-07-05 101 * MSW 2002-07-05
102 */ 102 */
103 103
104struct object_simple : extendable<object> { 104struct object_simple : attachable<object> {
105 static data_type get_dt () { return DT_OBJECT; }
106
107 /* These variables are not changed by copy_object() */ 105 /* These variables are not changed by copy_object() */
108 struct pl *contr; /* Pointer to the player which control this object */ 106 struct pl *contr; /* Pointer to the player which control this object */
109 struct object *next; /* Pointer to the next object in the free/used list */ 107 struct object *next; /* Pointer to the next object in the free/used list */
110 struct object *prev; /* Pointer to the previous object in the free/used list*/ 108 struct object *prev; /* Pointer to the previous object in the free/used list*/
111 struct object *active_next; /* Next & previous object in the 'active' */ 109 struct object *active_next; /* Next & previous object in the 'active' */
112 struct object *active_prev; /* List. This is used in process_events */ 110 struct object *active_prev; /* List. This is used in process_events */
113 /* so that the entire object list does not */ 111 /* so that the entire object list does not */
114 /* need to be gone through. */ 112 /* need to be gone through. */
115 struct object *below; /* Pointer to the object stacked below this one */ 113 struct object *below; /* Pointer to the object stacked below this one */
116 struct object *above; /* Pointer to the object stacked above this one */ 114 struct object *above; /* Pointer to the object stacked above this one */
117 /* Note: stacked in the *same* environment*/ 115 /* Note: stacked in the *same* environment*/
118 struct object *inv; /* Pointer to the first object in the inventory */ 116 struct object *inv; /* Pointer to the first object in the inventory */
119 struct object *container; /* Current container being used. I think this 117 struct object *container; /* Current container being used. I think this
120 * is only used by the player right now. 118 * is only used by the player right now.
121 */ 119 */
122 struct object *env; /* Pointer to the object which is the environment. 120 struct object *env; /* Pointer to the object which is the environment.
123 * This is typically the container that the object is in. 121 * This is typically the container that the object is in.
124 */ 122 */
125 struct object *more; /* Pointer to the rest of a large body of objects */ 123 struct object *more; /* Pointer to the rest of a large body of objects */
126 struct object *head; /* Points to the main object of a large body */ 124 struct object *head; /* Points to the main object of a large body */
127 struct mapstruct *map; /* Pointer to the map in which this object is present */ 125 struct mapstruct *map; /* Pointer to the map in which this object is present */
128 126
129 tag_t count; /* Unique object number for this object */ 127 tag_t count; /* Unique object number for this object */
140 const char *name; /* The name of the object, obviously... */ 138 const char *name; /* The name of the object, obviously... */
141 const char *name_pl; /* The plural name of the object */ 139 const char *name_pl; /* The plural name of the object */
142 const char *title; /* Of foo, etc */ 140 const char *title; /* Of foo, etc */
143 const char *race; /* human, goblin, dragon, etc */ 141 const char *race; /* human, goblin, dragon, etc */
144 const char *slaying; /* Which race to do double damage to */ 142 const char *slaying; /* Which race to do double damage to */
145 /* If this is an exit, this is the filename */ 143 /* If this is an exit, this is the filename */
146 const char *skill; /* Name of the skill this object uses/grants */ 144 const char *skill; /* Name of the skill this object uses/grants */
147 const char *msg; /* If this is a book/sign/magic mouth/etc */ 145 const char *msg; /* If this is a book/sign/magic mouth/etc */
148 const char *lore; /* Obscure information about this object, */ 146 const char *lore; /* Obscure information about this object, */
149 /* To get put into books and the like. */ 147 /* To get put into books and the like. */
150 148
151 sint16 x,y; /* Position in the map for this object */ 149 sint16 x,y; /* Position in the map for this object */
152 sint16 ox,oy; /* For debugging: Where it was last inserted */ 150 sint16 ox,oy; /* For debugging: Where it was last inserted */
153 float speed; /* The overall speed of this object */ 151 float speed; /* The overall speed of this object */
154 float speed_left; /* How much speed is left to spend this round */ 152 float speed_left; /* How much speed is left to spend this round */
187 sint32 weight_limit; /* Weight-limit of object */ 185 sint32 weight_limit; /* Weight-limit of object */
188 sint32 carrying; /* How much weight this object contains */ 186 sint32 carrying; /* How much weight this object contains */
189 sint8 glow_radius; /* indicates the glow radius of the object */ 187 sint8 glow_radius; /* indicates the glow radius of the object */
190 living stats; /* Str, Con, Dex, etc */ 188 living stats; /* Str, Con, Dex, etc */
191 sint64 perm_exp; /* Permanent exp */ 189 sint64 perm_exp; /* Permanent exp */
192 const char *current_weapon_script; /* The script of the currently used weapon. Executed */
193 /* each time the object attacks something */
194 struct object *current_weapon; /* Pointer to the weapon currently used */ 190 struct object *current_weapon; /* Pointer to the weapon currently used */
195 uint32 weapontype; /* type of weapon */ 191 uint32 weapontype; /* type of weapon */
196 uint32 tooltype; /* type of tool or build facility */ 192 uint32 tooltype; /* type of tool or build facility */
197 sint8 body_info[NUM_BODY_LOCATIONS]; /* body info as loaded from the file */ 193 sint8 body_info[NUM_BODY_LOCATIONS]; /* body info as loaded from the file */
198 sint8 body_used[NUM_BODY_LOCATIONS]; /* Calculated value based on items equipped */ 194 sint8 body_used[NUM_BODY_LOCATIONS]; /* Calculated value based on items equipped */
199 /* See the doc/Developers/objects for more info about body locations */ 195 /* See the doc/Developers/objects for more info about body locations */
200 196
201 /* Following mostly refers to fields only used for monsters */ 197 /* Following mostly refers to fields only used for monsters */
202 struct object *owner; /* Pointer to the object which controls this one */ 198 struct object *owner; /* Pointer to the object which controls this one */
203 /* Owner should not be referred to directly - */ 199 /* Owner should not be referred to directly - */
204 /* get_owner should be used instead. */ 200 /* get_owner should be used instead. */
205 tag_t ownercount; /* What count the owner had (in case owner */ 201 tag_t ownercount; /* What count the owner had (in case owner */
206 /* has been freed) */ 202 /* has been freed) */
207 struct object *enemy; /* Monster/player to follow even if not closest */ 203 struct object *enemy; /* Monster/player to follow even if not closest */
208 struct object *attacked_by; /* This object start to attack us! only player & monster */ 204 struct object *attacked_by; /* This object start to attack us! only player & monster */
209 tag_t attacked_by_count; /* the tag of attacker, so we can be sure */ 205 tag_t attacked_by_count; /* the tag of attacker, so we can be sure */
210 struct treasureliststruct *randomitems; /* Items to be generated */ 206 struct treasureliststruct *randomitems; /* Items to be generated */
211 uint16 run_away; /* Monster runs away if it's hp goes below this percentage. */ 207 uint16 run_away; /* Monster runs away if it's hp goes below this percentage. */
216 sint32 move_status; /* What stage in attack mode */ 212 sint32 move_status; /* What stage in attack mode */
217 uint16 attack_movement;/* What kind of attack movement */ 213 uint16 attack_movement;/* What kind of attack movement */
218 uint8 will_apply; /* See crossfire.doc */ 214 uint8 will_apply; /* See crossfire.doc */
219 struct object *spellitem; /* Spell ability monster is choosing to use */ 215 struct object *spellitem; /* Spell ability monster is choosing to use */
220 double expmul; /* needed experience = (calc_exp*expmul) - means some */ 216 double expmul; /* needed experience = (calc_exp*expmul) - means some */
221 /* races/classes can need less/more exp to gain levels */ 217 /* races/classes can need less/more exp to gain levels */
222 218
223 /* Spell related information, may be useful elsewhere 219 /* Spell related information, may be useful elsewhere
224 * Note that other fields are used - these files are basically 220 * Note that other fields are used - these files are basically
225 * only used in spells. 221 * only used in spells.
226 */ 222 */
235 uint8 range_modifier; /* How going up in level effects range */ 231 uint8 range_modifier; /* How going up in level effects range */
236 232
237 /* Following are values used by any object */ 233 /* Following are values used by any object */
238 struct archt *arch; /* Pointer to archetype */ 234 struct archt *arch; /* Pointer to archetype */
239 struct archt *other_arch; /* Pointer used for various things - mostly used for what */ 235 struct archt *other_arch; /* Pointer used for various things - mostly used for what */
240 /* this objects turns into or what this object creates */ 236 /* this objects turns into or what this object creates */
241 uint32 flags[4]; /* various flags */ 237 uint32 flags[4]; /* various flags */
242 uint16 animation_id; /* An index into the animation array */ 238 uint16 animation_id; /* An index into the animation array */
243 uint8 anim_speed; /* ticks between animation-frames */ 239 uint8 anim_speed; /* ticks between animation-frames */
244 uint8 last_anim; /* last sequence used to draw face */ 240 uint8 last_anim; /* last sequence used to draw face */
245 sint32 elevation; /* elevation of this terrain - not currently used */ 241 sint32 elevation; /* elevation of this terrain - not currently used */
258 const char *custom_name; /* Custom name assigned by player */ 254 const char *custom_name; /* Custom name assigned by player */
259 key_value *key_values; /* Fields not explictly known by the loader. */ 255 key_value *key_values; /* Fields not explictly known by the loader. */
260}; 256};
261 257
262struct object : object_special, object_simple { 258struct object : object_special, object_simple {
263 void instantiate_ ();
264 void instantiate ()
265 {
266 if (attach)
267 {
268 instantiate_ ();
269 free_string (attach);
270 attach = 0;
271 }
272 }
273 void clone (object *destination) 259 void clone (object *destination)
274 { 260 {
275 if (attach) 261 if (attach)
276 destination->attach = add_refcount (attach); 262 destination->attach = add_refcount (attach);
277 263
307 struct archt *head; /* The main part of a linked object */ 293 struct archt *head; /* The main part of a linked object */
308 struct archt *more; /* Next part of a linked object */ 294 struct archt *more; /* Next part of a linked object */
309 object clone; /* An object from which to do copy_object() */ 295 object clone; /* An object from which to do copy_object() */
310 uint32 editable; /* editable flags (mainly for editor) */ 296 uint32 editable; /* editable flags (mainly for editor) */
311 sint8 tail_x, tail_y; /* Where the lower right most portion of the object is 297 sint8 tail_x, tail_y; /* Where the lower right most portion of the object is
312 * in comparison to the head. 298 * in comparison to the head.
313 */ 299 */
314} archetype; 300} archetype;
315 301
316extern object *objects; 302extern object *objects;
317extern object *active_objects; 303extern object *active_objects;
318extern object *free_objects; 304extern object *free_objects;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines