… | |
… | |
280 | * we remove the magic flag - that can be derived from |
280 | * we remove the magic flag - that can be derived from |
281 | * spob->attacktype. |
281 | * spob->attacktype. |
282 | * This function sets up the appropriate owner and skill |
282 | * This function sets up the appropriate owner and skill |
283 | * pointers. |
283 | * pointers. |
284 | */ |
284 | */ |
285 | |
|
|
286 | int |
285 | int |
287 | fire_bolt (object *op, object *caster, int dir, object *spob, object *skill) |
286 | fire_bolt (object *op, object *caster, int dir, object *spob, object *skill) |
288 | { |
287 | { |
289 | object *tmp = NULL; |
288 | object *tmp = NULL; |
290 | int mflags; |
289 | int mflags; |
… | |
… | |
315 | |
314 | |
316 | tmp->x = op->x + DIRX (tmp); |
315 | tmp->x = op->x + DIRX (tmp); |
317 | tmp->y = op->y + DIRY (tmp); |
316 | tmp->y = op->y + DIRY (tmp); |
318 | tmp->map = op->map; |
317 | tmp->map = op->map; |
319 | |
318 | |
|
|
319 | maptile *newmap; |
320 | mflags = get_map_flags (tmp->map, &tmp->map, tmp->x, tmp->y, &tmp->x, &tmp->y); |
320 | mflags = get_map_flags (tmp->map, &newmap, tmp->x, tmp->y, &tmp->x, &tmp->y); |
321 | if (mflags & P_OUT_OF_MAP) |
321 | if (mflags & P_OUT_OF_MAP) |
322 | { |
322 | { |
323 | tmp->destroy (); |
323 | tmp->destroy (); |
324 | return 0; |
324 | return 0; |
325 | } |
325 | } |
|
|
326 | |
|
|
327 | tmp->map = newmap; |
326 | |
328 | |
327 | if (OB_TYPE_MOVE_BLOCK (tmp, GET_MAP_MOVE_BLOCK (tmp->map, tmp->x, tmp->y))) |
329 | if (OB_TYPE_MOVE_BLOCK (tmp, GET_MAP_MOVE_BLOCK (tmp->map, tmp->x, tmp->y))) |
328 | { |
330 | { |
329 | if (!QUERY_FLAG (tmp, FLAG_REFLECTING)) |
331 | if (!QUERY_FLAG (tmp, FLAG_REFLECTING)) |
330 | { |
332 | { |
… | |
… | |
553 | } |
555 | } |
554 | } |
556 | } |
555 | } |
557 | } |
556 | } |
558 | } |
557 | |
559 | |
558 | |
|
|
559 | /* Basically, we move 'op' one square, and if it hits something, |
560 | /* Basically, we move 'op' one square, and if it hits something, |
560 | * call check_bullet. |
561 | * call check_bullet. |
561 | * This function is only applicable to bullets, but not to all |
562 | * This function is only applicable to bullets, but not to all |
562 | * fired arches (eg, bolts). |
563 | * fired arches (eg, bolts). |
563 | */ |
564 | */ |
564 | |
|
|
565 | void |
565 | void |
566 | move_bullet (object *op) |
566 | move_bullet (object *op) |
567 | { |
567 | { |
568 | sint16 new_x, new_y; |
568 | sint16 new_x, new_y; |
569 | int mflags; |
569 | int mflags; |
… | |
… | |
624 | { |
624 | { |
625 | op->direction = absdir (op->direction + 4); |
625 | op->direction = absdir (op->direction + 4); |
626 | update_turn_face (op); |
626 | update_turn_face (op); |
627 | } |
627 | } |
628 | else |
628 | else |
629 | { |
|
|
630 | check_bullet (op); |
629 | check_bullet (op); |
631 | } |
|
|
632 | } |
630 | } |
633 | |
631 | |
634 | |
632 | |
635 | |
633 | |
636 | |
634 | |
… | |
… | |
678 | |
676 | |
679 | tmp->x = op->x + freearr_x[dir]; |
677 | tmp->x = op->x + freearr_x[dir]; |
680 | tmp->y = op->y + freearr_y[dir]; |
678 | tmp->y = op->y + freearr_y[dir]; |
681 | tmp->map = op->map; |
679 | tmp->map = op->map; |
682 | |
680 | |
|
|
681 | maptile *newmap; |
683 | mflags = get_map_flags (tmp->map, &tmp->map, tmp->x, tmp->y, &tmp->x, &tmp->y); |
682 | mflags = get_map_flags (tmp->map, &newmap, tmp->x, tmp->y, &tmp->x, &tmp->y); |
684 | if (mflags & P_OUT_OF_MAP) |
683 | if (mflags & P_OUT_OF_MAP) |
685 | { |
684 | { |
686 | tmp->destroy (); |
685 | tmp->destroy (); |
687 | return 0; |
686 | return 0; |
688 | } |
687 | } |
|
|
688 | |
|
|
689 | tmp->map = newmap; |
689 | |
690 | |
690 | if (OB_TYPE_MOVE_BLOCK (tmp, GET_MAP_MOVE_BLOCK (tmp->map, tmp->x, tmp->y))) |
691 | if (OB_TYPE_MOVE_BLOCK (tmp, GET_MAP_MOVE_BLOCK (tmp->map, tmp->x, tmp->y))) |
691 | { |
692 | { |
692 | if (!QUERY_FLAG (tmp, FLAG_REFLECTING)) |
693 | if (!QUERY_FLAG (tmp, FLAG_REFLECTING)) |
693 | { |
694 | { |
… | |
… | |
699 | tmp->y = op->y; |
700 | tmp->y = op->y; |
700 | tmp->direction = absdir (tmp->direction + 4); |
701 | tmp->direction = absdir (tmp->direction + 4); |
701 | tmp->map = op->map; |
702 | tmp->map = op->map; |
702 | } |
703 | } |
703 | |
704 | |
704 | if ((tmp = insert_ob_in_map (tmp, tmp->map, op, 0)) != NULL) |
705 | if ((tmp = insert_ob_in_map (tmp, tmp->map, op, 0))) |
705 | check_bullet (tmp); |
706 | check_bullet (tmp); |
706 | |
707 | |
707 | return 1; |
708 | return 1; |
708 | } |
709 | } |
709 | |
710 | |
… | |
… | |
1530 | force->stats.ac = spell_ob->stats.ac; |
1531 | force->stats.ac = spell_ob->stats.ac; |
1531 | force->stats.wc = spell_ob->stats.wc; |
1532 | force->stats.wc = spell_ob->stats.wc; |
1532 | |
1533 | |
1533 | change_abil (tmp, force); /* Mostly to display any messages */ |
1534 | change_abil (tmp, force); /* Mostly to display any messages */ |
1534 | insert_ob_in_ob (force, tmp); |
1535 | insert_ob_in_ob (force, tmp); |
1535 | fix_player (tmp); |
1536 | tmp->update_stats (); |
1536 | return 1; |
1537 | return 1; |
1537 | |
1538 | |
1538 | } |
1539 | } |
1539 | |
1540 | |
1540 | |
1541 | |