… | |
… | |
183 | |
183 | |
184 | /* Find all other teleporters within range. This range |
184 | /* Find all other teleporters within range. This range |
185 | * should really be setable by some object attribute instead of |
185 | * should really be setable by some object attribute instead of |
186 | * using hard coded values. |
186 | * using hard coded values. |
187 | */ |
187 | */ |
188 | unordered_mapwalk (teleporter, -5, -5, 5, 5) |
188 | unordered_mapwalk (mapwalk_buf, teleporter, -5, -5, 5, 5) |
189 | { |
189 | { |
190 | mapspace &ms = m->at (nx, ny); |
190 | mapspace &ms = m->at (nx, ny); |
191 | |
191 | |
192 | for (object *tmp = ms.top; tmp; tmp = tmp->below) |
192 | for (object *tmp = ms.top; tmp; tmp = tmp->below) |
193 | if (tmp->type == tele_type) |
193 | if (tmp->type == tele_type) |
… | |
… | |
246 | return !other_teleporter->map->insert ( |
246 | return !other_teleporter->map->insert ( |
247 | user, other_teleporter->x + freearr_x[k], other_teleporter->y + freearr_y[k] |
247 | user, other_teleporter->x + freearr_x[k], other_teleporter->y + freearr_y[k] |
248 | ); |
248 | ); |
249 | } |
249 | } |
250 | |
250 | |
251 | void |
|
|
252 | recursive_roll (object *op, int dir, object *pusher) |
|
|
253 | { |
|
|
254 | if (!roll_ob (op, dir, pusher)) |
|
|
255 | { |
|
|
256 | new_draw_info_format (NDI_UNIQUE, 0, pusher, "You fail to push the %s.", query_name (op)); |
|
|
257 | return; |
|
|
258 | } |
|
|
259 | |
|
|
260 | move_ob (pusher, dir, pusher); |
|
|
261 | new_draw_info_format (NDI_BLACK, 0, pusher, "You move the %s.", query_name (op)); |
|
|
262 | return; |
|
|
263 | } |
|
|
264 | |
|
|
265 | /* |
251 | /* |
266 | * This is a new version of blocked, this one handles objects |
252 | * This is a new version of blocked, this one handles objects |
267 | * that can be passed through by monsters with the CAN_PASS_THRU defined. |
253 | * that can be passed through by monsters with the CAN_PASS_THRU defined. |
268 | * |
254 | * |
269 | * very new version handles also multipart objects |
255 | * very new version handles also multipart objects |
270 | * This is currently only used for the boulder roll code. |
256 | * This is currently only used for the boulder roll code. |
271 | * Returns 1 if object does not fit, 0 if it does. |
257 | * Returns 1 if object does not fit, 0 if it does. |
272 | */ |
258 | */ |
273 | |
259 | static int |
274 | int |
|
|
275 | try_fit (object *op, maptile *m, int x, int y) |
260 | try_fit (object *op, maptile *m, int x, int y) |
276 | { |
261 | { |
277 | object *tmp, *more; |
262 | object *tmp, *more; |
278 | sint16 tx, ty; |
263 | sint16 tx, ty; |
279 | int mflags; |
264 | int mflags; |
… | |
… | |
311 | /* |
296 | /* |
312 | * this is not perfect yet. |
297 | * this is not perfect yet. |
313 | * it does not roll objects behind multipart objects properly. |
298 | * it does not roll objects behind multipart objects properly. |
314 | * Support for rolling multipart objects is questionable. |
299 | * Support for rolling multipart objects is questionable. |
315 | */ |
300 | */ |
316 | int |
301 | static int |
317 | roll_ob (object *op, int dir, object *pusher) |
302 | roll_ob (object *op, int dir, object *pusher) |
318 | { |
303 | { |
319 | sint16 x, y; |
304 | sint16 x, y; |
320 | int flags; |
305 | int flags; |
321 | maptile *m; |
306 | maptile *m; |
… | |
… | |
357 | return 0; |
342 | return 0; |
358 | |
343 | |
359 | op->move (dir); |
344 | op->move (dir); |
360 | |
345 | |
361 | return 1; |
346 | return 1; |
|
|
347 | } |
|
|
348 | |
|
|
349 | void |
|
|
350 | recursive_roll (object *op, int dir, object *pusher) |
|
|
351 | { |
|
|
352 | if (!roll_ob (op, dir, pusher)) |
|
|
353 | { |
|
|
354 | new_draw_info_format (NDI_UNIQUE, 0, pusher, "You fail to push the %s.", query_name (op)); |
|
|
355 | return; |
|
|
356 | } |
|
|
357 | |
|
|
358 | move_ob (pusher, dir, pusher); |
|
|
359 | new_draw_info_format (NDI_BLACK, 0, pusher, "You move the %s.", query_name (op)); |
|
|
360 | return; |
362 | } |
361 | } |
363 | |
362 | |
364 | /* returns 1 if pushing invokes a attack, 0 when not */ |
363 | /* returns 1 if pushing invokes a attack, 0 when not */ |
365 | int |
364 | int |
366 | push_ob (object *who, int dir, object *pusher) |
365 | push_ob (object *who, int dir, object *pusher) |
… | |
… | |
418 | CLEAR_FLAG (who, FLAG_UNAGGRESSIVE); /* the sucker don't like you anymore */ |
417 | CLEAR_FLAG (who, FLAG_UNAGGRESSIVE); /* the sucker don't like you anymore */ |
419 | who->enemy = pusher; |
418 | who->enemy = pusher; |
420 | return 1; |
419 | return 1; |
421 | } |
420 | } |
422 | else |
421 | else |
423 | new_draw_info_format (NDI_UNIQUE, 0, pusher, "You avoid attacking %s.", &who->name); |
422 | new_draw_info_format (NDI_UNIQUE, 0, pusher, "You avoid attacking %s. H<You have to run if you wish to attack unnagressive NPCs.>", &who->name); |
424 | } |
423 | } |
425 | |
424 | |
426 | /* now, lets test stand still. we NEVER can push stand_still monsters. */ |
425 | /* now, let's test stand still. we NEVER can push stand_still monsters. */ |
427 | if (QUERY_FLAG (who, FLAG_STAND_STILL)) |
426 | if (QUERY_FLAG (who, FLAG_STAND_STILL)) |
428 | { |
427 | { |
429 | new_draw_info_format (NDI_UNIQUE, 0, pusher, "You can't push %s.", &who->name); |
428 | new_draw_info_format (NDI_UNIQUE, 0, pusher, "You can't push %s. H<You simply can't.>", &who->name); |
430 | return 0; |
429 | return 0; |
431 | } |
430 | } |
432 | |
431 | |
433 | /* This block is basically if you are pushing friendly but |
432 | /* This block is basically if you are pushing friendly but |
434 | * non pet creaturs. |
433 | * non pet creaturs. |
… | |
… | |
451 | |
450 | |
452 | /* If we get here, the push succeeded. |
451 | /* If we get here, the push succeeded. |
453 | * Let everyone know the status. |
452 | * Let everyone know the status. |
454 | */ |
453 | */ |
455 | if (who->type == PLAYER) |
454 | if (who->type == PLAYER) |
456 | { |
|
|
457 | new_draw_info_format (NDI_UNIQUE, 0, who, "%s pushed you.", &pusher->name); |
455 | new_draw_info_format (NDI_UNIQUE, 0, who, "%s pushed you.", &pusher->name); |
458 | } |
456 | |
459 | if (pusher->type == PLAYER) |
457 | if (pusher->type == PLAYER) |
460 | { |
|
|
461 | new_draw_info_format (NDI_UNIQUE, 0, pusher, "You pushed %s back.", &who->name); |
458 | new_draw_info_format (NDI_UNIQUE, 0, pusher, "You pushed %s back.", &who->name); |
462 | } |
|
|
463 | |
459 | |
464 | return 1; |
460 | return 1; |
465 | } |
461 | } |