変愚蛮怒のメインリポジトリです
Révision | 31572f0533aeeac1341deca7fb6c7c86c05ad748 (tree) |
---|---|
l'heure | 2020-03-08 13:32:36 |
Auteur | Hourier <hourier@user...> |
Commiter | Hourier |
[Refactor] #40030 Changed function names in monster-process.c
@@ -120,7 +120,7 @@ static bool mon_will_run(player_type *target_ptr, MONSTER_IDX m_idx) | ||
120 | 120 | * @param xp 適したマスのX座標を返す参照ポインタ |
121 | 121 | * @return 有効なマスがあった場合TRUEを返す |
122 | 122 | */ |
123 | -static bool get_moves_aux2(player_type *target_ptr, MONSTER_IDX m_idx, POSITION *yp, POSITION *xp) | |
123 | +static bool sweep_ranged_attack_grid(player_type *target_ptr, MONSTER_IDX m_idx, POSITION *yp, POSITION *xp) | |
124 | 124 | { |
125 | 125 | floor_type *floor_ptr = target_ptr->current_floor_ptr; |
126 | 126 | monster_type *m_ptr = &floor_ptr->m_list[m_idx]; |
@@ -181,7 +181,7 @@ static bool get_moves_aux2(player_type *target_ptr, MONSTER_IDX m_idx, POSITION | ||
181 | 181 | * @param yp 移動先のマスのY座標を返す参照ポインタ |
182 | 182 | * @param xp 移動先のマスのX座標を返す参照ポインタ |
183 | 183 | * @param no_flow モンスターにFLOWフラグが経っていない状態でTRUE |
184 | - * @return 有効なマスがあった場合TRUEを返す | |
184 | + * @return なし | |
185 | 185 | * @details |
186 | 186 | * Note that ghosts and rock-eaters are never allowed to "flow",\n |
187 | 187 | * since they should move directly towards the player.\n |
@@ -202,7 +202,7 @@ static bool get_moves_aux2(player_type *target_ptr, MONSTER_IDX m_idx, POSITION | ||
202 | 202 | * being close enough to chase directly. I have no idea what will\n |
203 | 203 | * happen if you combine "smell" with low "aaf" values.\n |
204 | 204 | */ |
205 | -static bool get_moves_aux(player_type *target_ptr, MONSTER_IDX m_idx, POSITION *yp, POSITION *xp, bool no_flow) | |
205 | +static void sweep_movable_grid(player_type *target_ptr, MONSTER_IDX m_idx, POSITION *yp, POSITION *xp, bool no_flow) | |
206 | 206 | { |
207 | 207 | grid_type *g_ptr; |
208 | 208 | floor_type *floor_ptr = target_ptr->current_floor_ptr; |
@@ -213,16 +213,16 @@ static bool get_moves_aux(player_type *target_ptr, MONSTER_IDX m_idx, POSITION * | ||
213 | 213 | r_ptr->a_ability_flags1 & (RF5_ATTACK_MASK) || |
214 | 214 | r_ptr->a_ability_flags2 & (RF6_ATTACK_MASK)) |
215 | 215 | { |
216 | - if (get_moves_aux2(target_ptr, m_idx, yp, xp)) return TRUE; | |
216 | + if (sweep_ranged_attack_grid(target_ptr, m_idx, yp, xp)) return; | |
217 | 217 | } |
218 | 218 | |
219 | - if (no_flow) return FALSE; | |
220 | - if ((r_ptr->flags2 & RF2_PASS_WALL) && ((m_idx != target_ptr->riding) || target_ptr->pass_wall)) return FALSE; | |
221 | - if ((r_ptr->flags2 & RF2_KILL_WALL) && (m_idx != target_ptr->riding)) return FALSE; | |
219 | + if (no_flow) return; | |
220 | + if ((r_ptr->flags2 & RF2_PASS_WALL) && ((m_idx != target_ptr->riding) || target_ptr->pass_wall)) return; | |
221 | + if ((r_ptr->flags2 & RF2_KILL_WALL) && (m_idx != target_ptr->riding)) return; | |
222 | 222 | |
223 | 223 | POSITION y1 = m_ptr->fy; |
224 | 224 | POSITION x1 = m_ptr->fx; |
225 | - if (player_has_los_bold(target_ptr, y1, x1) && projectable(target_ptr, target_ptr->y, target_ptr->x, y1, x1)) return FALSE; | |
225 | + if (player_has_los_bold(target_ptr, y1, x1) && projectable(target_ptr, target_ptr->y, target_ptr->x, y1, x1)) return; | |
226 | 226 | |
227 | 227 | g_ptr = &floor_ptr->grid_array[y1][x1]; |
228 | 228 |
@@ -234,14 +234,14 @@ static bool get_moves_aux(player_type *target_ptr, MONSTER_IDX m_idx, POSITION * | ||
234 | 234 | } |
235 | 235 | else if (g_ptr->when) |
236 | 236 | { |
237 | - if (floor_ptr->grid_array[target_ptr->y][target_ptr->x].when - g_ptr->when > 127) return FALSE; | |
237 | + if (floor_ptr->grid_array[target_ptr->y][target_ptr->x].when - g_ptr->when > 127) return; | |
238 | 238 | |
239 | 239 | use_scent = TRUE; |
240 | 240 | best = 0; |
241 | 241 | } |
242 | 242 | else |
243 | 243 | { |
244 | - return FALSE; | |
244 | + return; | |
245 | 245 | } |
246 | 246 | |
247 | 247 | for (int i = 7; i >= 0; i--) |
@@ -279,10 +279,6 @@ static bool get_moves_aux(player_type *target_ptr, MONSTER_IDX m_idx, POSITION * | ||
279 | 279 | *yp = target_ptr->y + 16 * ddy_ddd[i]; |
280 | 280 | *xp = target_ptr->x + 16 * ddx_ddd[i]; |
281 | 281 | } |
282 | - | |
283 | - if (best == 999 || best == 0) return FALSE; | |
284 | - | |
285 | - return TRUE; | |
286 | 282 | } |
287 | 283 | |
288 | 284 |
@@ -298,7 +294,7 @@ static bool get_moves_aux(player_type *target_ptr, MONSTER_IDX m_idx, POSITION * | ||
298 | 294 | * but instead of heading directly for it, the monster should "swerve"\n |
299 | 295 | * around the player so that he has a smaller chance of getting hit.\n |
300 | 296 | */ |
301 | -static bool get_fear_moves_aux(floor_type *floor_ptr, MONSTER_IDX m_idx, POSITION *yp, POSITION *xp) | |
297 | +static bool sweep_runnable_away_grid(floor_type *floor_ptr, MONSTER_IDX m_idx, POSITION *yp, POSITION *xp) | |
302 | 298 | { |
303 | 299 | POSITION gy = 0, gx = 0; |
304 | 300 |
@@ -345,7 +341,7 @@ static bool get_fear_moves_aux(floor_type *floor_ptr, MONSTER_IDX m_idx, POSITIO | ||
345 | 341 | * @param mm 移動方向を返す方向IDの参照ポインタ |
346 | 342 | * @return 有効方向があった場合TRUEを返す |
347 | 343 | */ |
348 | -static bool get_moves(player_type *target_ptr, MONSTER_IDX m_idx, DIRECTION *mm) | |
344 | +static bool get_movable_grid(player_type *target_ptr, MONSTER_IDX m_idx, DIRECTION *mm) | |
349 | 345 | { |
350 | 346 | floor_type *floor_ptr = target_ptr->current_floor_ptr; |
351 | 347 | monster_type *m_ptr = &floor_ptr->m_list[m_idx]; |
@@ -433,7 +429,7 @@ static bool get_moves(player_type *target_ptr, MONSTER_IDX m_idx, DIRECTION *mm) | ||
433 | 429 | |
434 | 430 | if (!done) |
435 | 431 | { |
436 | - (void)get_moves_aux(target_ptr, m_idx, &y2, &x2, no_flow); | |
432 | + sweep_movable_grid(target_ptr, m_idx, &y2, &x2, no_flow); | |
437 | 433 | y = m_ptr->fy - y2; |
438 | 434 | x = m_ptr->fx - x2; |
439 | 435 | } |
@@ -450,7 +446,7 @@ static bool get_moves(player_type *target_ptr, MONSTER_IDX m_idx, DIRECTION *mm) | ||
450 | 446 | int tmp_y = (-y); |
451 | 447 | if (find_safety(target_ptr, m_idx, &y, &x) && !no_flow) |
452 | 448 | { |
453 | - if (get_fear_moves_aux(target_ptr->current_floor_ptr, m_idx, &y, &x)) | |
449 | + if (sweep_runnable_away_grid(target_ptr->current_floor_ptr, m_idx, &y, &x)) | |
454 | 450 | done = TRUE; |
455 | 451 | } |
456 | 452 |
@@ -545,7 +541,7 @@ void process_monster(player_type *target_ptr, MONSTER_IDX m_idx) | ||
545 | 541 | mm[0] = mm[1] = mm[2] = mm[3] = 0; |
546 | 542 | mm[4] = mm[5] = mm[6] = mm[7] = 0; |
547 | 543 | |
548 | - if (!decide_monster_movement_direction(target_ptr, mm, m_idx, turn_flags_ptr->aware, get_moves)) return; | |
544 | + if (!decide_monster_movement_direction(target_ptr, mm, m_idx, turn_flags_ptr->aware, get_movable_grid)) return; | |
549 | 545 | |
550 | 546 | int count = 0; |
551 | 547 | if (!process_monster_movement(target_ptr, turn_flags_ptr, m_idx, mm, oy, ox, &count)) return; |
@@ -180,7 +180,7 @@ static bool random_walk(player_type *target_ptr, DIRECTION *mm, monster_type *m_ | ||
180 | 180 | * @param m_idx モンスターID |
181 | 181 | * @return モンスターがペットであればTRUE |
182 | 182 | */ |
183 | -static bool decide_pet_movement_direction(player_type *target_ptr, DIRECTION *mm, MONSTER_IDX m_idx, get_moves_pf get_moves) | |
183 | +static bool decide_pet_movement_direction(player_type *target_ptr, DIRECTION *mm, MONSTER_IDX m_idx, get_moves_pf get_movable_grid) | |
184 | 184 | { |
185 | 185 | monster_type *m_ptr = &target_ptr->current_floor_ptr->m_list[m_idx]; |
186 | 186 | if (!is_pet(m_ptr)) return FALSE; |
@@ -198,7 +198,7 @@ static bool decide_pet_movement_direction(player_type *target_ptr, DIRECTION *mm | ||
198 | 198 | target_ptr->pet_follow_distance = PET_SEEK_DIST; |
199 | 199 | } |
200 | 200 | |
201 | - (void)get_moves(target_ptr, m_idx, mm); | |
201 | + (void)get_movable_grid(target_ptr, m_idx, mm); | |
202 | 202 | target_ptr->pet_follow_distance = (s16b)dis; |
203 | 203 | return TRUE; |
204 | 204 | } |
@@ -212,7 +212,7 @@ static bool decide_pet_movement_direction(player_type *target_ptr, DIRECTION *mm | ||
212 | 212 | * @param aware モンスターがプレーヤーに気付いているならばTRUE、超隠密状態ならばFALSE |
213 | 213 | * @return 移動先が存在すればTRUE |
214 | 214 | */ |
215 | -bool decide_monster_movement_direction(player_type *target_ptr, DIRECTION *mm, MONSTER_IDX m_idx, bool aware, get_moves_pf get_moves) | |
215 | +bool decide_monster_movement_direction(player_type *target_ptr, DIRECTION *mm, MONSTER_IDX m_idx, bool aware, get_moves_pf get_movable_grid) | |
216 | 216 | { |
217 | 217 | monster_type *m_ptr = &target_ptr->current_floor_ptr->m_list[m_idx]; |
218 | 218 | monster_race *r_ptr = &r_info[m_ptr->r_idx]; |
@@ -231,7 +231,7 @@ bool decide_monster_movement_direction(player_type *target_ptr, DIRECTION *mm, M | ||
231 | 231 | return TRUE; |
232 | 232 | } |
233 | 233 | |
234 | - if (decide_pet_movement_direction(target_ptr, mm, m_idx, get_moves)) return TRUE; | |
234 | + if (decide_pet_movement_direction(target_ptr, mm, m_idx, get_movable_grid)) return TRUE; | |
235 | 235 | |
236 | 236 | if (!is_hostile(m_ptr)) |
237 | 237 | { |
@@ -240,7 +240,7 @@ bool decide_monster_movement_direction(player_type *target_ptr, DIRECTION *mm, M | ||
240 | 240 | return TRUE; |
241 | 241 | } |
242 | 242 | |
243 | - if (!get_moves(target_ptr, m_idx, mm)) return FALSE; | |
243 | + if (!get_movable_grid(target_ptr, m_idx, mm)) return FALSE; | |
244 | 244 | |
245 | 245 | return TRUE; |
246 | 246 | } |
@@ -6,4 +6,4 @@ | ||
6 | 6 | typedef bool(*get_moves_pf)(player_type*, MONSTER_IDX, DIRECTION*); |
7 | 7 | |
8 | 8 | bool get_enemy_dir(player_type *target_ptr, MONSTER_IDX m_idx, int *mm); |
9 | -bool decide_monster_movement_direction(player_type *target_ptr, DIRECTION *mm, MONSTER_IDX m_idx, bool aware, get_moves_pf get_moves); | |
9 | +bool decide_monster_movement_direction(player_type *target_ptr, DIRECTION *mm, MONSTER_IDX m_idx, bool aware, get_moves_pf get_movable_grid); |
@@ -133,7 +133,7 @@ void store_enemy_approch_direction(int *mm, POSITION y, POSITION x) | ||
133 | 133 | |
134 | 134 | |
135 | 135 | /*! |
136 | - * @brief get_moves() における移動の方向を保存する | |
136 | + * @brief get_movable_grid() における移動の方向を保存する | |
137 | 137 | * @param mm 移動方向 |
138 | 138 | * @param y 移動先Y座標 |
139 | 139 | * @param x 移動先X座標 |