version 1.22 | | version 1.23 |
---|
| | |
/* | | /* |
* static char *rcsid_object_h = | | * static char *rcsid_object_h = |
* "$Id: object.h,v 1.22 2002/05/31 04:18:33 mwedel Exp $"; | | * "$Id: object.h,v 1.23 2002/07/15 04:57:12 mwedel Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
#define OBJECT_H | | #define OBJECT_H |
| | |
typedef uint32 tag_t; | | typedef uint32 tag_t; |
| | #define NUM_BODY_LOCATIONS 12 |
| | |
| | /* See common/item.c */ |
| | |
| | typedef struct Body_Locations { |
| | char *save_name; /* Name used to load/save it to disk */ |
| | char *use_name; /* Name used when describing an item we can use */ |
| | char *nonuse_name; /* Name to describe objects we can't use */ |
| | } Body_Locations; |
| | |
| | extern Body_Locations body_locations[NUM_BODY_LOCATIONS]; |
| | |
| | /* Definition for WILL_APPLY values. Replaces having harcoded values |
| | * sprinkled in the code. Note that some of these also replace fields |
| | * that were in the can_apply area. What is the point of having both |
| | * can_apply and will_apply? |
| | */ |
| | #define WILL_APPLY_HANDLE 0x1 |
| | #define WILL_APPLY_TREASURE 0x2 |
| | #define WILL_APPLY_EARTHWALL 0x4 |
| | #define WILL_APPLY_DOOR 0x8 |
| | #define WILL_APPLY_FOOD 0x10 |
| | |
| | |
| | /* Note that the ordering of this structure is sort of relevent - |
| | * copy_object copies everything over beyond 'name' using memcpy. |
| | * Thus, values that need to be copied need to be located beyond that |
| | * point. |
| | * |
| | * I've tried to clean up this structure a bit (in terms of formatting) |
| | * by making it more consistent. I've also tried to locate some of the fields |
| | * more logically together (put the item related ones together, the monster |
| | * related ones, etc. |
| | * This structure is best viewed with about a 100 width screen. |
| | * MSW 2002-07-05 |
| | */ |
typedef struct obj { | | typedef struct obj { |
/* These variables are not changed by copy_object(): */ | | /* These variables are not changed by copy_object() */ |
struct pl *contr; /* Pointer to the player which control this object */ | | struct pl *contr; /* Pointer to the player which control this object */ |
struct obj *next; /* Pointer to the next object in the free/used list */ | | struct obj *next; /* Pointer to the next object in the free/used list */ |
struct obj *prev; /* Pointer to the previous object in the free/used list*/ | | struct obj *prev; /* Pointer to the previous object in the free/used list*/ |
| | |
struct obj *head; /* Points to the main object of a large body */ | | struct obj *head; /* Points to the main object of a large body */ |
struct mapdef *map; /* Pointer to the map in which this object is present */ | | struct mapdef *map; /* Pointer to the map in which this object is present */ |
| | |
tag_t count; /* Which nr. of object created this is. */ | | tag_t count; /* Unique object number for this object */ |
uint16 refcount; /* How many objects points to this object */ | | uint16 refcount; /* How many objects points to this object */ |
| | |
/* These get an extra add_refcount(), after having been copied by memcpy() */ | | /* These get an extra add_refcount(), after having been copied by memcpy(). |
| | * All fields beow this point are automatically copied by memcpy. If |
| | * adding something that needs a refcount updated, make sure you modify |
| | * copy_object to do so. Everything below here also gets cleared |
| | * by clear_object() |
| | */ |
char *name; /* The name of the object, obviously... */ | | char *name; /* The name of the object, obviously... */ |
char *name_pl; /* The plural name of the object */ | | char *name_pl; /* The plural name of the object */ |
char *title; /* Of foo, etc */ | | char *title; /* Of foo, etc */ |
char *race; /* human, goblin, dragon, etc */ | | char *race; /* human, goblin, dragon, etc */ |
char *slaying; /* Which race to do double damage to */ | | char *slaying; /* Which race to do double damage to */ |
char *msg; /* If this is a book/sign/magic mouth/etc */ | | |
/* If this is an exit, this is the filename */ | | /* If this is an exit, this is the filename */ |
/* These variables are copied by memcpy() in copy_object(): */ | | char *msg; /* If this is a book/sign/magic mouth/etc */ |
| | |
sint16 x,y; /* Position in the map for this object */ | | sint16 x,y; /* Position in the map for this object */ |
sint16 ox,oy; /* For debugging: Where it was last inserted */ | | sint16 ox,oy; /* For debugging: Where it was last inserted */ |
float speed; /* The overall speed of this object */ | | float speed; /* The overall speed of this object */ |
| | |
sint8 direction; /* Means the object is moving that way. */ | | sint8 direction; /* Means the object is moving that way. */ |
sint8 facing; /* Object is oriented/facing that way. */ | | sint8 facing; /* Object is oriented/facing that way. */ |
| | |
| | /* This next big block are basically used for monsters and equipment */ |
uint8 type; /* PLAYER, BULLET, etc. See define.h */ | | uint8 type; /* PLAYER, BULLET, etc. See define.h */ |
uint16 client_type; /* Public type information */ | | uint16 client_type; /* Public type information. see doc/Developers/objects */ |
| | |
sint16 resist[NROFATTACKS]; /* Resistance adjustments for attacks */ | | sint16 resist[NROFATTACKS]; /* Resistance adjustments for attacks */ |
uint32 attacktype; /* Bitmask of attacks this object does */ | | uint32 attacktype; /* Bitmask of attacks this object does */ |
uint32 path_attuned; /* Paths the object is attuned to */ | | uint32 path_attuned; /* Paths the object is attuned to */ |
| | |
sint8 thrownthaco; /* How precise the throw is */ | | sint8 thrownthaco; /* How precise the throw is */ |
uint8 state; /* How the object was last drawn (animation) */ | | uint8 state; /* How the object was last drawn (animation) */ |
sint32 value; /* How much money it is worth (or contains) */ | | sint32 value; /* How much money it is worth (or contains) */ |
signed short level; | | sint16 level; /* Level of creature or object */ |
| | /* Note that the last_.. values are sometimes used for non obvious |
| | * meanings by some objects, eg, sp penalty, permanent exp. |
| | */ |
sint32 last_heal; /* Last healed. Depends on constitution */ | | sint32 last_heal; /* Last healed. Depends on constitution */ |
sint32 last_sp; /* As last_heal, but for spell points */ | | sint32 last_sp; /* As last_heal, but for spell points */ |
signed short last_grace; /* as last_sp, except for grace */ | | sint16 last_grace; /* as last_sp, except for grace */ |
signed short last_eat; /* How long since we last ate */ | | sint16 last_eat; /* How long since we last ate */ |
signed short invisible; /* How much longer the object will be invis */ | | sint16 invisible; /* How much longer the object will be invis */ |
unsigned char pick_up; /* See crossfire.doc */ | | uint8 pick_up; /* See crossfire.doc */ |
| | sint8 item_power; /* power rating of the object */ |
| | sint8 gen_sp_armour; /* sp regen penalty this object has (was last_heal)*/ |
| | sint32 weight; /* Attributes of the object */ |
| | sint32 weight_limit; /* Weight-limit of object */ |
| | sint32 carrying; /* How much weight this object contains */ |
| | sint16 glow_radius; /* indicates the glow radius of the object */ |
| | living stats; /* Str, Con, Dex, etc */ |
| | char *current_weapon_script; /* The script of the currently used weapon. Executed */ |
| | /* each time the object attacks something */ |
| | struct obj *current_weapon; /* Pointer to the weapon currently used */ |
| | uint32 weapontype; /* type of weapon */ |
| | sint8 body_info[NUM_BODY_LOCATIONS]; /* body info as loaded from the file */ |
| | sint8 body_used[NUM_BODY_LOCATIONS]; /* Calculated value based on items equipped */ |
| | /* See the doc/Developers/objects for more info about body locations */ |
| | |
| | /* Following mostly refers to fields only used for monsters */ |
struct obj *owner; /* Pointer to the object which controls this one */ | | struct obj *owner; /* Pointer to the object which controls this one */ |
/* Owner should not be referred to directly - */ | | /* Owner should not be referred to directly - */ |
/* get_owner should be used instead. */ | | /* get_owner should be used instead. */ |
| | tag_t ownercount; /* What count the owner had (in case owner */ |
| | /* has been freed) */ |
struct obj *enemy; /* Monster/player to follow even if not closest */ | | struct obj *enemy; /* Monster/player to follow even if not closest */ |
struct obj *attacked_by; /* This object start to attack us! only player & monster */ | | struct obj *attacked_by; /* This object start to attack us! only player & monster */ |
tag_t attacked_by_count; /* the tag of attacker, so we can be sure */ | | tag_t attacked_by_count; /* the tag of attacker, so we can be sure */ |
| | |
struct archt *arch; /* Pointer to archetype */ | | |
struct archt *other_arch; /* Pointer used for various things */ | | |
signed long weight; /* Attributes of the object */ | | |
signed long carrying; /* How much weight this object contains */ | | |
uint32 flags[4]; /* various flags */ | | |
tag_t ownercount; /* What count the owner had (in case owner */ | | |
/* has been freed) */ | | |
struct treasureliststruct *randomitems; /* Items to be generated */ | | struct treasureliststruct *randomitems; /* Items to be generated */ |
/* Some debug variables: */ | | uint16 run_away; /* Monster runs away if it's hp goes below this percentage. */ |
unsigned short run_away; /* Monster runs away if it's hp goes below \ | | |
this percentage. */ | | |
| | |
/* Not commented out by ALLOW_SKILLS - to many pieces of code want this | | |
* information | | |
*/ | | |
struct obj *chosen_skill; /* the skill chosen to use */ | | struct obj *chosen_skill; /* the skill chosen to use */ |
struct obj *exp_obj; /* the exp. obj (category) assoc. w/ this object */ | | struct obj *exp_obj; /* the exp. obj (category) assoc. w/ this object */ |
uint32 hide; /* The object is hidden, not invisible */ | | uint32 hide; /* The object is hidden, not invisible */ |
| | |
/* lighting code uses these - b.t. */ | | |
signed short glow_radius; /* indicates the glow radius of the object */ | | |
| | |
/* changes made by kholland@sunlab.cit.cornell.edu */ | | /* changes made by kholland@sunlab.cit.cornell.edu */ |
/* allows different movement patterns for attackers */ | | /* allows different movement patterns for attackers */ |
signed long move_status; /* What stage in attack mode */ | | sint32 move_status; /* What stage in attack mode */ |
unsigned short move_type; /* What kind of attack movement */ | | uint16 move_type; /* What kind of attack movement */ |
| | uint8 will_apply; /* See crossfire.doc */ |
signed long weight_limit; /* Weight-limit of object */ | | struct obj *spellitem; /* Spell ability monster is choosing to use */ |
unsigned char can_apply; /* See crossfire.doc */ | | double expmul; /* needed experience = (calc_exp*expmul) - means some */ |
unsigned char will_apply; /* See crossfire.doc */ | | /* races/classes can need less/more exp to gain levels */ |
uint16 animation_id; /* An index into the animation array */ | | |
uint8 anim_speed, last_anim; /* ticks between animation-frames */ | | |
living stats; | | |
sint32 elevation; /* elevation of this terrain - not currently used */ | | |
| | |
#ifdef CASTING_TIME | | #ifdef CASTING_TIME |
signed short casting; /* time left before spell goes off */ | | sint16 casting; /* time left before spell goes off */ |
unsigned short spell_state; | | uint16 spell_state; |
unsigned short start_holding; | | uint16 start_holding; |
struct spell_struct *spell; | | struct spell_struct *spell; |
unsigned int spelltype; | | uint32 spelltype; |
char *spellarg; | | char *spellarg; |
#endif | | #endif |
| | |
struct obj *spellitem; | | /* Following are values used by any object */ |
| | struct archt *arch; /* Pointer to archetype */ |
| | struct archt *other_arch; /* Pointer used for various things - mostly used for what */ |
| | /* this objects turns into or what this object creates */ |
| | uint32 flags[4]; /* various flags */ |
| | uint16 animation_id; /* An index into the animation array */ |
| | uint8 anim_speed; /* ticks between animation-frames */ |
| | uint8 last_anim; /* last sequence used to draw face */ |
| | sint32 elevation; /* elevation of this terrain - not currently used */ |
| | |
/* This modification will allow variable experience requirements | | char *event_hook[30]; /* GROS - extensions for scripting events */ |
for advancement (eanders@cmu.edu) */ | | |
double expmul; /* needed experience = (calc_exp*expmul) */ | | |
/* GROS: Upgraded obj structure to allow script events */ | | |
char *event_hook[30]; | | |
char *event_plugin[30]; | | char *event_plugin[30]; |
char *event_options[30]; | | char *event_options[30]; |
/* GROS: Added for script_attack with weapons support */ | | |
char *current_weapon_script; /* The script of the currently used weapon. Executed each time the object | | |
* attacks something */ | | |
struct obj *current_weapon; /* Pointer to the weapon currently used */ | | |
uint32 weapontype; /* type of weapon */ | | |
| | |
} object; | | } object; |
| | |