/* File: types.h */ #include "types_fwd.h" /* Purpose: global type declarations */ /* * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke * * This software may be copied and distributed for educational, research, and * not for profit purposes provided that this copyright and statement are * included in all such copies. */ /* * This file should ONLY be included by "angband.h" */ /* * Note that "char" may or may not be signed, and that "signed char" * may or may not work on all machines. So always use "s16b" or "s32b" * for signed values. Also, note that unsigned values cause math problems * in many cases, so try to only use "u16b" and "u32b" for "bit flags", * unless you really need the extra bit of information, or you really * need to restrict yourself to a single byte for storage reasons. * * Also, if possible, attempt to restrict yourself to sub-fields of * known size (use "s16b" or "s32b" instead of "int", and "byte" instead * of "bool"), and attempt to align all fields along four-byte words, to * optimize storage issues on 32-bit machines. Also, avoid "bit flags" * since these increase the code size and slow down execution. When * you need to store bit flags, use one byte per flag, or, where space * is an issue, use a "byte" or "u16b" or "u32b", and add special code * to access the various bit flags. * * Many of these structures were developed to reduce the number of global * variables, facilitate structured program design, allow the use of ascii * template files, simplify access to indexed data, or facilitate efficient * clearing of many variables at once. * * Certain data is saved in multiple places for efficient access, currently, * this includes the tval/sval/weight fields in "object_type" and the "m_idx" * and "o_idx" fields in "cave_type". All of these could be removed, but * this would, in general, slow down the game and increase the complexity of * the code. */ /* * "Themed" objects. * Probability in percent for each class of objects to be dropped. * This could perhaps be an array - but that wouldn't be as clear. */ typedef struct obj_theme obj_theme; struct obj_theme { byte treasure; byte combat; byte magic; byte tools; }; /* * Information about terrain "features" */ typedef struct feature_type feature_type; struct feature_type { char *name; /* Name */ const char *text; /* Text. May point to shared read-only memory, DO NOT FREE! */ const char *tunnel; /* Text for tunneling. May point to shared read-only memory, DO NOT FREE! */ const char *block; /* Text for blocking. May point to shared read-only memory, DO NOT FREE! */ byte mimic; /* Feature to mimic */ u32b flags1; /* First set of flags */ byte extra; /* Extra byte (unused) */ s16b unused; /* Extra bytes (unused) */ byte d_attr; /* Default feature attribute */ char d_char; /* Default feature character */ byte x_attr; /* Desired feature attribute */ char x_char; /* Desired feature character */ byte shimmer[7]; /* Shimmer colors */ int d_dice[4]; /* Number of dices */ int d_side[4]; /* Number of sides */ int d_frequency[4]; /* Frequency of damage (1 is the minimum) */ int d_type[4]; /* Type of damage */ }; /* * Information about object "kinds", including player knowledge. * * Only "aware" and "tried" are saved in the savefile */ typedef struct object_kind object_kind; struct object_kind { const char *name; /* Name */ char *text; /* Text */ byte tval; /* Object type */ byte sval; /* Object sub type */ s32b pval; /* Object extra info */ s32b pval2; /* Object extra info */ s16b to_h; /* Bonus to hit */ s16b to_d; /* Bonus to damage */ s16b to_a; /* Bonus to armor */ s16b activate; /* Activation number */ s16b ac; /* Base armor */ byte dd, ds; /* Damage dice/sides */ s32b weight; /* Weight */ s32b cost; /* Object "base cost" */ u32b flags1; /* Flags, set 1 */ u32b flags2; /* Flags, set 2 */ u32b flags3; /* Flags, set 3 */ u32b flags4; /* Flags, set 4 */ u32b flags5; /* Flags, set 5 */ u32b oflags1; /* Obvious Flags, set 1 */ u32b oflags2; /* Obvious Flags, set 2 */ u32b oflags3; /* Obvious Flags, set 3 */ u32b oflags4; /* Obvious Flags, set 4 */ u32b oflags5; /* Obvious Flags, set 5 */ byte locale[ALLOCATION_MAX]; /* Allocation level(s) */ byte chance[ALLOCATION_MAX]; /* Allocation chance(s) */ byte level; /* Level */ byte extra; /* Something */ byte d_attr; /* Default object attribute */ char d_char; /* Default object character */ byte x_attr; /* Desired object attribute */ char x_char; /* Desired object character */ byte flavor; /* Special object flavor (or zero) */ bool_ easy_know; /* This object is always known (if aware) */ bool_ aware; /* The player is "aware" of the item's effects */ bool_ tried; /* The player has "tried" one of the items */ bool_ know; /* extractable flag for the alchemist */ u32b esp; /* ESP flags */ u32b oesp; /* Obvious ESP flags */ byte btval; /* Become Object type */ byte bsval; /* Become Object sub type */ bool_ artifact; /* Is it a normal artifact(already generated) */ s16b power; /* Power granted(if any) */ }; /* * Information about "artifacts". * * Note that the save-file only writes "cur_num" to the savefile. * * Note that "max_num" is always "1" (if that artifact "exists") */ typedef struct artifact_type artifact_type; struct artifact_type { char const *name; /* Artifact name */ char *text; /* Artifact description */ byte tval; /* Artifact type */ byte sval; /* Artifact sub type */ s16b pval; /* Artifact extra info */ s16b to_h; /* Bonus to hit */ s16b to_d; /* Bonus to damage */ s16b to_a; /* Bonus to armor */ s16b activate; /* Activation Number */ s16b ac; /* Base armor */ byte dd, ds; /* Damage when hits */ s16b weight; /* Weight */ s32b cost; /* Artifact "cost" */ u32b flags1; /* Artifact Flags, set 1 */ u32b flags2; /* Artifact Flags, set 2 */ u32b flags3; /* Artifact Flags, set 3 */ u32b flags4; /* Artifact Flags, set 4 */ u32b flags5; /* Artifact Flags, set 5 */ u32b oflags1; /* Obvious Flags, set 1 */ u32b oflags2; /* Obvious Flags, set 2 */ u32b oflags3; /* Obvious Flags, set 3 */ u32b oflags4; /* Obvious Flags, set 4 */ u32b oflags5; /* Obvious Flags, set 5 */ byte level; /* Artifact level */ byte rarity; /* Artifact rarity */ byte cur_num; /* Number created (0 or 1) */ byte max_num; /* Unused (should be "1") */ u32b esp; /* ESP flags */ u32b oesp; /* ESP flags */ s16b power; /* Power granted(if any) */ s16b set; /* Does it belongs to a set ?*/ }; /* * Information about "ego-items". */ typedef struct ego_item_type ego_item_type; struct ego_item_type { const char *name; /* Name (offset) */ bool_ before; /* Before or after the object name ? */ byte tval[10]; byte min_sval[10]; byte max_sval[10]; byte rating; /* Rating boost */ byte level; /* Minimum level */ byte rarity; /* Object rarity */ byte mrarity; /* Object rarity */ s16b max_to_h; /* Maximum to-hit bonus */ s16b max_to_d; /* Maximum to-dam bonus */ s16b max_to_a; /* Maximum to-ac bonus */ s16b activate; /* Activation Number */ s32b max_pval; /* Maximum pval */ s32b cost; /* Ego-item "cost" */ byte rar[FLAG_RARITY_MAX]; u32b flags1[FLAG_RARITY_MAX]; /* Ego-Item Flags, set 1 */ u32b flags2[FLAG_RARITY_MAX]; /* Ego-Item Flags, set 2 */ u32b flags3[FLAG_RARITY_MAX]; /* Ego-Item Flags, set 3 */ u32b flags4[FLAG_RARITY_MAX]; /* Ego-Item Flags, set 4 */ u32b flags5[FLAG_RARITY_MAX]; /* Ego-Item Flags, set 5 */ u32b esp[FLAG_RARITY_MAX]; /* ESP flags */ u32b oflags1[FLAG_RARITY_MAX]; /* Ego-Item Obvious Flags, set 1 */ u32b oflags2[FLAG_RARITY_MAX]; /* Ego-Item Obvious Flags, set 2 */ u32b oflags3[FLAG_RARITY_MAX]; /* Ego-Item Obvious Flags, set 3 */ u32b oflags4[FLAG_RARITY_MAX]; /* Ego-Item Obvious Flags, set 4 */ u32b oflags5[FLAG_RARITY_MAX]; /* Ego-Item Obvious Flags, set 5 */ u32b oesp[FLAG_RARITY_MAX]; /* Obvious ESP flags */ u32b fego[FLAG_RARITY_MAX]; /* ego flags */ u32b need_flags1; /* Ego-Item Flags, set 1 */ u32b need_flags2; /* Ego-Item Flags, set 2 */ u32b need_flags3; /* Ego-Item Flags, set 3 */ u32b need_flags4; /* Ego-Item Flags, set 4 */ u32b need_flags5; /* Ego-Item Flags, set 5 */ u32b need_esp; /* ESP flags */ u32b forbid_flags1; /* Ego-Item Flags, set 1 */ u32b forbid_flags2; /* Ego-Item Flags, set 2 */ u32b forbid_flags3; /* Ego-Item Flags, set 3 */ u32b forbid_flags4; /* Ego-Item Flags, set 4 */ u32b forbid_flags5; /* Ego-Item Flags, set 5 */ u32b forbid_esp; /* ESP flags */ s16b power; /* Power granted(if any) */ }; /* * Information about "random artifacts parts". */ typedef struct randart_part_type randart_part_type; struct randart_part_type { byte tval[20]; byte min_sval[20]; byte max_sval[20]; byte level; /* Minimum level */ byte rarity; /* Object rarity */ byte mrarity; /* Object rarity */ s16b max_to_h; /* Maximum to-hit bonus */ s16b max_to_d; /* Maximum to-dam bonus */ s16b max_to_a; /* Maximum to-ac bonus */ s32b max_pval; /* Maximum pval */ s32b value; /* power value */ s16b max; /* Number of time it can appear on a single item */ u32b flags1; /* Ego-Item Flags, set 1 */ u32b flags2; /* Ego-Item Flags, set 2 */ u32b flags3; /* Ego-Item Flags, set 3 */ u32b flags4; /* Ego-Item Flags, set 4 */ u32b flags5; /* Ego-Item Flags, set 5 */ u32b esp; /* ESP flags */ u32b fego; /* ego flags */ u32b aflags1; /* Ego-Item Flags, set 1 */ u32b aflags2; /* Ego-Item Flags, set 2 */ u32b aflags3; /* Ego-Item Flags, set 3 */ u32b aflags4; /* Ego-Item Flags, set 4 */ u32b aflags5; /* Ego-Item Flags, set 5 */ u32b aesp; /* ESP flags */ s16b power; /* Power granted(if any) */ }; typedef struct randart_gen_type randart_gen_type; struct randart_gen_type { int chance; /* Chance to have that number of powers */ int dd; int ds; int plus; /* xdy+plus power */ }; /* * Monster blow structure * * - Method (RBM_*) * - Effect (RBE_*) * - Damage Dice * - Damage Sides */ typedef struct monster_blow monster_blow; struct monster_blow { byte method; byte effect; byte d_dice; byte d_side; }; /* * Monster "race" information, including racial memories * * Note that "d_attr" and "d_char" are used for MORE than "visual" stuff. * * Note that "x_attr" and "x_char" are used ONLY for "visual" stuff. * * Note that "cur_num" (and "max_num") represent the number of monsters * of the given race currently on (and allowed on) the current level. * This information yields the "dead" flag for Unique monsters. * * Note that "max_num" is reset when a new player is created. * Note that "cur_num" is reset when a new level is created. * * Note that several of these fields, related to "recall", can be * scrapped if space becomes an issue, resulting in less "complete" * monster recall (no knowledge of spells, etc). All of the "recall" * fields have a special prefix to aid in searching for them. */ typedef struct monster_race monster_race; struct monster_race { const char *name; /* Name */ char *text; /* Text */ u16b hdice; /* Creatures hit dice count */ u16b hside; /* Creatures hit dice sides */ s16b ac; /* Armour Class */ s16b sleep; /* Inactive counter (base) */ byte aaf; /* Area affect radius (1-100) */ byte speed; /* Speed (normally 110) */ s32b mexp; /* Exp value for kill */ s32b weight; /* Weight of the monster */ byte freq_inate; /* Inate spell frequency */ byte freq_spell; /* Other spell frequency */ u32b flags1; /* Flags 1 (general) */ u32b flags2; /* Flags 2 (abilities) */ u32b flags3; /* Flags 3 (race/resist) */ u32b flags4; /* Flags 4 (inate/breath) */ u32b flags5; /* Flags 5 (normal spells) */ u32b flags6; /* Flags 6 (special spells) */ u32b flags7; /* Flags 7 (movement related abilities) */ u32b flags8; /* Flags 8 (wilderness info) */ u32b flags9; /* Flags 9 (drops info) */ monster_blow blow[4]; /* Up to four blows per round */ byte body_parts[BODY_MAX]; /* To help to decide what to use when body changing */ byte level; /* Level of creature */ byte rarity; /* Rarity of creature */ byte d_attr; /* Default monster attribute */ char d_char; /* Default monster character */ byte x_attr; /* Desired monster attribute */ char x_char; /* Desired monster character */ s16b max_num; /* Maximum population allowed per level */ byte cur_num; /* Monster population on current level */ s16b r_sights; /* Count sightings of this monster */ s16b r_deaths; /* Count deaths from this monster */ s16b r_pkills; /* Count monsters killed in this life */ s16b r_tkills; /* Count monsters killed in all lives */ byte r_wake; /* Number of times woken up (?) */ byte r_ignore; /* Number of times ignored (?) */ byte r_xtra1; /* Something (unused) */ byte r_xtra2; /* Something (unused) */ byte r_drop_gold; /* Max number of gold dropped at once */ byte r_drop_item; /* Max number of item dropped at once */ byte r_cast_inate; /* Max number of inate spells seen */ byte r_cast_spell; /* Max number of other spells seen */ byte r_blows[4]; /* Number of times each blow type was seen */ u32b r_flags1; /* Observed racial flags */ u32b r_flags2; /* Observed racial flags */ u32b r_flags3; /* Observed racial flags */ u32b r_flags4; /* Observed racial flags */ u32b r_flags5; /* Observed racial flags */ u32b r_flags6; /* Observed racial flags */ u32b r_flags7; /* Observed racial flags */ u32b r_flags8; /* Observed racial flags */ u32b r_flags9; /* Observed racial flags */ bool_ on_saved; /* Is the (unique) on a saved level ? */ byte total_visible; /* Amount of this race that are visible */ obj_theme drops; /* The drops type */ }; typedef struct monster_ego monster_ego; struct monster_ego { const char *name; /* Name */ bool_ before; /* Display ego before or after */ monster_blow blow[4]; /* Up to four blows per round */ byte blowm[4][2]; s16b hdice; /* Creatures hit dice count */ s16b hside; /* Creatures hit dice sides */ s16b ac; /* Armour Class */ s16b sleep; /* Inactive counter (base) */ s16b aaf; /* Area affect radius (1-100) */ s16b speed; /* Speed (normally 110) */ s32b mexp; /* Exp value for kill */ s32b weight; /* Weight of the monster */ byte freq_inate; /* Inate spell frequency */ byte freq_spell; /* Other spell frequency */ /* Ego flags */ u32b flags1; /* Flags 1 */ u32b flags2; /* Flags 1 */ u32b flags3; /* Flags 1 */ u32b flags7; /* Flags 1 */ u32b flags8; /* Flags 1 */ u32b flags9; /* Flags 1 */ u32b hflags1; /* Flags 1 */ u32b hflags2; /* Flags 1 */ u32b hflags3; /* Flags 1 */ u32b hflags7; /* Flags 1 */ u32b hflags8; /* Flags 1 */ u32b hflags9; /* Flags 1 */ /* Monster flags */ u32b mflags1; /* Flags 1 (general) */ u32b mflags2; /* Flags 2 (abilities) */ u32b mflags3; /* Flags 3 (race/resist) */ u32b mflags4; /* Flags 4 (inate/breath) */ u32b mflags5; /* Flags 5 (normal spells) */ u32b mflags6; /* Flags 6 (special spells) */ u32b mflags7; /* Flags 7 (movement related abilities) */ u32b mflags8; /* Flags 8 (wilderness info) */ u32b mflags9; /* Flags 9 (drops info) */ /* Negative Flags, to be removed from the monster flags */ u32b nflags1; /* Flags 1 (general) */ u32b nflags2; /* Flags 2 (abilities) */ u32b nflags3; /* Flags 3 (race/resist) */ u32b nflags4; /* Flags 4 (inate/breath) */ u32b nflags5; /* Flags 5 (normal spells) */ u32b nflags6; /* Flags 6 (special spells) */ u32b nflags7; /* Flags 7 (movement related abilities) */ u32b nflags8; /* Flags 8 (wilderness info) */ u32b nflags9; /* Flags 9 (drops info) */ s16b level; /* Level of creature */ s16b rarity; /* Rarity of creature */ byte d_attr; /* Default monster attribute */ char d_char; /* Default monster character */ byte g_attr; /* Overlay graphic attribute */ char g_char; /* Overlay graphic character */ char r_char[5]; /* Monster race allowed */ char nr_char[5]; /* Monster race not allowed */ }; /* * Information about "vault generation" */ typedef struct vault_type vault_type; struct vault_type { char *data; /* Vault data */ byte typ; /* Vault type */ byte rat; /* Vault rating */ byte hgt; /* Vault height */ byte wid; /* Vault width */ s16b lvl; /* level of special (if any) */ byte dun_type; /* Dungeon type where the level will show up */ s16b mon[10]; /* special monster */ int item[3]; /* number of item (usually artifact) */ }; /* jk */ /* name and description are in some other arrays */ typedef struct trap_type trap_type; struct trap_type { s16b probability; /* probability of existence */ s16b another; /* does this trap easily combine */ s16b p1valinc; /* how much does this trap attribute to p1val */ byte difficulty; /* how difficult to disarm */ byte minlevel; /* what is the minimum level on which the traps should be */ byte color; /* what is the color on screen */ u32b flags; /* where can these traps go - and perhaps other flags */ bool_ ident; /* do we know the name */ s16b known; /* how well is this trap known */ const char *name; /* normal name like weakness */ s16b dd, ds; /* base damage */ char *text; /* longer description once you've met this trap */ byte g_attr; /* Overlay graphic attribute */ char g_char; /* Overlay graphic character */ }; /* * A single "grid" in a Cave * * Note that several aspects of the code restrict the actual cave * to a max size of 256 by 256. In partcular, locations are often * saved as bytes, limiting each coordinate to the 0-255 range. * * The "o_idx" and "m_idx" fields are very interesting. There are * many places in the code where we need quick access to the actual * monster or object(s) in a given cave grid. The easiest way to * do this is to simply keep the index of the monster and object * (if any) with the grid, but this takes 198*66*4 bytes of memory. * Several other methods come to mind, which require only half this * amound of memory, but they all seem rather complicated, and would * probably add enough code that the savings would be lost. So for * these reasons, we simply store an index into the "o_list" and * "m_list" arrays, using "zero" when no monster/object is present. * * Note that "o_idx" is the index of the top object in a stack of * objects, using the "next_o_idx" field of objects (see below) to * create the singly linked list of objects. If "o_idx" is zero * then there are no objects in the grid. */ typedef struct cave_type cave_type; struct cave_type { u16b info; /* Hack -- cave flags */ byte feat; /* Hack -- feature type */ s16b o_idx; /* Object in this grid */ s16b m_idx; /* Monster in this grid */ s16b t_idx; /* trap index (in t_list) or zero */ s16b special, special2; /* Special cave info */ s16b inscription; /* Inscription of the grid */ byte mana; /* Magical energy of the grid */ byte mimic; /* Feature to mimic */ byte cost; /* Hack -- cost of flowing */ byte when; /* Hack -- when cost was computed */ s16b effect; /* The lasting effects */ }; /* Lasting spell effects(clouds, ..) */ typedef struct effect_type effect_type; struct effect_type { s16b time; /* For how long */ s16b dam; /* How much damage */ s16b type; /* Of which type */ s16b cy; /* Center of the cast*/ s16b cx; /* Center of the cast*/ s16b rad; /* Radius -- if needed */ u32b flags; /* Flags */ }; /* * Object information, for a specific object. * * Note that a "discount" on an item is permanent and never goes away. * * Note that inscriptions are now handled via the "quark_str()" function * applied to the "note" field, which will return NULL if "note" is zero. * * Note that "object" records are "copied" on a fairly regular basis, * and care must be taken when handling such objects. * * Note that "object flags" must now be derived from the object kind, * the artifact and ego-item indexes, and the two "xtra" fields. * * Each cave grid points to one (or zero) objects via the "o_idx" * field (above). Each object then points to one (or zero) objects * via the "next_o_idx" field, forming a singly linked list, which * in game terms, represents a "stack" of objects in the same grid. * * Each monster points to one (or zero) objects via the "hold_o_idx" * field (below). Each object then points to one (or zero) objects * via the "next_o_idx" field, forming a singly linked list, which * in game terms, represents a pile of objects held by the monster. * * The "held_m_idx" field is used to indicate which monster, if any, * is holding the object. Objects being held have "ix=0" and "iy=0". */ typedef struct object_type object_type; struct object_type { s16b k_idx; /* Kind index (zero if "dead") */ byte iy; /* Y-position on map, or zero */ byte ix; /* X-position on map, or zero */ byte tval; /* Item type (from kind) */ byte sval; /* Item sub-type (from kind) */ s32b pval; /* Item extra-parameter */ s16b pval2; /* Item extra-parameter for some special items*/ s32b pval3; /* Item extra-parameter for some special items*/ byte discount; /* Discount (if any) */ byte number; /* Number of items */ s32b weight; /* Item weight */ byte elevel; /* Item exp level */ s32b exp; /* Item exp */ byte name1; /* Artifact type, if any */ s16b name2; /* Ego-Item type, if any */ s16b name2b; /* Second Ego-Item type, if any */ byte xtra1; /* Extra info type */ s16b xtra2; /* Extra info index */ s16b to_h; /* Plusses to hit */ s16b to_d; /* Plusses to damage */ s16b to_a; /* Plusses to AC */ s16b ac; /* Normal AC */ byte dd, ds; /* Damage dice/sides */ s16b timeout; /* Timeout Counter */ byte ident; /* Special flags */ byte marked; /* Object is marked */ u16b note; /* Inscription index */ u16b art_name; /* Artifact name (random artifacts) */ u32b art_flags1; /* Flags, set 1 Alas, these were necessary */ u32b art_flags2; /* Flags, set 2 for the random artifacts of*/ u32b art_flags3; /* Flags, set 3 Zangband */ u32b art_flags4; /* Flags, set 4 PernAngband */ u32b art_flags5; /* Flags, set 5 PernAngband */ u32b art_esp; /* Flags, set esp PernAngband */ u32b art_oflags1; /* Obvious Flags, set 1 */ u32b art_oflags2; /* Obvious Flags, set 2 */ u32b art_oflags3; /* Obvious Flags, set 3 */ u32b art_oflags4; /* Obvious Flags, set 4 */ u32b art_oflags5; /* Obvious Flags, set 5 */ u32b art_oesp; /* Obvious Flags, set esp */ s16b next_o_idx; /* Next object in stack (if any) */ s16b held_m_idx; /* Monster holding us (if any) */ byte sense; /* Pseudo-id status */ byte found; /* How did we find it */ s16b found_aux1; /* Stores info for found */ s16b found_aux2; /* Stores info for found */ s16b found_aux3; /* Stores info for found */ s16b found_aux4; /* Stores info for found */ }; /* * Monster information, for a specific monster. * * Note: fy, fx constrain dungeon size to 256x256 * * The "hold_o_idx" field points to the first object of a stack * of objects (if any) being carried by the monster (see above). */ typedef struct monster_type monster_type; struct monster_type { s16b r_idx; /* Monster race index */ u16b ego; /* Ego monster type */ byte fy; /* Y location on map */ byte fx; /* X location on map */ s32b hp; /* Current Hit points */ s32b maxhp; /* Max Hit points */ monster_blow blow[4]; /* Up to four blows per round */ byte speed; /* Speed (normally 110) */ byte level; /* Level of creature */ s16b ac; /* Armour Class */ s32b exp; /* Experience */ s16b csleep; /* Inactive counter */ byte mspeed; /* Monster "speed" */ byte energy; /* Monster "energy" */ byte stunned; /* Monster is stunned */ byte confused; /* Monster is confused */ byte monfear; /* Monster is afraid */ s16b bleeding; /* Monster is bleeding */ s16b poisoned; /* Monster is poisoned */ byte cdis; /* Current dis from player */ s32b mflag; /* Extra monster flags */ bool_ ml; /* Monster is "visible" */ s16b hold_o_idx; /* Object being held (if any) */ u32b smart; /* Field for "smart_learn" */ s16b status; /* Status(friendly, pet, companion, ..) */ s16b target; /* Monster target */ s16b possessor; /* Is it under the control of a possessor ? */ }; /* * An entry for the object/monster allocation functions * * Pass 1 is determined from allocation information * Pass 2 is determined from allocation restriction * Pass 3 is determined from allocation calculation */ typedef struct alloc_entry alloc_entry; struct alloc_entry { s16b index; /* The actual index */ byte level; /* Base dungeon level */ byte prob1; /* Probability, pass 1 */ byte prob2; /* Probability, pass 2 */ byte prob3; /* Probability, pass 3 */ }; /* * Available "options" * * - Address of actual option variable (or NULL) * * - Normal Value (TRUE or FALSE) * * - Option Page Number (or zero) * * - Savefile Set (or zero) * - Savefile Bit in that set * * - Textual name (or NULL) * - Textual description */ typedef struct option_type option_type; struct option_type { bool_ *o_var; byte o_norm; byte o_page; byte o_bit; cptr o_text; cptr o_desc; }; /* * A store owner */ typedef struct owner_type owner_type; struct owner_type { const char *name; /* Name */ s16b max_cost; /* Purse limit */ s16b inflation; /* Inflation */ u32b races[2][2]; /* Liked/hated races */ u32b classes[2][2]; /* Liked/hated classes */ s16b costs[3]; /* Costs for liked people */ }; /* * A store, with an owner, various state flags, a current stock * of items, and a table of items that are often purchased. */ typedef struct store_type store_type; struct store_type { u16b st_idx; u16b owner; /* Owner index */ s32b store_open; /* Closed until this turn */ s32b last_visit; /* Last visited on this turn */ byte stock_num; /* Stock -- Number of entries */ s16b stock_size; /* Stock -- Total Size of Array */ object_type *stock; /* Stock -- Actual stock items */ }; /* * A store/building type */ typedef struct store_info_type store_info_type; struct store_info_type { const char *name; /* Name */ s16b table[STORE_CHOICES][2]; /* Table -- Legal item kinds */ byte table_num; /* Number of items */ s16b max_obj; /* Number of items this store can hold */ u16b owners[4]; /* List of owners(refers to ow_info) */ u16b actions[6]; /* Actions(refers to ba_info) */ byte d_attr; /* Default building attribute */ char d_char; /* Default building character */ byte x_attr; /* Desired building attribute */ char x_char; /* Desired building character */ u32b flags1; /* Flags */ }; /* * Stores/buildings actions */ typedef struct store_action_type store_action_type; struct store_action_type { const char *name; /* Name */ s16b costs[3]; /* Costs for liked people */ char letter; /* Action letter */ char letter_aux; /* Action letter */ s16b action; /* Action code */ s16b action_restr; /* Action restriction */ }; /* * Player sex info */ typedef struct player_sex player_sex; struct player_sex { cptr title; /* Type of sex */ cptr winner; /* Name of winner */ }; /* * Player racial info */ typedef struct player_race player_race; struct player_race { const char *title; /* Type of race */ char *desc; s16b r_adj[6]; /* Racial stat bonuses */ char luck; /* Luck */ s16b r_dis; /* disarming */ s16b r_dev; /* magic devices */ s16b r_sav; /* saving throw */ s16b r_stl; /* stealth */ s16b r_srh; /* search ability */ s16b r_fos; /* search frequency */ s16b r_thn; /* combat (normal) */ s16b r_thb; /* combat (shooting) */ byte r_mhp; /* Race hit-dice modifier */ u16b r_exp; /* Race experience factor */ byte b_age; /* base age */ byte m_age; /* mod age */ byte m_b_ht; /* base height (males) */ byte m_m_ht; /* mod height (males) */ byte m_b_wt; /* base weight (males) */ byte m_m_wt; /* mod weight (males) */ byte f_b_ht; /* base height (females) */ byte f_m_ht; /* mod height (females) */ byte f_b_wt; /* base weight (females) */ byte f_m_wt; /* mod weight (females) */ byte infra; /* Infra-vision range */ u32b choice[2]; /* Legal class choices */ s16b powers[4]; /* Powers of the race */ byte body_parts[BODY_MAX]; /* To help to decide what to use when body changing */ s16b chart; /* Chart history */ u32b flags1; u32b flags2; /* flags */ u32b oflags1[PY_MAX_LEVEL + 1]; u32b oflags2[PY_MAX_LEVEL + 1]; u32b oflags3[PY_MAX_LEVEL + 1]; u32b oflags4[PY_MAX_LEVEL + 1]; u32b oflags5[PY_MAX_LEVEL + 1]; u32b oesp[PY_MAX_LEVEL + 1]; s16b opval[PY_MAX_LEVEL + 1]; char skill_basem[MAX_SKILLS]; u32b skill_base[MAX_SKILLS]; char skill_modm[MAX_SKILLS]; s16b skill_mod[MAX_SKILLS]; s16b obj_tval[5]; s16b obj_sval[5]; s16b obj_pval[5]; s16b obj_dd[5]; s16b obj_ds[5]; s16b obj_num; struct { s16b ability; s16b level; } abilities[10]; /* Abilitiers to be gained by level(doesnt take prereqs in account) */ }; typedef struct player_race_mod player_race_mod; struct player_race_mod { char *title; /* Type of race mod */ char *desc; /* Desc */ bool_ place; /* TRUE = race race modifier, FALSE = Race modifier race */ s16b r_adj[6]; /* (+) Racial stat bonuses */ char luck; /* Luck */ s16b mana; /* Mana % */ s16b r_dis; /* (+) disarming */ s16b r_dev; /* (+) magic devices */ s16b r_sav; /* (+) saving throw */ s16b r_stl; /* (+) stealth */ s16b r_srh; /* (+) search ability */ s16b r_fos; /* (+) search frequency */ s16b r_thn; /* (+) combat (normal) */ s16b r_thb; /* (+) combat (shooting) */ char r_mhp; /* (+) Race mod hit-dice modifier */ s16b r_exp; /* (+) Race mod experience factor */ char b_age; /* (+) base age */ char m_age; /* (+) mod age */ char m_b_ht; /* (+) base height (males) */ char m_m_ht; /* (+) mod height (males) */ char m_b_wt; /* (+) base weight (males) */ char m_m_wt; /* (+) mod weight (males) */ char f_b_ht; /* (+) base height (females) */ char f_m_ht; /* (+) mod height (females) */ char f_b_wt; /* (+) base weight (females) */ char f_m_wt; /* (+) mod weight (females) */ char infra; /* (+) Infra-vision range */ u32b choice[2]; /* Legal race choices */ u32b pclass[2]; /* Classes allowed */ u32b mclass[2]; /* Classes restricted */ s16b powers[4]; /* Powers of the subrace */ char body_parts[BODY_MAX]; /* To help to decide what to use when body changing */ u32b flags1; u32b flags2; /* flags */ u32b oflags1[PY_MAX_LEVEL + 1]; u32b oflags2[PY_MAX_LEVEL + 1]; u32b oflags3[PY_MAX_LEVEL + 1]; u32b oflags4[PY_MAX_LEVEL + 1]; u32b oflags5[PY_MAX_LEVEL + 1]; u32b oesp[PY_MAX_LEVEL + 1]; s16b opval[PY_MAX_LEVEL + 1]; byte g_attr; /* Overlay graphic attribute */ char g_char; /* Overlay graphic character */ char skill_basem[MAX_SKILLS]; u32b skill_base[MAX_SKILLS]; char skill_modm[MAX_SKILLS]; s16b skill_mod[MAX_SKILLS]; s16b obj_tval[5]; s16b obj_sval[5]; s16b obj_pval[5]; s16b obj_dd[5]; s16b obj_ds[5]; s16b obj_num; struct { s16b ability; s16b level; } abilities[10]; /* Abilitiers to be gained by level(doesnt take prereqs in account) */ }; /* * Player class info */ typedef struct player_spec player_spec; struct player_spec { const char *title; /* Type of class spec */ char *desc; /* Small desc of the class spec */ char skill_basem[MAX_SKILLS]; /* Mod for value */ u32b skill_base[MAX_SKILLS]; /* value */ char skill_modm[MAX_SKILLS]; /* mod for mod */ s16b skill_mod[MAX_SKILLS]; /* mod */ u32b skill_ideal[MAX_SKILLS]; /* Ideal skill levels at level 50 */ s16b obj_tval[5]; s16b obj_sval[5]; s16b obj_pval[5]; s16b obj_dd[5]; s16b obj_ds[5]; s16b obj_num; u32b gods; u32b flags1; u32b flags2; /* flags */ struct { s16b ability; s16b level; } abilities[10]; /* Abilitiers to be gained by level(doesnt take prereqs in account) */ }; typedef struct player_class player_class; struct player_class { const char *title; /* Type of class */ char *desc; /* Small desc of the class */ const char *titles[PY_MAX_LEVEL / 5]; /* Titles */ s16b c_adj[6]; /* Class stat modifier */ s16b c_dis; /* class disarming */ s16b c_dev; /* class magic devices */ s16b c_sav; /* class saving throws */ s16b c_stl; /* class stealth */ s16b c_srh; /* class searching ability */ s16b c_fos; /* class searching frequency */ s16b c_thn; /* class to hit (normal) */ s16b c_thb; /* class to hit (bows) */ s16b x_dis; /* extra disarming */ s16b x_dev; /* extra magic devices */ s16b x_sav; /* extra saving throws */ s16b x_stl; /* extra stealth */ s16b x_srh; /* extra searching ability */ s16b x_fos; /* extra searching frequency */ s16b x_thn; /* extra to hit (normal) */ s16b x_thb; /* extra to hit (bows) */ s16b c_mhp; /* Class hit-dice adjustment */ s16b c_exp; /* Class experience factor */ s16b powers[4]; /* Powers of the class */ s16b spell_book; /* Tval of spell books (if any) */ s16b spell_stat; /* Stat for spells (if any) */ s16b spell_lev; /* The higher it is the higher the spells level are */ s16b spell_fail; /* The higher it is the higher the spells failure are */ s16b spell_mana; /* The higher it is the higher the spells mana are */ s16b spell_first; /* Level of first spell */ s16b spell_weight; /* Weight that hurts spells */ byte max_spell_level; /* Maximun spell level */ byte magic_max_spell; /* Maximun numbner of spells one can learn by natural means */ u32b flags1; /* flags */ u32b flags2; /* flags */ s16b mana; s16b blow_num; s16b blow_wgt; s16b blow_mul; s16b extra_blows; s32b sense_base; s32b sense_pl; s32b sense_plus; byte sense_heavy; byte sense_heavy_magic; s16b obj_tval[5]; s16b obj_sval[5]; s16b obj_pval[5]; s16b obj_dd[5]; s16b obj_ds[5]; s16b obj_num; char body_parts[BODY_MAX]; /* To help to decide what to use when body changing */ u32b oflags1[PY_MAX_LEVEL + 1]; u32b oflags2[PY_MAX_LEVEL + 1]; u32b oflags3[PY_MAX_LEVEL + 1]; u32b oflags4[PY_MAX_LEVEL + 1]; u32b oflags5[PY_MAX_LEVEL + 1]; u32b oesp[PY_MAX_LEVEL + 1]; s16b opval[PY_MAX_LEVEL + 1]; char skill_basem[MAX_SKILLS]; u32b skill_base[MAX_SKILLS]; char skill_modm[MAX_SKILLS]; s16b skill_mod[MAX_SKILLS]; u32b gods; player_spec spec[MAX_SPEC]; struct { s16b ability; s16b level; } abilities[10]; /* Abilitiers to be gained by level(doesnt take prereqs in account) */ }; typedef struct meta_class_type meta_class_type; struct meta_class_type { char name[80]; /* Name */ byte color; s16b *classes; /* list of classes */ }; /* Help type */ typedef struct help_info help_info; struct help_info { bool_ enabled; /* ingame help enabled */ bool_ activated[HELP_MAX]; /* help item #i activated? */ }; /* * Most of the "player" information goes here. * * This stucture gives us a large collection of player variables. * * This structure contains several "blocks" of information. * (1) the "permanent" info * (2) the "variable" info * (3) the "transient" info * * All of the "permanent" info, and most of the "variable" info, * is saved in the savefile. The "transient" info is recomputed * whenever anything important changes. */ typedef struct player_type player_type; struct player_type { s32b lives; /* How many times we resurected */ s16b oldpy; /* Previous player location -KMW- */ s16b oldpx; /* Previous player location -KMW- */ s16b py; /* Player location */ s16b px; /* Player location */ byte psex; /* Sex index */ byte prace; /* Race index */ byte pracem; /* Race Mod index */ byte pclass; /* Class index */ byte pspec; /* Class spec index */ byte mimic_form; /* Actualy transformation */ s16b mimic_level; /* Level of the mimic effect */ byte oops; /* Unused */ object_type inventory[INVEN_TOTAL]; /* Player inventory */ byte hitdie; /* Hit dice (sides) */ u16b expfact; /* Experience factor */ byte preserve; /* Preserve artifacts */ byte special; /* Special levels */ byte allow_one_death; /* Blood of life */ s16b age; /* Characters age */ s16b ht; /* Height */ s16b wt; /* Weight */ s16b sc; /* Social Class */ s32b au; /* Current Gold */ s32b max_exp; /* Max experience */ s32b exp; /* Cur experience */ u16b exp_frac; /* Cur exp frac (times 2^16) */ s16b lev; /* Level */ s16b town_num; /* Current town number */ s16b inside_quest; /* Inside quest level */ s32b wilderness_x; /* Coordinates in the wilderness */ s32b wilderness_y; bool_ wild_mode; /* TRUE = Small map, FLASE = Big map */ bool_ old_wild_mode; /* TRUE = Small map, FLASE = Big map */ s16b mhp; /* Max hit pts */ s16b chp; /* Cur hit pts */ u16b chp_frac; /* Cur hit frac (times 2^16) */ s16b hp_mod; /* A modificator(permanent) */ s16b msp; /* Max mana pts */ s16b csp; /* Cur mana pts */ u16b csp_frac; /* Cur mana frac (times 2^16) */ s16b msane; /* Max sanity */ s16b csane; /* Cur sanity */ u16b csane_frac; /* Cur sanity frac */ s32b grace; /* Your God's appreciation factor. */ s32b grace_delay; /* Delay factor for granting piety. */ byte pgod; /* Your God. */ bool_ praying; /* Praying to your god. */ s16b melkor_sacrifice; /* How much hp has been sacrified for damage */ s16b max_plv; /* Max Player Level */ s16b stat_max[6]; /* Current "maximal" stat values */ s16b stat_cur[6]; /* Current "natural" stat values */ s16b luck_cur; /* Current "natural" luck value (range -30 <> 30) */ s16b luck_max; /* Current "maximal base" luck value (range -30 <> 30) */ s16b luck_base; /* Current "base" luck value (range -30 <> 30) */ s16b speed_factor; /* Timed -- Fast */ s16b fast; /* Timed -- Fast */ s16b lightspeed; /* Timed -- Light Speed */ s16b slow; /* Timed -- Slow */ s16b blind; /* Timed -- Blindness */ s16b paralyzed; /* Timed -- Paralysis */ s16b confused; /* Timed -- Confusion */ s16b afraid; /* Timed -- Fear */ s16b image; /* Timed -- Hallucination */ s16b poisoned; /* Timed -- Poisoned */ s16b cut; /* Timed -- Cut */ s16b stun; /* Timed -- Stun */ s16b protevil; /* Timed -- Protection from Evil*/ s16b protgood; /* Timed -- Protection from Good*/ s16b protundead; /* Timed -- Protection from Undead*/ s16b invuln; /* Timed -- Invulnerable */ s16b hero; /* Timed -- Heroism */ s16b shero; /* Timed -- Super Heroism */ s16b shield; /* Timed -- Shield Spell */ s16b shield_power; /* Timed -- Shield Spell Power */ s16b shield_opt; /* Timed -- Shield Spell options */ s16b shield_power_opt; /* Timed -- Shield Spell Power */ s16b shield_power_opt2; /* Timed -- Shield Spell Power */ s16b blessed; /* Timed -- Blessed */ s16b tim_invis; /* Timed -- See Invisible */ s16b tim_infra; /* Timed -- Infra Vision */ s16b oppose_acid; /* Timed -- oppose acid */ s16b oppose_elec; /* Timed -- oppose lightning */ s16b oppose_fire; /* Timed -- oppose heat */ s16b oppose_cold; /* Timed -- oppose cold */ s16b oppose_pois; /* Timed -- oppose poison */ s16b oppose_ld; /* Timed -- oppose light & dark */ s16b oppose_cc; /* Timed -- oppose chaos & confusion */ s16b oppose_ss; /* Timed -- oppose sound & shards */ s16b oppose_nex; /* Timed -- oppose nexus */ s16b tim_esp; /* Timed ESP */ s16b tim_wraith; /* Timed wraithform */ s16b tim_ffall; /* Timed Levitation */ s16b tim_fly; /* Timed Levitation */ s16b tim_poison; /* Timed poison hands */ s16b tim_thunder; /* Timed thunderstorm */ s16b tim_thunder_p1; /* Timed thunderstorm */ s16b tim_thunder_p2; /* Timed thunderstorm */ s16b tim_project; /* Timed project upon melee blow */ s16b tim_project_dam; s16b tim_project_gf; s16b tim_project_rad; s16b tim_project_flag; s16b tim_roots; /* Timed roots */ s16b tim_roots_ac; s16b tim_roots_dam; s16b tim_invisible; /* Timed Invisibility */ s16b tim_inv_pow; /* Power of timed invisibility */ s16b tim_mimic; /* Timed Mimic */ s16b tim_lite; /* Timed Lite */ s16b tim_regen; /* Timed extra regen */ s16b tim_regen_pow; /* Timed extra regen power */ s16b holy; /* Holy Aura */ s16b strike; /* True Strike(+25 hit) */ s16b tim_reflect; /* Timed Reflection */ s16b tim_deadly; /* Timed deadly blow */ s16b prob_travel; /* Timed probability travel */ s16b disrupt_shield;/* Timed disruption shield */ s16b parasite; /* Timed parasite */ s16b parasite_r_idx;/* Timed parasite monster */ s16b absorb_soul; /* Timed soul absordtion */ s16b tim_magic_breath; /* Magical breathing -- can breath anywhere */ s16b tim_water_breath; /* Water breathing -- can breath underwater */ s16b tim_precognition; /* Timed precognition */ s16b immov_cntr; /* Timed -- Last ``immovable'' command. */ s16b recall_dungeon; /* Recall in which dungeon */ s16b word_recall; /* Word of recall counter */ s32b energy; /* Current energy */ s16b food; /* Current nutrition */ byte confusing; /* Glowing hands */ byte searching; /* Currently searching */ bool_ old_cumber_armor; bool_ old_cumber_glove; bool_ old_heavy_wield; bool_ old_heavy_shoot; bool_ old_icky_wield; s16b old_lite; /* Old radius of lite (if any) */ s16b old_view; /* Old radius of view (if any) */ s16b old_food_aux; /* Old value of food */ bool_ cumber_armor; /* Mana draining armor */ bool_ cumber_glove; /* Mana draining gloves */ bool_ heavy_wield; /* Heavy weapon */ bool_ heavy_shoot; /* Heavy shooter */ bool_ icky_wield; /* Icky weapon */ bool_ immovable; /* Immovable character */ s16b cur_lite; /* Radius of lite (if any) */ u32b notice; /* Special Updates (bit flags) */ u32b update; /* Pending Updates (bit flags) */ u32b redraw; /* Normal Redraws (bit flags) */ u32b window; /* Window Redraws (bit flags) */ s16b stat_use[6]; /* Current modified stats */ s16b stat_top[6]; /* Maximal modified stats */ s16b stat_add[6]; /* Modifiers to stat values */ s16b stat_ind[6]; /* Indexes into stat tables */ s16b stat_cnt[6]; /* Counter for temporary drains */ s16b stat_los[6]; /* Amount of temporary drains */ bool_ immune_acid; /* Immunity to acid */ bool_ immune_elec; /* Immunity to lightning */ bool_ immune_fire; /* Immunity to fire */ bool_ immune_cold; /* Immunity to cold */ bool_ immune_neth; /* Immunity to nether */ bool_ resist_acid; /* Resist acid */ bool_ resist_elec; /* Resist lightning */ bool_ resist_fire; /* Resist fire */ bool_ resist_cold; /* Resist cold */ bool_ resist_pois; /* Resist poison */ bool_ resist_conf; /* Resist confusion */ bool_ resist_sound; /* Resist sound */ bool_ resist_lite; /* Resist light */ bool_ resist_dark; /* Resist darkness */ bool_ resist_chaos; /* Resist chaos */ bool_ resist_disen; /* Resist disenchant */ bool_ resist_shard; /* Resist shards */ bool_ resist_nexus; /* Resist nexus */ bool_ resist_blind; /* Resist blindness */ bool_ resist_neth; /* Resist nether */ bool_ resist_fear; /* Resist fear */ bool_ resist_continuum; /* Resist space-time continuum disruption */ bool_ sensible_fire; /* Fire does more damage on the player */ bool_ sensible_lite; /* Lite does more damage on the player and blinds her/him */ bool_ reflect; /* Reflect 'bolt' attacks */ bool_ sh_fire; /* Fiery 'immolation' effect */ bool_ sh_elec; /* Electric 'immolation' effect */ bool_ wraith_form; /* wraithform */ bool_ anti_magic; /* Anti-magic */ bool_ anti_tele; /* Prevent teleportation */ bool_ sustain_str; /* Keep strength */ bool_ sustain_int; /* Keep intelligence */ bool_ sustain_wis; /* Keep wisdom */ bool_ sustain_dex; /* Keep dexterity */ bool_ sustain_con; /* Keep constitution */ bool_ sustain_chr; /* Keep charisma */ bool_ aggravate; /* Aggravate monsters */ bool_ teleport; /* Random teleporting */ bool_ exp_drain; /* Experience draining */ byte drain_mana; /* mana draining */ byte drain_life; /* hp draining */ bool_ magical_breath; /* Magical breathing -- can breath anywhere */ bool_ water_breath; /* Water breathing -- can breath underwater */ bool_ climb; /* Can climb mountains */ bool_ fly; /* Can fly over some features */ bool_ ffall; /* No damage falling */ bool_ lite; /* Permanent light */ bool_ free_act; /* Never paralyzed */ bool_ see_inv; /* Can see invisible */ bool_ regenerate; /* Regenerate hit pts */ bool_ hold_life; /* Resist life draining */ u32b telepathy; /* Telepathy */ bool_ slow_digest; /* Slower digestion */ bool_ bless_blade; /* Blessed blade */ byte xtra_might; /* Extra might bow */ bool_ impact; /* Earthquake blows */ bool_ auto_id; /* Auto id items */ s16b invis; /* Invisibility */ s16b dis_to_h; /* Known bonus to hit */ s16b dis_to_d; /* Known bonus to dam */ s16b dis_to_a; /* Known bonus to ac */ s16b dis_ac; /* Known base ac */ s16b to_l; /* Bonus to life */ s16b to_m; /* Bonus to mana */ s16b to_s; /* Bonus to spell */ s16b to_h; /* Bonus to hit */ s16b to_d; /* Bonus to dam */ s16b to_h_melee; /* Bonus to hit for melee */ s16b to_d_melee; /* Bonus to dam for melee */ s16b to_h_ranged; /* Bonus to hit for ranged */ s16b to_d_ranged; /* Bonus to dam for ranged */ s16b to_a; /* Bonus to ac */ s16b ac; /* Base ac */ byte antimagic; /* Power of the anti magic field */ byte antimagic_dis; /* Radius of the anti magic field */ s16b see_infra; /* Infravision range */ s16b skill_dis; /* Skill: Disarming */ s16b skill_dev; /* Skill: Magic Devices */ s16b skill_sav; /* Skill: Saving throw */ s16b skill_stl; /* Skill: Stealth factor */ s16b skill_srh; /* Skill: Searching ability */ s16b skill_fos; /* Skill: Searching frequency */ s16b skill_thn; /* Skill: To hit (normal) */ s16b skill_thb; /* Skill: To hit (shooting) */ s16b skill_tht; /* Skill: To hit (throwing) */ s16b skill_dig; /* Skill: Digging */ s16b num_blow; /* Number of blows */ s16b num_fire; /* Number of shots */ s16b xtra_crit; /* % of increased crits */ byte throw_mult; /* Multiplier for throw damage */ byte tval_ammo; /* Correct ammo tval */ s16b pspeed; /* Current speed */ u32b mimic_extra; /* Mimicry powers use that */ u32b antimagic_extra; /* Antimagic powers */ u32b music_extra; /* Music songs */ u32b necro_extra; /* Necro powers */ u32b necro_extra2; /* Necro powers */ s16b dodge_chance; /* Dodging chance */ u32b maintain_sum; /* Do we have partial summons */ byte spellbinder_num; /* Number of spells bound */ u32b spellbinder[4]; /* Spell bounds */ byte spellbinder_trigger; /* Spellbinder trigger condition */ cptr mimic_name; char tactic; /* from 128-4 extremely coward to */ /* 128+4 berserker */ char movement; /* base movement way */ s16b companion_killed; /* Number of companion death */ bool_ no_mortal; /* Fated to never die by the hand of a mortal being */ bool_ black_breath; /* The Tolkien's Black Breath */ bool_ precognition; /* Like the cheat mode */ /*** Extra flags -- used for lua and easying stuff ***/ u32b xtra_f1; u32b xtra_f2; u32b xtra_f3; u32b xtra_f4; u32b xtra_f5; u32b xtra_esp; /* Corruptions */ bool_ corruptions[CORRUPTIONS_MAX]; bool_ corrupt_anti_teleport_stopped; /*** Pet commands ***/ byte pet_follow_distance; /* Length of the imaginary "leash" for pets */ byte pet_open_doors; /* flag - allow pets to open doors */ byte pet_pickup_items; /* flag - allow pets to pickup items */ s16b control; /* Controlled monster */ byte control_dir; /* Controlled monster */ /*** Body changing variables ***/ u16b body_monster; /* In which body is the player */ bool_ disembodied; /* Is the player in a body ? */ byte body_parts[INVEN_TOTAL - INVEN_WIELD]; /* Which body parts does he have ? */ /* Astral */ bool_ astral; /* We started at the bottom ? */ /* Powers */ bool_ powers[POWER_MAX]; /* Actual powers */ bool_ powers_mod[POWER_MAX]; /* Intrinsinc powers */ /* Skills */ s16b skill_points; s16b skill_last_level; /* Prevents gaining skills by losing level and regaining them */ s16b melee_style; /* How are */ s16b use_piercing_shots; /* for archery */ /* Dripping Tread spell timer */ s16b dripping_tread; /* Help */ help_info help; /* Inertia control */ s32b inertia_controlled_spell; /* For automatic stat-gain */ s16b last_rewarded_level; /*** Temporary fields ***/ bool_ did_nothing; /* True if the last action wasnt a real action */ bool_ leaving; /* True if player is leaving */ }; /* For Monk martial arts */ typedef struct martial_arts martial_arts; struct martial_arts { cptr desc; /* A verbose attack description */ int min_level; /* Minimum level to use */ int chance; /* Chance of 'success' */ int dd; /* Damage dice */ int ds; /* Damage sides */ s16b effect; /* Special effects */ s16b power; /* Special effects power */ }; /* Powers - used by Mindcrafters and Necromancers */ typedef struct magic_power magic_power; struct magic_power { int min_lev; int mana_cost; int fail; cptr name; cptr desc; }; /* Border */ typedef struct border_type border_type; struct border_type { byte north[MAX_WID]; byte south[MAX_WID]; byte east[MAX_HGT]; byte west[MAX_HGT]; byte north_west; byte north_east; byte south_west; byte south_east; }; /* * A structure describing a wilderness area * with a terrain, a town or a dungeon entrance */ typedef struct wilderness_type_info wilderness_type_info; struct wilderness_type_info { const char *name; /* Name */ const char *text; /* Text */ u16b entrance; /* Which town is there(<1000 i's a town, >=1000 it a dungeon) */ s32b wild_x; /* Map coordinates (backed out while parsing map) */ s32b wild_y; byte road; /* Flags of road */ int level; /* Difficulty level */ u32b flags1; /* Some flags */ byte feat; /* The feature of f_info.txt that is used to allow passing, ... and to get a char/color/graph */ byte terrain_idx; /* Terrain index(defined in defines.h) */ byte terrain[MAX_WILD_TERRAIN];/* Feature types for the plasma generator */ }; /* * A structure describing a wilderness map */ typedef struct wilderness_map wilderness_map; struct wilderness_map { int feat; /* Wilderness feature */ u32b seed; /* Seed for the RNG */ u16b entrance; /* Entrance for dungeons */ bool_ known; /* Is it seen by the player ? */ }; /* * A structure describing a town with * stores and buildings */ typedef struct town_type town_type; struct town_type { cptr name; u32b seed; /* Seed for RNG */ store_type *store; /* The stores [max_st_idx] */ byte numstores; byte flags; /* Town flags */ /* Left this for the sake of compatibility */ bool_ stocked; /* Is the town actualy stocked ? */ bool_ destroyed; /* Is the town destroyed? */ }; /* Alchemists */ typedef struct tval_desc2 { int tval; cptr desc; } tval_desc2; typedef struct alchemist_recipe alchemist_recipe; struct alchemist_recipe { int sval_essence; byte tval; byte sval; byte qty; }; typedef struct artifact_select_flag artifact_select_flag; struct artifact_select_flag { byte group; /* Flag group to display it in */ int flag; /* item flag to set */ byte level; /* Player skill level to start at */ char *desc; /* Display this description to select flag */ u32b xp; /* xp cost for this flag */ bool_ pval; /* indicates this flag benifits from pval */ char *item_desc; /* Description of required item */ char *item_descp; /* Description of required item; plural */ byte rtval; /* Required items' tval */ byte rsval; /* Required items' sval */ int rpval; /* Required items' pval (zero for no req) */ int rflag[6]; /* Monster Race flags for required Corpses */ }; /* A structure for deity information. */ typedef struct deity_type deity_type; struct deity_type { int modules[3]; /* terminated with -1 */ cptr name; char desc[10][80]; }; /* A structure for tactics */ typedef struct tactic_info_type tactic_info_type; struct tactic_info_type { s16b to_hit; s16b to_dam; s16b to_ac; s16b to_stealth; s16b to_disarm; s16b to_saving; cptr name; }; /* A structure to describe a random artifact. */ typedef struct random_artifact random_artifact; struct random_artifact { char name_full[80]; /* Full name for the artifact */ char name_short[80]; /* Un-Id'd name */ byte level; /* Level of the artifact */ byte attr; /* Color that is used on the screen */ u32b cost; /* Object's value */ byte activation; /* Activation. */ s16b timeout; /* Timeout. */ byte generated; /* Does it exist already? */ }; /* A structure to describe an activation. */ typedef struct activation activation; struct activation { char desc[80]; /* Desc of the activation */ u32b cost; /* costs value */ s16b spell; /* Spell. */ }; /* A structure to describe a music. */ typedef struct music music; struct music { char desc[80]; /* Desc of the music */ s16b music; /* Music. */ s16b dur; /* Duration(if any) */ s16b init_recharge; /* Minimal recharge time */ s16b turn_recharge; /* Recharge time for each more turn */ byte min_inst; /* Minimum instrument for the music */ byte rarity; /* Rarity of the music(use 100 to unallow to be randomly generated) */ }; /* A structure to describe the random spells of the Power Mages */ typedef struct random_spell random_spell; struct random_spell { char desc[30]; /* Desc of the spell */ char name[30]; /* Name of the spell */ s16b mana; /* Mana cost */ s16b fail; /* Failure rate */ u32b proj_flags; /* Project function flags */ byte GF; /* Type of the projection */ byte radius; byte dam_sides; byte dam_dice; byte level; /* Level needed */ bool_ untried; /* Is the spell was tried? */ }; /* A structure to describe the fate of the player */ typedef struct fate fate; struct fate { byte fate; /* Which fate */ byte level; /* On which level */ byte serious; /* Is it sure? */ s16b o_idx; /* Object to find */ s16b e_idx; /* Ego-Item to find */ s16b a_idx; /* Artifact to find */ s16b v_idx; /* Vault to find */ s16b r_idx; /* Monster to find */ s16b count; /* Number of things */ s16b time; /* Turn before */ bool_ know; /* Has it been predicted? */ bool_ icky; /* Hackish runtime-only flag */ }; /* A structure for movements */ typedef struct move_info_type move_info_type; struct move_info_type { s16b to_speed; s16b to_search; s16b to_stealth; s16b to_percep; cptr name; }; /* Define monster generation rules */ typedef struct rule_type rule_type; struct rule_type { byte mode; /* Mode of combination of the monster flags */ byte percent; /* Percent of monsters affected by the rule */ u32b mflags1; /* The monster flags that are allowed */ u32b mflags2; u32b mflags3; u32b mflags4; u32b mflags5; u32b mflags6; u32b mflags7; u32b mflags8; u32b mflags9; char r_char[5]; /* Monster race allowed */ }; /* A structure for the != dungeon types */ typedef struct dungeon_info_type dungeon_info_type; struct dungeon_info_type { const char *name; /* Name */ char *text; /* Description */ char short_name[3]; /* Short name */ char generator[30]; /* Name of the level generator */ s16b floor1; /* Floor tile 1 */ byte floor_percent1[2]; /* Chance of type 1 */ s16b floor2; /* Floor tile 2 */ byte floor_percent2[2]; /* Chance of type 2 */ s16b floor3; /* Floor tile 3 */ byte floor_percent3[2]; /* Chance of type 3 */ s16b outer_wall; /* Outer wall tile */ s16b inner_wall; /* Inner wall tile */ s16b fill_type1; /* Cave tile 1 */ byte fill_percent1[2]; /* Chance of type 1 */ s16b fill_type2; /* Cave tile 2 */ byte fill_percent2[2]; /* Chance of type 2 */ s16b fill_type3; /* Cave tile 3 */ byte fill_percent3[2]; /* Chance of type 3 */ byte fill_method; /* Smoothing parameter for the above */ s16b mindepth; /* Minimal depth */ s16b maxdepth; /* Maximal depth */ bool_ principal; /* If it's a part of the main dungeon */ byte next; /* The next part of the main dungeon */ byte min_plev; /* Minimal plev needed to enter -- it's an anti-cheating mesure */ int min_m_alloc_level; /* Minimal number of monsters per level */ int max_m_alloc_chance; /* There is a 1/max_m_alloc_chance chance per round of creating a new monster */ u32b flags1; /* Flags 1 */ u32b flags2; /* Flags 1 */ int size_x, size_y; /* Desired numers of panels */ byte rule_percents[100]; /* Flat rule percents */ rule_type rules[5]; /* Monster generation rules */ int final_object; /* The object you'll find at the bottom */ int final_artifact; /* The artifact you'll find at the bottom */ int final_guardian; /* The artifact's guardian. If an artifact is specified, then it's NEEDED */ int ix, iy, ox, oy; /* Wilderness coordinates of the entrance/output of the dungeon */ obj_theme objs; /* The drops type */ int d_dice[4]; /* Number of dices */ int d_side[4]; /* Number of sides */ int d_frequency[4]; /* Frequency of damage (1 is the minimum) */ int d_type[4]; /* Type of damage */ s16b t_idx[TOWN_DUNGEON]; /* The towns */ s16b t_level[TOWN_DUNGEON]; /* The towns levels */ s16b t_num; /* Number of towns */ }; /* A structure for inscriptions */ typedef struct inscription_info_type inscription_info_type; struct inscription_info_type { char text[40]; /* The inscription itself */ byte when; /* When it is executed */ bool_ know; /* Is the inscription know ? */ byte mana; /* Grid mana needed */ }; /* To hold Runecrafters prefered spells */ typedef struct rune_spell rune_spell; struct rune_spell { char name[30]; /* name */ s16b type; /* Type of the spell(GF) */ s16b rune2; /* Modifiers */ s16b mana; /* Mana involved */ }; /* For level gaining artifacts, artifact creation, ... */ typedef struct flags_group flags_group; struct flags_group { char name[30]; /* Name */ byte color; /* Color */ byte price; /* Price to "buy" it */ u32b flags1; /* Flags set 1 */ u32b flags2; /* Flags set 2 */ u32b flags3; /* Flags set 3 */ u32b flags4; /* Flags set 4 */ u32b esp; /* ESP flags set */ }; /* For powers(racial, class, mutation, artifacts, ... */ typedef struct power_type power_type; struct power_type { const char *name; /* Name */ const char *desc_text; /* Text describing power */ const char *gain_text; /* Text displayed on gaining the power */ const char *lose_text; /* Text displayed on losing the power */ byte level; /* Min level */ byte cost; /* Mana/Life cost */ byte stat; /* Stat used */ byte diff; /* Difficulty */ }; /* Hooks */ typedef struct hook_move_in hook_move_in; struct hook_move_in { int y; int x; }; typedef struct hook_get_in hook_get_in; struct hook_get_in { object_type *o_ptr; int o_idx; }; typedef struct hook_player_level_in hook_player_level_in; struct hook_player_level_in { int gained_levels; }; typedef enum { IDENT_NORMAL, IDENT_FULL } identify_mode; typedef struct hook_identify_in hook_identify_in; struct hook_identify_in { object_type *o_ptr; identify_mode mode; }; typedef struct hook_give_in hook_give_in; struct hook_give_in { int m_idx; int item; }; typedef struct hook_mon_speak_in hook_mon_speak_in; struct hook_mon_speak_in { s32b m_idx; cptr m_name; }; typedef struct hook_monster_death_in hook_monster_death_in; struct hook_monster_death_in { s32b m_idx; }; typedef struct hook_monster_ai_in hook_monster_ai_in; struct hook_monster_ai_in { s32b m_idx; monster_type *m_ptr; }; typedef struct hook_monster_ai_out hook_monster_ai_out; struct hook_monster_ai_out { s32b y; s32b x; }; typedef struct hook_calculate_hp_in hook_calculate_hp_in; struct hook_calculate_hp_in { s32b mhp; }; typedef struct hook_calculate_hp_out hook_calculate_hp_out; struct hook_calculate_hp_out { s32b mhp; }; typedef struct hook_chat_in hook_chat_in; struct hook_chat_in { s32b m_idx; }; typedef struct hook_enter_dungeon_in hook_enter_dungeon_in; struct hook_enter_dungeon_in { s32b d_idx; }; typedef struct hook_wild_gen_in hook_wild_gen_in; struct hook_wild_gen_in { bool_ small; }; typedef struct hook_build_room1_in hook_build_room1_in; struct hook_build_room1_in { s32b y; s32b x; }; typedef struct hook_chardump_in hook_chardump_in; struct hook_chardump_in { FILE *file; }; typedef struct hook_wield_in hook_wield_in; struct hook_wield_in { object_type *o_ptr; }; typedef struct hook_drop_in hook_drop_in; struct hook_drop_in { int o_idx; }; typedef struct hook_eat_in hook_eat_in; struct hook_eat_in { object_type *o_ptr; }; typedef struct hook_eat_out hook_eat_out; struct hook_eat_out { bool_ ident; }; typedef struct hook_quest_fail_in hook_quest_fail_in; struct hook_quest_fail_in { s16b q_idx; }; typedef struct hook_quest_finish_in hook_quest_finish_in; struct hook_quest_finish_in { s32b q_idx; }; typedef enum { STAIRS_UP, STAIRS_DOWN } stairs_direction; typedef struct hook_stair_in hook_stair_in; struct hook_stair_in { stairs_direction direction; }; typedef struct hook_stair_out hook_stair_out; struct hook_stair_out { bool_ allow; }; typedef struct hook_init_quest_in hook_init_quest_in; struct hook_init_quest_in { int q_idx; }; typedef struct hook_new_monster_in hook_new_monster_in; struct hook_new_monster_in { s32b r_idx; }; typedef struct hook_new_monster_end_in hook_new_monster_end_in; struct hook_new_monster_end_in { monster_type *m_ptr; }; /* * Structure for the "quests" */ typedef struct quest_type quest_type; struct quest_type { bool_ silent; char name[40]; /* Quest name */ char desc[10][80]; /* Quest desc */ s16b status; /* Is the quest taken, completed, finished? */ s16b level; /* Dungeon level */ s16b *plot; /* Which plot does it belongs to? */ bool_ (*init)(int q); /* Function that takes care of generating hardcoded quests */ s32b data[9]; /* Various datas used by the quests */ bool_ (*gen_desc)(FILE *fff); /* Function for generating description. */ }; typedef struct random_quest random_quest; struct random_quest { byte type; /* Type/number of monsters to kill(0 = no quest) */ s16b r_idx; /* Monsters to crush */ bool_ done; /* Done ? */ }; /* Monster powers for player uses */ typedef struct monster_power monster_power; struct monster_power { u32b power; /* Power RF?_xxx */ cptr name; /* Name of it */ int mana; /* Mana needed */ bool_ great; /* Need the use of great spells */ }; /* Tval descs */ typedef struct tval_desc tval_desc; struct tval_desc { int tval; /* tval */ cptr desc; /* desc */ }; /* * Between exit */ typedef struct between_exit between_exit; struct between_exit { s16b corresp; /* Corresponding between gate */ bool_ dungeon; /* Do we exit in a dungeon or in the wild ? */ s16b wild_x, wild_y; /* Wilderness spot to land onto */ s16b px, py; /* Location of the map */ s16b d_idx; /* Dungeon to land onto */ s16b level; }; /* * A structure to hold "rolled" information */ typedef struct birther birther; struct birther { s16b sex; s16b race; s16b rmod; s16b pclass; s16b spec; byte quests; byte god; s32b grace; s32b god_favor; s16b age; s16b wt; s16b ht; s16b sc; s32b au; s16b stat[6]; s16b luck; char history[4][60]; bool_ quick_ok; }; /* * Forward declare */ typedef struct hist_type hist_type; /* * Player background information */ struct hist_type { char *info; /* Textual History */ byte roll; /* Frequency of this entry */ s16b chart; /* Chart index */ s16b next; /* Next chart index */ byte bonus; /* Social Class Bonus + 50 */ }; /* * Item sets */ typedef struct set_type set_type; struct set_type { const char *name; /* Name */ char *desc; /* Desc */ byte num; /* Number of artifacts used */ byte num_use; /* Number actually wore */ struct /* the various items */ { bool_ present; /* Is it actually wore ? */ s16b a_idx; /* What artifact ? */ s16b pval[6]; /* Pval for each combination */ u32b flags1[6]; /* Flags */ u32b flags2[6]; /* Flags */ u32b flags3[6]; /* Flags */ u32b flags4[6]; /* Flags */ u32b flags5[6]; /* Flags */ u32b esp[6]; /* Flags */ } arts[6]; }; /* A structure for CLI commands. */ typedef struct cli_comm cli_comm; struct cli_comm { cptr comm; /* Extended name of the command. */ cptr descrip; /* Description of the command. */ s16b key; /* Key to convert command to. */ }; /* * Skills ! */ typedef struct skill_type skill_type; struct skill_type { const char *name; /* Name */ char *desc; /* Description */ const char *action_desc; /* Action Description */ s16b action_mkey; /* Action do to */ s32b i_value; /* Actual value */ s32b i_mod; /* Modifier(1 skill point = modifier skill) */ s32b value; /* Actual value */ s32b mod; /* Modifier(1 skill point = modifier skill) */ s16b rate; /* Modifier decreasing rate */ u32b uses; /* Number of times used */ s16b action[MAX_SKILLS]; /* List of actions against other skills */ s16b father; /* Father in the skill tree */ bool_ dev; /* Is the branch developped ? */ s16b order; /* Order in the tree */ bool_ hidden; /* Innactive */ byte random_gain_chance; /* random gain chance, still needs the flag */ u32b flags1; /* Skill flags */ }; typedef struct school_type school_type; struct school_type { cptr name; /* Name */ s16b skill; /* Skill used for that school */ bool_ spell_power; /* Does spell power affect spells in this school? */ bool_ sorcery; /* Does Sorcery affect this school? */ int deity_idx; /* Deity; if <=0, no deity required */ deity_type *deity; /* Direct pointer to deity */ int (*bonus_levels)(); /* Calculate number of bonus levels */ bool_ (*depends_satisfied)(); /* Are dependendies satisfied? */ struct school_provider_list *providers; /* List of secondary providers of this school */ }; /* * Desc for GF_FOO */ typedef struct gf_name_type gf_name_type; struct gf_name_type { int gf; cptr name; }; /* * Timers */ typedef struct timer_type timer_type; struct timer_type { timer_type *next; /* The next timer in the list */ bool_ enabled; /* Is it currently counting? */ s32b delay; /* Delay between activations */ s32b countdown; /* The current number of turns passed, when it reaches delay it fires */ void (*callback)(); /* The C function to call upon firing */ }; /* * Abilities */ typedef struct ability_type ability_type; struct ability_type { const char *name; /* Name */ char *desc; /* Description */ const char *action_desc; /* Action Description */ s16b action_mkey; /* Action do to */ s16b cost; /* Skill points cost */ bool_ acquired; /* Do the player actualylg ot it ? */ /* Prereqs */ s16b skills[10]; /* List of prereq skills(10 max) */ s16b skill_levels[10]; /* List of prereq skills(10 max) */ s16b stat[6]; /* List of prereq stats */ s16b need_abilities[10]; /* List of prereq abilities(10 max) */ s16b forbid_abilities[10]; /* List of forbidden abilities(10 max) */ }; /** * Module metadata */ typedef struct module_meta_type module_meta_type; struct module_meta_type { /* Module name */ cptr name; /* Module version number */ struct { s32b major; s32b minor; s32b patch; } version; /* Module author */ struct { cptr name; cptr email; } author; /* Module description */ cptr desc; /* Save file tag */ cptr save_file_tag; /* Module directory */ cptr module_dir; }; /** * Modules */ typedef struct module_type module_type; struct module_type { /* Metadata about the module: author, description, etc. */ module_meta_type meta; /* Random artifact generation chances */ struct { s32b weapon_chance; s32b armor_chance; s32b jewelry_chance; } randarts; /* Max player level. */ int max_plev; /* Skills */ struct { /* Skill points per level */ s32b skill_per_level; /* Maximum "overage" for skill points, i.e. how many skill points you can go above your current level. */ s32b max_skill_overage; } skills; /* Function to show introduction to module */ void (*intro)(); /* Function to compute race status, i.e. whether monsters are friendly/neutral towards the player. Returns NULL to indicate that no override happens. */ s16b *(*race_status)(int r_idx); };