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.
11 /* Purpose: Angband variables */
17 * Hack -- Link a copyright message into the executable
21 "Copyright (c) 1989 James E. Wilson, Robert A. Keoneke",
23 "This software may be copied and distributed for educational, research,",
24 "and not for profit purposes provided that this copyright and statement",
25 "are included in all such copies."
29 int max_macrotrigger = 0;
30 cptr macro_template = NULL;
31 cptr macro_modifier_chr;
32 cptr macro_modifier_name[MAX_MACRO_MOD];
33 cptr macro_trigger_name[MAX_MACRO_TRIG];
34 cptr macro_trigger_keycode[2][MAX_MACRO_TRIG];
36 /* ¥ì¥Ù¥ë¥¢¥Ã¥×¤Î»þ¤Ë¾å¾ºÎ̤òɽ¼¨¤¹¤ë¤Î¤Ë»È¤¦ */
40 * List for auto-picker/destroyer entries
43 autopick_type autopick_list[MAX_AUTOPICK];
48 byte h_ver_major; /* Savefile version for Hengband 1.1.1 and later */
53 byte sf_extra; /* Savefile's encoding key */
55 byte z_major; /* Savefile version for Hengband */
60 * Savefile information
62 u32b sf_system; /* Operating system info */
63 u32b sf_when; /* Time when savefile created */
64 u16b sf_lives; /* Number of past "lives" with this file */
65 u16b sf_saves; /* Number of "saves" during this life */
70 bool arg_fiddle; /* Command arg -- Request fiddle mode */
71 bool arg_wizard; /* Command arg -- Request wizard mode */
72 bool arg_sound; /* Command arg -- Request special sounds */
73 byte arg_graphics; /* Command arg -- Request graphics mode */
74 bool arg_monochrome; /* Command arg -- Request monochrome mode */
75 bool arg_force_original; /* Command arg -- Request original keyset */
76 bool arg_force_roguelike; /* Command arg -- Request roguelike keyset */
77 bool arg_bigtile = FALSE; /* Command arg -- Request big tile mode */
82 bool character_generated; /* The character exists */
83 bool character_dungeon; /* The character has a dungeon */
84 bool character_loaded; /* The character was loaded from a savefile */
85 bool character_saved; /* The character was just saved to a savefile */
87 bool character_icky; /* The game is in an icky full screen mode */
88 bool character_xtra; /* The game is in an icky startup mode */
90 u32b seed_flavor; /* Hack -- consistent object colors */
91 u32b seed_town; /* Hack -- consistent town layout */
93 s16b command_cmd; /* Current "Angband Command" */
95 s16b command_arg; /* Gives argument of current command */
96 s16b command_rep; /* Gives repetition of current command */
97 s16b command_dir; /* Gives direction of current command */
99 s16b command_see; /* See "object1.c" */
100 s16b command_wrk; /* See "object1.c" */
102 s16b command_gap = 999; /* See "object1.c" */
104 s16b command_new; /* Command chaining from inven/equip view */
106 s16b energy_use; /* Energy use this turn */
108 bool msg_flag; /* Used in msg_print() for "buffering" */
110 s16b running; /* Current counter for running, if any */
111 s16b resting; /* Current counter for resting, if any */
113 s16b cur_hgt; /* Current dungeon height */
114 s16b cur_wid; /* Current dungeon width */
115 s16b dun_level; /* Current dungeon level */
116 s16b num_repro; /* Current reproducer count */
117 s16b object_level; /* Current object creation level */
118 s16b monster_level; /* Current monster creation level */
119 s16b base_level; /* Base dungeon level */
121 s32b turn; /* Current game turn */
122 s32b dungeon_turn; /* Game turn in dungeon */
123 s32b old_turn; /* Turn when level began (feelings) */
126 bool use_sound; /* The "sound" mode is enabled */
127 bool use_graphics; /* The "graphics" mode is enabled */
128 bool use_bigtile = FALSE;
130 s16b signal_count; /* Hack -- Count interupts */
132 bool inkey_base; /* See the "inkey()" function */
133 bool inkey_xtra; /* See the "inkey()" function */
134 bool inkey_scan; /* See the "inkey()" function */
135 bool inkey_flag; /* See the "inkey()" function */
136 bool inkey_special; /* See the "inkey()" function */
138 s16b coin_type; /* Hack -- force coin type */
140 bool opening_chest; /* Hack -- prevent chest generation */
142 bool shimmer_monsters; /* Hack -- optimize multi-hued monsters */
143 bool shimmer_objects; /* Hack -- optimize multi-hued objects */
145 bool repair_monsters; /* Hack -- optimize detect monsters */
146 bool repair_objects; /* Hack -- optimize detect objects */
148 s16b inven_nxt; /* Hack -- unused */
152 s16b inven_cnt; /* Number of items in inventory */
153 s16b equip_cnt; /* Number of items in equipment */
155 s16b o_max = 1; /* Number of allocated objects */
156 s16b o_cnt = 0; /* Number of live objects */
158 s16b m_max = 1; /* Number of allocated monsters */
159 s16b m_cnt = 0; /* Number of live monsters */
161 s16b hack_m_idx = 0; /* Hack -- see "process_monsters()" */
162 s16b hack_m_idx_ii = 0;
163 bool multi_rew = FALSE;
164 char summon_kin_type; /* Hack, by Julian Lighton: summon 'relatives' */
166 int total_friends = 0;
167 s32b total_friend_levels = 0;
168 s32b friend_align = 0;
170 int leaving_quest = 0;
171 bool reinit_wilderness = FALSE;
175 * Software options (set via the '=' command). See "tables.c"
179 /* Option Set 1 -- User Interface */
181 bool rogue_like_commands; /* Rogue-like commands */
182 bool quick_messages; /* Activate quick messages */
185 bool other_query_flag; /* Prompt for various information */
186 bool carry_query_flag; /* Prompt before picking things up */
187 bool use_old_target; /* Use old target by default */
188 bool always_pickup; /* Pick things up by default */
189 bool always_repeat; /* Repeat obvious commands */
190 bool depth_in_feet; /* Show dungeon level in feet */
192 bool stack_force_notes; /* Merge inscriptions when stacking */
193 bool stack_force_costs; /* Merge discounts when stacking */
195 bool show_labels; /* Show labels in object listings */
196 bool show_weights; /* Show weights in object listings */
198 bool ring_bell; /* Ring the bell (on errors, etc) */
200 bool show_item_graph;
203 /* Option Set 2 -- Disturbance */
205 bool find_ignore_stairs; /* Run past stairs */
206 bool find_ignore_doors; /* Run through open doors */
207 bool find_cut; /* Run past known corners */
209 bool disturb_move; /* Disturb whenever any monster moves */
210 bool disturb_near; /* Disturb whenever viewable monster moves */
211 bool disturb_high; /* Disturb whenever high-level monster moves */
212 bool disturb_panel; /* Disturb whenever map panel changes */
213 bool disturb_state; /* Disturn whenever player state changes */
214 bool disturb_minor; /* Disturb whenever boring things happen */
216 bool disturb_trap_detect; /* Disturb when leaving trap detected area */
217 bool alert_trap_detect; /* Alert when leaving trap detected area */
218 bool last_words; /* Get last words upon dying */
220 bool small_levels; /* Allow unusually small dungeon levels */
221 bool always_small_levels; /* Use always unusually small dungeon levels */
222 bool empty_levels; /* Allow empty 'arena' levels */
223 bool bound_walls_perm; /* Boundary walls are created by permanent wall */
224 bool equippy_chars; /* Back by popular demand... */
225 bool display_mutations; /* Skip mutations screen even if we have it */
226 bool plain_descriptions; /* Plain object descriptions */
227 bool confirm_destroy; /* Known worthless items are destroyed without confirmation */
228 bool confirm_quest; /* Prompt before staircases... */
229 bool confirm_wear; /* Confirm before putting on known cursed items */
230 bool disturb_pets; /* Pets moving nearby disturb us */
234 /* Option Set 3 -- Game-Play */
236 bool manual_haggle; /* Auto-haggle in stores */
238 bool auto_scum; /* Auto-scum for good levels */
240 bool expand_list; /* Expand the power of the list commands */
242 bool view_perma_grids; /* Map remembers all perma-lit grids */
243 bool view_torch_grids; /* Map remembers all torch-lit grids */
244 bool view_unsafe_grids; /* Map marked by detect traps */
246 bool dungeon_align; /* Generate dungeons with aligned rooms */
248 bool track_follow; /* Monsters follow the player */
249 bool track_target; /* Monsters target the player */
251 bool smart_learn; /* Monsters learn from their mistakes */
252 bool smart_cheat; /* Monsters exploit player weaknesses */
255 /* Option Set 4 -- Efficiency */
257 bool view_reduce_view; /* Reduce view-radius in town */
259 bool check_abort; /* Avoid checking for user abort */
261 bool flush_failure; /* Flush input on any failure */
262 bool flush_disturb; /* Flush input on disturbance */
264 bool fresh_before; /* Flush output before normal commands */
265 bool fresh_after; /* Flush output after normal commands */
266 bool fresh_message; /* Flush output after all messages */
268 bool compress_savefile; /* Compress messages in savefiles */
270 bool hilite_player; /* Hilite the player with the cursor */
272 bool view_yellow_lite; /* Use special colors for torch-lit grids */
273 bool view_bright_lite; /* Use special colors for 'viewable' grids */
275 bool view_granite_lite; /* Use special colors for wall grids (slow) */
276 bool view_special_lite; /* Use special colors for floor grids (slow) */
277 bool new_ascii_graphics;
282 bool always_show_list;
286 bool allow_debug_opts; /* Allow use of debug/cheat options */
288 /* Cheating options */
290 bool cheat_peek; /* Peek into object creation */
291 bool cheat_hear; /* Peek into monster creation */
292 bool cheat_room; /* Peek into dungeon creation */
293 bool cheat_xtra; /* Peek into something else */
294 bool cheat_know; /* Know complete monster info */
295 bool cheat_live; /* Allow player to avoid death */
296 bool cheat_save; /* Ask for saving death */
299 /* Special options */
301 byte hitpoint_warn; /* Hitpoint warning (0 to 9) */
303 byte delay_factor; /* Delay factor (0 to 9) */
305 bool autosave_l; /* Autosave before entering new levels */
306 bool autosave_t; /* Timed autosave */
307 s16b autosave_freq; /* Autosave frequency */
314 byte feeling; /* Most recent feeling */
315 s16b rating; /* Level's current rating */
317 bool good_item_flag; /* True if "Artifact" on this level */
319 bool closing_flag; /* Dungeon is closing */
326 s16b panel_row_min, panel_row_max;
327 s16b panel_col_min, panel_col_max;
328 s16b panel_col_prt, panel_row_prt;
331 * Player location in dungeon
337 * Targetting variables
352 * Current player's character name
354 char player_name[32];
357 * Stripped version of "player_name"
359 char player_base[32];
363 * Buffer to hold the current savefile name
364 * 'savefile' holds full path name. 'savefile_base' holds only base name.
367 char savefile_base[40];
370 * Array of grids lit by player lite (see "cave.c")
373 s16b lite_y[LITE_MAX];
374 s16b lite_x[LITE_MAX];
377 * Array of grids lit by player lite (see "cave.c")
380 s16b mon_lite_y[MON_LITE_MAX];
381 s16b mon_lite_x[MON_LITE_MAX];
384 * Array of grids viewable to the player (see "cave.c")
387 byte view_y[VIEW_MAX];
388 byte view_x[VIEW_MAX];
391 * Array of grids for use by various functions (see "cave.c")
394 byte temp_y[TEMP_MAX];
395 byte temp_x[TEMP_MAX];
398 * Array of grids for delayed visual updating (see "cave.c")
401 byte redraw_y[REDRAW_MAX];
402 byte redraw_x[REDRAW_MAX];
406 * Number of active macros.
411 * Array of macro patterns [MACRO_MAX]
416 * Array of macro actions [MACRO_MAX]
421 * Array of macro types [MACRO_MAX]
426 * Current macro action [1024]
432 * The number of quarks
437 * The pointers to the quarks [QUARK_MAX]
443 * The next "free" index to use
448 * The index of the oldest message (none yet)
453 * The next "free" offset
458 * The offset to the oldest used char (none yet)
463 * The array of offsets, by index [MESSAGE_MAX]
468 * The array of chars, by offset [MESSAGE_BUF]
474 * The array of normal options
481 * The array of window options
488 * The array of window pointers
490 term *angband_term[8];
494 * Standard window names
496 char angband_term_name[8][16] =
510 * Global table of color definitions
512 byte angband_color_table[256][4] =
514 {0x00, 0x00, 0x00, 0x00}, /* TERM_DARK */
515 {0x00, 0xFF, 0xFF, 0xFF}, /* TERM_WHITE */
516 {0x00, 0x80, 0x80, 0x80}, /* TERM_SLATE */
517 {0x00, 0xFF, 0x80, 0x00}, /* TERM_ORANGE */
518 {0x00, 0xC0, 0x00, 0x00}, /* TERM_RED */
519 {0x00, 0x00, 0x80, 0x40}, /* TERM_GREEN */
520 {0x00, 0x00, 0x00, 0xFF}, /* TERM_BLUE */
521 {0x00, 0x80, 0x40, 0x00}, /* TERM_UMBER */
522 {0x00, 0x40, 0x40, 0x40}, /* TERM_L_DARK */
523 {0x00, 0xC0, 0xC0, 0xC0}, /* TERM_L_WHITE */
524 {0x00, 0xFF, 0x00, 0xFF}, /* TERM_VIOLET */
525 {0x00, 0xFF, 0xFF, 0x00}, /* TERM_YELLOW */
526 {0x00, 0xFF, 0x00, 0x00}, /* TERM_L_RED */
527 {0x00, 0x00, 0xFF, 0x00}, /* TERM_L_GREEN */
528 {0x00, 0x00, 0xFF, 0xFF}, /* TERM_L_BLUE */
529 {0x00, 0xC0, 0x80, 0x40} /* TERM_L_UMBER */
534 * Standard sound names
536 char angband_sound_name[SOUND_MAX][16] =
607 * The array of "cave grids" [MAX_WID][MAX_HGT].
608 * Not completely allocated, that would be inefficient
609 * Not completely hardcoded, that would overflow memory
611 cave_type *cave[MAX_HGT];
615 * The array of saved floors
617 saved_floor_type saved_floors[MAX_SAVED_FLOORS];
621 * Number of floor_id used from birth
627 * Sign for current process used in temporal files.
628 * Actually it is the start time of current process.
630 u32b saved_floor_file_sign;
634 * The array of dungeon items [max_o_idx]
639 * The array of dungeon monsters [max_m_idx]
641 monster_type *m_list;
645 * Maximum number of towns
650 * The towns [max_towns]
656 * The player's inventory [INVEN_TOTAL]
658 object_type *inventory;
662 * The size of "alloc_kind_table" (at most max_k_idx * 4)
664 s16b alloc_kind_size;
667 * The entries in the "kind allocator table"
669 alloc_entry *alloc_kind_table;
673 * The size of "alloc_race_table" (at most max_r_idx)
675 s16b alloc_race_size;
678 * The entries in the "race allocator table"
680 alloc_entry *alloc_race_table;
684 * Specify attr/char pairs for visual special effects
685 * Be sure to use "index & 0x7F" to avoid illegal access
687 byte misc_to_attr[256];
688 char misc_to_char[256];
692 * Specify attr/char pairs for inventory items (by tval)
693 * Be sure to use "index & 0x7F" to avoid illegal access
695 byte tval_to_attr[128];
696 char tval_to_char[128];
700 * Keymaps for each "mode" associated with each keypress.
702 cptr keymap_act[KEYMAP_MODES][256];
706 /*** Player information ***/
709 * Static player info record
714 * Pointer to the player info
716 player_type *p_ptr = &p_body;
719 * Pointer to the player tables
720 * (sex, race, class, magic)
724 player_class *cp_ptr;
725 player_seikaku *ap_ptr;
726 player_magic *mp_ptr;
730 * The last character rolled,
731 * holded for quick start
733 birther previous_char;
737 * The vault generation arrays
751 player_magic *m_info;
754 * The terrain feature arrays
756 feature_type *f_info;
760 * The object kind arrays
767 * The artifact arrays
769 artifact_type *a_info;
774 * The ego-item arrays
776 ego_item_type *e_info;
782 * The monster race arrays
784 monster_race *r_info;
792 dungeon_info_type *d_info;
798 * Hack -- The special Angband "System Suffix"
799 * This variable is used to choose an appropriate "pref-xxx" file
801 cptr ANGBAND_SYS = "xxx";
804 * Hack -- The special Angband "Keyboard Suffix"
805 * This variable is used to choose an appropriate macro-trigger definition
808 cptr ANGBAND_KEYBOARD = "JAPAN";
810 cptr ANGBAND_KEYBOARD = "0";
814 * Hack -- The special Angband "Graphics Suffix"
815 * This variable is used to choose an appropriate "graf-xxx" file
817 cptr ANGBAND_GRAF = "ascii";
820 * Path name: The main "lib" directory
821 * This variable is not actually used anywhere in the code
826 * High score files (binary)
827 * These files may be portable between platforms
829 cptr ANGBAND_DIR_APEX;
832 * Bone files for player ghosts (ascii)
833 * These files are portable between platforms
835 cptr ANGBAND_DIR_BONE;
838 * Binary image files for the "*_info" arrays (binary)
839 * These files are not portable between platforms
841 cptr ANGBAND_DIR_DATA;
844 * Textual template files for the "*_info" arrays (ascii)
845 * These files are portable between platforms
847 cptr ANGBAND_DIR_EDIT;
851 * These files are portable between platforms.
853 cptr ANGBAND_DIR_SCRIPT;
856 * Various extra files (ascii)
857 * These files may be portable between platforms
859 cptr ANGBAND_DIR_FILE;
862 * Help files (normal) for the online help (ascii)
863 * These files are portable between platforms
865 cptr ANGBAND_DIR_HELP;
868 * Help files (spoilers) for the online help (ascii)
869 * These files are portable between platforms
871 cptr ANGBAND_DIR_INFO;
874 * Default user "preference" files (ascii)
875 * These files are rarely portable between platforms
877 cptr ANGBAND_DIR_PREF;
880 * Savefiles for current characters (binary)
881 * These files are portable between platforms
883 cptr ANGBAND_DIR_SAVE;
886 * User "preference" files (ascii)
887 * These files are rarely portable between platforms
889 cptr ANGBAND_DIR_USER;
892 * Various extra files (binary)
893 * These files are rarely portable between platforms
895 cptr ANGBAND_DIR_XTRA;
899 * Total Hack -- allow all items to be listed (even empty ones)
900 * This is only used by "do_cmd_inven_e()" and is cleared there.
902 bool item_tester_full;
904 bool item_tester_no_ryoute = FALSE;
907 * Here is a "pseudo-hook" used during calls to "get_item()" and
908 * "show_inven()" and "show_equip()", and the choice window routines.
910 byte item_tester_tval;
914 * Here is a "hook" used during calls to "get_item()" and
915 * "show_inven()" and "show_equip()", and the choice window routines.
917 bool (*item_tester_hook)(object_type*);
922 * Current "comp" function for ang_sort()
924 bool (*ang_sort_comp)(vptr u, vptr v, int a, int b);
928 * Current "swap" function for ang_sort()
930 void (*ang_sort_swap)(vptr u, vptr v, int a, int b);
935 * Hack -- function hooks to restrict "get_mon_num_prep()" function
937 monster_hook_type get_mon_num_hook;
938 monster_hook_type get_mon_num2_hook;
942 * Hack -- function hook to restrict "get_obj_num_prep()" function
944 bool (*get_obj_num_hook)(int k_idx);
947 /* Hack, monk armour */
948 bool monk_armour_aux;
949 bool monk_notify_aux;
951 #ifdef ALLOW_EASY_OPEN /* TNB */
953 #endif /* ALLOW_EASY_OPEN -- TNB */
955 #ifdef ALLOW_EASY_DISARM /* TNB */
957 #endif /* ALLOW_EASY_DISARM -- TNB */
959 #ifdef ALLOW_EASY_FLOOR /* TNB */
961 #endif /* ALLOW_EASY_FLOOR -- TNB */
967 /* Auto-destruction options */
969 bool destroy_feeling;
970 bool destroy_identify;
981 bool record_rand_art;
982 bool record_destroy_uniq;
983 bool record_fix_quest;
984 bool record_rand_quest;
985 bool record_maxdeapth;
992 bool record_named_pet;
993 char record_o_name[MAX_NLEN];
999 wilderness_type **wilderness;
1005 building_type building[MAX_BLDG];
1009 * Maximum number of quests
1014 * Maximum number of monsters in r_info.txt
1019 * Maximum number of items in k_info.txt
1024 * Maximum number of vaults in v_info.txt
1029 * Maximum number of terrain features in f_info.txt
1034 * Maximum number of artifacts in a_info.txt
1039 * Maximum number of ego-items in e_info.txt
1044 * Maximum number of dungeon in e_info.txt
1049 * Maximum number of objects in the level
1054 * Maximum number of monsters in the level
1059 * Maximum size of the wilderness
1072 char quest_text[10][80];
1075 * Current line of the quest text
1077 int quest_text_line;
1080 * Default spell color table (quark index)
1082 s16b gf_color[MAX_GF];
1085 * Flags for initialization
1091 * The "highscore" file descriptor, if available.
1093 int highscore_fd = -1;
1095 int mutant_regenerate_mod = 100;
1101 bool vanilla_town; /* Use "vanilla" town without set quests */
1102 bool ironman_shops; /* Stores are permanently closed */
1103 bool ironman_small_levels; /* Always create unusually small dungeon levels */
1104 bool ironman_downward; /* Don't allow climbing upwards/recalling */
1105 bool ironman_autoscum; /* Permanently enable the autoscummer */
1106 bool lite_town; /* Use "lite" town without wilderness */
1107 bool ironman_empty_levels; /* Always create empty 'arena' levels */
1108 bool ironman_rooms; /* Always generate very unusual rooms */
1109 bool ironman_nightmare; /* Play the game in Nightmare mode */
1116 bool can_save = FALSE; /* Game can be saved */
1136 s16b kubi_r_idx[MAX_KUBI];
1139 monster_type party_mon[MAX_PARTY_MON];
1154 bool generate_encounter;
1156 cptr screen_dump = NULL;
1164 byte feat_wall_outer;
1165 byte feat_wall_inner;
1166 byte feat_wall_solid;
1167 byte floor_type[100], fill_type[100];
1174 bool chuukei_server;
1175 bool chuukei_client;