OSDN Git Service

c217af09326d559832498dd79b4860db02843bef
[hengband/hengband.git] / src / variable.c
1 /*!
2  * @file variable.c
3  * @brief グローバル変数定義 / Angband variables
4  * @date 2014/10/05
5  * @author
6  * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke<br>
7  * <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>
11  */
12
13 #include "angband.h"
14
15 /*!
16  * コピーライト情報 /
17  * Hack -- Link a copyright message into the executable
18  */
19 const cptr copyright[5] =
20 {
21         "Copyright (c) 1989 James E. Wilson, Robert A. Keoneke",
22         "",
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."
26 };
27
28
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];  /*!< マクロの内容 */
35
36 int level_up = 0; /*!< レベルアップの際に遅延してcalc_mana()関数上で上昇量を表示するかどうかの判定フラグ */
37
38
39 /* 
40  * 自動拾い/破壊設定のリストに関する変数 / List for auto-picker/destroyer entries
41  */
42 int max_autopick = 0; /*!< 現在登録している自動拾い/破壊設定の数 */
43 int max_max_autopick = 0; /*!< 自動拾い/破壊設定の限界数 */
44 autopick_type *autopick_list = NULL; /*!< 自動拾い/破壊設定構造体のポインタ配列 */
45
46 /*
47  * Savefile version
48  */
49 byte h_ver_major;       /* Savefile version for Hengband 1.1.1 and later */
50 byte h_ver_minor;
51 byte h_ver_patch;
52 byte h_ver_extra;
53
54 byte sf_extra;          /* Savefile's encoding key */
55
56 byte z_major;           /* Savefile version for Hengband */
57 byte z_minor;
58 byte z_patch;
59
60 /*
61  * Savefile information
62  */
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 */
67
68 /*
69  * Run-time arguments
70  */
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 */
80
81 /*
82  * Various things
83  */
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 */
88
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 */
91
92 bool creating_savefile;         /* New savefile is currently created */
93
94 u32b seed_flavor;               /* Hack -- consistent object colors */
95 u32b seed_town;                 /* Hack -- consistent town layout */
96
97 s16b command_cmd;               /* Current "Angband Command" */
98
99 COMMAND_ARG command_arg;        /*!< 各種コマンドの汎用的な引数として扱う / Gives argument of current command */
100
101 COMMAND_NUM command_rep;        /*!< 各種コマンドの汎用的なリピート数として扱う / Gives repetition of current command */
102
103 DIRECTION command_dir;          /*!< 各種コマンドの汎用的な方向値処理として扱う/ Gives direction of current command */
104
105 s16b command_see;               /* See "object1.c" */
106 s16b command_wrk;               /* See "object1.c" */
107
108 TERM_LEN command_gap = 999;         /* See "object1.c" */
109
110 s16b command_new;               /* Command chaining from inven/equip view */
111
112 bool msg_flag;                  /* Used in msg_print() for "buffering" */
113
114 s16b running;                   /* Current counter for running, if any */
115 GAME_TURN resting;                      /* Current counter for resting, if any */
116
117 POSITION cur_hgt;               /* Current dungeon height */
118 POSITION cur_wid;               /* Current dungeon width */
119 DEPTH dun_level;                /*!< 現在の実ダンジョン階層、base_levelの参照元となる / Current dungeon level */
120 MONSTER_NUMBER num_repro; /*!< Current reproducer count */
121 DEPTH base_level;               /*!< 基本生成レベル、後述のobject_level, monster_levelの参照元となる / Base dungeon level */
122 DEPTH object_level;             /*!< アイテムの生成レベル、base_levelを起点に一時変更する時に参照 / Current object creation level */
123 DEPTH monster_level;    /*!< モンスターの生成レベル、base_levelを起点に一時変更する時に参照 / Current monster creation level */
124 bool invoking_midnight_curse; /*!< 悪夢モード時の真夜中太古の呪い発生処理フラグ */
125
126 GAME_TURN turn;                         /*!< 画面表示上のゲーム時間基準となるターン / Current game turn */
127 GAME_TURN turn_limit;           /*!< turnの最大値 / Limit of game turn */
128 GAME_TURN dungeon_turn;                 /*!< NASTY生成の計算に関わる内部ターン値 / Game turn in dungeon */
129 GAME_TURN dungeon_turn_limit;   /*!< dungeon_turnの最大値 / Limit of game turn in dungeon */
130 GAME_TURN old_turn;                     /* Turn when level began */
131 GAME_TURN old_battle;
132
133 bool use_sound;                 /* The "sound" mode is enabled */
134 bool use_music;                 /* The "music" mode is enabled */
135 bool use_graphics;              /* The "graphics" mode is enabled */
136 bool use_bigtile = FALSE;
137
138 s16b signal_count;              /* Hack -- Count interupts */
139
140 bool inkey_base;                /* See the "inkey()" function */
141 bool inkey_xtra;                /* See the "inkey()" function */
142 bool inkey_scan;                /* See the "inkey()" function */
143 bool inkey_flag;                /* See the "inkey()" function */
144 bool get_com_no_macros = FALSE; /* Expand macros in "get_com" or not */
145
146 OBJECT_SUBTYPE_VALUE coin_type; /* Hack -- force coin type */
147
148 bool opening_chest;             /* Hack -- prevent chest generation */
149
150 bool shimmer_monsters;  /* Hack -- optimize multi-hued monsters */
151 bool shimmer_objects;   /* Hack -- optimize multi-hued objects */
152
153 bool repair_monsters;   /* Hack -- optimize detect monsters */
154 bool repair_objects;    /* Hack -- optimize detect objects */
155
156 bool is_loading_now;    /*!< ロード直後にcalc_bonus()時の徳変化、及びsanity_blast()による異常を抑止する */
157 bool hack_mutation;
158
159 s16b inven_cnt;                 /* Number of items in inventory */
160 s16b equip_cnt;                 /* Number of items in equipment */
161
162 s16b o_max = 1;                 /* Number of allocated objects */
163 s16b o_cnt = 0;                 /* Number of live objects */
164
165 MONSTER_IDX m_max = 1;                  /* Number of allocated monsters */
166 MONSTER_IDX m_cnt = 0;                  /* Number of live monsters */
167
168 MONSTER_IDX hack_m_idx = 0;     /* Hack -- see "process_monsters()" */
169 MONSTER_IDX hack_m_idx_ii = 0;
170 bool multi_rew = FALSE;
171 char summon_kin_type;   /* Hack, by Julian Lighton: summon 'relatives' */
172
173 int total_friends = 0;
174 s32b friend_align = 0;
175
176 int leaving_quest = 0;
177 bool reinit_wilderness = FALSE;
178
179
180
181 /*
182  * Dungeon variables
183  */
184
185 bool closing_flag;              /* Dungeon is closing */
186
187
188 /*
189  * Dungeon size info
190  */
191
192 POSITION panel_row_min, panel_row_max;
193 POSITION panel_col_min, panel_col_max;
194 POSITION panel_col_prt, panel_row_prt;
195
196
197 /*
198  * Targetting variables
199  */
200 IDX target_who;
201 POSITION target_col;
202 POSITION target_row;
203
204
205 /*
206  * User info
207  */
208 int player_uid;
209 int player_euid;
210 int player_egid;
211
212 /*
213  * Stripped version of "player_name"
214  */
215 char player_base[32];
216
217
218 /*
219  * Buffer to hold the current savefile name
220  * 'savefile' holds full path name. 'savefile_base' holds only base name.
221  */
222 char savefile[1024];
223 char savefile_base[40];
224
225 /*
226  * Array of grids lit by player lite (see "cave.c")
227  */
228 POSITION_IDX lite_n;
229 POSITION lite_y[LITE_MAX];
230 POSITION lite_x[LITE_MAX];
231
232 /*
233  * Array of grids lit by player lite (see "cave.c")
234  */
235 POSITION_IDX mon_lite_n;
236 POSITION mon_lite_y[MON_LITE_MAX];
237 POSITION mon_lite_x[MON_LITE_MAX];
238
239 /*
240  * Array of grids viewable to the player (see "cave.c")
241  */
242 POSITION_IDX view_n;
243 POSITION view_y[VIEW_MAX];
244 POSITION view_x[VIEW_MAX];
245
246 /*
247  * Array of grids for use by various functions (see "cave.c")
248  */
249 POSITION_IDX temp_n;
250 POSITION temp_y[TEMP_MAX];
251 POSITION temp_x[TEMP_MAX];
252
253 /*
254  * Array of grids for delayed visual updating (see "cave.c")
255  */
256 POSITION_IDX redraw_n = 0;
257 POSITION redraw_y[REDRAW_MAX];
258 POSITION redraw_x[REDRAW_MAX];
259
260
261 /*
262  * Number of active macros.
263  */
264 s16b macro__num;
265
266 /*
267  * Array of macro patterns [MACRO_MAX]
268  */
269 cptr *macro__pat;
270
271 /*
272  * Array of macro actions [MACRO_MAX]
273  */
274 cptr *macro__act;
275
276 /*
277  * Array of macro types [MACRO_MAX]
278  */
279 bool *macro__cmd;
280
281 /*
282  * Current macro action [1024]
283  */
284 char *macro__buf;
285
286
287 /*
288  * The number of quarks
289  */
290 STR_OFFSET quark__num;
291
292 /*
293  * The pointers to the quarks [QUARK_MAX]
294  */
295 cptr *quark__str;
296
297
298 /*
299  * The next "free" index to use
300  */
301 u32b message__next;
302
303 /*
304  * The index of the oldest message (none yet)
305  */
306 u32b message__last;
307
308 /*
309  * The next "free" offset
310  */
311 u32b message__head;
312
313 /*
314  * The offset to the oldest used char (none yet)
315  */
316 u32b message__tail;
317
318 /*
319  * The array of offsets, by index [MESSAGE_MAX]
320  */
321 u32b *message__ptr;
322
323 /*
324  * The array of chars, by offset [MESSAGE_BUF]
325  */
326 char *message__buf;
327
328
329 /*
330  * The array of normal options
331  */
332 u32b option_flag[8];
333 u32b option_mask[8];
334
335
336 /*
337  * The array of window options
338  */
339 u32b window_flag[8];
340 u32b window_mask[8];
341
342
343 /*
344  * The array of window pointers
345  */
346 term *angband_term[8];
347
348
349 /*
350  * Standard window names
351  */
352 const char angband_term_name[8][16] =
353 {
354         "Hengband",
355         "Term-1",
356         "Term-2",
357         "Term-3",
358         "Term-4",
359         "Term-5",
360         "Term-6",
361         "Term-7"
362 };
363
364
365 /*
366  * Global table of color definitions
367  */
368 byte angband_color_table[256][4] =
369 {
370         {0x00, 0x00, 0x00, 0x00},       /* TERM_DARK */
371         {0x00, 0xFF, 0xFF, 0xFF},       /* TERM_WHITE */
372         {0x00, 0x80, 0x80, 0x80},       /* TERM_SLATE */
373         {0x00, 0xFF, 0x80, 0x00},       /* TERM_ORANGE */
374         {0x00, 0xC0, 0x00, 0x00},       /* TERM_RED */
375         {0x00, 0x00, 0x80, 0x40},       /* TERM_GREEN */
376         {0x00, 0x00, 0x00, 0xFF},       /* TERM_BLUE */
377         {0x00, 0x80, 0x40, 0x00},       /* TERM_UMBER */
378         {0x00, 0x40, 0x40, 0x40},       /* TERM_L_DARK */
379         {0x00, 0xC0, 0xC0, 0xC0},       /* TERM_L_WHITE */
380         {0x00, 0xFF, 0x00, 0xFF},       /* TERM_VIOLET */
381         {0x00, 0xFF, 0xFF, 0x00},       /* TERM_YELLOW */
382         {0x00, 0xFF, 0x00, 0x00},       /* TERM_L_RED */
383         {0x00, 0x00, 0xFF, 0x00},       /* TERM_L_GREEN */
384         {0x00, 0x00, 0xFF, 0xFF},       /* TERM_L_BLUE */
385         {0x00, 0xC0, 0x80, 0x40}        /* TERM_L_UMBER */
386 };
387
388
389 /*
390  * Standard sound names
391  */
392 const cptr angband_sound_name[SOUND_MAX] =
393 {
394         "dummy",
395         "hit",
396         "miss",
397         "flee",
398         "drop",
399         "kill",
400         "level",
401         "death",
402         "study",
403         "teleport",
404         "shoot",
405         "quaff",
406         "zap",
407         "walk",
408         "tpother",
409         "hitwall",
410         "eat",
411         "store1",
412         "store2",
413         "store3",
414         "store4",
415         "dig",
416         "opendoor",
417         "shutdoor",
418         "tplevel",
419         "scroll",
420         "buy",
421         "sell",
422         "warn",
423         "rocket",
424         "n_kill",
425         "u_kill",
426         "quest",
427         "heal",
428         "x_heal",
429         "bite",
430         "claw",
431         "m_spell",
432         "summon",
433         "breath",
434         "ball",
435         "m_heal",
436         "atkspell",
437         "evil",
438         "touch",
439         "sting",
440         "crush",
441         "slime",
442         "wail",
443         "winner",
444         "fire",
445         "acid",
446         "elec",
447         "cold",
448         "illegal",
449         "fail",
450         "wakeup",
451         "invuln",
452         "fall",
453         "pain",
454         "destitem",
455         "moan",
456         "show",
457         "unused",
458         "explode",
459         "glass",
460         "reflect",
461 };
462
463 /*
464  * Standard music names
465  */
466 const cptr angband_music_basic_name[MUSIC_BASIC_MAX] =
467 {
468         "default",
469         "gameover",
470         "exit",
471         "town",
472         "field1",
473         "field2",
474         "field3",
475         "dun_low",
476         "dun_med",
477         "dun_high",
478         "feel1",
479         "feel2",
480         "winner",
481         "build",
482         "wild",
483         "quest",
484         "arena",
485         "battle",
486         "quest_clear",
487         "final_quest_clear",
488         "ambush",
489 };
490
491
492 /*
493  * The array of "cave grids" [MAX_WID][MAX_HGT].
494  * Not completely allocated, that would be inefficient
495  * Not completely hardcoded, that would overflow memory
496  */
497 cave_type *cave[MAX_HGT];
498
499
500 /*
501  * The array of saved floors
502  */
503 saved_floor_type saved_floors[MAX_SAVED_FLOORS];
504
505
506 /*
507  * Number of floor_id used from birth
508  */
509 s16b max_floor_id;
510
511
512 /*
513  * Sign for current process used in temporal files.
514  * Actually it is the start time of current process.
515  */
516 u32b saved_floor_file_sign;
517
518
519 /*
520  * The array of dungeon items [max_o_idx]
521  */
522 object_type *o_list;
523
524 /*
525  * The array of dungeon monsters [max_m_idx]
526  */
527 monster_type *m_list;
528
529 /*
530  * The array to process dungeon monsters [max_m_idx]
531  */
532 s16b *mproc_list[MAX_MTIMED];
533 s16b mproc_max[MAX_MTIMED]; /* Number of monsters to be processed */
534
535
536 /*
537  * Maximum number of towns
538  */
539 u16b max_towns;
540
541 /*
542  * The towns [max_towns]
543  */
544 town_type *town;
545
546
547 /*
548  * The player's inventory [INVEN_TOTAL]
549  */
550 object_type *inventory;
551
552
553 /*
554  * The size of "alloc_kind_table" (at most max_k_idx * 4)
555  */
556 s16b alloc_kind_size;
557
558 /*
559  * The entries in the "kind allocator table"
560  */
561 alloc_entry *alloc_kind_table;
562
563
564 /*
565  * The size of "alloc_race_table" (at most max_r_idx)
566  */
567 s16b alloc_race_size;
568
569 /*
570  * The entries in the "race allocator table"
571  */
572 alloc_entry *alloc_race_table;
573
574
575 /*
576  * Specify attr/char pairs for visual special effects
577  * Be sure to use "index & 0x7F" to avoid illegal access
578  */
579 TERM_COLOR misc_to_attr[256];
580 char misc_to_char[256];
581
582
583 /*
584  * Specify attr/char pairs for inventory items (by tval)
585  * Be sure to use "index & 0x7F" to avoid illegal access
586  */
587 TERM_COLOR tval_to_attr[128];
588 char tval_to_char[128];
589
590
591 /*
592  * Keymaps for each "mode" associated with each keypress.
593  */
594 cptr keymap_act[KEYMAP_MODES][256];
595
596
597
598 /*** Player information ***/
599
600 /*
601  * Static player info record
602  */
603 player_type p_body;
604
605 /*
606  * Pointer to the player info
607  */
608 player_type *p_ptr = &p_body;
609
610 /*
611  * Pointer to the player tables
612  * (sex, race, class, magic)
613  */
614 const player_sex *sp_ptr;
615 const player_race *rp_ptr;
616 const player_class *cp_ptr;
617 const player_seikaku *ap_ptr;
618 const player_magic *mp_ptr;
619
620
621 /*
622  * The last character rolled,
623  * holded for quick start
624  */
625 birther previous_char;
626
627
628 /*
629  * The vault generation arrays
630  */
631 vault_type *v_info;
632 char *v_name;
633 char *v_text;
634
635 /*
636  * The skill table
637  */
638 skill_table *s_info;
639
640 /*
641  * The magic info
642  */
643 player_magic *m_info;
644
645 /*
646  * The terrain feature arrays
647  */
648 feature_type *f_info;
649 char *f_name;
650 char *f_tag;
651
652 /*
653  * The object kind arrays
654  */
655 object_kind *k_info;
656 char *k_name;
657 char *k_text;
658
659 /*
660  * The artifact arrays
661  */
662 artifact_type *a_info;
663 char *a_name;
664 char *a_text;
665
666 /*
667  * The ego-item arrays
668  */
669 ego_item_type *e_info;
670 char *e_name;
671 char *e_text;
672
673
674 /*
675  * The monster race arrays
676  */
677 monster_race *r_info;
678 char *r_name;
679 char *r_text;
680
681
682 /*
683  * The dungeon arrays
684  */
685 dungeon_info_type *d_info;
686 char *d_name;
687 char *d_text;
688
689
690 /*
691  * Hack -- The special Angband "System Suffix"
692  * This variable is used to choose an appropriate "pref-xxx" file
693  */
694 cptr ANGBAND_SYS = "xxx";
695
696 /*
697  * Hack -- The special Angband "Keyboard Suffix"
698  * This variable is used to choose an appropriate macro-trigger definition
699  */
700 #ifdef JP
701 cptr ANGBAND_KEYBOARD = "JAPAN";
702 #else
703 cptr ANGBAND_KEYBOARD = "0";
704 #endif
705
706 /*
707  * Hack -- The special Angband "Graphics Suffix"
708  * This variable is used to choose an appropriate "graf-xxx" file
709  */
710 cptr ANGBAND_GRAF = "ascii";
711
712 /*
713  * Path name: The main "lib" directory
714  * This variable is not actually used anywhere in the code
715  */
716 cptr ANGBAND_DIR;
717
718 /*
719  * High score files (binary)
720  * These files may be portable between platforms
721  */
722 cptr ANGBAND_DIR_APEX;
723
724 /*
725  * Bone files for player ghosts (ascii)
726  * These files are portable between platforms
727  */
728 cptr ANGBAND_DIR_BONE;
729
730 /*
731  * Binary image files for the "*_info" arrays (binary)
732  * These files are not portable between platforms
733  */
734 cptr ANGBAND_DIR_DATA;
735
736 /*
737  * Textual template files for the "*_info" arrays (ascii)
738  * These files are portable between platforms
739  */
740 cptr ANGBAND_DIR_EDIT;
741
742 /*
743  * Script files
744  * These files are portable between platforms.
745  */
746 cptr ANGBAND_DIR_SCRIPT;
747
748 /*
749  * Various extra files (ascii)
750  * These files may be portable between platforms
751  */
752 cptr ANGBAND_DIR_FILE;
753
754 /*
755  * Help files (normal) for the online help (ascii)
756  * These files are portable between platforms
757  */
758 cptr ANGBAND_DIR_HELP;
759
760 /*
761  * Help files (spoilers) for the online help (ascii)
762  * These files are portable between platforms
763  */
764 cptr ANGBAND_DIR_INFO;
765
766 /*
767  * Default user "preference" files (ascii)
768  * These files are rarely portable between platforms
769  */
770 cptr ANGBAND_DIR_PREF;
771
772 /*
773  * Savefiles for current characters (binary)
774  * These files are portable between platforms
775  */
776 cptr ANGBAND_DIR_SAVE;
777
778 /*
779  * User "preference" files (ascii)
780  * These files are rarely portable between platforms
781  */
782 cptr ANGBAND_DIR_USER;
783
784 /*
785  * Various extra files (binary)
786  * These files are rarely portable between platforms
787  */
788 cptr ANGBAND_DIR_XTRA;
789
790
791 /*
792  * Total Hack -- allow all items to be listed (even empty ones)
793  * This is only used by "do_cmd_inven_e()" and is cleared there.
794  */
795 bool item_tester_full;
796
797 bool item_tester_no_ryoute = FALSE;
798
799 /*
800  * Here is a "pseudo-hook" used during calls to "get_item()" and
801  * "show_inven()" and "show_equip()", and the choice window routines.
802  */
803 OBJECT_TYPE_VALUE item_tester_tval;
804
805
806 /*
807  * Here is a "hook" used during calls to "get_item()" and
808  * "show_inven()" and "show_equip()", and the choice window routines.
809  */
810 bool (*item_tester_hook)(object_type*);
811
812
813
814 /*
815  * Current "comp" function for ang_sort()
816  */
817 bool (*ang_sort_comp)(vptr u, vptr v, int a, int b);
818
819
820 /*
821  * Current "swap" function for ang_sort()
822  */
823 void (*ang_sort_swap)(vptr u, vptr v, int a, int b);
824
825
826
827 /*
828  * Hack -- function hooks to restrict "get_mon_num_prep()" function
829  */
830 monster_hook_type get_mon_num_hook;
831 monster_hook_type get_mon_num2_hook;
832
833
834 /*
835  * Hack -- function hook to restrict "get_obj_num_prep()" function
836  */
837 bool (*get_obj_num_hook)(KIND_OBJECT_IDX k_idx);
838
839
840 /* Hack, monk armour */
841 bool monk_armour_aux;
842 bool monk_notify_aux;
843
844
845 /*
846  * Wilderness
847  */
848 wilderness_type **wilderness;
849
850
851 /*
852  * Buildings
853  */
854 building_type building[MAX_BLDG];
855
856
857 /*
858  * Maximum number of quests
859  */
860 QUEST_IDX max_q_idx;
861
862 /*
863  * Maximum number of monsters in r_info.txt
864  */
865 MONRACE_IDX max_r_idx;
866
867 /*
868  * Maximum number of items in k_info.txt
869  */
870 KIND_OBJECT_IDX max_k_idx;
871
872 /*
873  * Maximum number of vaults in v_info.txt
874  */
875 IDX max_v_idx;
876
877 /*
878  * Maximum number of terrain features in f_info.txt
879  */
880 IDX max_f_idx;
881
882 /*
883  * Maximum number of artifacts in a_info.txt
884  */
885 ARTIFACT_IDX max_a_idx;
886
887 /*
888  * Maximum number of ego-items in e_info.txt
889  */
890 IDX max_e_idx;
891
892 /*
893  * Maximum number of dungeon in e_info.txt
894  */
895 DUNGEON_IDX max_d_idx;
896
897 /*
898  * Maximum number of objects in the level
899  */
900 OBJECT_IDX max_o_idx;
901
902 /*
903  * Maximum number of monsters in the level
904  */
905 MONSTER_IDX max_m_idx;
906
907 /*
908  * Maximum size of the wilderness
909  */
910 POSITION max_wild_x;
911 POSITION max_wild_y;
912
913 /*
914  * Quest info
915  */
916 quest_type *quest;
917
918 /*
919  * Quest text
920  */
921 char quest_text[10][80];
922
923 /*
924  * Current line of the quest text
925  */
926 int quest_text_line;
927
928 /*
929  * Default spell color table (quark index)
930  */
931 s16b gf_color[MAX_GF];
932
933 /*
934  * Flags for initialization
935  */
936 int init_flags;
937
938
939 /*
940  * The "highscore" file descriptor, if available.
941  */
942 int highscore_fd = -1;
943
944 int mutant_regenerate_mod = 100;
945
946 bool can_save = FALSE;        /* Game can be saved */
947
948 s16b world_monster;
949 bool world_player;
950
951 int cap_mon;
952 int cap_mspeed;
953 HIT_POINT cap_hp;
954 HIT_POINT cap_maxhp;
955 STR_OFFSET cap_nickname;
956
957 MONRACE_IDX battle_mon[4];
958 int sel_monster;
959 int battle_odds;
960 PRICE kakekin;
961 u32b mon_odds[4];
962
963 MONSTER_IDX pet_t_m_idx;
964 MONSTER_IDX riding_t_m_idx;
965
966 MONSTER_IDX kubi_r_idx[MAX_KUBI];
967 MONSTER_IDX today_mon;
968
969 bool write_level;
970
971 u32b playtime;
972 u32b start_time;
973
974 int tsuri_dir;
975
976 bool sukekaku;
977 bool new_mane;
978
979 bool mon_fight;
980
981 bool ambush_flag;
982 bool generate_encounter;
983
984 cptr screen_dump = NULL;
985
986 /*** Terrain feature variables ***/
987
988 /* Nothing */
989 FEAT_IDX feat_none;
990
991 /* Floor */
992 FEAT_IDX feat_floor;
993
994 /* Objects */
995 FEAT_IDX feat_glyph;
996 FEAT_IDX feat_explosive_rune;
997 FEAT_IDX feat_mirror;
998
999 /* Doors */
1000 door_type feat_door[MAX_DOOR_TYPES];
1001
1002 /* Stairs */
1003 FEAT_IDX feat_up_stair;
1004 FEAT_IDX feat_down_stair;
1005 FEAT_IDX feat_entrance;
1006
1007 /* Special traps */
1008 FEAT_IDX feat_trap_open;
1009 FEAT_IDX feat_trap_armageddon;
1010 FEAT_IDX feat_trap_piranha;
1011
1012 /* Rubble */
1013 FEAT_IDX feat_rubble;
1014
1015 /* Seams */
1016 FEAT_IDX feat_magma_vein;
1017 FEAT_IDX feat_quartz_vein;
1018
1019 /* Walls */
1020 FEAT_IDX feat_granite;
1021 FEAT_IDX feat_permanent;
1022
1023 /* Glass floor */
1024 FEAT_IDX feat_glass_floor;
1025
1026 /* Glass walls */
1027 FEAT_IDX feat_glass_wall;
1028 FEAT_IDX feat_permanent_glass_wall;
1029
1030 /* Pattern */
1031 FEAT_IDX feat_pattern_start;
1032 FEAT_IDX feat_pattern_1;
1033 FEAT_IDX feat_pattern_2;
1034 FEAT_IDX feat_pattern_3;
1035 FEAT_IDX feat_pattern_4;
1036 FEAT_IDX feat_pattern_end;
1037 FEAT_IDX feat_pattern_old;
1038 FEAT_IDX feat_pattern_exit;
1039 FEAT_IDX feat_pattern_corrupted;
1040
1041 /* Various */
1042 FEAT_IDX feat_black_market;
1043 FEAT_IDX feat_town;
1044
1045 /* Terrains */
1046 FEAT_IDX feat_deep_water;
1047 FEAT_IDX feat_shallow_water;
1048 FEAT_IDX feat_deep_lava;
1049 FEAT_IDX feat_shallow_lava;
1050 FEAT_IDX feat_dirt;
1051 FEAT_IDX feat_grass;
1052 FEAT_IDX feat_flower;
1053 FEAT_IDX feat_brake;
1054 FEAT_IDX feat_tree;
1055 FEAT_IDX feat_mountain;
1056 FEAT_IDX feat_swamp;
1057
1058 /* Unknown grid (not detected) */
1059 FEAT_IDX feat_undetected;
1060
1061 /*
1062  * Which dungeon ?
1063  */
1064 DUNGEON_IDX dungeon_type;
1065 DEPTH *max_dlv;
1066
1067 FEAT_IDX feat_wall_outer;
1068 FEAT_IDX feat_wall_inner;
1069 FEAT_IDX feat_wall_solid;
1070 FEAT_IDX floor_type[100], fill_type[100];
1071
1072 bool now_damaged;
1073 COMMAND_CODE now_message;
1074 bool use_menu;
1075
1076 #ifdef CHUUKEI
1077 bool chuukei_server;
1078 bool chuukei_client;
1079 char *server_name;
1080 int server_port;
1081 #endif
1082
1083 /* for movie */
1084 bool browsing_movie;
1085
1086 #ifdef TRAVEL
1087 /* for travel */
1088 travel_type travel;
1089 #endif
1090
1091 /* for snipers */
1092 int snipe_type = SP_NONE;
1093 bool reset_concent = FALSE;   /* Concentration reset flag */
1094 bool is_fired = FALSE;
1095