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>
18 * Hack -- Link a copyright message into the executable
20 const concptr copyright[5] =
22 "Copyright (c) 1989 James E. Wilson, Robert A. Keoneke",
24 "This software may be copied and distributed for educational, research,",
25 "and not for profit purposes provided that this copyright and statement",
26 "are included in all such copies."
29 int max_macrotrigger = 0; /*!< 現在登録中のマクロ(トリガー)の数 */
30 concptr macro_template = NULL; /*!< Angband設定ファイルのT: タグ情報から読み込んだ長いTコードを処理するために利用する文字列ポインタ */
31 concptr macro_modifier_chr; /*!< &x# で指定されるマクロトリガーに関する情報を記録する文字列ポインタ */
32 concptr macro_modifier_name[MAX_MACRO_MOD]; /*!< マクロ上で取り扱う特殊キーを文字列上で表現するためのフォーマットを記録した文字列ポインタ配列 */
33 concptr macro_trigger_name[MAX_MACRO_TRIG]; /*!< マクロのトリガーコード */
34 concptr 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 */
114 bool invoking_midnight_curse; /*!< 悪夢モード時の真夜中太古の呪い発生処理フラグ */
116 GAME_TURN old_battle;
118 bool use_sound; /* The "sound" mode is enabled */
119 bool use_music; /* The "music" mode is enabled */
120 bool use_graphics; /* The "graphics" mode is enabled */
121 bool use_bigtile = FALSE;
123 s16b signal_count; /* Hack -- Count interupts */
125 bool inkey_base; /* See the "inkey()" function */
126 bool inkey_xtra; /* See the "inkey()" function */
127 bool inkey_scan; /* See the "inkey()" function */
128 bool inkey_flag; /* See the "inkey()" function */
129 bool get_com_no_macros = FALSE; /* Expand macros in "get_com" or not */
131 OBJECT_SUBTYPE_VALUE coin_type; /* Hack -- force coin type */
133 bool opening_chest; /* Hack -- prevent chest generation */
135 bool shimmer_monsters; /* Hack -- optimize multi-hued monsters */
136 bool shimmer_objects; /* Hack -- optimize multi-hued objects */
138 bool repair_monsters; /* Hack -- optimize detect monsters */
139 bool repair_objects; /* Hack -- optimize detect objects */
141 bool is_loading_now; /*!< ロード直後にcalc_bonus()時の徳変化、及びsanity_blast()による異常を抑止する */
144 s16b inven_cnt; /* Number of items in inventory */
145 s16b equip_cnt; /* Number of items in equipment */
147 OBJECT_IDX o_max = 1; /* Number of allocated objects */
148 OBJECT_IDX o_cnt = 0; /* Number of live objects */
150 MONSTER_IDX m_max = 1; /* Number of allocated monsters */
151 MONSTER_IDX m_cnt = 0; /* Number of live monsters */
153 MONSTER_IDX hack_m_idx = 0; /* Hack -- see "process_monsters()" */
154 MONSTER_IDX hack_m_idx_ii = 0;
156 bool multi_rew = FALSE;
157 char summon_kin_type; /* Hack, by Julian Lighton: summon 'relatives' */
159 int total_friends = 0;
160 s32b friend_align = 0;
162 int leaving_quest = 0;
163 bool reinit_wilderness = FALSE;
171 bool closing_flag; /* Dungeon is closing */
178 POSITION panel_row_min, panel_row_max;
179 POSITION panel_col_min, panel_col_max;
180 POSITION panel_col_prt, panel_row_prt;
184 * Targetting variables
186 MONSTER_IDX target_who;
199 * Stripped version of "player_name"
201 char player_base[32];
205 * Buffer to hold the current savefile name
206 * 'savefile' holds full path name. 'savefile_base' holds only base name.
209 char savefile_base[40];
216 * Number of active macros.
221 * Array of macro patterns [MACRO_MAX]
226 * Array of macro actions [MACRO_MAX]
231 * Array of macro types [MACRO_MAX]
236 * Current macro action [1024]
242 * The number of quarks
244 STR_OFFSET quark__num;
247 * The pointers to the quarks [QUARK_MAX]
253 * The next "free" index to use
258 * The index of the oldest message (none yet)
263 * The next "free" offset
268 * The offset to the oldest used char (none yet)
273 * The array of offsets, by index [MESSAGE_MAX]
278 * The array of chars, by offset [MESSAGE_BUF]
282 BIT_FLAGS option_flag[8]; //!< The array of normal options
283 BIT_FLAGS option_mask[8]; //!< The array of normal options
284 BIT_FLAGS window_flag[8]; //!< The array of window options
285 BIT_FLAGS window_mask[8]; //!< The array of window options
288 * The array of window pointers
290 term *angband_term[8];
293 * Standard window names
295 const char angband_term_name[8][16] =
309 * Global table of color definitions
311 byte angband_color_table[256][4] =
313 {0x00, 0x00, 0x00, 0x00}, /* TERM_DARK */
314 {0x00, 0xFF, 0xFF, 0xFF}, /* TERM_WHITE */
315 {0x00, 0x80, 0x80, 0x80}, /* TERM_SLATE */
316 {0x00, 0xFF, 0x80, 0x00}, /* TERM_ORANGE */
317 {0x00, 0xC0, 0x00, 0x00}, /* TERM_RED */
318 {0x00, 0x00, 0x80, 0x40}, /* TERM_GREEN */
319 {0x00, 0x00, 0x00, 0xFF}, /* TERM_BLUE */
320 {0x00, 0x80, 0x40, 0x00}, /* TERM_UMBER */
321 {0x00, 0x40, 0x40, 0x40}, /* TERM_L_DARK */
322 {0x00, 0xC0, 0xC0, 0xC0}, /* TERM_L_WHITE */
323 {0x00, 0xFF, 0x00, 0xFF}, /* TERM_VIOLET */
324 {0x00, 0xFF, 0xFF, 0x00}, /* TERM_YELLOW */
325 {0x00, 0xFF, 0x00, 0x00}, /* TERM_L_RED */
326 {0x00, 0x00, 0xFF, 0x00}, /* TERM_L_GREEN */
327 {0x00, 0x00, 0xFF, 0xFF}, /* TERM_L_BLUE */
328 {0x00, 0xC0, 0x80, 0x40} /* TERM_L_UMBER */
333 * Standard sound names
335 const concptr angband_sound_name[SOUND_MAX] =
407 * Standard music names
409 const concptr angband_music_basic_name[MUSIC_BASIC_MAX] =
436 * The array of "current_floor_ptr->grid_array grids" [MAX_WID][MAX_HGT].
437 * Not completely allocated, that would be inefficient
438 * Not completely hardcoded, that would overflow memory
441 floor_type *current_floor_ptr = &floor;
444 * The array of saved floors
446 saved_floor_type saved_floors[MAX_SAVED_FLOORS];
450 * Number of floor_id used from birth
452 FLOOR_IDX max_floor_id;
456 world_type *current_world_ptr = &world;
460 * Sign for current process used in temporal files.
461 * Actually it is the start time of current process.
463 u32b saved_floor_file_sign;
467 * Maximum number of towns
472 * The towns [max_towns]
474 town_type *town_info;
478 * The player's inventory [INVEN_TOTAL]
480 object_type *inventory;
484 * The size of "alloc_kind_table" (at most max_k_idx * 4)
486 s16b alloc_kind_size;
489 * The entries in the "kind allocator table"
491 alloc_entry *alloc_kind_table;
495 * The size of "alloc_race_table" (at most max_r_idx)
497 s16b alloc_race_size;
500 * The entries in the "race allocator table"
502 alloc_entry *alloc_race_table;
506 * Specify attr/char pairs for visual special effects
507 * Be sure to use "index & 0x7F" to avoid illegal access
509 TERM_COLOR misc_to_attr[256];
510 SYMBOL_CODE misc_to_char[256];
514 * Specify attr/char pairs for inventory items (by tval)
515 * Be sure to use "index & 0x7F" to avoid illegal access
517 TERM_COLOR tval_to_attr[128];
518 SYMBOL_CODE tval_to_char[128];
522 * Keymaps for each "mode" associated with each keypress.
524 concptr keymap_act[KEYMAP_MODES][256];
528 /*** Player information ***/
531 * Static player info record
536 * Pointer to the player info
538 player_type *p_ptr = &p_body;
541 * Pointer to the player tables
542 * (sex, race, class, magic)
544 const player_sex *sp_ptr;
545 const player_race *rp_ptr;
546 const player_class *cp_ptr;
547 const player_seikaku *ap_ptr;
548 const player_magic *mp_ptr;
552 * The last character rolled,
553 * holded for quick start
555 birther previous_char;
559 * The vault generation arrays
573 player_magic *m_info;
576 * The terrain feature arrays
578 feature_type *f_info;
583 * The object kind arrays
590 * The artifact arrays
592 artifact_type *a_info;
597 * The ego-item arrays
599 ego_item_type *e_info;
605 * The monster race arrays
607 monster_race *r_info;
615 dungeon_type *d_info;
620 concptr ANGBAND_SYS = "xxx"; //!< Hack -- The special Angband "System Suffix" This variable is used to choose an appropriate "pref-xxx" file
624 concptr ANGBAND_KEYBOARD = "JAPAN"; //!< Hack -- The special Angband "Keyboard Suffix" This variable is used to choose an appropriate macro-trigger definition
626 concptr ANGBAND_KEYBOARD = "0";
629 concptr ANGBAND_GRAF = "ascii"; //!< Hack -- The special Angband "Graphics Suffix" This variable is used to choose an appropriate "graf-xxx" file
630 concptr ANGBAND_DIR; //!< Path name: The main "lib" directory This variable is not actually used anywhere in the code
631 concptr ANGBAND_DIR_APEX; //!< High score files (binary) These files may be portable between platforms
632 concptr ANGBAND_DIR_BONE; //!< Bone files for player ghosts (ascii) These files are portable between platforms
633 concptr ANGBAND_DIR_DATA; //!< Binary image files for the "*_info" arrays (binary) These files are not portable between platforms
634 concptr ANGBAND_DIR_EDIT; //!< Textual template files for the "*_info" arrays (ascii) These files are portable between platforms
635 concptr ANGBAND_DIR_SCRIPT; //!< Script files These files are portable between platforms.
636 concptr ANGBAND_DIR_FILE; //!< Various extra files (ascii) These files may be portable between platforms
637 concptr ANGBAND_DIR_HELP; //!< Help files (normal) for the online help (ascii) These files are portable between platforms
638 concptr ANGBAND_DIR_INFO; //!< Help files (spoilers) for the online help (ascii) These files are portable between platforms
639 concptr ANGBAND_DIR_PREF; //!< Default user "preference" files (ascii) These files are rarely portable between platforms
640 concptr ANGBAND_DIR_SAVE; //!< Savefiles for current characters (binary)
641 concptr ANGBAND_DIR_USER; //!< User "preference" files (ascii) These files are rarely portable between platforms
642 concptr ANGBAND_DIR_XTRA; //!< Various extra files (binary) These files are rarely portable between platforms
646 * Here is a "pseudo-hook" used during calls to "get_item()" and
647 * "show_inven()" and "show_equip()", and the choice window routines.
649 OBJECT_TYPE_VALUE item_tester_tval;
653 * Here is a "hook" used during calls to "get_item()" and
654 * "show_inven()" and "show_equip()", and the choice window routines.
656 bool (*item_tester_hook)(object_type*);
661 * Current "comp" function for ang_sort()
663 bool (*ang_sort_comp)(vptr u, vptr v, int a, int b);
667 * Current "swap" function for ang_sort()
669 void (*ang_sort_swap)(vptr u, vptr v, int a, int b);
674 * Hack -- function hooks to restrict "get_mon_num_prep()" function
676 monsterrace_hook_type get_mon_num_hook;
677 monsterrace_hook_type get_mon_num2_hook;
681 * Hack -- function hook to restrict "get_obj_num_prep()" function
683 bool (*get_obj_num_hook)(KIND_OBJECT_IDX k_idx);
688 building_type building[MAX_BLDG];
692 * Maximum number of quests
697 * Maximum number of monsters in r_info.txt
699 MONRACE_IDX max_r_idx;
702 * Maximum number of items in k_info.txt
704 KIND_OBJECT_IDX max_k_idx;
707 * Maximum number of vaults in v_info.txt
712 * Maximum number of terrain features in f_info.txt
717 * Maximum number of artifacts in a_info.txt
719 ARTIFACT_IDX max_a_idx;
722 * Maximum number of ego-items in e_info.txt
727 * Maximum number of dungeon in e_info.txt
729 DUNGEON_IDX max_d_idx;
741 char quest_text[10][80];
744 * Current line of the quest text
749 * Default spell color table (quark index)
751 TERM_COLOR gf_color[MAX_GF];
754 * Flags for initialization
760 * The "highscore" file descriptor, if available.
762 int highscore_fd = -1;
764 bool can_save = FALSE; /* Game can be saved */
771 STR_OFFSET cap_nickname;
773 MONRACE_IDX battle_mon[4];
779 MONSTER_IDX pet_t_m_idx;
780 MONSTER_IDX riding_t_m_idx;
782 MONSTER_IDX today_mon;
794 bool generate_encounter;
796 concptr screen_dump = NULL;
798 /*** Terrain feature variables ***/
808 FEAT_IDX feat_explosive_rune;
809 FEAT_IDX feat_mirror;
812 FEAT_IDX feat_up_stair;
813 FEAT_IDX feat_down_stair;
814 FEAT_IDX feat_entrance;
817 FEAT_IDX feat_trap_open;
818 FEAT_IDX feat_trap_armageddon;
819 FEAT_IDX feat_trap_piranha;
822 FEAT_IDX feat_rubble;
825 FEAT_IDX feat_magma_vein;
826 FEAT_IDX feat_quartz_vein;
829 FEAT_IDX feat_granite;
830 FEAT_IDX feat_permanent;
833 FEAT_IDX feat_glass_floor;
836 FEAT_IDX feat_glass_wall;
837 FEAT_IDX feat_permanent_glass_wall;
840 FEAT_IDX feat_pattern_start;
841 FEAT_IDX feat_pattern_1;
842 FEAT_IDX feat_pattern_2;
843 FEAT_IDX feat_pattern_3;
844 FEAT_IDX feat_pattern_4;
845 FEAT_IDX feat_pattern_end;
846 FEAT_IDX feat_pattern_old;
847 FEAT_IDX feat_pattern_exit;
848 FEAT_IDX feat_pattern_corrupted;
851 FEAT_IDX feat_black_market;
855 FEAT_IDX feat_deep_water;
856 FEAT_IDX feat_shallow_water;
857 FEAT_IDX feat_deep_lava;
858 FEAT_IDX feat_shallow_lava;
859 FEAT_IDX feat_heavy_cold_zone;
860 FEAT_IDX feat_cold_zone;
861 FEAT_IDX feat_heavy_electrical_zone;
862 FEAT_IDX feat_electrical_zone;
863 FEAT_IDX feat_deep_acid_puddle;
864 FEAT_IDX feat_shallow_acid_puddle;
865 FEAT_IDX feat_deep_poisonous_puddle;
866 FEAT_IDX feat_shallow_poisonous_puddle;
869 FEAT_IDX feat_flower;
872 FEAT_IDX feat_mountain;
875 /* Unknown grid (not detected) */
876 FEAT_IDX feat_undetected;
883 FEAT_IDX feat_wall_outer;
884 FEAT_IDX feat_wall_inner;
885 FEAT_IDX feat_wall_solid;
886 FEAT_IDX feat_ground_type[100], feat_wall_type[100];
888 COMMAND_CODE now_message;
907 bool reset_concent = FALSE; /* Concentration reset flag */
908 bool is_fired = FALSE;