OSDN Git Service

a2d4d0882b5210b36ef2e56026f77a21b207e7db
[hengband/hengband.git] / src / defines.h
1 #pragma once
2
3 /*!
4  *  @file defines.h
5  *  @brief 主要なマクロ定義ヘッダ / Purpose: global constants and macro definitions
6  *  @date 2014/01/02
7  *  @author
8  * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke\n
9  *\n
10  * This software may be copied and distributed for educational, research,\n
11  * and not for profit purposes provided that this copyright and statement\n
12  * are included in all such copies.  Other copyrights may also apply.\n
13  *  @details
14  * Do not edit this file unless you know *exactly* what you are doing.\n
15  *\n
16  * Some of the values in this file were chosen to preserve game balance,\n
17  * while others are hard-coded based on the format of old save-files, the\n
18  * definition of arrays in various places, mathematical properties, fast\n
19  * computation, storage limits, or the format of external text files.\n
20  *\n
21  * Changing some of these values will induce crashes or memory errors or\n
22  * savefile mis-reads.  Most of the comments in this file are meant as\n
23  * reminders, not complete descriptions, and even a complete knowledge\n
24  * of the source may not be sufficient to fully understand the effects\n
25  * of changing certain definitions.\n
26  *\n
27  * Lastly, note that the code does not always use the symbolic constants\n
28  * below, and sometimes uses various hard-coded values that may not even\n
29  * be defined in this file, but which may be related to definitions here.\n
30  * This is of course bad programming practice, but nobody is perfect...\n
31  *\n
32  * For example, there are MANY things that depend on the screen being\n
33  * 80x24, with the top line used for messages, the bottom line being\n
34  * used for status, and exactly 22 lines used to show the dungeon.\n
35  * Just because your screen can hold 46 lines does not mean that the\n
36  * game will work if you try to use 44 lines to show the dungeon.\n
37  *\n
38  * You have been warned.\n
39  */
40
41 /*
42  * Arena constants
43  */
44 #define ARENA_DEFEATED_OLD_VER (-(MAX_SHORT)) /*<! 旧バージョンの闘技場敗北定義 */
45
46 #define MAX_CLASS       28 /*!< 職業の最大定義数 Maximum number of player "class" types (see "table.c", etc) */
47 #define MAX_SEIKAKU     13 /*!< 性格の最大定義数 */
48
49 #define MAX_MIND_POWERS  21 /*!< 超能力の数 / Mindcraft */
50
51 /*!
52  * @brief 視界及び光源の過渡処理配列サイズ / Maximum size of the "temp" array (see "current_floor_ptr->grid_array.c")
53  * @details We must be as large as "VIEW_MAX" and "LITE_MAX" for proper functioning
54  * of "update_view()" and "update_lite()".  We must also be as large as the
55  * largest illuminatable room, but no room is larger than 800 grids.  We
56  * must also be large enough to allow "good enough" use as a circular queue,
57  * to calculate monster flow, but note that the flow code is "paranoid".
58  */
59 #define TEMP_MAX 2298
60
61 /*!
62  * @brief 再描画処理用配列サイズ / Maximum size of the "redraw" array (see "current_floor_ptr->grid_array.c")
63  * @details We must be large for proper functioning of delayed redrawing.
64  * We must also be as large as two times of the largest view area.
65  * Note that maximum view grids are 1149 entries.
66  */
67 #define REDRAW_MAX 2298
68
69
70 /*!
71  * @brief マクロ登録の最大数 / Maximum number of macros (see "io.c")
72  * @note Default: assume at most 256 macros are used
73  */
74 #define MACRO_MAX       256
75
76 /*!
77  * @brief 銘情報の最大数 / Maximum number of "quarks" (see "io.c")
78  * @note 
79  * Default: assume at most 512 different inscriptions are used<br>
80  * Was 512... 256 quarks added for random artifacts<br>
81  */
82 #define QUARK_MAX       768
83
84 /*
85  * OPTION: Maximum number of messages to remember (see "io.c")
86  * Default: assume maximal memorization of 2048 total messages
87  */
88 #define MESSAGE_MAX  81920
89
90 /*
91  * OPTION: Maximum space for the message text buffer (see "io.c")
92  * Default: assume that each of the 2048 messages is repeated an
93  * average of three times, and has an average length of 48
94  */
95 #define MESSAGE_BUF 655360
96
97
98 /*** Screen Locations ***/
99
100 #define VER_INFO_ROW 3   //!< タイトル表記(行)
101
102
103 #define ROW_MAP                 0
104 #define COL_MAP                 12
105
106 /*
107  * Bit flags for the *_can_enter() and monster_can_cross_terrain()
108  */
109 #define CEM_RIDING              0x0001
110 #define CEM_P_CAN_ENTER_PATTERN 0x0002
111
112
113 #define OBJ_GOLD_LIST   480     /* First "gold" entry */
114 #define MAX_GOLD        18      /* Number of "gold" entries */
115
116 /*
117  * Object flags
118  *
119  * Old variables for object flags such as flags1, flags2, and flags3
120  * are obsolated.  Now single array flgs[TR_FLAG_SIZE] contains all
121  * object flags.  And each flag is refered by single index number
122  * instead of a bit mask.
123  *
124  * Therefore it's very easy to add a lot of new flags; no one need to
125  * worry about in which variable a new flag should be put, nor to
126  * modify a huge number of files all over the source directory at once
127  * to add new flag variables such as flags4, a_ability_flags1, etc...
128  *
129  * All management of flags is now treated using a set of macros
130  * instead of bit operations.
131  * Note: These macros are using division, modulo, and bit shift
132  * operations, and it seems that these operations are rather slower
133  * than original bit operation.  But since index numbers are almost
134  * always given as constant, such slow operations are performed in the
135  * compile time.  So there is no problem on the speed.
136  *
137  * Exceptions of new flag management is a set of flags to control
138  * object generation and the curse flags.  These are not yet rewritten
139  * in new index form; maybe these have no merit of rewriting.
140  */
141
142 #define have_flag(ARRAY, INDEX) !!((ARRAY)[(INDEX)/32] & (1L << ((INDEX)%32)))
143 #define add_flag(ARRAY, INDEX) ((ARRAY)[(INDEX)/32] |= (1L << ((INDEX)%32)))
144 #define remove_flag(ARRAY, INDEX) ((ARRAY)[(INDEX)/32] &= ~(1L << ((INDEX)%32)))
145 #define is_pval_flag(INDEX) ((TR_STR <= (INDEX) && (INDEX) <= TR_MAGIC_MASTERY) || (TR_STEALTH <= (INDEX) && (INDEX) <= TR_BLOWS))
146 #define have_pval_flags(ARRAY) !!((ARRAY)[0] & (0x00003f7f))
147
148 /*
149  * Is the monster seen by the player?
150  */
151 #define is_seen(A) \
152         ((bool)((A)->ml && (!ignore_unview || p_ptr->inside_battle || \
153          (player_can_see_bold((A)->fy, (A)->fx) && projectable(p_ptr->y, p_ptr->x, (A)->fy, (A)->fx)))))
154
155
156 #define EATER_EXT 36
157 #define EATER_CHARGE 0x10000L
158 #define EATER_ROD_CHARGE 0x10L
159
160
161
162 /* Maximum "Nazguls" number */
163 #define MAX_NAZGUL_NUM 5
164
165 #define VIRTUE_LARGE 1
166 #define VIRTUE_SMALL 2
167
168
169 #define DUNGEON_FEAT_PROB_NUM 3
170
171 /*
172  * Max numbers of macro trigger names
173  */
174 #define MAX_MACRO_MOD 12
175 #define MAX_MACRO_TRIG 200 /*!< 登録を許すマクロ(トリガー)の最大数 */
176
177
178 #define MTIMED_CSLEEP   0 /* Monster is sleeping */
179 #define MTIMED_FAST     1 /* Monster is temporarily fast */
180 #define MTIMED_SLOW     2 /* Monster is temporarily slow */
181 #define MTIMED_STUNNED  3 /* Monster is stunned */
182 #define MTIMED_CONFUSED 4 /* Monster is confused */
183 #define MTIMED_MONFEAR  5 /* Monster is afraid */
184 #define MTIMED_INVULNER 6 /* Monster is temporarily invulnerable */
185
186 #define MAX_MTIMED      7
187
188 #define MON_CSLEEP(M_PTR)   ((M_PTR)->mtimed[MTIMED_CSLEEP])
189 #define MON_FAST(M_PTR)     ((M_PTR)->mtimed[MTIMED_FAST])
190 #define MON_SLOW(M_PTR)     ((M_PTR)->mtimed[MTIMED_SLOW])
191 #define MON_STUNNED(M_PTR)  ((M_PTR)->mtimed[MTIMED_STUNNED])
192 #define MON_CONFUSED(M_PTR) ((M_PTR)->mtimed[MTIMED_CONFUSED])
193 #define MON_MONFEAR(M_PTR)  ((M_PTR)->mtimed[MTIMED_MONFEAR])
194 #define MON_INVULNER(M_PTR) ((M_PTR)->mtimed[MTIMED_INVULNER])
195
196 /*
197  * For travel command (auto run)
198  */
199 #define TRAVEL
200
201 #define CONCENT_RADAR_THRESHOLD 2
202 #define CONCENT_TELE_THRESHOLD  5
203
204 /*
205   Language selection macro
206 */
207 #ifdef JP
208 #define _(JAPANESE,ENGLISH) (JAPANESE)
209 #else
210 #define _(JAPANESE,ENGLISH) (ENGLISH)
211 #endif
212
213 /* Lite flag macro */
214 #define have_lite_flag(ARRAY) \
215         (have_flag(ARRAY, TR_LITE_1) || have_flag(ARRAY, TR_LITE_2) || have_flag(ARRAY, TR_LITE_3))
216
217 #define have_dark_flag(ARRAY) \
218         (have_flag(ARRAY, TR_LITE_M1) || have_flag(ARRAY, TR_LITE_M2) || have_flag(ARRAY, TR_LITE_M3))
219
220
221 #define COMMAND_ARG_REST_UNTIL_DONE -2   /*!<休憩コマンド引数 … 必要な分だけ回復 */
222 #define COMMAND_ARG_REST_FULL_HEALING -1 /*!<休憩コマンド引数 … HPとMPが全回復するまで */
223