|
Atrinik Server 2.5
|
00001 /************************************************************************ 00002 * Atrinik, a Multiplayer Online Role Playing Game * 00003 * * 00004 * Copyright (C) 2009-2011 Alex Tokar and Atrinik Development Team * 00005 * * 00006 * Fork from Daimonin (Massive Multiplayer Online Role Playing Game) * 00007 * and Crossfire (Multiplayer game for X-windows). * 00008 * * 00009 * This program is free software; you can redistribute it and/or modify * 00010 * it under the terms of the GNU General Public License as published by * 00011 * the Free Software Foundation; either version 2 of the License, or * 00012 * (at your option) any later version. * 00013 * * 00014 * This program is distributed in the hope that it will be useful, * 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00017 * GNU General Public License for more details. * 00018 * * 00019 * You should have received a copy of the GNU General Public License * 00020 * along with this program; if not, write to the Free Software * 00021 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 00022 * * 00023 * The author can be reached at admin@atrinik.org * 00024 ************************************************************************/ 00025 00030 #ifndef OBJECT_H 00031 #define OBJECT_H 00032 00036 #define WEIGHT(op) (!op->nrof || op->type == CONTAINER ? op->weight + op->carrying : op->weight) 00037 00038 #define WEIGHT_NROF(op, nrof) ((nrof ? op->weight * (sint32) nrof : op->weight) + op->carrying) 00039 00043 #define MOVE_APPLY_DEFAULT 0 00044 #define MOVE_APPLY_WALK_ON 1 00045 #define MOVE_APPLY_FLY_ON 2 00046 #define MOVE_APPLY_WALK_OFF 4 00047 #define MOVE_APPLY_FLY_OFF 8 00048 00049 #define MOVE_APPLY_MOVE 16 00050 00055 #define MOVE_APPLY_VANISHED 32 00056 00057 #define MOVE_APPLY_SAVING 64 00058 00063 #define CHECK_WALK_OK 0 00064 #define CHECK_WALK_DESTROYED 1 00065 #define CHECK_WALK_MOVED 2 00066 00071 typedef struct key_value_struct 00072 { 00074 const char *key; 00075 00077 const char *value; 00078 00080 struct key_value_struct *next; 00081 } key_value; 00082 00085 typedef struct obj 00086 { 00087 /* These variables are not changed by copy_object(): */ 00088 00094 struct obj *active_next; 00095 00101 struct obj *active_prev; 00102 00104 struct obj *below; 00105 00109 struct obj *above; 00110 00112 struct obj *inv; 00113 00118 struct obj *env; 00119 00121 struct obj *more; 00122 00124 struct obj *head; 00125 00127 struct mapdef *map; 00128 00130 tag_t count; 00131 00136 uint32 damage_round_tag; 00137 00143 sint32 carrying; 00144 00145 /* These get an extra add_refcount(), after having been copied by memcpy(). 00146 * All fields below this point are automatically copied by memcpy. If 00147 * adding something that needs a refcount updated, make sure you modify 00148 * copy_object to do so. */ 00149 00151 const char *name; 00152 00154 const char *title; 00155 00157 const char *race; 00158 00162 const char *slaying; 00163 00165 const char *msg; 00166 00168 shstr *artifact; 00169 00171 shstr *custom_name; 00172 00174 struct obj *enemy; 00175 00177 struct obj *attacked_by; 00178 00184 struct obj *owner; 00185 00187 struct obj *chosen_skill; 00188 00190 struct obj *exp_obj; 00191 00193 tag_t enemy_count; 00194 00196 tag_t ownercount; 00197 00199 tag_t attacked_by_count; 00200 00202 struct archt *arch; 00203 00205 struct archt *other_arch; 00206 00208 struct treasureliststruct *randomitems; 00209 00211 New_Face *face; 00212 00214 New_Face *inv_face; 00215 00217 sint64 value; 00218 00220 uint32 event_flags; 00221 00223 sint32 weight; 00224 00228 uint32 weight_limit; 00229 00231 uint32 path_attuned; 00232 00234 uint32 path_repelled; 00235 00237 uint32 path_denied; 00238 00240 uint32 nrof; 00241 00243 uint32 update_tag; 00244 00246 uint32 flags[NUM_FLAGS_32]; 00247 00249 sint16 x; 00250 00252 sint16 y; 00253 00261 sint16 z; 00262 00264 sint16 attacked_by_distance; 00265 00267 uint16 last_damage; 00268 00272 uint16 terrain_type; 00273 00275 uint16 terrain_flag; 00276 00278 uint16 material; 00279 00281 sint16 material_real; 00282 00284 sint16 last_heal; 00285 00287 sint16 last_sp; 00288 00290 sint16 last_grace; 00291 00293 sint16 last_eat; 00294 00296 uint16 animation_id; 00297 00299 uint16 inv_animation_id; 00300 00301 #ifdef POSITION_DEBUG 00302 00303 sint16 ox, oy; 00304 #endif 00305 00310 sint16 align; 00311 00313 sint16 rotate; 00314 00316 sint8 glow_radius; 00317 00319 sint8 magic; 00320 00322 uint8 state; 00323 00325 sint8 level; 00326 00328 sint8 direction; 00329 00331 sint8 facing; 00332 00337 uint8 quick_pos; 00338 00340 uint8 type; 00341 00343 uint8 sub_type; 00344 00346 uint8 item_quality; 00347 00349 uint8 item_condition; 00350 00352 uint8 item_race; 00353 00355 uint8 item_level; 00356 00358 uint8 item_skill; 00359 00361 sint8 move_status; 00362 00364 uint8 move_type; 00365 00367 uint8 attack_move_type; 00368 00370 sint8 anim_enemy_dir; 00371 00373 sint8 anim_moving_dir; 00374 00376 sint8 anim_enemy_dir_last; 00377 00379 sint8 anim_moving_dir_last; 00380 00382 sint8 anim_last_facing; 00383 00385 sint8 anim_last_facing_last; 00386 00388 uint8 anim_speed; 00389 00391 uint8 last_anim; 00392 00394 uint8 behavior; 00395 00397 uint8 run_away; 00398 00400 uint8 layer; 00401 00403 uint8 quickslot; 00404 00417 uint8 attack[NROFATTACKS]; 00418 00420 sint8 protection[NROFATTACKS]; 00421 00423 sint8 item_power; 00424 00431 uint8 zoom; 00432 00434 uint8 alpha; 00435 00437 float speed; 00438 00440 float speed_left; 00441 00443 float weapon_speed; 00444 00446 float weapon_speed_left; 00447 00449 float weapon_speed_add; 00450 00452 living stats; 00453 00455 void *custom_attrset; 00456 00458 key_value *key_values; 00459 } object; 00460 00462 typedef struct oblnk 00463 { 00465 union 00466 { 00468 struct oblnk *link; 00469 00471 object *ob; 00472 00474 struct ban_struct *ban; 00475 } objlink; 00476 00478 struct oblnk *next; 00479 00481 struct oblnk *prev; 00482 00484 tag_t id; 00485 00487 long value; 00488 } objectlink; 00489 00490 #define free_objectlink_simple(_chunk_) return_poolchunk((_chunk_), pool_objectlink); 00491 00493 extern object *active_objects; 00494 00495 extern struct mempool_chunk *removed_objects; 00496 00497 #define CONTR(ob) ((player *) ((ob)->custom_attrset)) 00498 00499 /* This returns TRUE if the object is something that 00500 * should be displayed in the look window */ 00501 #define LOOK_OBJ(_ob) (!IS_SYS_INVISIBLE(_ob) && _ob->type != PLAYER) 00502 00510 #define UP_OBJ_INSERT 1 00511 00512 #define UP_OBJ_REMOVE 2 00513 00516 #define UP_OBJ_FLAGS 3 00517 00518 #define UP_OBJ_FACE 4 00519 00520 #define UP_OBJ_FLAGFACE 5 00521 00522 #define UP_OBJ_ALL 6 00523 00526 #define UP_OBJ_LAYER 7 00527 00532 #define OBJECT_VALID(_ob_, _count_) ((_ob_) && (_ob_)->count == ((tag_t) _count_) && !QUERY_FLAG((_ob_), FLAG_REMOVED) && !OBJECT_FREE(_ob_)) 00533 00535 #define OBJECT_ACTIVE(_ob_) (!QUERY_FLAG((_ob_), FLAG_REMOVED) && !OBJECT_FREE(_ob_)) 00536 00538 #define OBJECT_FREE(_ob_) ((_ob_)->count == 0 && CHUNK_FREE(_ob_)) 00539 00548 #define INS_NO_MERGE 0x0001 00549 00553 #define INS_NO_WALK_ON 0x0002 00554 00557 #define INS_TAIL_MARKER 0x0004 00558 00565 #define BEHAVIOR_SPELL_FRIENDLY 1 00566 00567 #define BEHAVIOR_OPEN_DOORS 2 00568 00571 #define decrease_ob(xyz) decrease_ob_nr(xyz, 1) 00572 00578 #define GENDER_NEUTER 0 00579 00580 #define GENDER_MALE 1 00581 00582 #define GENDER_FEMALE 2 00583 00584 #define GENDER_HERMAPHRODITE 3 00585 00586 #define GENDER_MAX 4 00587 00592 #define CORPSE_INFRAVISION_PERCENT 75 00593 00599 #define HEAD(op) ((op)->head ? (op)->head : (op)) 00600 00603 typedef struct magic_mirror_struct 00604 { 00606 struct mapdef *map; 00607 00609 sint16 x; 00610 00612 sint16 y; 00613 } magic_mirror_struct; 00614 00619 #define MMIRROR(ob) ((magic_mirror_struct *) ((ob)->custom_attrset)) 00620 00621 extern const char *gender_noun[]; 00622 extern const char *gender_subjective[]; 00623 extern const char *gender_subjective_upper[]; 00624 extern const char *gender_objective[]; 00625 extern const char *gender_possessive[]; 00626 extern const char *gender_reflexive[]; 00627 00628 #endif
1.7.4