3 * @brief グローバル変数定義 / Angband variables
6 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke<br>
8 * This software may be copied and distributed for educational, research,<br>
9 * and not for profit purposes provided that this copyright and statement<br>
10 * are included in all such copies. Other copyrights may also apply.<br>
17 * Hack -- Link a copyright message into the executable
19 const cptr copyright[5] =
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; /*!< Angband設定ファイルのT: タグ情報から読み込んだ長いTコードを処理するために利用する文字列ポインタ */
31 cptr macro_modifier_chr; /*!< &x# で指定されるマクロトリガーに関する情報を記録する文字列ポインタ */
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 int level_up = 0; /*!< レベルアップの際に遅延してcalc_mana()関数上で上昇量を表示するかどうかの判定フラグ */
40 * 自動拾い/破壊設定のリストに関する変数 / List for auto-picker/destroyer entries
42 int max_autopick = 0; /*!< 現在登録している自動拾い/破壊設定の数 */
43 int max_max_autopick = 0; /*!< 自動拾い/破壊設定の限界数 */
44 autopick_type *autopick_list = NULL; /*!< 自動拾い/破壊設定構造体のポインタ配列 */
49 byte h_ver_major; /* Savefile version for Hengband 1.1.1 and later */
54 byte sf_extra; /* Savefile's encoding key */
56 byte z_major; /* Savefile version for Hengband */
61 * Savefile information
63 u32b sf_system; /* Operating system info */
64 u32b sf_when; /* Time when savefile created */
65 u16b sf_lives; /* Number of past "lives" with this file */
66 u16b sf_saves; /* Number of "saves" during this life */
71 bool arg_fiddle; /* Command arg -- Request fiddle mode */
72 bool arg_wizard; /* Command arg -- Request wizard mode */
73 bool arg_sound; /* Command arg -- Request special sounds */
74 bool arg_music; /* Command arg -- Request special musics */
75 byte arg_graphics; /* Command arg -- Request graphics mode */
76 bool arg_monochrome; /* Command arg -- Request monochrome mode */
77 bool arg_force_original; /* Command arg -- Request original keyset */
78 bool arg_force_roguelike; /* Command arg -- Request roguelike keyset */
79 bool arg_bigtile = FALSE; /* Command arg -- Request big tile mode */
84 bool character_generated; /* The character exists */
85 bool character_dungeon; /* The character has a dungeon */
86 bool character_loaded; /* The character was loaded from a savefile */
87 bool character_saved; /* The character was just saved to a savefile */
89 bool character_icky; /* The game is in an icky full screen mode */
90 bool character_xtra; /* The game is in an icky startup mode */
92 bool creating_savefile; /* New savefile is currently created */
94 u32b seed_flavor; /* Hack -- consistent object colors */
95 u32b seed_town; /* Hack -- consistent town layout */
97 s16b command_cmd; /* Current "Angband Command" */
99 COMMAND_ARG command_arg; /*!< 各種コマンドの汎用的な引数として扱う / Gives argument of current command */
100 COMMAND_NUM command_rep; /*!< 各種コマンドの汎用的なリピート数として扱う / Gives repetition of current command */
101 DIRECTION command_dir; /*!< 各種コマンドの汎用的な方向値処理として扱う/ Gives direction of current command */
103 s16b command_see; /* See "object1.c" */
104 s16b command_wrk; /* See "object1.c" */
106 TERM_LEN command_gap = 999; /* See "object1.c" */
108 s16b command_new; /* Command chaining from inven/equip view */
110 bool msg_flag; /* Used in msg_print() for "buffering" */
112 s16b running; /* Current counter for running, if any */
113 GAME_TURN resting; /* Current counter for resting, if any */
115 POSITION cur_hgt; /* Current dungeon height */
116 POSITION cur_wid; /* Current dungeon width */
117 DEPTH dun_level; /*!< 現在の実ダンジョン階層、base_levelの参照元となる / Current dungeon level */
118 MONSTER_NUMBER num_repro; /*!< Current reproducer count */
119 DEPTH base_level; /*!< 基本生成レベル、後述のobject_level, monster_levelの参照元となる / Base dungeon level */
120 DEPTH object_level; /*!< アイテムの生成レベル、base_levelを起点に一時変更する時に参照 / Current object creation level */
121 DEPTH monster_level; /*!< モンスターの生成レベル、base_levelを起点に一時変更する時に参照 / Current monster creation level */
122 bool invoking_midnight_curse; /*!< 悪夢モード時の真夜中太古の呪い発生処理フラグ */
124 GAME_TURN turn; /*!< 画面表示上のゲーム時間基準となるターン / Current game turn */
125 GAME_TURN turn_limit; /*!< turnの最大値 / Limit of game turn */
126 GAME_TURN dungeon_turn; /*!< NASTY生成の計算に関わる内部ターン値 / Game turn in dungeon */
127 GAME_TURN dungeon_turn_limit; /*!< dungeon_turnの最大値 / Limit of game turn in dungeon */
128 GAME_TURN old_turn; /* Turn when level began */
129 GAME_TURN old_battle;
131 bool use_sound; /* The "sound" mode is enabled */
132 bool use_music; /* The "music" mode is enabled */
133 bool use_graphics; /* The "graphics" mode is enabled */
134 bool use_bigtile = FALSE;
136 s16b signal_count; /* Hack -- Count interupts */
138 bool inkey_base; /* See the "inkey()" function */
139 bool inkey_xtra; /* See the "inkey()" function */
140 bool inkey_scan; /* See the "inkey()" function */
141 bool inkey_flag; /* See the "inkey()" function */
142 bool get_com_no_macros = FALSE; /* Expand macros in "get_com" or not */
144 OBJECT_SUBTYPE_VALUE coin_type; /* Hack -- force coin type */
146 bool opening_chest; /* Hack -- prevent chest generation */
148 bool shimmer_monsters; /* Hack -- optimize multi-hued monsters */
149 bool shimmer_objects; /* Hack -- optimize multi-hued objects */
151 bool repair_monsters; /* Hack -- optimize detect monsters */
152 bool repair_objects; /* Hack -- optimize detect objects */
154 bool is_loading_now; /*!< ロード直後にcalc_bonus()時の徳変化、及びsanity_blast()による異常を抑止する */
157 s16b inven_cnt; /* Number of items in inventory */
158 s16b equip_cnt; /* Number of items in equipment */
160 s16b o_max = 1; /* Number of allocated objects */
161 s16b o_cnt = 0; /* Number of live objects */
163 MONSTER_IDX m_max = 1; /* Number of allocated monsters */
164 MONSTER_IDX m_cnt = 0; /* Number of live monsters */
166 MONSTER_IDX hack_m_idx = 0; /* Hack -- see "process_monsters()" */
167 MONSTER_IDX hack_m_idx_ii = 0;
168 bool multi_rew = FALSE;
169 char summon_kin_type; /* Hack, by Julian Lighton: summon 'relatives' */
171 int total_friends = 0;
172 s32b friend_align = 0;
174 int leaving_quest = 0;
175 bool reinit_wilderness = FALSE;
183 bool closing_flag; /* Dungeon is closing */
190 POSITION panel_row_min, panel_row_max;
191 POSITION panel_col_min, panel_col_max;
192 POSITION panel_col_prt, panel_row_prt;
196 * Targetting variables
211 * Stripped version of "player_name"
213 char player_base[32];
217 * Buffer to hold the current savefile name
218 * 'savefile' holds full path name. 'savefile_base' holds only base name.
221 char savefile_base[40];
223 POSITION_IDX lite_n; //!< Array of grids lit by player lite (see "cave.c")
224 POSITION lite_y[LITE_MAX];
225 POSITION lite_x[LITE_MAX];
227 POSITION_IDX mon_lite_n; //!< Array of grids lit by player lite (see "cave.c")
228 POSITION mon_lite_y[MON_LITE_MAX];
229 POSITION mon_lite_x[MON_LITE_MAX];
231 POSITION_IDX view_n; //!< Array of grids viewable to the player (see "cave.c")
232 POSITION view_y[VIEW_MAX];
233 POSITION view_x[VIEW_MAX];
235 POSITION_IDX temp_n; //!< Array of grids for use by various functions (see "cave.c")
236 POSITION temp_y[TEMP_MAX];
237 POSITION temp_x[TEMP_MAX];
239 POSITION_IDX redraw_n = 0; //!< Array of grids for delayed visual updating (see "cave.c")
240 POSITION redraw_y[REDRAW_MAX];
241 POSITION redraw_x[REDRAW_MAX];
245 * Number of active macros.
250 * Array of macro patterns [MACRO_MAX]
255 * Array of macro actions [MACRO_MAX]
260 * Array of macro types [MACRO_MAX]
265 * Current macro action [1024]
271 * The number of quarks
273 STR_OFFSET quark__num;
276 * The pointers to the quarks [QUARK_MAX]
282 * The next "free" index to use
287 * The index of the oldest message (none yet)
292 * The next "free" offset
297 * The offset to the oldest used char (none yet)
302 * The array of offsets, by index [MESSAGE_MAX]
307 * The array of chars, by offset [MESSAGE_BUF]
311 BIT_FLAGS option_flag[8]; //!< The array of normal options
312 BIT_FLAGS option_mask[8]; //!< The array of normal options
313 BIT_FLAGS window_flag[8]; //!< The array of window options
314 BIT_FLAGS window_mask[8]; //!< The array of window options
317 * The array of window pointers
319 term *angband_term[8];
322 * Standard window names
324 const char angband_term_name[8][16] =
338 * Global table of color definitions
340 byte angband_color_table[256][4] =
342 {0x00, 0x00, 0x00, 0x00}, /* TERM_DARK */
343 {0x00, 0xFF, 0xFF, 0xFF}, /* TERM_WHITE */
344 {0x00, 0x80, 0x80, 0x80}, /* TERM_SLATE */
345 {0x00, 0xFF, 0x80, 0x00}, /* TERM_ORANGE */
346 {0x00, 0xC0, 0x00, 0x00}, /* TERM_RED */
347 {0x00, 0x00, 0x80, 0x40}, /* TERM_GREEN */
348 {0x00, 0x00, 0x00, 0xFF}, /* TERM_BLUE */
349 {0x00, 0x80, 0x40, 0x00}, /* TERM_UMBER */
350 {0x00, 0x40, 0x40, 0x40}, /* TERM_L_DARK */
351 {0x00, 0xC0, 0xC0, 0xC0}, /* TERM_L_WHITE */
352 {0x00, 0xFF, 0x00, 0xFF}, /* TERM_VIOLET */
353 {0x00, 0xFF, 0xFF, 0x00}, /* TERM_YELLOW */
354 {0x00, 0xFF, 0x00, 0x00}, /* TERM_L_RED */
355 {0x00, 0x00, 0xFF, 0x00}, /* TERM_L_GREEN */
356 {0x00, 0x00, 0xFF, 0xFF}, /* TERM_L_BLUE */
357 {0x00, 0xC0, 0x80, 0x40} /* TERM_L_UMBER */
362 * Standard sound names
364 const cptr angband_sound_name[SOUND_MAX] =
436 * Standard music names
438 const cptr angband_music_basic_name[MUSIC_BASIC_MAX] =
465 * The array of "cave grids" [MAX_WID][MAX_HGT].
466 * Not completely allocated, that would be inefficient
467 * Not completely hardcoded, that would overflow memory
469 cave_type *cave[MAX_HGT];
473 * The array of saved floors
475 saved_floor_type saved_floors[MAX_SAVED_FLOORS];
479 * Number of floor_id used from birth
485 * Sign for current process used in temporal files.
486 * Actually it is the start time of current process.
488 u32b saved_floor_file_sign;
492 * The array of dungeon items [max_o_idx]
497 * The array of dungeon monsters [max_m_idx]
499 monster_type *m_list;
502 * The array to process dungeon monsters [max_m_idx]
504 s16b *mproc_list[MAX_MTIMED];
505 s16b mproc_max[MAX_MTIMED]; /* Number of monsters to be processed */
509 * Maximum number of towns
514 * The towns [max_towns]
520 * The player's inventory [INVEN_TOTAL]
522 object_type *inventory;
526 * The size of "alloc_kind_table" (at most max_k_idx * 4)
528 s16b alloc_kind_size;
531 * The entries in the "kind allocator table"
533 alloc_entry *alloc_kind_table;
537 * The size of "alloc_race_table" (at most max_r_idx)
539 s16b alloc_race_size;
542 * The entries in the "race allocator table"
544 alloc_entry *alloc_race_table;
548 * Specify attr/char pairs for visual special effects
549 * Be sure to use "index & 0x7F" to avoid illegal access
551 TERM_COLOR misc_to_attr[256];
552 char misc_to_char[256];
556 * Specify attr/char pairs for inventory items (by tval)
557 * Be sure to use "index & 0x7F" to avoid illegal access
559 TERM_COLOR tval_to_attr[128];
560 char tval_to_char[128];
564 * Keymaps for each "mode" associated with each keypress.
566 cptr keymap_act[KEYMAP_MODES][256];
570 /*** Player information ***/
573 * Static player info record
578 * Pointer to the player info
580 player_type *p_ptr = &p_body;
583 * Pointer to the player tables
584 * (sex, race, class, magic)
586 const player_sex *sp_ptr;
587 const player_race *rp_ptr;
588 const player_class *cp_ptr;
589 const player_seikaku *ap_ptr;
590 const player_magic *mp_ptr;
594 * The last character rolled,
595 * holded for quick start
597 birther previous_char;
601 * The vault generation arrays
615 player_magic *m_info;
618 * The terrain feature arrays
620 feature_type *f_info;
625 * The object kind arrays
632 * The artifact arrays
634 artifact_type *a_info;
639 * The ego-item arrays
641 ego_item_type *e_info;
647 * The monster race arrays
649 monster_race *r_info;
657 dungeon_info_type *d_info;
662 cptr ANGBAND_SYS = "xxx"; //!< Hack -- The special Angband "System Suffix" This variable is used to choose an appropriate "pref-xxx" file
666 cptr ANGBAND_KEYBOARD = "JAPAN"; //!< Hack -- The special Angband "Keyboard Suffix" This variable is used to choose an appropriate macro-trigger definition
668 cptr ANGBAND_KEYBOARD = "0";
671 cptr ANGBAND_GRAF = "ascii"; //!< Hack -- The special Angband "Graphics Suffix" This variable is used to choose an appropriate "graf-xxx" file
672 cptr ANGBAND_DIR; //!< Path name: The main "lib" directory This variable is not actually used anywhere in the code
673 cptr ANGBAND_DIR_APEX; //!< High score files (binary) These files may be portable between platforms
674 cptr ANGBAND_DIR_BONE; //!< Bone files for player ghosts (ascii) These files are portable between platforms
675 cptr ANGBAND_DIR_DATA; //!< Binary image files for the "*_info" arrays (binary) These files are not portable between platforms
676 cptr ANGBAND_DIR_EDIT; //!< Textual template files for the "*_info" arrays (ascii) These files are portable between platforms
677 cptr ANGBAND_DIR_SCRIPT; //!< Script files These files are portable between platforms.
678 cptr ANGBAND_DIR_FILE; //!< Various extra files (ascii) These files may be portable between platforms
679 cptr ANGBAND_DIR_HELP; //!< Help files (normal) for the online help (ascii) These files are portable between platforms
680 cptr ANGBAND_DIR_INFO; //!< Help files (spoilers) for the online help (ascii) These files are portable between platforms
681 cptr ANGBAND_DIR_PREF; //!< Default user "preference" files (ascii) These files are rarely portable between platforms
682 cptr ANGBAND_DIR_SAVE; //!< Savefiles for current characters (binary)
683 cptr ANGBAND_DIR_USER; //!< User "preference" files (ascii) These files are rarely portable between platforms
684 cptr ANGBAND_DIR_XTRA; //!< Various extra files (binary) These files are rarely portable between platforms
685 bool item_tester_full; //!< Total Hack -- allow all items to be listed (even empty ones) This is only used by "do_cmd_inven_e()" and is cleared there.
687 bool item_tester_no_ryoute = FALSE;
690 * Here is a "pseudo-hook" used during calls to "get_item()" and
691 * "show_inven()" and "show_equip()", and the choice window routines.
693 OBJECT_TYPE_VALUE item_tester_tval;
697 * Here is a "hook" used during calls to "get_item()" and
698 * "show_inven()" and "show_equip()", and the choice window routines.
700 bool (*item_tester_hook)(object_type*);
705 * Current "comp" function for ang_sort()
707 bool (*ang_sort_comp)(vptr u, vptr v, int a, int b);
711 * Current "swap" function for ang_sort()
713 void (*ang_sort_swap)(vptr u, vptr v, int a, int b);
718 * Hack -- function hooks to restrict "get_mon_num_prep()" function
720 monster_hook_type get_mon_num_hook;
721 monster_hook_type get_mon_num2_hook;
725 * Hack -- function hook to restrict "get_obj_num_prep()" function
727 bool (*get_obj_num_hook)(KIND_OBJECT_IDX k_idx);
730 /* Hack, monk armour */
731 bool monk_armour_aux;
732 bool monk_notify_aux;
738 wilderness_type **wilderness;
744 building_type building[MAX_BLDG];
748 * Maximum number of quests
753 * Maximum number of monsters in r_info.txt
755 MONRACE_IDX max_r_idx;
758 * Maximum number of items in k_info.txt
760 KIND_OBJECT_IDX max_k_idx;
763 * Maximum number of vaults in v_info.txt
768 * Maximum number of terrain features in f_info.txt
773 * Maximum number of artifacts in a_info.txt
775 ARTIFACT_IDX max_a_idx;
778 * Maximum number of ego-items in e_info.txt
783 * Maximum number of dungeon in e_info.txt
785 DUNGEON_IDX max_d_idx;
788 * Maximum number of objects in the level
790 OBJECT_IDX max_o_idx;
793 * Maximum number of monsters in the level
795 MONSTER_IDX max_m_idx;
798 * Maximum size of the wilderness
811 char quest_text[10][80];
814 * Current line of the quest text
819 * Default spell color table (quark index)
821 s16b gf_color[MAX_GF];
824 * Flags for initialization
830 * The "highscore" file descriptor, if available.
832 int highscore_fd = -1;
834 int mutant_regenerate_mod = 100;
836 bool can_save = FALSE; /* Game can be saved */
845 STR_OFFSET cap_nickname;
847 MONRACE_IDX battle_mon[4];
853 MONSTER_IDX pet_t_m_idx;
854 MONSTER_IDX riding_t_m_idx;
856 MONSTER_IDX kubi_r_idx[MAX_KUBI];
857 MONSTER_IDX today_mon;
870 bool generate_encounter;
872 cptr screen_dump = NULL;
874 /*** Terrain feature variables ***/
884 FEAT_IDX feat_explosive_rune;
885 FEAT_IDX feat_mirror;
888 door_type feat_door[MAX_DOOR_TYPES];
891 FEAT_IDX feat_up_stair;
892 FEAT_IDX feat_down_stair;
893 FEAT_IDX feat_entrance;
896 FEAT_IDX feat_trap_open;
897 FEAT_IDX feat_trap_armageddon;
898 FEAT_IDX feat_trap_piranha;
901 FEAT_IDX feat_rubble;
904 FEAT_IDX feat_magma_vein;
905 FEAT_IDX feat_quartz_vein;
908 FEAT_IDX feat_granite;
909 FEAT_IDX feat_permanent;
912 FEAT_IDX feat_glass_floor;
915 FEAT_IDX feat_glass_wall;
916 FEAT_IDX feat_permanent_glass_wall;
919 FEAT_IDX feat_pattern_start;
920 FEAT_IDX feat_pattern_1;
921 FEAT_IDX feat_pattern_2;
922 FEAT_IDX feat_pattern_3;
923 FEAT_IDX feat_pattern_4;
924 FEAT_IDX feat_pattern_end;
925 FEAT_IDX feat_pattern_old;
926 FEAT_IDX feat_pattern_exit;
927 FEAT_IDX feat_pattern_corrupted;
930 FEAT_IDX feat_black_market;
934 FEAT_IDX feat_deep_water;
935 FEAT_IDX feat_shallow_water;
936 FEAT_IDX feat_deep_lava;
937 FEAT_IDX feat_shallow_lava;
940 FEAT_IDX feat_flower;
943 FEAT_IDX feat_mountain;
946 /* Unknown grid (not detected) */
947 FEAT_IDX feat_undetected;
952 DUNGEON_IDX dungeon_type;
955 FEAT_IDX feat_wall_outer;
956 FEAT_IDX feat_wall_inner;
957 FEAT_IDX feat_wall_solid;
958 FEAT_IDX floor_type[100], fill_type[100];
961 COMMAND_CODE now_message;
980 int snipe_type = SP_NONE;
981 bool reset_concent = FALSE; /* Concentration reset flag */
982 bool is_fired = FALSE;