OSDN Git Service

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