… | |
… | |
145 | } |
145 | } |
146 | |
146 | |
147 | return 0; |
147 | return 0; |
148 | } |
148 | } |
149 | |
149 | |
150 | |
|
|
151 | /* Tries to find an enmy for npc. We pass the range vector since |
150 | /* Tries to find an enemy for npc. We pass the range vector since |
152 | * our caller will find the information useful. |
151 | * our caller will find the information useful. |
153 | * Currently, only move_monster calls this function. |
152 | * Currently, only move_monster calls this function. |
154 | * Fix function so that we always make calls to get_rangevector |
153 | * Fix function so that we always make calls to get_rangevector |
155 | * if we have a valid target - function as not doing so in |
154 | * if we have a valid target - function as not doing so in |
156 | * many cases. |
155 | * many cases. |
157 | */ |
156 | */ |
158 | |
|
|
159 | object * |
157 | object * |
160 | find_enemy (object *npc, rv_vector * rv) |
158 | find_enemy (object *npc, rv_vector * rv) |
161 | { |
159 | { |
162 | object *attacker, *tmp = NULL; |
160 | object *attacker, *tmp = NULL; |
163 | |
161 | |
… | |
… | |
231 | /* Sees if this monster should wake up. |
229 | /* Sees if this monster should wake up. |
232 | * Currently, this is only called from move_monster, and |
230 | * Currently, this is only called from move_monster, and |
233 | * if enemy is set, then so should be rv. |
231 | * if enemy is set, then so should be rv. |
234 | * returns 1 if the monster should wake up, 0 otherwise. |
232 | * returns 1 if the monster should wake up, 0 otherwise. |
235 | */ |
233 | */ |
236 | |
|
|
237 | int |
234 | int |
238 | check_wakeup (object *op, object *enemy, rv_vector * rv) |
235 | check_wakeup (object *op, object *enemy, rv_vector * rv) |
239 | { |
236 | { |
240 | int radius = op->stats.Wis > MIN_MON_RADIUS ? op->stats.Wis : MIN_MON_RADIUS; |
237 | int radius = op->stats.Wis > MIN_MON_RADIUS ? op->stats.Wis : MIN_MON_RADIUS; |
241 | |
238 | |
… | |
… | |
289 | } |
286 | } |
290 | |
287 | |
291 | /* |
288 | /* |
292 | * Move-monster returns 1 if the object has been freed, otherwise 0. |
289 | * Move-monster returns 1 if the object has been freed, otherwise 0. |
293 | */ |
290 | */ |
294 | |
|
|
295 | int |
291 | int |
296 | move_monster (object *op) |
292 | move_monster (object *op) |
297 | { |
293 | { |
298 | int dir, diff, pre_att_dir; /* elmex: pre_att_dir remembers the direction before attack movement */ |
294 | int dir, diff, pre_att_dir; /* elmex: pre_att_dir remembers the direction before attack movement */ |
299 | object *owner, *enemy, *part, *oph = op; |
295 | object *owner, *enemy, *part, *oph = op; |