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 concptr 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."
28 int max_macrotrigger = 0; /*!< 現在登録中のマクロ(トリガー)の数 */
29 concptr macro_template = NULL; /*!< Angband設定ファイルのT: タグ情報から読み込んだ長いTコードを処理するために利用する文字列ポインタ */
30 concptr macro_modifier_chr; /*!< &x# で指定されるマクロトリガーに関する情報を記録する文字列ポインタ */
31 concptr macro_modifier_name[MAX_MACRO_MOD]; /*!< マクロ上で取り扱う特殊キーを文字列上で表現するためのフォーマットを記録した文字列ポインタ配列 */
32 concptr macro_trigger_name[MAX_MACRO_TRIG]; /*!< マクロのトリガーコード */
33 concptr macro_trigger_keycode[2][MAX_MACRO_TRIG]; /*!< マクロの内容 */
35 int level_up = 0; /*!< レベルアップの際に遅延してcalc_mana()関数上で上昇量を表示するかどうかの判定フラグ */
39 * 自動拾い/破壊設定のリストに関する変数 / List for auto-picker/destroyer entries
41 int max_autopick = 0; /*!< 現在登録している自動拾い/破壊設定の数 */
42 int max_max_autopick = 0; /*!< 自動拾い/破壊設定の限界数 */
43 autopick_type *autopick_list = NULL; /*!< 自動拾い/破壊設定構造体のポインタ配列 */
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 bool arg_music; /* Command arg -- Request special musics */
74 byte arg_graphics; /* Command arg -- Request graphics mode */
75 bool arg_monochrome; /* Command arg -- Request monochrome mode */
76 bool arg_force_original; /* Command arg -- Request original keyset */
77 bool arg_force_roguelike; /* Command arg -- Request roguelike keyset */
78 bool arg_bigtile = FALSE; /* Command arg -- Request big tile mode */
83 bool character_generated; /* The character exists */
84 bool character_dungeon; /* The character has a dungeon */
85 bool character_loaded; /* The character was loaded from a savefile */
86 bool character_saved; /* The character was just saved to a savefile */
88 bool character_icky; /* The game is in an icky full screen mode */
89 bool character_xtra; /* The game is in an icky startup mode */
91 bool creating_savefile; /* New savefile is currently created */
93 u32b seed_flavor; /* Hack -- consistent object colors */
94 u32b seed_town; /* Hack -- consistent town layout */
96 s16b command_cmd; /* Current "Angband Command" */
98 COMMAND_ARG command_arg; /*!< 各種コマンドの汎用的な引数として扱う / Gives argument of current command */
99 COMMAND_NUM command_rep; /*!< 各種コマンドの汎用的なリピート数として扱う / Gives repetition of current command */
100 DIRECTION command_dir; /*!< 各種コマンドの汎用的な方向値処理として扱う/ Gives direction of current command */
102 s16b command_see; /* See "object1.c" */
103 s16b command_wrk; /* See "object1.c" */
105 TERM_LEN command_gap = 999; /* See "object1.c" */
107 s16b command_new; /* Command chaining from inven/equip view */
109 bool msg_flag; /* Used in msg_print() for "buffering" */
111 s16b running; /* Current counter for running, if any */
112 GAME_TURN resting; /* Current counter for resting, if any */
114 POSITION cur_hgt; /* Current dungeon height */
115 POSITION cur_wid; /* Current dungeon width */
116 MONSTER_NUMBER num_repro; /*!< Current reproducer count */
117 DEPTH object_level; /*!< アイテムの生成レベル、current_floor_ptr->base_levelを起点に一時変更する時に参照 / Current object creation level */
118 DEPTH monster_level; /*!< モンスターの生成レベル、current_floor_ptr->base_levelを起点に一時変更する時に参照 / Current monster creation level */
119 bool invoking_midnight_curse; /*!< 悪夢モード時の真夜中太古の呪い発生処理フラグ */
121 GAME_TURN turn; /*!< 画面表示上のゲーム時間基準となるターン / Current game turn */
122 GAME_TURN turn_limit; /*!< turnの最大値 / Limit of game turn */
123 GAME_TURN dungeon_turn; /*!< NASTY生成の計算に関わる内部ターン値 / Game turn in dungeon */
124 GAME_TURN dungeon_turn_limit; /*!< dungeon_turnの最大値 / Limit of game turn in dungeon */
125 GAME_TURN old_turn; /* Turn when level began */
126 GAME_TURN old_battle;
128 bool use_sound; /* The "sound" mode is enabled */
129 bool use_music; /* The "music" mode is enabled */
130 bool use_graphics; /* The "graphics" mode is enabled */
131 bool use_bigtile = FALSE;
133 s16b signal_count; /* Hack -- Count interupts */
135 bool inkey_base; /* See the "inkey()" function */
136 bool inkey_xtra; /* See the "inkey()" function */
137 bool inkey_scan; /* See the "inkey()" function */
138 bool inkey_flag; /* See the "inkey()" function */
139 bool get_com_no_macros = FALSE; /* Expand macros in "get_com" or not */
141 OBJECT_SUBTYPE_VALUE coin_type; /* Hack -- force coin type */
143 bool opening_chest; /* Hack -- prevent chest generation */
145 bool shimmer_monsters; /* Hack -- optimize multi-hued monsters */
146 bool shimmer_objects; /* Hack -- optimize multi-hued objects */
148 bool repair_monsters; /* Hack -- optimize detect monsters */
149 bool repair_objects; /* Hack -- optimize detect objects */
151 bool is_loading_now; /*!< ロード直後にcalc_bonus()時の徳変化、及びsanity_blast()による異常を抑止する */
154 s16b inven_cnt; /* Number of items in inventory */
155 s16b equip_cnt; /* Number of items in equipment */
157 OBJECT_IDX o_max = 1; /* Number of allocated objects */
158 OBJECT_IDX o_cnt = 0; /* Number of live objects */
160 MONSTER_IDX m_max = 1; /* Number of allocated monsters */
161 MONSTER_IDX m_cnt = 0; /* Number of live monsters */
163 MONSTER_IDX hack_m_idx = 0; /* Hack -- see "process_monsters()" */
164 MONSTER_IDX hack_m_idx_ii = 0;
165 bool multi_rew = FALSE;
166 char summon_kin_type; /* Hack, by Julian Lighton: summon 'relatives' */
168 int total_friends = 0;
169 s32b friend_align = 0;
171 int leaving_quest = 0;
172 bool reinit_wilderness = FALSE;
180 bool closing_flag; /* Dungeon is closing */
187 POSITION panel_row_min, panel_row_max;
188 POSITION panel_col_min, panel_col_max;
189 POSITION panel_col_prt, panel_row_prt;
193 * Targetting variables
195 MONSTER_IDX target_who;
208 * Stripped version of "player_name"
210 char player_base[32];
214 * Buffer to hold the current savefile name
215 * 'savefile' holds full path name. 'savefile_base' holds only base name.
218 char savefile_base[40];
220 POSITION_IDX lite_n; //!< Array of grids lit by player lite (see "current_floor_ptr->grid_array.c")
221 POSITION lite_y[LITE_MAX];
222 POSITION lite_x[LITE_MAX];
224 POSITION_IDX mon_lite_n; //!< Array of grids lit by player lite (see "current_floor_ptr->grid_array.c")
225 POSITION mon_lite_y[MON_LITE_MAX];
226 POSITION mon_lite_x[MON_LITE_MAX];
228 POSITION_IDX view_n; //!< Array of grids viewable to the player (see "current_floor_ptr->grid_array.c")
229 POSITION view_y[VIEW_MAX];
230 POSITION view_x[VIEW_MAX];
232 POSITION_IDX temp_n; //!< Array of grids for use by various functions (see "current_floor_ptr->grid_array.c")
233 POSITION temp_y[TEMP_MAX];
234 POSITION temp_x[TEMP_MAX];
236 POSITION_IDX redraw_n = 0; //!< Array of grids for delayed visual updating (see "current_floor_ptr->grid_array.c")
237 POSITION redraw_y[REDRAW_MAX];
238 POSITION redraw_x[REDRAW_MAX];
242 * Number of active macros.
247 * Array of macro patterns [MACRO_MAX]
252 * Array of macro actions [MACRO_MAX]
257 * Array of macro types [MACRO_MAX]
262 * Current macro action [1024]
268 * The number of quarks
270 STR_OFFSET quark__num;
273 * The pointers to the quarks [QUARK_MAX]
279 * The next "free" index to use
284 * The index of the oldest message (none yet)
289 * The next "free" offset
294 * The offset to the oldest used char (none yet)
299 * The array of offsets, by index [MESSAGE_MAX]
304 * The array of chars, by offset [MESSAGE_BUF]
308 BIT_FLAGS option_flag[8]; //!< The array of normal options
309 BIT_FLAGS option_mask[8]; //!< The array of normal options
310 BIT_FLAGS window_flag[8]; //!< The array of window options
311 BIT_FLAGS window_mask[8]; //!< The array of window options
314 * The array of window pointers
316 term *angband_term[8];
319 * Standard window names
321 const char angband_term_name[8][16] =
335 * Global table of color definitions
337 byte angband_color_table[256][4] =
339 {0x00, 0x00, 0x00, 0x00}, /* TERM_DARK */
340 {0x00, 0xFF, 0xFF, 0xFF}, /* TERM_WHITE */
341 {0x00, 0x80, 0x80, 0x80}, /* TERM_SLATE */
342 {0x00, 0xFF, 0x80, 0x00}, /* TERM_ORANGE */
343 {0x00, 0xC0, 0x00, 0x00}, /* TERM_RED */
344 {0x00, 0x00, 0x80, 0x40}, /* TERM_GREEN */
345 {0x00, 0x00, 0x00, 0xFF}, /* TERM_BLUE */
346 {0x00, 0x80, 0x40, 0x00}, /* TERM_UMBER */
347 {0x00, 0x40, 0x40, 0x40}, /* TERM_L_DARK */
348 {0x00, 0xC0, 0xC0, 0xC0}, /* TERM_L_WHITE */
349 {0x00, 0xFF, 0x00, 0xFF}, /* TERM_VIOLET */
350 {0x00, 0xFF, 0xFF, 0x00}, /* TERM_YELLOW */
351 {0x00, 0xFF, 0x00, 0x00}, /* TERM_L_RED */
352 {0x00, 0x00, 0xFF, 0x00}, /* TERM_L_GREEN */
353 {0x00, 0x00, 0xFF, 0xFF}, /* TERM_L_BLUE */
354 {0x00, 0xC0, 0x80, 0x40} /* TERM_L_UMBER */
359 * Standard sound names
361 const concptr angband_sound_name[SOUND_MAX] =
433 * Standard music names
435 const concptr angband_music_basic_name[MUSIC_BASIC_MAX] =
462 * The array of "current_floor_ptr->grid_array grids" [MAX_WID][MAX_HGT].
463 * Not completely allocated, that would be inefficient
464 * Not completely hardcoded, that would overflow memory
467 floor_type *current_floor_ptr = &floor;
472 * The array of saved floors
474 saved_floor_type saved_floors[MAX_SAVED_FLOORS];
478 * Number of floor_id used from birth
480 FLOOR_IDX max_floor_id;
484 * Sign for current process used in temporal files.
485 * Actually it is the start time of current process.
487 u32b saved_floor_file_sign;
491 * The array of dungeon items [max_o_idx]
496 * The array of dungeon monsters [max_m_idx]
498 monster_type *m_list;
501 * The array to process dungeon monsters [max_m_idx]
503 s16b *mproc_list[MAX_MTIMED];
504 s16b mproc_max[MAX_MTIMED]; /* Number of monsters to be processed */
508 * Maximum number of towns
513 * The towns [max_towns]
515 town_type *town_info;
519 * The player's inventory [INVEN_TOTAL]
521 object_type *inventory;
525 * The size of "alloc_kind_table" (at most max_k_idx * 4)
527 s16b alloc_kind_size;
530 * The entries in the "kind allocator table"
532 alloc_entry *alloc_kind_table;
536 * The size of "alloc_race_table" (at most max_r_idx)
538 s16b alloc_race_size;
541 * The entries in the "race allocator table"
543 alloc_entry *alloc_race_table;
547 * Specify attr/char pairs for visual special effects
548 * Be sure to use "index & 0x7F" to avoid illegal access
550 TERM_COLOR misc_to_attr[256];
551 char misc_to_char[256];
555 * Specify attr/char pairs for inventory items (by tval)
556 * Be sure to use "index & 0x7F" to avoid illegal access
558 TERM_COLOR tval_to_attr[128];
559 char tval_to_char[128];
563 * Keymaps for each "mode" associated with each keypress.
565 concptr keymap_act[KEYMAP_MODES][256];
569 /*** Player information ***/
572 * Static player info record
577 * Pointer to the player info
579 player_type *p_ptr = &p_body;
582 * Pointer to the player tables
583 * (sex, race, class, magic)
585 const player_sex *sp_ptr;
586 const player_race *rp_ptr;
587 const player_class *cp_ptr;
588 const player_seikaku *ap_ptr;
589 const player_magic *mp_ptr;
593 * The last character rolled,
594 * holded for quick start
596 birther previous_char;
600 * The vault generation arrays
614 player_magic *m_info;
617 * The terrain feature arrays
619 feature_type *f_info;
624 * The object kind arrays
631 * The artifact arrays
633 artifact_type *a_info;
638 * The ego-item arrays
640 ego_item_type *e_info;
646 * The monster race arrays
648 monster_race *r_info;
656 dungeon_type *d_info;
661 concptr ANGBAND_SYS = "xxx"; //!< Hack -- The special Angband "System Suffix" This variable is used to choose an appropriate "pref-xxx" file
665 concptr ANGBAND_KEYBOARD = "JAPAN"; //!< Hack -- The special Angband "Keyboard Suffix" This variable is used to choose an appropriate macro-trigger definition
667 concptr ANGBAND_KEYBOARD = "0";
670 concptr ANGBAND_GRAF = "ascii"; //!< Hack -- The special Angband "Graphics Suffix" This variable is used to choose an appropriate "graf-xxx" file
671 concptr ANGBAND_DIR; //!< Path name: The main "lib" directory This variable is not actually used anywhere in the code
672 concptr ANGBAND_DIR_APEX; //!< High score files (binary) These files may be portable between platforms
673 concptr ANGBAND_DIR_BONE; //!< Bone files for player ghosts (ascii) These files are portable between platforms
674 concptr ANGBAND_DIR_DATA; //!< Binary image files for the "*_info" arrays (binary) These files are not portable between platforms
675 concptr ANGBAND_DIR_EDIT; //!< Textual template files for the "*_info" arrays (ascii) These files are portable between platforms
676 concptr ANGBAND_DIR_SCRIPT; //!< Script files These files are portable between platforms.
677 concptr ANGBAND_DIR_FILE; //!< Various extra files (ascii) These files may be portable between platforms
678 concptr ANGBAND_DIR_HELP; //!< Help files (normal) for the online help (ascii) These files are portable between platforms
679 concptr ANGBAND_DIR_INFO; //!< Help files (spoilers) for the online help (ascii) These files are portable between platforms
680 concptr ANGBAND_DIR_PREF; //!< Default user "preference" files (ascii) These files are rarely portable between platforms
681 concptr ANGBAND_DIR_SAVE; //!< Savefiles for current characters (binary)
682 concptr ANGBAND_DIR_USER; //!< User "preference" files (ascii) These files are rarely portable between platforms
683 concptr ANGBAND_DIR_XTRA; //!< Various extra files (binary) These files are rarely portable between platforms
687 * Here is a "pseudo-hook" used during calls to "get_item()" and
688 * "show_inven()" and "show_equip()", and the choice window routines.
690 OBJECT_TYPE_VALUE item_tester_tval;
694 * Here is a "hook" used during calls to "get_item()" and
695 * "show_inven()" and "show_equip()", and the choice window routines.
697 bool (*item_tester_hook)(object_type*);
702 * Current "comp" function for ang_sort()
704 bool (*ang_sort_comp)(vptr u, vptr v, int a, int b);
708 * Current "swap" function for ang_sort()
710 void (*ang_sort_swap)(vptr u, vptr v, int a, int b);
715 * Hack -- function hooks to restrict "get_mon_num_prep()" function
717 monsterrace_hook_type get_mon_num_hook;
718 monsterrace_hook_type get_mon_num2_hook;
722 * Hack -- function hook to restrict "get_obj_num_prep()" function
724 bool (*get_obj_num_hook)(KIND_OBJECT_IDX k_idx);
730 wilderness_type **wilderness;
736 building_type building[MAX_BLDG];
740 * Maximum number of quests
745 * Maximum number of monsters in r_info.txt
747 MONRACE_IDX max_r_idx;
750 * Maximum number of items in k_info.txt
752 KIND_OBJECT_IDX max_k_idx;
755 * Maximum number of vaults in v_info.txt
760 * Maximum number of terrain features in f_info.txt
765 * Maximum number of artifacts in a_info.txt
767 ARTIFACT_IDX max_a_idx;
770 * Maximum number of ego-items in e_info.txt
775 * Maximum number of dungeon in e_info.txt
777 DUNGEON_IDX max_d_idx;
780 * Maximum number of objects in the level
782 OBJECT_IDX max_o_idx;
785 * Maximum number of monsters in the level
787 MONSTER_IDX max_m_idx;
790 * Maximum size of the wilderness
803 char quest_text[10][80];
806 * Current line of the quest text
811 * Default spell color table (quark index)
813 s16b gf_color[MAX_GF];
816 * Flags for initialization
822 * The "highscore" file descriptor, if available.
824 int highscore_fd = -1;
826 int mutant_regenerate_mod = 100;
828 bool can_save = FALSE; /* Game can be saved */
836 STR_OFFSET cap_nickname;
838 MONRACE_IDX battle_mon[4];
844 MONSTER_IDX pet_t_m_idx;
845 MONSTER_IDX riding_t_m_idx;
847 MONSTER_IDX kubi_r_idx[MAX_KUBI];
848 MONSTER_IDX today_mon;
861 bool generate_encounter;
863 concptr screen_dump = NULL;
865 /*** Terrain feature variables ***/
875 FEAT_IDX feat_explosive_rune;
876 FEAT_IDX feat_mirror;
879 FEAT_IDX feat_up_stair;
880 FEAT_IDX feat_down_stair;
881 FEAT_IDX feat_entrance;
884 FEAT_IDX feat_trap_open;
885 FEAT_IDX feat_trap_armageddon;
886 FEAT_IDX feat_trap_piranha;
889 FEAT_IDX feat_rubble;
892 FEAT_IDX feat_magma_vein;
893 FEAT_IDX feat_quartz_vein;
896 FEAT_IDX feat_granite;
897 FEAT_IDX feat_permanent;
900 FEAT_IDX feat_glass_floor;
903 FEAT_IDX feat_glass_wall;
904 FEAT_IDX feat_permanent_glass_wall;
907 FEAT_IDX feat_pattern_start;
908 FEAT_IDX feat_pattern_1;
909 FEAT_IDX feat_pattern_2;
910 FEAT_IDX feat_pattern_3;
911 FEAT_IDX feat_pattern_4;
912 FEAT_IDX feat_pattern_end;
913 FEAT_IDX feat_pattern_old;
914 FEAT_IDX feat_pattern_exit;
915 FEAT_IDX feat_pattern_corrupted;
918 FEAT_IDX feat_black_market;
922 FEAT_IDX feat_deep_water;
923 FEAT_IDX feat_shallow_water;
924 FEAT_IDX feat_deep_lava;
925 FEAT_IDX feat_shallow_lava;
926 FEAT_IDX feat_heavy_cold_zone;
927 FEAT_IDX feat_cold_zone;
928 FEAT_IDX feat_heavy_electrical_zone;
929 FEAT_IDX feat_electrical_zone;
930 FEAT_IDX feat_deep_acid_puddle;
931 FEAT_IDX feat_shallow_acid_puddle;
932 FEAT_IDX feat_deep_poisonous_puddle;
933 FEAT_IDX feat_shallow_poisonous_puddle;
936 FEAT_IDX feat_flower;
939 FEAT_IDX feat_mountain;
942 /* Unknown grid (not detected) */
943 FEAT_IDX feat_undetected;
950 FEAT_IDX feat_wall_outer;
951 FEAT_IDX feat_wall_inner;
952 FEAT_IDX feat_wall_solid;
953 FEAT_IDX feat_ground_type[100], feat_wall_type[100];
956 COMMAND_CODE now_message;
975 int snipe_type = SP_NONE;
976 bool reset_concent = FALSE; /* Concentration reset flag */
977 bool is_fired = FALSE;