OSDN Git Service

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