Crossfire Server, Branches 1.12  R18729
object.h
Go to the documentation of this file.
1 /*
2  * static char *rcsid_object_h =
3  * "$Id: object.h 11578 2009-02-23 22:02:27Z lalo $";
4  */
5 
6 /*
7  CrossFire, A Multiplayer game for X-windows
8 
9  Copyright (C) 2001 Mark Wedel & Crossfire Development Team
10  Copyright (C) 1992 Frank Tore Johansen
11 
12  This program is free software; you can redistribute it and/or modify
13  it under the terms of the GNU General Public License as published by
14  the Free Software Foundation; either version 2 of the License, or
15  (at your option) any later version.
16 
17  This program is distributed in the hope that it will be useful,
18  but WITHOUT ANY WARRANTY; without even the implied warranty of
19  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  GNU General Public License for more details.
21 
22  You should have received a copy of the GNU General Public License
23  along with this program; if not, write to the Free Software
24  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 
26  The authors can be reached via e-mail at crossfire-devel@real-time.com
27 */
28 
34 #include "dialog.h"
35 
36 #ifndef OBJECT_H
37 #define OBJECT_H
38 
40 typedef uint32 tag_t;
41 #define NUM_BODY_LOCATIONS 13
42 #define BODY_ARMS 1
48 typedef struct body_locations_struct {
49  const char *save_name;
50  const char *use_name;
51  const char *nonuse_name;
53 
55 
66 typedef struct _key_value {
67  const char *key;
68  const char *value;
69  struct _key_value *next;
70 } key_value;
71 
78 #define WILL_APPLY_HANDLE 0x1
79 #define WILL_APPLY_TREASURE 0x2
80 #define WILL_APPLY_EARTHWALL 0x4
81 #define WILL_APPLY_DOOR 0x8
82 #define WILL_APPLY_FOOD 0x10
83 
94 #define was_destroyed(op, old_tag) \
95  (op->count != old_tag || QUERY_FLAG(op, FLAG_FREED))
96 
97 
107 #define SPELL_TAG_SIZE 16
108 #define OB_SPELL_TAG_HASH(op, count) (op->spell_tags[count&0xf])
109 #define OB_SPELL_TAG_MATCH(op, count) (op->spell_tags[count&0xf] == count)
110 
132 typedef struct obj {
133  /* These variables are not changed by copy_object() */
134  struct pl *contr;
135  struct obj *next;
136  struct obj *prev;
137  struct obj *active_next;
141  struct obj *active_prev;
145  struct obj *below;
146  struct obj *above;
147  /* Note: stacked in the *same *environment*/
148  struct obj *inv;
149  struct obj *container;
151  struct obj *env;
153  struct obj *more;
154  struct obj *head;
155  struct mapdef *map;
161  /* These get an extra add_refcount(), after having been copied by memcpy().
162  * All fields beow this point are automatically copied by memcpy. If
163  * adding something that needs a refcount updated, make sure you modify
164  * copy_object to do so. Everything below here also gets cleared
165  * by clear_object()
166  */
167  const char *name;
168  const char *name_pl;
169  const char *anim_suffix;
170  const char *title;
171  const char *race;
172  const char *slaying;
174  const char *skill;
175  const char *msg;
176  const char *lore;
179  sint16 x, y;
181  float speed;
182  float speed_left;
188  /* This next big block are basically used for monsters and equipment */
197  const char *materialname;
204  /* Note that the last_.. values are sometimes used for non obvious
205  * meanings by some objects, eg, sp penalty, permanent exp.
206  */
220  sint64 perm_exp;
221  struct obj *current_weapon;
225  /* See the doc/Developers/objects for more info about body locations */
226 
227  /* Following mostly refers to fields only used for monsters */
228  struct obj *owner;
232  struct obj *enemy;
233  struct obj *attacked_by;
237  struct obj *chosen_skill;
239  /* changes made by kholland@sunlab.cit.cornell.edu */
240  /* allows different movement patterns for attackers */
245  struct obj *spellitem;
246  double expmul;
249  /* Spell related information, may be useful elsewhere
250  * Note that other fields are used - these files are basically
251  * only used in spells.
252  */
259  struct obj *spell;
260  char *spellarg;
261 
262  /* Following are values used by any object */
263  struct archt *arch;
264  struct archt *other_arch;
285  const char *custom_name;
293 } object;
294 
298 typedef struct oblnk {
299  object *ob;
300  struct oblnk *next;
302 } objectlink;
303 
307 typedef struct oblinkpt {
308  struct oblnk *link;
309  long value;
310  struct oblinkpt *next;
311 } oblinkpt;
312 
321 typedef struct archt {
322  const char *name;
323  struct archt *next;
324  struct archt *head;
325  struct archt *more;
326  object clone;
330 } archetype;
331 
332 extern object *objects;
333 extern object *active_objects;
334 extern object *free_objects;
335 extern object objarray[STARTMAX];
336 
337 extern int nrofallocobjects;
338 extern int nroffreeobjects;
339 
344 #define LOOK_OBJ(ob) (!ob->invisible && ob->type != PLAYER && ob->type != EVENT_CONNECTOR)
345 
353 #define UP_OBJ_INSERT 1
354 #define UP_OBJ_REMOVE 2
355 #define UP_OBJ_CHANGE 3
356 #define UP_OBJ_FACE 4
360 
361 
392 #define INS_NO_MERGE 0x0001
393 #define INS_ABOVE_FLOOR_ONLY 0x0002
394 #define INS_NO_WALK_ON 0x0004
395 #define INS_ON_TOP 0x0008
396 #define INS_BELOW_ORIGINATOR 0x0010
397 #define INS_MAP_LOAD 0x0020
400 #define ARCH_SINGULARITY "singularity"
401 #define ARCH_SINGULARITY_LEN 11
402 #define ARCH_DETECT_MAGIC "detect_magic"
403 #define ARCH_DEPLETION "depletion"
404 #define ARCH_SYMPTOM "symptom"
406 #endif /* OBJECT_H */
uint8 map_layer
Definition: object.h:275
Definition: object.h:132
int reference_count
Definition: object.h:329
signed char sint8
Definition: global.h:80
#define NUM_BODY_LOCATIONS
Definition: object.h:41
sint16 oy
Definition: object.h:180
Definition: player.h:146
struct _key_value * next
Definition: object.h:69
tag_t ownercount
Definition: object.h:231
MoveType move_type
Definition: object.h:277
MoveType move_on
Definition: object.h:280
signed short sint16
Definition: global.h:72
Definition: object.h:298
const char * race
Definition: object.h:171
uint16 attack_movement
Definition: object.h:242
tag_t attacked_by_count
Definition: object.h:234
MoveType move_allow
Definition: object.h:279
uint8 range_modifier
Definition: object.h:257
int nrofallocobjects
Definition: object.c:67
sint8 range
Definition: object.h:256
signed int sint32
Definition: global.h:64
uint16 material
Definition: object.h:198
uint16 client_type
Definition: object.h:191
tag_t * spell_tags
Definition: object.h:292
struct obj * container
Definition: object.h:149
unsigned char MoveType
Definition: define.h:725
sint32 move_status
Definition: object.h:241
sint32 last_heal
Definition: object.h:208
struct treasureliststruct * randomitems
Definition: object.h:236
object clone
Definition: object.h:326
sint16 duration
Definition: object.h:254
sint16 invisible
Definition: object.h:211
uint8 last_anim
Definition: object.h:269
const char * key
Definition: object.h:67
struct obj * prev
Definition: object.h:136
const char * slaying
Definition: object.h:172
sint32 last_sp
Definition: object.h:209
object * free_objects
Definition: object.c:71
uint8 subtype
Definition: object.h:190
struct obj * above
Definition: object.h:146
struct oblinkpt oblinkpt
double expmul
Definition: object.h:246
Definition: living.h:77
sint32 elevation
Definition: object.h:273
sint16 x
Definition: object.h:179
uint32 path_attuned
Definition: object.h:194
uint8 temp_anim_speed
Definition: object.h:271
uint8 smoothlevel
Definition: object.h:274
uint32 path_repelled
Definition: object.h:195
struct obj * enemy
Definition: object.h:232
struct archt * other_arch
Definition: object.h:264
long value
Definition: object.h:309
struct obj object
tag_t id
Definition: object.h:301
Definition: object.h:321
uint8 dam_modifier
Definition: object.h:258
struct oblnk * link
Definition: object.h:308
object * ob
Definition: object.h:299
uint32 flags[4]
Definition: object.h:266
const char * lore
Definition: object.h:176
uint32 tag_t
Definition: object.h:40
struct obj * chosen_skill
Definition: object.h:237
const char * title
Definition: object.h:170
struct oblinkpt * next
Definition: object.h:310
uint32 path_denied
Definition: object.h:196
#define STARTMAX
Definition: config.h:591
sint32 weight_limit
Definition: object.h:217
struct obj * spell
Definition: object.h:259
const char * name_pl
Definition: object.h:168
const char * save_name
Definition: object.h:49
float speed_left
Definition: object.h:182
const char * materialname
Definition: object.h:197
sint32 weight
Definition: object.h:216
struct mapdef * map
Definition: object.h:155
struct obj * active_prev
Definition: object.h:141
object * active_objects
Definition: object.c:72
uint8 temp_last_anim
Definition: object.h:272
uint16 temp_animation_id
Definition: object.h:270
sint32 carrying
Definition: object.h:218
const char * name
Definition: object.h:167
struct obj * env
Definition: object.h:151
sint64 perm_exp
Definition: object.h:220
uint16 run_away
Definition: object.h:235
struct obj * below
Definition: object.h:145
struct archt * more
Definition: object.h:325
sint16 last_grace
Definition: object.h:210
struct obj * current_weapon
Definition: object.h:221
uint32 nrof
Definition: object.h:184
struct oblnk objectlink
unsigned char uint8
Definition: global.h:75
struct archt * head
Definition: object.h:324
MoveType move_off
Definition: object.h:281
sint8 facing
Definition: object.h:186
sint16 y
Definition: object.h:179
struct pl * contr
Definition: object.h:134
sint8 item_power
Definition: object.h:213
const char * use_name
Definition: object.h:50
sint8 tail_y
Definition: object.h:327
char * spellarg
Definition: object.h:260
float speed
Definition: object.h:181
uint8 state
Definition: object.h:200
struct obj * active_next
Definition: object.h:137
const char * nonuse_name
Definition: object.h:51
MoveType move_slow
Definition: object.h:282
unsigned short uint16
Definition: global.h:67
const char * skill
Definition: object.h:174
sint32 last_eat
Definition: object.h:207
struct struct_dialog_information * dialog_information
Definition: object.h:158
key_value * key_values
Definition: object.h:286
struct obj * next
Definition: object.h:135
sint16 resist[NROFATTACKS]
Definition: object.h:192
sint8 body_info[NUM_BODY_LOCATIONS]
Definition: object.h:223
sint8 body_used[NUM_BODY_LOCATIONS]
Definition: object.h:224
uint32 attacktype
Definition: object.h:193
struct obj * spellitem
Definition: object.h:245
sint8 direction
Definition: object.h:185
struct obj * owner
Definition: object.h:228
const char * custom_name
Definition: object.h:285
struct body_locations_struct body_locations_struct
tag_t count
Definition: object.h:157
living stats
Definition: object.h:219
struct archt * arch
Definition: object.h:263
object objarray[STARTMAX]
Definition: object.c:65
struct oblnk * next
Definition: object.h:300
uint8 will_apply
Definition: object.h:243
sint8 sound_chance
Definition: object.h:244
struct archt * next
Definition: object.h:323
uint32 weapontype
Definition: object.h:222
#define NROFATTACKS
Definition: attack.h:45
body_locations_struct body_locations[NUM_BODY_LOCATIONS]
Definition: item.c:64
const char * anim_suffix
Definition: object.h:169
const char * msg
Definition: object.h:175
uint8 no_save
Definition: object.h:288
const char * value
Definition: object.h:68
sint16 casting_time
Definition: object.h:253
uint16 animation_id
Definition: object.h:267
sint8 glow_radius
Definition: object.h:215
struct _key_value key_value
uint8 anim_speed
Definition: object.h:268
struct obj * inv
Definition: object.h:148
struct obj * head
Definition: object.h:154
unsigned int uint32
Definition: global.h:58
uint8 pick_up
Definition: object.h:212
int nroffreeobjects
Definition: object.c:66
MoveType move_block
Definition: object.h:278
float move_slow_penalty
Definition: object.h:283
object * objects
Definition: object.c:70
sint16 ox
Definition: object.h:180
sint8 tail_x
Definition: object.h:327
Definition: map.h:346
New_Face * face
Definition: object.h:183
sint16 level
Definition: object.h:202
sint16 * discrete_damage
Definition: object.h:291
struct obj * more
Definition: object.h:153
sint32 value
Definition: object.h:201
sint8 magic
Definition: object.h:199
uint8 duration_modifier
Definition: object.h:255
const char * name
Definition: object.h:322
struct archt archetype
uint8 type
Definition: object.h:189
sint8 gen_sp_armour
Definition: object.h:214
struct obj * attacked_by
Definition: object.h:233
uint32 hide
Definition: object.h:238