OSDN Git Service

[Refactor] #38993 mon_fight を floor_type の monster_noise に置換.
[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 #include "geometry.h"
15
16 int max_macrotrigger = 0; /*!< 現在登録中のマクロ(トリガー)の数 */
17 concptr macro_template = NULL; /*!< Angband設定ファイルのT: タグ情報から読み込んだ長いTコードを処理するために利用する文字列ポインタ */
18 concptr macro_modifier_chr; /*!< &x# で指定されるマクロトリガーに関する情報を記録する文字列ポインタ */
19 concptr macro_modifier_name[MAX_MACRO_MOD]; /*!< マクロ上で取り扱う特殊キーを文字列上で表現するためのフォーマットを記録した文字列ポインタ配列 */
20 concptr macro_trigger_name[MAX_MACRO_TRIG]; /*!< マクロのトリガーコード */
21 concptr macro_trigger_keycode[2][MAX_MACRO_TRIG];  /*!< マクロの内容 */
22
23 int level_up = 0; /*!< レベルアップの際に遅延してcalc_mana()関数上で上昇量を表示するかどうかの判定フラグ */
24
25 /*
26  * Various things
27  */
28 bool character_generated;       /* The character exists */
29 bool character_dungeon;         /* The character has a dungeon */
30 bool character_loaded;          /* The character was loaded from a savefile */
31 bool character_saved;           /* The character was just saved to a savefile */
32
33 bool character_icky;            /* The game is in an icky full screen mode */
34 bool character_xtra;            /* The game is in an icky startup mode */
35
36 bool creating_savefile;         /* New savefile is currently created */
37
38 s16b command_cmd;               /* Current "Angband Command" */
39
40 COMMAND_ARG command_arg;        /*!< 各種コマンドの汎用的な引数として扱う / Gives argument of current command */
41 COMMAND_NUM command_rep;        /*!< 各種コマンドの汎用的なリピート数として扱う / Gives repetition of current command */
42 DIRECTION command_dir;          /*!< 各種コマンドの汎用的な方向値処理として扱う/ Gives direction of current command */
43
44 s16b command_see;               /* See "object1.c" */
45 s16b command_wrk;               /* See "object1.c" */
46
47 TERM_LEN command_gap = 999;         /* See "object1.c" */
48
49 s16b command_new;               /* Command chaining from inven/equip view */
50
51 bool msg_flag;                  /* Used in msg_print() for "buffering" */
52
53 s16b running;                   /* Current counter for running, if any */
54
55 GAME_TURN old_battle;
56
57 s16b signal_count;              /* Hack -- Count interupts */
58
59 bool inkey_base;                /* See the "inkey()" function */
60 bool inkey_xtra;                /* See the "inkey()" function */
61 bool inkey_scan;                /* See the "inkey()" function */
62 bool inkey_flag;                /* See the "inkey()" function */
63 bool get_com_no_macros = FALSE; /* Expand macros in "get_com" or not */
64
65 OBJECT_SUBTYPE_VALUE coin_type; /* Hack -- force coin type */
66
67 bool repair_monsters;   /* Hack -- optimize detect monsters */
68 bool repair_objects;    /* Hack -- optimize detect objects */
69
70 MONSTER_IDX hack_m_idx = 0;     /* Hack -- see "process_monsters()" */
71 MONSTER_IDX hack_m_idx_ii = 0;
72
73 bool multi_rew = FALSE;
74
75 int total_friends = 0;
76 int leaving_quest = 0;
77 bool reinit_wilderness = FALSE;
78
79 /*
80  * Dungeon size info
81  */
82
83 POSITION panel_row_min, panel_row_max;
84 POSITION panel_col_min, panel_col_max;
85 POSITION panel_col_prt, panel_row_prt;
86
87
88 /*
89  * Targetting variables
90  */
91 MONSTER_IDX target_who;
92 POSITION target_col;
93 POSITION target_row;
94
95
96 /*
97  * User info
98  */
99 int player_uid;
100 int player_euid;
101 int player_egid;
102
103 /*
104  * Stripped version of "player_name"
105  */
106 char player_base[32];
107
108
109 /*
110  * Buffer to hold the current savefile name
111  * 'savefile' holds full path name. 'savefile_base' holds only base name.
112  */
113 char savefile[1024];
114 char savefile_base[40];
115
116
117 pos_list tmp_pos;
118
119
120 /*
121  * Number of active macros.
122  */
123 s16b macro__num;
124
125 /*
126  * Array of macro patterns [MACRO_MAX]
127  */
128 concptr *macro__pat;
129
130 /*
131  * Array of macro actions [MACRO_MAX]
132  */
133 concptr *macro__act;
134
135 /*
136  * Array of macro types [MACRO_MAX]
137  */
138 bool *macro__cmd;
139
140 /*
141  * Current macro action [1024]
142  */
143 char *macro__buf;
144
145
146 /*
147  * The number of quarks
148  */
149 STR_OFFSET quark__num;
150
151 /*
152  * The pointers to the quarks [QUARK_MAX]
153  */
154 concptr *quark__str;
155
156 /*
157  * The array of window pointers
158  */
159 term *angband_term[8];
160
161 /*
162  * Standard window names
163  */
164 const char angband_term_name[8][16] =
165 {
166         "Hengband",
167         "Term-1",
168         "Term-2",
169         "Term-3",
170         "Term-4",
171         "Term-5",
172         "Term-6",
173         "Term-7"
174 };
175
176
177 /*
178  * Global table of color definitions
179  */
180 byte angband_color_table[256][4] =
181 {
182         {0x00, 0x00, 0x00, 0x00},       /* TERM_DARK */
183         {0x00, 0xFF, 0xFF, 0xFF},       /* TERM_WHITE */
184         {0x00, 0x80, 0x80, 0x80},       /* TERM_SLATE */
185         {0x00, 0xFF, 0x80, 0x00},       /* TERM_ORANGE */
186         {0x00, 0xC0, 0x00, 0x00},       /* TERM_RED */
187         {0x00, 0x00, 0x80, 0x40},       /* TERM_GREEN */
188         {0x00, 0x00, 0x00, 0xFF},       /* TERM_BLUE */
189         {0x00, 0x80, 0x40, 0x00},       /* TERM_UMBER */
190         {0x00, 0x40, 0x40, 0x40},       /* TERM_L_DARK */
191         {0x00, 0xC0, 0xC0, 0xC0},       /* TERM_L_WHITE */
192         {0x00, 0xFF, 0x00, 0xFF},       /* TERM_VIOLET */
193         {0x00, 0xFF, 0xFF, 0x00},       /* TERM_YELLOW */
194         {0x00, 0xFF, 0x00, 0x00},       /* TERM_L_RED */
195         {0x00, 0x00, 0xFF, 0x00},       /* TERM_L_GREEN */
196         {0x00, 0x00, 0xFF, 0xFF},       /* TERM_L_BLUE */
197         {0x00, 0xC0, 0x80, 0x40}        /* TERM_L_UMBER */
198 };
199
200
201 /*
202  * Standard sound names
203  */
204 const concptr angband_sound_name[SOUND_MAX] =
205 {
206         "dummy",
207         "hit",
208         "miss",
209         "flee",
210         "drop",
211         "kill",
212         "level",
213         "death",
214         "study",
215         "teleport",
216         "shoot",
217         "quaff",
218         "zap",
219         "walk",
220         "tpother",
221         "hitwall",
222         "eat",
223         "store1",
224         "store2",
225         "store3",
226         "store4",
227         "dig",
228         "opendoor",
229         "shutdoor",
230         "tplevel",
231         "scroll",
232         "buy",
233         "sell",
234         "warn",
235         "rocket",
236         "n_kill",
237         "u_kill",
238         "quest",
239         "heal",
240         "x_heal",
241         "bite",
242         "claw",
243         "m_spell",
244         "summon",
245         "breath",
246         "ball",
247         "m_heal",
248         "atkspell",
249         "evil",
250         "touch",
251         "sting",
252         "crush",
253         "slime",
254         "wail",
255         "winner",
256         "fire",
257         "acid",
258         "elec",
259         "cold",
260         "illegal",
261         "fail",
262         "wakeup",
263         "invuln",
264         "fall",
265         "pain",
266         "destitem",
267         "moan",
268         "show",
269         "unused",
270         "explode",
271         "glass",
272         "reflect",
273 };
274
275 /*
276  * Standard music names
277  */
278 const concptr angband_music_basic_name[MUSIC_BASIC_MAX] =
279 {
280         "default",
281         "gameover",
282         "exit",
283         "town",
284         "field1",
285         "field2",
286         "field3",
287         "dun_low",
288         "dun_med",
289         "dun_high",
290         "feel1",
291         "feel2",
292         "winner",
293         "build",
294         "wild",
295         "quest",
296         "arena",
297         "battle",
298         "quest_clear",
299         "final_quest_clear",
300         "ambush",
301 };
302
303
304 /*
305  * Number of floor_id used from birth
306  */
307 FLOOR_IDX max_floor_id;
308
309 /*
310  * Sign for current process used in temporal files.
311  * Actually it is the start time of current process.
312  */
313 u32b saved_floor_file_sign;
314
315
316 /*
317  * Keymaps for each "mode" associated with each keypress.
318  */
319 concptr keymap_act[KEYMAP_MODES][256];
320
321
322
323 /*** Player information ***/
324
325 /*
326  * Static player info record
327  */
328 player_type p_body;
329
330 /*
331  * Pointer to the player info
332  */
333 player_type *p_ptr = &p_body;
334
335
336 /*
337  * Here is a "pseudo-hook" used during calls to "get_item()" and
338  * "show_inven()" and "show_equip()", and the choice window routines.
339  */
340 OBJECT_TYPE_VALUE item_tester_tval;
341
342
343 /*
344  * Here is a "hook" used during calls to "get_item()" and
345  * "show_inven()" and "show_equip()", and the choice window routines.
346  */
347 bool (*item_tester_hook)(object_type*);
348
349
350
351
352 /*
353  * Hack -- function hooks to restrict "get_mon_num_prep()" function
354  */
355 monsterrace_hook_type get_mon_num_hook;
356 monsterrace_hook_type get_mon_num2_hook;
357
358
359 /*
360  * Hack -- function hook to restrict "get_obj_num_prep()" function
361  */
362 bool (*get_obj_num_hook)(KIND_OBJECT_IDX k_idx);
363
364 /*
365  * Maximum number of vaults in v_info.txt
366  */
367 VAULT_IDX max_v_idx;
368
369 /*
370  * Maximum number of terrain features in f_info.txt
371  */
372 FEAT_IDX max_f_idx;
373
374 /*
375  * Maximum number of ego-items in e_info.txt
376  */
377 EGO_IDX max_e_idx;
378
379 /*
380  * Maximum number of dungeon in e_info.txt
381  */
382 DUNGEON_IDX max_d_idx;
383
384 /*
385  * Flags for initialization
386  */
387 int init_flags;
388
389
390 /*
391  * The "highscore" file descriptor, if available.
392  */
393 int highscore_fd = -1;
394
395 bool can_save = FALSE;        /* Game can be saved */
396
397 MONRACE_IDX battle_mon[4];
398 int sel_monster;
399 int battle_odds;
400 PRICE kakekin;
401 u32b mon_odds[4];
402
403 MONSTER_IDX pet_t_m_idx;
404 MONSTER_IDX riding_t_m_idx;
405
406 MONSTER_IDX today_mon;
407
408 bool write_level;
409
410 u32b start_time;
411
412 bool sukekaku;
413 bool new_mane;
414
415 bool generate_encounter;
416
417 concptr screen_dump = NULL;
418
419
420 /*
421  * Which dungeon ?
422  */
423 DEPTH *max_dlv;
424
425 COMMAND_CODE now_message;
426 bool use_menu;
427
428 #ifdef CHUUKEI
429 bool chuukei_server;
430 bool chuukei_client;
431 char *server_name;
432 int server_port;
433 #endif
434
435 /* for movie */
436 bool browsing_movie;
437
438
439 /* for snipers */
440 bool reset_concent = FALSE;   /* Concentration reset flag */
441 bool is_fired = FALSE;
442