4 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
6 * This software may be copied and distributed for educational, research,
7 * and not for profit purposes provided that this copyright and statement
8 * are included in all such copies. Other copyrights may also apply.
15 * Hack -- Link a copyright message into the executable
18 "Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Keoneke\n"
20 "This software may be copied and distributed for educational, research,\n"
21 "and not for profit purposes provided that this copyright and statement\n"
22 "are included in all such copies. Other copyrights may also apply.\n";
28 byte version_major
= VERSION_MAJOR
;
29 byte version_minor
= VERSION_MINOR
;
30 byte version_patch
= VERSION_PATCH
;
31 byte version_extra
= VERSION_EXTRA
;
36 byte sf_major
; /* Savefile's "version_major" */
37 byte sf_minor
; /* Savefile's "version_minor" */
38 byte sf_patch
; /* Savefile's "version_patch" */
39 byte sf_extra
; /* Savefile's "version_extra" */
42 * Savefile information
44 u32b sf_xtra
; /* Operating system info */
45 u32b sf_when
; /* Time when savefile created */
46 u16b sf_lives
; /* Number of past "lives" with this file */
47 u16b sf_saves
; /* Number of "saves" during this life */
52 bool arg_fiddle
; /* Command arg -- Request fiddle mode */
53 bool arg_wizard
; /* Command arg -- Request wizard mode */
54 bool arg_sound
; /* Command arg -- Request special sounds */
55 int arg_graphics
; /* Command arg -- Request graphics mode */
61 bool character_generated
; /* The character exists */
62 bool character_dungeon
; /* The character has a dungeon */
63 bool character_saved
; /* The character was just saved to a savefile */
65 s16b character_icky
; /* Depth of the game in special mode */
66 s16b character_xtra
; /* Depth of the game in startup mode */
68 u32b seed_randart
; /* Hack -- consistent random artifacts */
70 u32b seed_flavor
; /* Hack -- consistent object colors */
71 u32b seed_town
; /* Hack -- consistent town layout */
73 s16b num_repro
; /* Current reproducer count */
74 s16b object_level
; /* Current object creation level */
75 s16b monster_level
; /* Current monster creation level */
77 char summon_kin_type
; /* Hack -- See summon_specific() */
79 s32b turn
; /* Current game turn */
81 s32b old_turn
; /* Hack -- Level feeling counter */
84 int use_graphics
; /* The "graphics" mode is enabled */
85 bool use_bigtile
= FALSE
;
87 s16b signal_count
; /* Hack -- Count interrupts */
89 bool msg_flag
; /* Player has pending message */
91 bool inkey_base
; /* See the "inkey()" function */
92 bool inkey_xtra
; /* See the "inkey()" function */
93 bool inkey_scan
; /* See the "inkey()" function */
94 bool inkey_flag
; /* See the "inkey()" function */
96 s16b coin_type
; /* Hack -- force coin type */
98 bool opening_chest
; /* Hack -- prevent chest generation */
100 bool shimmer_monsters
; /* Hack -- optimize multi-hued monsters */
101 bool shimmer_objects
; /* Hack -- optimize multi-hued objects */
103 bool repair_mflag_nice
; /* Hack -- repair monster flags (nice) */
104 bool repair_mflag_show
; /* Hack -- repair monster flags (show) */
105 bool repair_mflag_mark
; /* Hack -- repair monster flags (mark) */
107 s16b o_max
= 1; /* Number of allocated objects */
108 s16b o_cnt
= 0; /* Number of live objects */
110 s16b mon_max
= 1; /* Number of allocated monsters */
111 s16b mon_cnt
= 0; /* Number of live monsters */
115 * TRUE if process_command() is a repeated call.
117 bool command_repeating
= FALSE
;
124 byte feeling
; /* Most recent feeling */
125 s16b rating
; /* Level's current rating */
127 bool good_item_flag
; /* True if "Artifact" on this level */
129 bool closing_flag
; /* Dungeon is closing */
140 * Buffer to hold the current savefile name
146 * Number of active macros.
151 * Array of macro patterns [MACRO_MAX]
156 * Array of macro actions [MACRO_MAX]
162 * The array[ANGBAND_TERM_MAX] of window pointers
164 term
*angband_term
[ANGBAND_TERM_MAX
];
168 * The array[ANGBAND_TERM_MAX] of window names (modifiable?)
170 * ToDo: Make the names independent of ANGBAND_TERM_MAX.
172 char angband_term_name
[ANGBAND_TERM_MAX
][16] =
185 int max_macrotrigger
= 0;
186 cptr macro_template
= NULL
;
187 cptr macro_modifier_chr
;
188 cptr macro_modifier_name
[MAX_MACRO_MOD
];
189 cptr macro_trigger_name
[MAX_MACRO_TRIGGER
];
190 cptr macro_trigger_keycode
[2][MAX_MACRO_TRIGGER
];
194 * Global table of color definitions (mostly zeros)
196 byte angband_color_table
[MAX_COLORS
][4] =
198 {0x00, 0x00, 0x00, 0x00}, /* TERM_DARK */
199 {0x00, 0xFF, 0xFF, 0xFF}, /* TERM_WHITE */
200 {0x00, 0x80, 0x80, 0x80}, /* TERM_SLATE */
201 {0x00, 0xFF, 0x80, 0x00}, /* TERM_ORANGE */
202 {0x00, 0xC0, 0x00, 0x00}, /* TERM_RED */
203 {0x00, 0x00, 0x80, 0x40}, /* TERM_GREEN */
204 {0x00, 0x00, 0x40, 0xFF}, /* TERM_BLUE */
205 {0x00, 0x80, 0x40, 0x00}, /* TERM_UMBER */
206 {0x00, 0x60, 0x60, 0x60}, /* TERM_L_DARK */
207 {0x00, 0xC0, 0xC0, 0xC0}, /* TERM_L_WHITE */
208 {0x00, 0xFF, 0x00, 0xFF}, /* TERM_VIOLET */
209 {0x00, 0xFF, 0xFF, 0x00}, /* TERM_YELLOW */
210 {0x00, 0xFF, 0x40, 0x40}, /* TERM_L_RED */
211 {0x00, 0x00, 0xFF, 0x00}, /* TERM_L_GREEN */
212 {0x00, 0x00, 0xFF, 0xFF}, /* TERM_L_BLUE */
213 {0x00, 0xC0, 0x80, 0x40} /* TERM_L_UMBER */
218 * Standard sound (and message) names
220 const cptr angband_sound_name
[MSG_MAX
] =
319 "breathe_disenchant",
376 * Array[VIEW_MAX] used by "update_view()"
382 * Arrays[TEMP_MAX] used for various things
384 * Note that temp_g shares memory with temp_x and temp_y.
393 * Array[DUNGEON_HGT][256] of cave grid info flags (padded)
395 * This array is padded to a width of 256 to allow fast access to elements
396 * in the array via "grid" values (see the GRID() macros).
398 byte (*cave_info
)[256];
401 * Array[DUNGEON_HGT][DUNGEON_WID] of cave grid feature codes
403 byte (*cave_feat
)[DUNGEON_WID
];
407 * Array[DUNGEON_HGT][DUNGEON_WID] of cave grid object indexes
409 * Note that this array yields the index of the top object in the stack of
410 * objects in a given grid, using the "next_o_idx" field in that object to
411 * indicate the next object in the stack, and so on, using zero to indicate
412 * "nothing". This array replicates the information contained in the object
413 * list, for efficiency, providing extremely fast determination of whether
414 * any object is in a grid, and relatively fast determination of which objects
417 s16b (*cave_o_idx
)[DUNGEON_WID
];
420 * Array[DUNGEON_HGT][DUNGEON_WID] of cave grid monster indexes
422 * Note that this array yields the index of the monster or player in a grid,
423 * where negative numbers are used to represent the player, positive numbers
424 * are used to represent a monster, and zero is used to indicate "nobody".
425 * This array replicates the information contained in the monster list and
426 * the player structure, but provides extremely fast determination of which,
427 * if any, monster or player is in any given grid.
429 s16b (*cave_m_idx
)[DUNGEON_WID
];
435 * Array[DUNGEON_HGT][DUNGEON_WID] of cave grid flow "cost" values
437 byte (*cave_cost
)[DUNGEON_WID
];
440 * Array[DUNGEON_HGT][DUNGEON_WID] of cave grid flow "when" stamps
442 byte (*cave_when
)[DUNGEON_WID
];
444 #endif /* MONSTER_FLOW */
448 * Array[z_info->o_max] of dungeon objects
453 * Array[z_info->m_max] of dungeon monsters
455 monster_type
*mon_list
;
459 * Array[z_info->r_max] of monster lore
461 monster_lore
*l_list
;
465 * Hack -- Array[MAX_Q_IDX] of quests
471 * Array[MAX_STORES] of stores
476 * Array[INVEN_TOTAL] of objects in the player's inventory
478 object_type
*inventory
;
482 * The size of "alloc_kind_table" (at most z_info->k_max * 4)
484 s16b alloc_kind_size
;
487 * The array[alloc_kind_size] of entries in the "kind allocator table"
489 alloc_entry
*alloc_kind_table
;
493 * The size of the "alloc_ego_table"
498 * The array[alloc_ego_size] of entries in the "ego allocator table"
500 alloc_entry
*alloc_ego_table
;
504 * The size of "alloc_race_table" (at most z_info->r_max)
506 s16b alloc_race_size
;
509 * The array[alloc_race_size] of entries in the "race allocator table"
511 alloc_entry
*alloc_race_table
;
515 * Specify attr/char pairs for visual special effects
516 * Be sure to use "index & 0xFF" to avoid illegal access
518 byte misc_to_attr
[256];
519 char misc_to_char
[256];
523 * Specify color for inventory item text display (by tval)
524 * Be sure to use "index & 0x7F" to avoid illegal access
526 byte tval_to_attr
[128];
530 * Current (or recent) macro action
532 char macro_buffer
[1024];
536 * Keymaps for each "mode" associated with each keypress.
538 cptr keymap_act
[KEYMAP_MODES
][256];
542 /*** Player information ***/
545 * Pointer to the player tables (sex, race, class, magic)
547 const player_sex
*sp_ptr
;
548 const player_race
*rp_ptr
;
549 const player_class
*cp_ptr
;
550 const player_magic
*mp_ptr
;
553 * The player other record (static)
555 static player_other player_other_body
;
558 * Pointer to the player other record
560 player_other
*op_ptr
= &player_other_body
;
563 * The player info record (static)
565 static player_type player_type_body
;
568 * Pointer to the player info record
570 player_type
*p_ptr
= &player_type_body
;
574 * Structure (not array) of size limits
579 * The vault generation arrays
586 * The terrain feature arrays
588 feature_type
*f_info
;
593 * The object kind arrays
600 * The artifact arrays
602 artifact_type
*a_info
;
607 * The ego-item arrays
609 ego_item_type
*e_info
;
615 * The monster race arrays
617 monster_race
*r_info
;
623 * The player race arrays
630 * The player class arrays
632 player_class
*c_info
;
637 * The player history arrays
643 * The shop owner arrays
650 * The racial price adjustment arrays
658 * The object flavor arrays
660 flavor_type
*flavor_info
;
673 * The spell_list is built from s_info to facilitate a quick lookup
674 * of the spell when realm, book and position in book are known.
676 s16b spell_list
[MAX_REALMS
][BOOKS_PER_REALM
][SPELLS_PER_BOOK
];
680 * Hack -- The special Angband "System Suffix"
681 * This variable is used to choose an appropriate "pref-xxx" file
683 cptr ANGBAND_SYS
= "xxx";
686 * Hack -- The special Angband "Graphics Suffix"
687 * This variable is used to choose an appropriate "graf-xxx" file
689 cptr ANGBAND_GRAF
= "old";
692 * Path name: The main "lib" directory
693 * This variable is not actually used anywhere in the code
698 * High score files (binary)
699 * These files may be portable between platforms
701 cptr ANGBAND_DIR_APEX
;
704 * Bone files for player ghosts (ascii)
705 * These files are portable between platforms
707 cptr ANGBAND_DIR_BONE
;
710 * Binary image files for the "*_info" arrays (binary)
711 * These files are not portable between platforms
713 cptr ANGBAND_DIR_DATA
;
716 * Textual template files for the "*_info" arrays (ascii)
717 * These files are portable between platforms
719 cptr ANGBAND_DIR_EDIT
;
722 * Various extra files (ascii)
723 * These files may be portable between platforms
725 cptr ANGBAND_DIR_FILE
;
728 * Help files (normal) for the online help (ascii)
729 * These files are portable between platforms
731 cptr ANGBAND_DIR_HELP
;
734 * Help files (spoilers) for the online help (ascii)
735 * These files are portable between platforms
737 cptr ANGBAND_DIR_INFO
;
740 * Savefiles for current characters (binary)
741 * These files are portable between platforms
743 cptr ANGBAND_DIR_SAVE
;
746 * Default user "preference" files (ascii)
747 * These files are rarely portable between platforms
749 cptr ANGBAND_DIR_PREF
;
752 * User defined "preference" files (ascii)
753 * These files are rarely portable between platforms
755 cptr ANGBAND_DIR_USER
;
758 * Various extra files (binary)
759 * These files are rarely portable between platforms
761 cptr ANGBAND_DIR_XTRA
;
765 * Total Hack -- allow all items to be listed (even empty ones)
766 * This is only used by "do_cmd_inven_e()" and is cleared there.
768 bool item_tester_full
;
772 * Here is a "pseudo-hook" used during calls to "get_item()" and
773 * "show_inven()" and "show_equip()", and the choice window routines.
775 byte item_tester_tval
;
779 * Here is a "hook" used during calls to "get_item()" and
780 * "show_inven()" and "show_equip()", and the choice window routines.
782 bool (*item_tester_hook
)(const object_type
*);
787 * Current "comp" function for ang_sort()
789 bool (*ang_sort_comp
)(const void *u
, const void *v
, int a
, int b
);
793 * Current "swap" function for ang_sort()
795 void (*ang_sort_swap
)(void *u
, void *v
, int a
, int b
);
800 * Hack -- function hook to restrict "get_mon_num_prep()" function
802 bool (*get_mon_num_hook
)(int r_idx
);
807 * Hack -- function hook to restrict "get_obj_num_prep()" function
809 bool (*get_obj_num_hook
)(int k_idx
);
812 void (*object_info_out_flags
)(const object_type
*o_ptr
, u32b
*f1
, u32b
*f2
, u32b
*f3
);
816 * Hack - the destination file for text_out_to_file.
818 FILE *text_out_file
= NULL
;
822 * Hack -- function hook to output (colored) text to the
823 * screen or to a file.
825 void (*text_out_hook
)(byte a
, cptr str
);
829 * Hack -- Where to wrap the text when using text_out(). Use the default
830 * value (for example the screen width) when 'text_out_wrap' is 0.
832 int text_out_wrap
= 0;
836 * Hack -- Indentation for the text when using text_out().
838 int text_out_indent
= 0;
842 * Use transparent tiles
844 bool use_transparency
= FALSE
;
848 * Sound hook (for playing FX).
850 void (*sound_hook
)(int sound
);
854 * For autoinscriptions.
856 autoinscription
*inscriptions
= 0;
857 u16b inscriptions_count
= 0;