3 /* Purpose: Angband variables */
6 * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke
8 * This software may be copied and distributed for educational, research, and
9 * not for profit purposes provided that this copyright and statement are
10 * included in all such copies.
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 char *macro_template = NULL;
31 char *macro_modifier_chr;
32 char *macro_modifier_name[MAX_MACRO_MOD];
33 char *macro_trigger_name[MAX_MACRO_TRIG];
34 char *macro_trigger_keycode[2][MAX_MACRO_TRIG];
36 /* ¥ì¥Ù¥ë¥¢¥Ã¥×¤Î»þ¤Ë¾å¾ºÎ̤òɽ¼¨¤¹¤ë¤Î¤Ë»È¤¦ */
40 * List for auto-picker/destroyer entries
43 autopick_type autopick_list[MAX_AUTOPICK];
44 autopick_type autopick_entry_last_destroyed;
49 byte version_major = VERSION_MAJOR;
50 byte version_minor = VERSION_MINOR;
51 byte version_patch = VERSION_PATCH;
52 byte version_extra = VERSION_EXTRA;
57 byte sf_major; /* Savefile's "version_major" */
58 byte sf_minor; /* Savefile's "version_minor" */
59 byte sf_patch; /* Savefile's "version_patch" */
60 byte sf_extra; /* Savefile's "version_extra" */
61 u32b sf_version; /* Savefile's "version" */
63 byte z_major; /* Savefile version for Hengband */
68 * Savefile information
70 u32b sf_xtra; /* Operating system info */
71 u32b sf_when; /* Time when savefile created */
72 u16b sf_lives; /* Number of past "lives" with this file */
73 u16b sf_saves; /* Number of "saves" during this life */
78 bool arg_fiddle; /* Command arg -- Request fiddle mode */
79 bool arg_wizard; /* Command arg -- Request wizard mode */
80 bool arg_sound; /* Command arg -- Request special sounds */
81 byte arg_graphics; /* Command arg -- Request graphics mode */
82 bool arg_monochrome; /* Command arg -- Request monochrome mode */
83 bool arg_force_original; /* Command arg -- Request original keyset */
84 bool arg_force_roguelike; /* Command arg -- Request roguelike keyset */
85 bool arg_bigtile = FALSE; /* Command arg -- Request big tile mode */
90 bool character_generated; /* The character exists */
91 bool character_dungeon; /* The character has a dungeon */
92 bool character_loaded; /* The character was loaded from a savefile */
93 bool character_saved; /* The character was just saved to a savefile */
95 bool character_icky; /* The game is in an icky full screen mode */
96 bool character_xtra; /* The game is in an icky startup mode */
98 u32b seed_flavor; /* Hack -- consistent object colors */
99 u32b seed_town; /* Hack -- consistent town layout */
101 s16b command_cmd; /* Current "Angband Command" */
103 s16b command_arg; /* Gives argument of current command */
104 s16b command_rep; /* Gives repetition of current command */
105 s16b command_dir; /* Gives direction of current command */
107 s16b command_see; /* See "cmd1.c" */
108 s16b command_wrk; /* See "cmd1.c" */
110 s16b command_gap = 50; /* See "cmd1.c" */
112 s16b command_new; /* Command chaining from inven/equip view */
114 s16b energy_use; /* Energy use this turn */
116 byte create_up_stair; /* Auto-create "up stairs" */
117 byte create_down_stair; /* Auto-create "down stairs" */
119 bool msg_flag; /* Used in msg_print() for "buffering" */
121 bool alive; /* True if game is running */
123 bool death; /* True if player has died */
125 s16b running; /* Current counter for running, if any */
126 s16b resting; /* Current counter for resting, if any */
128 s16b cur_hgt; /* Current dungeon height */
129 s16b cur_wid; /* Current dungeon width */
130 s16b dun_level; /* Current dungeon level */
131 s16b num_repro; /* Current reproducer count */
132 s16b object_level; /* Current object creation level */
133 s16b monster_level; /* Current monster creation level */
134 s16b base_level; /* Base dungeon level */
136 s32b turn; /* Current game turn */
137 s32b dungeon_turn; /* Game turn in dungeon */
138 s32b old_turn; /* Turn when level began (feelings) */
141 bool wizard; /* Is the player currently in Wizard mode? */
143 bool use_sound; /* The "sound" mode is enabled */
144 bool use_graphics; /* The "graphics" mode is enabled */
145 bool use_bigtile = FALSE;
147 u16b total_winner; /* Semi-Hack -- Game has been won */
149 u16b panic_save; /* Track some special "conditions" */
150 u16b noscore; /* Track various "cheating" conditions */
151 bool wait_report_score; /* Waiting to report score */
153 s16b signal_count; /* Hack -- Count interupts */
155 bool inkey_base; /* See the "inkey()" function */
156 bool inkey_xtra; /* See the "inkey()" function */
157 bool inkey_scan; /* See the "inkey()" function */
158 bool inkey_flag; /* See the "inkey()" function */
159 bool inkey_special; /* See the "inkey()" function */
161 s16b coin_type; /* Hack -- force coin type */
163 bool opening_chest; /* Hack -- prevent chest generation */
165 bool shimmer_monsters; /* Hack -- optimize multi-hued monsters */
166 bool shimmer_objects; /* Hack -- optimize multi-hued objects */
168 bool repair_monsters; /* Hack -- optimize detect monsters */
169 bool repair_objects; /* Hack -- optimize detect objects */
171 s16b inven_nxt; /* Hack -- unused */
175 s16b inven_cnt; /* Number of items in inventory */
176 s16b equip_cnt; /* Number of items in equipment */
178 s16b o_max = 1; /* Number of allocated objects */
179 s16b o_cnt = 0; /* Number of live objects */
181 s16b m_max = 1; /* Number of allocated monsters */
182 s16b m_cnt = 0; /* Number of live monsters */
184 s16b hack_m_idx = 0; /* Hack -- see "process_monsters()" */
185 s16b hack_m_idx_ii = 0;
186 bool multi_rew = FALSE;
187 char summon_kin_type; /* Hack, by Julian Lighton: summon 'relatives' */
189 int total_friends = 0;
190 s32b total_friend_levels = 0;
191 s32b friend_align = 0;
193 int leaving_quest = 0;
197 * Software options (set via the '=' command). See "tables.c"
201 /* Option Set 1 -- User Interface */
203 bool rogue_like_commands; /* Rogue-like commands */
204 bool quick_messages; /* Activate quick messages */
207 bool other_query_flag; /* Prompt for various information */
208 bool carry_query_flag; /* Prompt before picking things up */
209 bool use_old_target; /* Use old target by default */
210 bool always_pickup; /* Pick things up by default */
211 bool always_repeat; /* Repeat obvious commands */
212 bool depth_in_feet; /* Show dungeon level in feet */
214 bool stack_force_notes; /* Merge inscriptions when stacking */
215 bool stack_force_costs; /* Merge discounts when stacking */
217 bool show_labels; /* Show labels in object listings */
218 bool show_weights; /* Show weights in object listings */
219 bool show_choices; /* Show choices in certain sub-windows */
221 bool ring_bell; /* Ring the bell (on errors, etc) */
223 bool show_item_graph;
226 /* Option Set 2 -- Disturbance */
228 bool find_ignore_stairs; /* Run past stairs */
229 bool find_ignore_doors; /* Run through open doors */
230 bool find_cut; /* Run past known corners */
231 bool find_examine; /* Run into potential corners */
233 bool disturb_move; /* Disturb whenever any monster moves */
234 bool disturb_near; /* Disturb whenever viewable monster moves */
235 bool disturb_panel; /* Disturb whenever map panel changes */
236 bool disturb_state; /* Disturn whenever player state changes */
237 bool disturb_minor; /* Disturb whenever boring things happen */
239 bool alert_hitpoint; /* Alert user to critical hitpoints */
240 bool disturb_trap_detect; /* Disturb when leaving trap detected area */
241 bool alert_trap_detect; /* Alert when leaving trap detected area */
242 bool last_words; /* Get last words upon dying */
244 bool small_levels; /* Allow unusually small dungeon levels */
245 bool always_small_levels; /* Use always unusually small dungeon levels */
246 bool empty_levels; /* Allow empty 'arena' levels */
247 bool player_symbols; /* Use varying symbols for the player char */
248 bool equippy_chars; /* Back by popular demand... */
249 bool display_mutations; /* Skip mutations screen even if we have it */
250 bool plain_descriptions; /* Plain object descriptions */
251 bool stupid_monsters; /* Monsters use old AI */
252 bool confirm_destroy; /* Known worthless items are destroyed without confirmation */
253 bool confirm_stairs; /* Prompt before staircases... */
254 bool confirm_wear; /* Confirm before putting on known cursed items */
255 bool disturb_pets; /* Pets moving nearby disturb us */
259 /* Option Set 3 -- Game-Play */
261 bool manual_haggle; /* Auto-haggle in stores */
263 bool auto_scum; /* Auto-scum for good levels */
265 bool stack_allow_items; /* Allow weapons and armor to stack */
267 bool expand_look; /* Expand the power of the look command */
268 bool expand_list; /* Expand the power of the list commands */
270 bool view_perma_grids; /* Map remembers all perma-lit grids */
271 bool view_torch_grids; /* Map remembers all torch-lit grids */
272 bool view_unsafe_grids; /* Map marked by detect traps */
274 bool dungeon_align; /* Generate dungeons with aligned rooms */
275 bool dungeon_stair; /* Generate dungeons with connected stairs */
277 bool track_follow; /* Monsters follow the player */
278 bool track_target; /* Monsters target the player */
280 bool smart_learn; /* Monsters learn from their mistakes */
281 bool smart_cheat; /* Monsters exploit player weaknesses */
284 /* Option Set 4 -- Efficiency */
286 bool view_reduce_lite; /* Reduce lite-radius when running */
287 bool view_reduce_view; /* Reduce view-radius in town */
289 bool check_abort; /* Avoid checking for user abort */
291 bool flush_failure; /* Flush input on any failure */
292 bool flush_disturb; /* Flush input on disturbance */
294 bool fresh_before; /* Flush output before normal commands */
295 bool fresh_after; /* Flush output after normal commands */
296 bool fresh_message; /* Flush output after all messages */
298 bool compress_savefile; /* Compress messages in savefiles */
300 bool hilite_player; /* Hilite the player with the cursor */
302 bool view_yellow_lite; /* Use special colors for torch-lit grids */
303 bool view_bright_lite; /* Use special colors for 'viewable' grids */
305 bool view_granite_lite; /* Use special colors for wall grids (slow) */
306 bool view_special_lite; /* Use special colors for floor grids (slow) */
307 bool new_ascii_graphics;
312 bool always_show_list;
317 /* Cheating options */
319 bool cheat_peek; /* Peek into object creation */
320 bool cheat_hear; /* Peek into monster creation */
321 bool cheat_room; /* Peek into dungeon creation */
322 bool cheat_xtra; /* Peek into something else */
323 bool cheat_know; /* Know complete monster info */
324 bool cheat_live; /* Allow player to avoid death */
327 /* Special options */
329 byte hitpoint_warn; /* Hitpoint warning (0 to 9) */
331 byte delay_factor; /* Delay factor (0 to 9) */
333 bool autosave_l; /* Autosave before entering new levels */
334 bool autosave_t; /* Timed autosave */
335 s16b autosave_freq; /* Autosave frequency */
342 byte feeling; /* Most recent feeling */
343 s16b rating; /* Level's current rating */
345 bool good_item_flag; /* True if "Artifact" on this level */
347 bool closing_flag; /* Dungeon is closing */
354 s16b panel_row_min, panel_row_max;
355 s16b panel_col_min, panel_col_max;
356 s16b panel_col_prt, panel_row_prt;
359 * Player location in dungeon
365 * Targetting variables
380 * Current player's character name
382 char player_name[32];
385 * Stripped version of "player_name"
387 char player_base[32];
390 * What killed the player
395 * Hack -- Textual "history" for the Player
400 * Buffer to hold the current savefile name
401 * 'savefile' holds full path name. 'savefile_base' holds only base name.
404 char savefile_base[40];
407 * Array of grids lit by player lite (see "cave.c")
410 s16b lite_y[LITE_MAX];
411 s16b lite_x[LITE_MAX];
414 * Array of grids lit by player lite (see "cave.c")
417 s16b mon_lite_y[LITE_MAX];
418 s16b mon_lite_x[LITE_MAX];
421 * Array of grids viewable to the player (see "cave.c")
424 byte view_y[VIEW_MAX];
425 byte view_x[VIEW_MAX];
428 * Array of grids for use by various functions (see "cave.c")
431 byte temp_y[TEMP_MAX];
432 byte temp_x[TEMP_MAX];
436 * Number of active macros.
441 * Array of macro patterns [MACRO_MAX]
446 * Array of macro actions [MACRO_MAX]
451 * Array of macro types [MACRO_MAX]
456 * Current macro action [1024]
462 * The number of quarks
467 * The pointers to the quarks [QUARK_MAX]
473 * The next "free" index to use
478 * The index of the oldest message (none yet)
483 * The next "free" offset
488 * The offset to the oldest used char (none yet)
493 * The array of offsets, by index [MESSAGE_MAX]
498 * The array of chars, by offset [MESSAGE_BUF]
504 * The array of normal options
511 * The array of window options
518 * The array of window pointers
520 term *angband_term[8];
524 * Standard window names
526 char angband_term_name[8][16] =
540 * Global table of color definitions
542 byte angband_color_table[256][4] =
544 {0x00, 0x00, 0x00, 0x00}, /* TERM_DARK */
545 {0x00, 0xFF, 0xFF, 0xFF}, /* TERM_WHITE */
546 {0x00, 0x80, 0x80, 0x80}, /* TERM_SLATE */
547 {0x00, 0xFF, 0x80, 0x00}, /* TERM_ORANGE */
548 {0x00, 0xC0, 0x00, 0x00}, /* TERM_RED */
549 {0x00, 0x00, 0x80, 0x40}, /* TERM_GREEN */
550 {0x00, 0x00, 0x00, 0xFF}, /* TERM_BLUE */
551 {0x00, 0x80, 0x40, 0x00}, /* TERM_UMBER */
552 {0x00, 0x40, 0x40, 0x40}, /* TERM_L_DARK */
553 {0x00, 0xC0, 0xC0, 0xC0}, /* TERM_L_WHITE */
554 {0x00, 0xFF, 0x00, 0xFF}, /* TERM_VIOLET */
555 {0x00, 0xFF, 0xFF, 0x00}, /* TERM_YELLOW */
556 {0x00, 0xFF, 0x00, 0x00}, /* TERM_L_RED */
557 {0x00, 0x00, 0xFF, 0x00}, /* TERM_L_GREEN */
558 {0x00, 0x00, 0xFF, 0xFF}, /* TERM_L_BLUE */
559 {0x00, 0xC0, 0x80, 0x40} /* TERM_L_UMBER */
564 * Standard sound names
566 char angband_sound_name[SOUND_MAX][16] =
637 * The array of "cave grids" [MAX_WID][MAX_HGT].
638 * Not completely allocated, that would be inefficient
639 * Not completely hardcoded, that would overflow memory
641 cave_type *cave[MAX_HGT];
644 * The array of dungeon items [max_o_idx]
649 * The array of dungeon monsters [max_m_idx]
651 monster_type *m_list;
655 * Maximum number of towns
660 * The towns [max_towns]
666 * The player's inventory [INVEN_TOTAL]
668 object_type *inventory;
672 * The size of "alloc_kind_table" (at most max_k_idx * 4)
674 s16b alloc_kind_size;
677 * The entries in the "kind allocator table"
679 alloc_entry *alloc_kind_table;
683 * The size of "alloc_race_table" (at most max_r_idx)
685 s16b alloc_race_size;
688 * The entries in the "race allocator table"
690 alloc_entry *alloc_race_table;
694 * Specify attr/char pairs for visual special effects
695 * Be sure to use "index & 0x7F" to avoid illegal access
697 byte misc_to_attr[256];
698 char misc_to_char[256];
702 * Specify attr/char pairs for inventory items (by tval)
703 * Be sure to use "index & 0x7F" to avoid illegal access
705 byte tval_to_attr[128];
706 char tval_to_char[128];
710 * Keymaps for each "mode" associated with each keypress.
712 cptr keymap_act[KEYMAP_MODES][256];
716 /*** Player information ***/
719 * Static player info record
724 * Pointer to the player info
726 player_type *p_ptr = &p_body;
729 * Pointer to the player tables
730 * (sex, race, class, magic)
734 player_class *cp_ptr;
735 player_seikaku *ap_ptr;
736 player_magic *mp_ptr;
742 u32b spell_learned1; /* bit mask of spells learned */
743 u32b spell_learned2; /* bit mask of spells learned */
744 u32b spell_worked1; /* bit mask of spells tried and worked */
745 u32b spell_worked2; /* bit mask of spells tried and worked */
746 u32b spell_forgotten1; /* bit mask of spells learned but forgotten */
747 u32b spell_forgotten2; /* bit mask of spells learned but forgotten */
748 byte spell_order[64]; /* order spells learned/remembered/forgotten */
752 * Calculated base hp values for player at each level,
753 * store them so that drain life + restore life does not
754 * affect hit points. Also prevents shameless use of backup
755 * savefiles for hitpoint acquirement.
757 s16b player_hp[PY_MAX_LEVEL];
761 * The last character rolled,
762 * holded for quick start
764 birther previous_char;
768 * The vault generation arrays
784 player_magic *m_info;
789 * The terrain feature arrays
791 feature_type *f_info;
796 * The object kind arrays
803 * The artifact arrays
805 artifact_type *a_info;
810 * The ego-item arrays
812 ego_item_type *e_info;
818 * The monster race arrays
820 monster_race *r_info;
828 dungeon_info_type *d_info;
834 * Hack -- The special Angband "System Suffix"
835 * This variable is used to choose an appropriate "pref-xxx" file
837 cptr ANGBAND_SYS = "xxx";
840 * Hack -- The special Angband "Keyboard Suffix"
841 * This variable is used to choose an appropriate macro-trigger definition
844 cptr ANGBAND_KEYBOARD = "JAPAN";
846 cptr ANGBAND_KEYBOARD = "0";
850 * Hack -- The special Angband "Graphics Suffix"
851 * This variable is used to choose an appropriate "graf-xxx" file
853 cptr ANGBAND_GRAF = "ascii";
856 * Path name: The main "lib" directory
857 * This variable is not actually used anywhere in the code
862 * High score files (binary)
863 * These files may be portable between platforms
865 cptr ANGBAND_DIR_APEX;
868 * Bone files for player ghosts (ascii)
869 * These files are portable between platforms
871 cptr ANGBAND_DIR_BONE;
874 * Binary image files for the "*_info" arrays (binary)
875 * These files are not portable between platforms
877 cptr ANGBAND_DIR_DATA;
880 * Textual template files for the "*_info" arrays (ascii)
881 * These files are portable between platforms
883 cptr ANGBAND_DIR_EDIT;
887 * These files are portable between platforms.
889 cptr ANGBAND_DIR_SCRIPT;
892 * Various extra files (ascii)
893 * These files may be portable between platforms
895 cptr ANGBAND_DIR_FILE;
898 * Help files (normal) for the online help (ascii)
899 * These files are portable between platforms
901 cptr ANGBAND_DIR_HELP;
904 * Help files (spoilers) for the online help (ascii)
905 * These files are portable between platforms
907 cptr ANGBAND_DIR_INFO;
910 * Default user "preference" files (ascii)
911 * These files are rarely portable between platforms
913 cptr ANGBAND_DIR_PREF;
916 * Savefiles for current characters (binary)
917 * These files are portable between platforms
919 cptr ANGBAND_DIR_SAVE;
922 * User "preference" files (ascii)
923 * These files are rarely portable between platforms
925 cptr ANGBAND_DIR_USER;
928 * Various extra files (binary)
929 * These files are rarely portable between platforms
931 cptr ANGBAND_DIR_XTRA;
935 * Total Hack -- allow all items to be listed (even empty ones)
936 * This is only used by "do_cmd_inven_e()" and is cleared there.
938 bool item_tester_full;
940 bool item_tester_no_ryoute = FALSE;
943 * Here is a "pseudo-hook" used during calls to "get_item()" and
944 * "show_inven()" and "show_equip()", and the choice window routines.
946 byte item_tester_tval;
950 * Here is a "hook" used during calls to "get_item()" and
951 * "show_inven()" and "show_equip()", and the choice window routines.
953 bool (*item_tester_hook)(object_type*);
958 * Current "comp" function for ang_sort()
960 bool (*ang_sort_comp)(vptr u, vptr v, int a, int b);
964 * Current "swap" function for ang_sort()
966 void (*ang_sort_swap)(vptr u, vptr v, int a, int b);
971 * Hack -- function hooks to restrict "get_mon_num_prep()" function
973 monster_hook_type get_mon_num_hook;
974 monster_hook_type get_mon_num2_hook;
978 * Hack -- function hook to restrict "get_obj_num_prep()" function
980 bool (*get_obj_num_hook)(int k_idx);
983 /* Hack, monk armour */
984 bool monk_armour_aux;
985 bool monk_notify_aux;
987 #ifdef ALLOW_EASY_OPEN /* TNB */
989 #endif /* ALLOW_EASY_OPEN -- TNB */
991 #ifdef ALLOW_EASY_DISARM /* TNB */
993 #endif /* ALLOW_EASY_DISARM -- TNB */
995 #ifdef ALLOW_EASY_FLOOR /* TNB */
997 #endif /* ALLOW_EASY_FLOOR -- TNB */
1001 bool center_running;
1003 /* Auto-destruction options */
1013 bool record_fix_art;
1014 bool record_rand_art;
1015 bool record_destroy_uniq;
1016 bool record_fix_quest;
1017 bool record_rand_quest;
1018 bool record_maxdeapth;
1025 bool record_named_pet;
1026 char record_o_name[MAX_NLEN];
1032 wilderness_type **wilderness;
1038 building_type building[MAX_BLDG];
1042 * Maximum number of quests
1047 * Maximum number of monsters in r_info.txt
1052 * Maximum number of items in k_info.txt
1057 * Maximum number of vaults in v_info.txt
1062 * Maximum number of terrain features in f_info.txt
1067 * Maximum number of artifacts in a_info.txt
1072 * Maximum number of ego-items in e_info.txt
1077 * Maximum number of dungeon in e_info.txt
1082 * Maximum number of objects in the level
1087 * Maximum number of monsters in the level
1092 * Maximum size of the wilderness
1105 char quest_text[10][80];
1108 * Current line of the quest text
1110 int quest_text_line;
1113 * Default spell color table (quark index)
1115 s16b gf_color[MAX_GF];
1118 * Flags for initialization
1124 * The "highscore" file descriptor, if available.
1126 int highscore_fd = -1;
1128 int mutant_regenerate_mod = 100;
1134 bool vanilla_town; /* Use "vanilla" town without set quests */
1135 bool ironman_shops; /* Stores are permanently closed */
1136 bool ironman_small_levels; /* Always create unusually small dungeon levels */
1137 bool ironman_downward; /* Don't allow climbing upwards/recalling */
1138 bool ironman_autoscum; /* Permanently enable the autoscummer */
1139 bool lite_town; /* Use "lite" town without wilderness */
1140 bool ironman_empty_levels; /* Always create empty 'arena' levels */
1141 bool terrain_streams; /* Create terrain 'streamers' in the dungeon */
1142 bool munchkin_death; /* Ask for saving death */
1143 bool ironman_rooms; /* Always generate very unusual rooms */
1144 bool ironman_nightmare; /* Play the game in Nightmare mode */
1151 bool can_save = FALSE; /* Game can be saved */
1153 s16b spell_exp[64]; /* mahou keikenchi */
1155 s16b weapon_exp[5][64]; /* weapon keikenchi */
1157 s16b skill_exp[10]; /* ginou keikenchi */
1162 s16b mane_spell[MAX_MANE];
1163 s16b mane_dam[MAX_MANE];
1181 s16b kubi_r_idx[MAX_KUBI];
1184 monster_type party_mon[21];
1199 bool generate_encounter;
1201 cptr screen_dump = NULL;
1209 byte feat_wall_outer;
1210 byte feat_wall_inner;
1211 byte feat_wall_solid;
1212 byte floor_type[100], fill_type[100];
1219 bool chuukei_server;
1220 bool chuukei_client;