OSDN Git Service

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