OSDN Git Service

#37287 #37353 (2.2.0.89) TERM_COLOR 型を定義し、型の置換を継続中。 / Define TERM_COLOR, ongoing...
[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 s16b command_rep;               /* Gives repetition of current command */
101 DIRECTION command_dir;          /* Gives direction of current command */
102
103 s16b command_see;               /* See "object1.c" */
104 s16b command_wrk;               /* See "object1.c" */
105
106 TERM_POSITION command_gap = 999;         /* See "object1.c" */
107
108 s16b command_new;               /* Command chaining from inven/equip view */
109
110 bool msg_flag;                  /* Used in msg_print() for "buffering" */
111
112 s16b running;                   /* Current counter for running, if any */
113 s16b resting;                   /* Current counter for resting, if any */
114
115 POSITION cur_hgt;               /* Current dungeon height */
116 POSITION cur_wid;               /* Current dungeon width */
117 DEPTH dun_level;                /* Current dungeon level */
118 s16b num_repro;                 /* Current reproducer count */
119 DEPTH object_level;             /* Current object creation level */
120 DEPTH monster_level;    /* Current monster creation level */
121 DEPTH base_level;               /* Base dungeon level */
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 s16b inven_nxt;                 /* Hack -- unused */
154 bool hack_mind;
155 bool hack_mutation;
156
157 s16b inven_cnt;                 /* Number of items in inventory */
158 s16b equip_cnt;                 /* Number of items in equipment */
159
160 s16b o_max = 1;                 /* Number of allocated objects */
161 s16b o_cnt = 0;                 /* Number of live objects */
162
163 MONSTER_IDX m_max = 1;                  /* Number of allocated monsters */
164 MONSTER_IDX m_cnt = 0;                  /* Number of live monsters */
165
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' */
170
171 int total_friends = 0;
172 s32b friend_align = 0;
173
174 int leaving_quest = 0;
175 bool reinit_wilderness = FALSE;
176
177
178 /*
179  * Software options (set via the '=' command).  See "tables.c"
180  */
181
182 /*** Input Options ***/
183
184 bool rogue_like_commands;       /* Rogue-like commands */
185 bool always_pickup;     /* Pick things up by default */
186 bool carry_query_flag;  /* Prompt before picking things up */
187 bool quick_messages;    /* Activate quick messages */
188 bool auto_more; /* Automatically clear '-more-' prompts */
189 bool command_menu;      /* Enable command selection menu */
190 bool other_query_flag;  /* Prompt for floor item selection */
191 bool use_old_target;    /* Use old target by default */
192 bool always_repeat;     /* Repeat obvious commands */
193 bool confirm_destroy;   /* Prompt for destruction of known worthless items */
194 bool confirm_wear;      /* Confirm to wear/wield known cursed items */
195 bool confirm_quest;     /* Prompt before exiting a quest level */
196 bool target_pet;        /* Allow targetting pets */
197
198 #ifdef ALLOW_EASY_OPEN
199 bool easy_open; /* Automatically open doors */
200 #endif
201
202 #ifdef ALLOW_EASY_DISARM
203 bool easy_disarm;       /* Automatically disarm traps */
204 #endif
205
206 #ifdef ALLOW_EASY_FLOOR
207 bool easy_floor;        /* Display floor stacks in a list */
208 #endif
209
210 bool use_command;       /* Allow unified use command */
211 bool over_exert;        /* Allow casting spells when short of mana */
212 bool numpad_as_cursorkey;       /* Use numpad keys as cursor key in editor mode */
213
214
215 /*** Map Screen Options ***/
216
217 bool center_player;     /* Center map while walking (*slow*) */
218 bool center_running;    /* Centering even while running */
219 bool view_yellow_lite;  /* Use special colors for torch-lit grids */
220 bool view_bright_lite;  /* Use special colors for 'viewable' grids */
221 bool view_granite_lite; /* Use special colors for wall grids (slow) */
222 bool view_special_lite; /* Use special colors for floor grids (slow) */
223 bool view_perma_grids;  /* Map remembers all perma-lit grids */
224 bool view_torch_grids;  /* Map remembers all torch-lit grids */
225 bool view_unsafe_grids; /* Map marked by detect traps */
226 bool view_reduce_view;  /* Reduce view-radius in town */
227 bool fresh_before;      /* Flush output while continuous command */
228 bool fresh_after;       /* Flush output after monster's move */
229 bool fresh_message;     /* Flush output after every message */
230 bool hilite_player;     /* Hilite the player with the cursor */
231 bool display_path;      /* Display actual path before shooting */
232
233
234 /*** Text Display Options ***/
235
236 bool plain_descriptions;        /* Plain object descriptions */
237 bool plain_pickup;      /* Plain pickup messages(japanese only) */
238 bool always_show_list;  /* Always show list when choosing items */
239 bool depth_in_feet;     /* Show dungeon level in feet */
240 bool show_labels;       /* Show labels in object listings */
241 bool show_weights;      /* Show weights in object listings */
242 bool show_item_graph;   /* Show items graphics */
243 bool equippy_chars;     /* Display 'equippy' chars */
244 bool display_mutations; /* Display mutations in 'C'haracter Display */
245 bool compress_savefile; /* Compress messages in savefiles */
246 bool abbrev_extra;      /* Describe obj's extra resistances by abbreviation */
247 bool abbrev_all;        /* Describe obj's all resistances by abbreviation */
248 bool exp_need;  /* Show the experience needed for next level */
249 bool ignore_unview;     /* Ignore whenever any monster does */
250
251
252 /*** Game-Play Options ***/
253
254 bool stack_force_notes; /* Merge inscriptions when stacking */
255 bool stack_force_costs; /* Merge discounts when stacking */
256 bool expand_list;       /* Expand the power of the list commands */
257 bool small_levels;      /* Allow unusually small dungeon levels */
258 bool always_small_levels;       /* Always create unusually small dungeon levels */
259 bool empty_levels;      /* Allow empty 'arena' levels */
260 bool bound_walls_perm;  /* Boundary walls become 'permanent wall' */
261 bool last_words;        /* Leave last words when your character dies */
262
263 #ifdef WORLD_SCORE
264 bool send_score;        /* Send score dump to the world score server */
265 #endif
266
267 bool allow_debug_opts;  /* Allow use of debug/cheat options */
268
269
270 /*** Disturbance Options ***/
271
272 bool find_ignore_stairs;        /* Run past stairs */
273 bool find_ignore_doors; /* Run through open doors */
274 bool find_cut;  /* Run past known corners */
275 bool check_abort;       /* Check for user abort while continuous command */
276 bool flush_failure;     /* Flush input on various failures */
277 bool flush_disturb;     /* Flush input whenever disturbed */
278 bool disturb_move;      /* Disturb whenever any monster moves */
279 bool disturb_high;      /* Disturb whenever high-level monster moves */
280 bool disturb_near;      /* Disturb whenever viewable monster moves */
281 bool disturb_pets;      /* Disturb when visible pets move */
282 bool disturb_panel;     /* Disturb whenever map panel changes */
283 bool disturb_state;     /* Disturb whenever player state changes */
284 bool disturb_minor;     /* Disturb whenever boring things happen */
285 bool ring_bell; /* Audible bell (on errors, etc) */
286 bool disturb_trap_detect;       /* Disturb when leaving trap detected area */
287 bool alert_trap_detect; /* Alert when leaving trap detected area */
288
289
290 /*** Birth Options ***/
291
292 bool manual_haggle;     /* Manually haggle in stores */
293 bool easy_band; /* Easy Mode (*) */
294 bool smart_learn;       /* Monsters learn from their mistakes (*) */
295 bool smart_cheat;       /* Monsters exploit players weaknesses (*) */
296 bool vanilla_town;      /* Use 'vanilla' town without quests and wilderness */
297 bool lite_town; /* Use 'lite' town without a wilderness */
298 bool ironman_shops;     /* Stores are permanently closed (*) */
299 bool ironman_small_levels;      /* Always create unusually small dungeon levels (*) */
300 bool ironman_downward;  /* Disable recall and use of up stairs (*) */
301 bool ironman_empty_levels;      /* Always create empty 'arena' levels (*) */
302 bool ironman_rooms;     /* Always generate very unusual rooms (*) */
303 bool ironman_nightmare; /* Nightmare mode(it isn't even remotely fair!)(*) */
304 bool left_hander;       /* Left-Hander */
305 bool preserve_mode;     /* Preserve artifacts (*) */
306 bool autoroller;        /* Allow use of autoroller for stats (*) */
307 bool autochara; /* Autoroll for weight, height and social status */
308 bool powerup_home;      /* Increase capacity of your home (*) */
309 bool show_ammo_detail;  /* Show Description of ammo damage */
310 bool show_ammo_no_crit; /* Show No-crit damage of ammo */
311 bool show_ammo_crit_ratio;      /* Show critical ratio of ammo */
312
313
314
315
316 /*** Easy Object Auto-Destroyer ***/
317
318 bool destroy_items;     /* Use easy auto-destroyer */
319 bool destroy_feeling;   /* Apply auto-destroy as sense feeling */
320 bool destroy_identify;  /* Apply auto-destroy as identify an item */
321 bool leave_worth;       /* Auto-destroyer leaves known worthy items */
322 bool leave_equip;       /* Auto-destroyer leaves weapons and armour */
323 bool leave_chest;       /* Auto-destroyer leaves closed chests */
324 bool leave_wanted;      /* Auto-destroyer leaves wanted corpses */
325 bool leave_corpse;      /* Auto-destroyer leaves corpses and skeletons */
326 bool leave_junk;        /* Auto-destroyer leaves junk */
327 bool leave_special;     /* Auto-destroyer leaves items your race/class needs */
328
329
330 /*** Play-record Options ***/
331
332 bool record_fix_art;    /* Record fixed artifacts */
333 bool record_rand_art;   /* Record random artifacts */
334 bool record_destroy_uniq;       /* Record when destroy unique monster */
335 bool record_fix_quest;  /* Record fixed quests */
336 bool record_rand_quest; /* Record random quests */
337 bool record_maxdepth;   /* Record movements to deepest level */
338 bool record_stair;      /* Record recall and stair movements */
339 bool record_buy;        /* Record purchased items */
340 bool record_sell;       /* Record sold items */
341 bool record_danger;     /* Record hitpoint warning */
342 bool record_arena;      /* Record arena victories */
343 bool record_ident;      /* Record first identified items */
344 bool record_named_pet;  /* Record informations of named pets */
345 char record_o_name[MAX_NLEN];
346 s32b record_turn;
347
348
349 /* Cheating options */
350
351 bool cheat_peek;        /* Peek into object creation */
352 bool cheat_hear;        /* Peek into monster creation */
353 bool cheat_room;        /* Peek into dungeon creation */
354 bool cheat_xtra;        /* Peek into something else */
355 bool cheat_know;        /* Know complete monster info */
356 bool cheat_live;        /* Allow player to avoid death */
357 bool cheat_save;        /* Ask for saving death */
358 bool cheat_diary_output; /* Detailed info to diary */
359 bool cheat_turn;        /* Peek turn */
360
361
362 /* Special options */
363
364 byte hitpoint_warn;     /* Hitpoint warning (0 to 9) */
365 byte mana_warn; /* Mana color (0 to 9) */
366
367 byte delay_factor;      /* Delay factor (0 to 9) */
368
369 bool autosave_l;        /* Autosave before entering new levels */
370 bool autosave_t;        /* Timed autosave */
371 s16b autosave_freq;     /* Autosave frequency */
372
373
374 /*
375  * Dungeon variables
376  */
377
378 bool closing_flag;              /* Dungeon is closing */
379
380
381 /*
382  * Dungeon size info
383  */
384
385 POSITION panel_row_min, panel_row_max;
386 POSITION panel_col_min, panel_col_max;
387 POSITION panel_col_prt, panel_row_prt;
388
389
390 /*
391  * Targetting variables
392  */
393 IDX target_who;
394 POSITION target_col;
395 POSITION target_row;
396
397
398 /*
399  * User info
400  */
401 int player_uid;
402 int player_euid;
403 int player_egid;
404
405 /*
406  * Stripped version of "player_name"
407  */
408 char player_base[32];
409
410
411 /*
412  * Buffer to hold the current savefile name
413  * 'savefile' holds full path name. 'savefile_base' holds only base name.
414  */
415 char savefile[1024];
416 char savefile_base[40];
417
418 /*
419  * Array of grids lit by player lite (see "cave.c")
420  */
421 s16b lite_n;
422 POSITION lite_y[LITE_MAX];
423 POSITION lite_x[LITE_MAX];
424
425 /*
426  * Array of grids lit by player lite (see "cave.c")
427  */
428 s16b mon_lite_n;
429 POSITION mon_lite_y[MON_LITE_MAX];
430 POSITION mon_lite_x[MON_LITE_MAX];
431
432 /*
433  * Array of grids viewable to the player (see "cave.c")
434  */
435 s16b view_n;
436 POSITION view_y[VIEW_MAX];
437 POSITION view_x[VIEW_MAX];
438
439 /*
440  * Array of grids for use by various functions (see "cave.c")
441  */
442 s16b temp_n;
443 POSITION temp_y[TEMP_MAX];
444 POSITION temp_x[TEMP_MAX];
445
446 /*
447  * Array of grids for delayed visual updating (see "cave.c")
448  */
449 s16b redraw_n = 0;
450 POSITION redraw_y[REDRAW_MAX];
451 POSITION redraw_x[REDRAW_MAX];
452
453
454 /*
455  * Number of active macros.
456  */
457 s16b macro__num;
458
459 /*
460  * Array of macro patterns [MACRO_MAX]
461  */
462 cptr *macro__pat;
463
464 /*
465  * Array of macro actions [MACRO_MAX]
466  */
467 cptr *macro__act;
468
469 /*
470  * Array of macro types [MACRO_MAX]
471  */
472 bool *macro__cmd;
473
474 /*
475  * Current macro action [1024]
476  */
477 char *macro__buf;
478
479
480 /*
481  * The number of quarks
482  */
483 s16b quark__num;
484
485 /*
486  * The pointers to the quarks [QUARK_MAX]
487  */
488 cptr *quark__str;
489
490
491 /*
492  * The next "free" index to use
493  */
494 u32b message__next;
495
496 /*
497  * The index of the oldest message (none yet)
498  */
499 u32b message__last;
500
501 /*
502  * The next "free" offset
503  */
504 u32b message__head;
505
506 /*
507  * The offset to the oldest used char (none yet)
508  */
509 u32b message__tail;
510
511 /*
512  * The array of offsets, by index [MESSAGE_MAX]
513  */
514 u32b *message__ptr;
515
516 /*
517  * The array of chars, by offset [MESSAGE_BUF]
518  */
519 char *message__buf;
520
521
522 /*
523  * The array of normal options
524  */
525 u32b option_flag[8];
526 u32b option_mask[8];
527
528
529 /*
530  * The array of window options
531  */
532 u32b window_flag[8];
533 u32b window_mask[8];
534
535
536 /*
537  * The array of window pointers
538  */
539 term *angband_term[8];
540
541
542 /*
543  * Standard window names
544  */
545 const char angband_term_name[8][16] =
546 {
547         "Hengband",
548         "Term-1",
549         "Term-2",
550         "Term-3",
551         "Term-4",
552         "Term-5",
553         "Term-6",
554         "Term-7"
555 };
556
557
558 /*
559  * Global table of color definitions
560  */
561 byte angband_color_table[256][4] =
562 {
563         {0x00, 0x00, 0x00, 0x00},       /* TERM_DARK */
564         {0x00, 0xFF, 0xFF, 0xFF},       /* TERM_WHITE */
565         {0x00, 0x80, 0x80, 0x80},       /* TERM_SLATE */
566         {0x00, 0xFF, 0x80, 0x00},       /* TERM_ORANGE */
567         {0x00, 0xC0, 0x00, 0x00},       /* TERM_RED */
568         {0x00, 0x00, 0x80, 0x40},       /* TERM_GREEN */
569         {0x00, 0x00, 0x00, 0xFF},       /* TERM_BLUE */
570         {0x00, 0x80, 0x40, 0x00},       /* TERM_UMBER */
571         {0x00, 0x40, 0x40, 0x40},       /* TERM_L_DARK */
572         {0x00, 0xC0, 0xC0, 0xC0},       /* TERM_L_WHITE */
573         {0x00, 0xFF, 0x00, 0xFF},       /* TERM_VIOLET */
574         {0x00, 0xFF, 0xFF, 0x00},       /* TERM_YELLOW */
575         {0x00, 0xFF, 0x00, 0x00},       /* TERM_L_RED */
576         {0x00, 0x00, 0xFF, 0x00},       /* TERM_L_GREEN */
577         {0x00, 0x00, 0xFF, 0xFF},       /* TERM_L_BLUE */
578         {0x00, 0xC0, 0x80, 0x40}        /* TERM_L_UMBER */
579 };
580
581
582 /*
583  * Standard sound names
584  */
585 const cptr angband_sound_name[SOUND_MAX] =
586 {
587         "dummy",
588         "hit",
589         "miss",
590         "flee",
591         "drop",
592         "kill",
593         "level",
594         "death",
595         "study",
596         "teleport",
597         "shoot",
598         "quaff",
599         "zap",
600         "walk",
601         "tpother",
602         "hitwall",
603         "eat",
604         "store1",
605         "store2",
606         "store3",
607         "store4",
608         "dig",
609         "opendoor",
610         "shutdoor",
611         "tplevel",
612         "scroll",
613         "buy",
614         "sell",
615         "warn",
616         "rocket",
617         "n_kill",
618         "u_kill",
619         "quest",
620         "heal",
621         "x_heal",
622         "bite",
623         "claw",
624         "m_spell",
625         "summon",
626         "breath",
627         "ball",
628         "m_heal",
629         "atkspell",
630         "evil",
631         "touch",
632         "sting",
633         "crush",
634         "slime",
635         "wail",
636         "winner",
637         "fire",
638         "acid",
639         "elec",
640         "cold",
641         "illegal",
642         "fail",
643         "wakeup",
644         "invuln",
645         "fall",
646         "pain",
647         "destitem",
648         "moan",
649         "show",
650         "unused",
651         "explode",
652         "glass",
653 };
654
655 /*
656  * Standard music names
657  */
658 const cptr angband_music_basic_name[MUSIC_BASIC_MAX] =
659 {
660         "default",
661         "gameover",
662         "exit",
663         "town",
664         "field1",
665         "field2",
666         "field3",
667         "dun_low",
668         "dun_med",
669         "dun_high",
670         "feel1",
671         "feel2",
672         "winner",
673         "build",
674         "wild",
675         "quest",
676         "arena",
677         "battle",
678         "quest_clear",
679         "final_quest_clear",
680         "ambush",
681 };
682
683
684 /*
685  * The array of "cave grids" [MAX_WID][MAX_HGT].
686  * Not completely allocated, that would be inefficient
687  * Not completely hardcoded, that would overflow memory
688  */
689 cave_type *cave[MAX_HGT];
690
691
692 /*
693  * The array of saved floors
694  */
695 saved_floor_type saved_floors[MAX_SAVED_FLOORS];
696
697
698 /*
699  * Number of floor_id used from birth
700  */
701 s16b max_floor_id;
702
703
704 /*
705  * Sign for current process used in temporal files.
706  * Actually it is the start time of current process.
707  */
708 u32b saved_floor_file_sign;
709
710
711 /*
712  * The array of dungeon items [max_o_idx]
713  */
714 object_type *o_list;
715
716 /*
717  * The array of dungeon monsters [max_m_idx]
718  */
719 monster_type *m_list;
720
721 /*
722  * The array to process dungeon monsters [max_m_idx]
723  */
724 s16b *mproc_list[MAX_MTIMED];
725 s16b mproc_max[MAX_MTIMED]; /* Number of monsters to be processed */
726
727
728 /*
729  * Maximum number of towns
730  */
731 u16b max_towns;
732
733 /*
734  * The towns [max_towns]
735  */
736 town_type *town;
737
738
739 /*
740  * The player's inventory [INVEN_TOTAL]
741  */
742 object_type *inventory;
743
744
745 /*
746  * The size of "alloc_kind_table" (at most max_k_idx * 4)
747  */
748 s16b alloc_kind_size;
749
750 /*
751  * The entries in the "kind allocator table"
752  */
753 alloc_entry *alloc_kind_table;
754
755
756 /*
757  * The size of "alloc_race_table" (at most max_r_idx)
758  */
759 s16b alloc_race_size;
760
761 /*
762  * The entries in the "race allocator table"
763  */
764 alloc_entry *alloc_race_table;
765
766
767 /*
768  * Specify attr/char pairs for visual special effects
769  * Be sure to use "index & 0x7F" to avoid illegal access
770  */
771 byte misc_to_attr[256];
772 char misc_to_char[256];
773
774
775 /*
776  * Specify attr/char pairs for inventory items (by tval)
777  * Be sure to use "index & 0x7F" to avoid illegal access
778  */
779 byte tval_to_attr[128];
780 char tval_to_char[128];
781
782
783 /*
784  * Keymaps for each "mode" associated with each keypress.
785  */
786 cptr keymap_act[KEYMAP_MODES][256];
787
788
789
790 /*** Player information ***/
791
792 /*
793  * Static player info record
794  */
795 player_type p_body;
796
797 /*
798  * Pointer to the player info
799  */
800 player_type *p_ptr = &p_body;
801
802 /*
803  * Pointer to the player tables
804  * (sex, race, class, magic)
805  */
806 const player_sex *sp_ptr;
807 const player_race *rp_ptr;
808 const player_class *cp_ptr;
809 const player_seikaku *ap_ptr;
810 const player_magic *mp_ptr;
811
812
813 /*
814  * The last character rolled,
815  * holded for quick start
816  */
817 birther previous_char;
818
819
820 /*
821  * The vault generation arrays
822  */
823 vault_type *v_info;
824 char *v_name;
825 char *v_text;
826
827 /*
828  * The skill table
829  */
830 skill_table *s_info;
831
832 /*
833  * The magic info
834  */
835 player_magic *m_info;
836
837 /*
838  * The terrain feature arrays
839  */
840 feature_type *f_info;
841 char *f_name;
842 char *f_tag;
843
844 /*
845  * The object kind arrays
846  */
847 object_kind *k_info;
848 char *k_name;
849 char *k_text;
850
851 /*
852  * The artifact arrays
853  */
854 artifact_type *a_info;
855 char *a_name;
856 char *a_text;
857
858 /*
859  * The ego-item arrays
860  */
861 ego_item_type *e_info;
862 char *e_name;
863 char *e_text;
864
865
866 /*
867  * The monster race arrays
868  */
869 monster_race *r_info;
870 char *r_name;
871 char *r_text;
872
873
874 /*
875  * The dungeon arrays
876  */
877 dungeon_info_type *d_info;
878 char *d_name;
879 char *d_text;
880
881
882 /*
883  * Hack -- The special Angband "System Suffix"
884  * This variable is used to choose an appropriate "pref-xxx" file
885  */
886 cptr ANGBAND_SYS = "xxx";
887
888 /*
889  * Hack -- The special Angband "Keyboard Suffix"
890  * This variable is used to choose an appropriate macro-trigger definition
891  */
892 #ifdef JP
893 cptr ANGBAND_KEYBOARD = "JAPAN";
894 #else
895 cptr ANGBAND_KEYBOARD = "0";
896 #endif
897
898 /*
899  * Hack -- The special Angband "Graphics Suffix"
900  * This variable is used to choose an appropriate "graf-xxx" file
901  */
902 cptr ANGBAND_GRAF = "ascii";
903
904 /*
905  * Path name: The main "lib" directory
906  * This variable is not actually used anywhere in the code
907  */
908 cptr ANGBAND_DIR;
909
910 /*
911  * High score files (binary)
912  * These files may be portable between platforms
913  */
914 cptr ANGBAND_DIR_APEX;
915
916 /*
917  * Bone files for player ghosts (ascii)
918  * These files are portable between platforms
919  */
920 cptr ANGBAND_DIR_BONE;
921
922 /*
923  * Binary image files for the "*_info" arrays (binary)
924  * These files are not portable between platforms
925  */
926 cptr ANGBAND_DIR_DATA;
927
928 /*
929  * Textual template files for the "*_info" arrays (ascii)
930  * These files are portable between platforms
931  */
932 cptr ANGBAND_DIR_EDIT;
933
934 /*
935  * Script files
936  * These files are portable between platforms.
937  */
938 cptr ANGBAND_DIR_SCRIPT;
939
940 /*
941  * Various extra files (ascii)
942  * These files may be portable between platforms
943  */
944 cptr ANGBAND_DIR_FILE;
945
946 /*
947  * Help files (normal) for the online help (ascii)
948  * These files are portable between platforms
949  */
950 cptr ANGBAND_DIR_HELP;
951
952 /*
953  * Help files (spoilers) for the online help (ascii)
954  * These files are portable between platforms
955  */
956 cptr ANGBAND_DIR_INFO;
957
958 /*
959  * Default user "preference" files (ascii)
960  * These files are rarely portable between platforms
961  */
962 cptr ANGBAND_DIR_PREF;
963
964 /*
965  * Savefiles for current characters (binary)
966  * These files are portable between platforms
967  */
968 cptr ANGBAND_DIR_SAVE;
969
970 /*
971  * User "preference" files (ascii)
972  * These files are rarely portable between platforms
973  */
974 cptr ANGBAND_DIR_USER;
975
976 /*
977  * Various extra files (binary)
978  * These files are rarely portable between platforms
979  */
980 cptr ANGBAND_DIR_XTRA;
981
982
983 /*
984  * Total Hack -- allow all items to be listed (even empty ones)
985  * This is only used by "do_cmd_inven_e()" and is cleared there.
986  */
987 bool item_tester_full;
988
989 bool item_tester_no_ryoute = FALSE;
990
991 /*
992  * Here is a "pseudo-hook" used during calls to "get_item()" and
993  * "show_inven()" and "show_equip()", and the choice window routines.
994  */
995 OBJECT_TYPE_VALUE item_tester_tval;
996
997
998 /*
999  * Here is a "hook" used during calls to "get_item()" and
1000  * "show_inven()" and "show_equip()", and the choice window routines.
1001  */
1002 bool (*item_tester_hook)(object_type*);
1003
1004
1005
1006 /*
1007  * Current "comp" function for ang_sort()
1008  */
1009 bool (*ang_sort_comp)(vptr u, vptr v, int a, int b);
1010
1011
1012 /*
1013  * Current "swap" function for ang_sort()
1014  */
1015 void (*ang_sort_swap)(vptr u, vptr v, int a, int b);
1016
1017
1018
1019 /*
1020  * Hack -- function hooks to restrict "get_mon_num_prep()" function
1021  */
1022 monster_hook_type get_mon_num_hook;
1023 monster_hook_type get_mon_num2_hook;
1024
1025
1026 /*
1027  * Hack -- function hook to restrict "get_obj_num_prep()" function
1028  */
1029 bool (*get_obj_num_hook)(KIND_OBJECT_IDX k_idx);
1030
1031
1032 /* Hack, monk armour */
1033 bool monk_armour_aux;
1034 bool monk_notify_aux;
1035
1036
1037 /*
1038  * Wilderness
1039  */
1040 wilderness_type **wilderness;
1041
1042
1043 /*
1044  * Buildings
1045  */
1046 building_type building[MAX_BLDG];
1047
1048
1049 /*
1050  * Maximum number of quests
1051  */
1052 IDX max_quests;
1053
1054 /*
1055  * Maximum number of monsters in r_info.txt
1056  */
1057 MONRACE_IDX max_r_idx;
1058
1059 /*
1060  * Maximum number of items in k_info.txt
1061  */
1062 IDX max_k_idx;
1063
1064 /*
1065  * Maximum number of vaults in v_info.txt
1066  */
1067 IDX max_v_idx;
1068
1069 /*
1070  * Maximum number of terrain features in f_info.txt
1071  */
1072 IDX max_f_idx;
1073
1074 /*
1075  * Maximum number of artifacts in a_info.txt
1076  */
1077 IDX max_a_idx;
1078
1079 /*
1080  * Maximum number of ego-items in e_info.txt
1081  */
1082 IDX max_e_idx;
1083
1084 /*
1085  * Maximum number of dungeon in e_info.txt
1086  */
1087 IDX max_d_idx;
1088
1089 /*
1090  * Maximum number of objects in the level
1091  */
1092 IDX max_o_idx;
1093
1094 /*
1095  * Maximum number of monsters in the level
1096  */
1097 MONSTER_IDX max_m_idx;
1098
1099 /*
1100  * Maximum size of the wilderness
1101  */
1102 POSITION max_wild_x;
1103 POSITION max_wild_y;
1104
1105 /*
1106  * Quest info
1107  */
1108 quest_type *quest;
1109
1110 /*
1111  * Quest text
1112  */
1113 char quest_text[10][80];
1114
1115 /*
1116  * Current line of the quest text
1117  */
1118 int quest_text_line;
1119
1120 /*
1121  * Default spell color table (quark index)
1122  */
1123 s16b gf_color[MAX_GF];
1124
1125 /*
1126  * Flags for initialization
1127  */
1128 int init_flags;
1129
1130
1131 /*
1132  * The "highscore" file descriptor, if available.
1133  */
1134 int highscore_fd = -1;
1135
1136 int mutant_regenerate_mod = 100;
1137
1138 bool can_save = FALSE;        /* Game can be saved */
1139
1140 s16b world_monster;
1141 bool world_player;
1142
1143 int cap_mon;
1144 int cap_mspeed;
1145 HIT_POINT cap_hp;
1146 HIT_POINT cap_maxhp;
1147 STR_OFFSET cap_nickname;
1148
1149 MONRACE_IDX battle_mon[4];
1150 int sel_monster;
1151 int battle_odds;
1152 PRICE kakekin;
1153 u32b mon_odds[4];
1154
1155 MONSTER_IDX pet_t_m_idx;
1156 MONSTER_IDX riding_t_m_idx;
1157
1158 MONSTER_IDX kubi_r_idx[MAX_KUBI];
1159 MONSTER_IDX today_mon;
1160
1161 bool write_level;
1162
1163 u32b playtime;
1164 u32b start_time;
1165
1166 int tsuri_dir;
1167
1168 bool sukekaku;
1169 bool new_mane;
1170
1171 bool mon_fight;
1172
1173 bool ambush_flag;
1174 bool generate_encounter;
1175
1176 cptr screen_dump = NULL;
1177
1178 /*** Terrain feature variables ***/
1179
1180 /* Nothing */
1181 FEAT_IDX feat_none;
1182
1183 /* Floor */
1184 FEAT_IDX feat_floor;
1185
1186 /* Objects */
1187 FEAT_IDX feat_glyph;
1188 FEAT_IDX feat_explosive_rune;
1189 FEAT_IDX feat_mirror;
1190
1191 /* Doors */
1192 door_type feat_door[MAX_DOOR_TYPES];
1193
1194 /* Stairs */
1195 FEAT_IDX feat_up_stair;
1196 FEAT_IDX feat_down_stair;
1197 FEAT_IDX feat_entrance;
1198
1199 /* Special traps */
1200 FEAT_IDX feat_trap_open;
1201 FEAT_IDX feat_trap_armageddon;
1202 FEAT_IDX feat_trap_piranha;
1203
1204 /* Rubble */
1205 FEAT_IDX feat_rubble;
1206
1207 /* Seams */
1208 FEAT_IDX feat_magma_vein;
1209 FEAT_IDX feat_quartz_vein;
1210
1211 /* Walls */
1212 FEAT_IDX feat_granite;
1213 FEAT_IDX feat_permanent;
1214
1215 /* Glass floor */
1216 FEAT_IDX feat_glass_floor;
1217
1218 /* Glass walls */
1219 FEAT_IDX feat_glass_wall;
1220 FEAT_IDX feat_permanent_glass_wall;
1221
1222 /* Pattern */
1223 FEAT_IDX feat_pattern_start;
1224 FEAT_IDX feat_pattern_1;
1225 FEAT_IDX feat_pattern_2;
1226 FEAT_IDX feat_pattern_3;
1227 FEAT_IDX feat_pattern_4;
1228 FEAT_IDX feat_pattern_end;
1229 FEAT_IDX feat_pattern_old;
1230 FEAT_IDX feat_pattern_exit;
1231 FEAT_IDX feat_pattern_corrupted;
1232
1233 /* Various */
1234 FEAT_IDX feat_black_market;
1235 FEAT_IDX feat_town;
1236
1237 /* Terrains */
1238 FEAT_IDX feat_deep_water;
1239 FEAT_IDX feat_shallow_water;
1240 FEAT_IDX feat_deep_lava;
1241 FEAT_IDX feat_shallow_lava;
1242 FEAT_IDX feat_dirt;
1243 FEAT_IDX feat_grass;
1244 FEAT_IDX feat_flower;
1245 FEAT_IDX feat_brake;
1246 FEAT_IDX feat_tree;
1247 FEAT_IDX feat_mountain;
1248 FEAT_IDX feat_swamp;
1249
1250 /* Unknown grid (not detected) */
1251 FEAT_IDX feat_undetected;
1252
1253 /*
1254  * Which dungeon ?
1255  */
1256 DUNGEON_IDX dungeon_type;
1257 DEPTH *max_dlv;
1258
1259 FEAT_IDX feat_wall_outer;
1260 FEAT_IDX feat_wall_inner;
1261 FEAT_IDX feat_wall_solid;
1262 FEAT_IDX floor_type[100], fill_type[100];
1263
1264 bool now_damaged;
1265 COMMAND_CODE now_message;
1266 bool use_menu;
1267
1268 #ifdef CHUUKEI
1269 bool chuukei_server;
1270 bool chuukei_client;
1271 char *server_name;
1272 int server_port;
1273 #endif
1274
1275 /* for movie */
1276 bool browsing_movie;
1277
1278 #ifdef TRAVEL
1279 /* for travel */
1280 travel_type travel;
1281 #endif
1282
1283 /* for snipers */
1284 int snipe_type = SP_NONE;
1285 bool reset_concent = FALSE;   /* Concentration reset flag */
1286 bool is_fired = FALSE;
1287