… | |
… | |
545 | * fired arches (eg, bolts). |
545 | * fired arches (eg, bolts). |
546 | */ |
546 | */ |
547 | void |
547 | void |
548 | move_bullet (object *op) |
548 | move_bullet (object *op) |
549 | { |
549 | { |
550 | sint16 new_x, new_y; |
|
|
551 | int mflags; |
|
|
552 | maptile *m; |
|
|
553 | |
|
|
554 | #if 0 |
550 | #if 0 |
555 | /* We need a better general purpose way to do this */ |
551 | /* We need a better general purpose way to do this */ |
556 | |
552 | |
557 | /* peterm: added to make comet leave a trail of burnouts |
553 | /* peterm: added to make comet leave a trail of burnouts |
558 | it's an unadulterated hack, but the effect is cool. */ |
554 | it's an unadulterated hack, but the effect is cool. */ |
… | |
… | |
573 | op->destroy (); |
569 | op->destroy (); |
574 | |
570 | |
575 | return; |
571 | return; |
576 | } |
572 | } |
577 | |
573 | |
578 | new_x = op->x + DIRX (op); |
574 | mapxy pos (op); |
579 | new_y = op->y + DIRY (op); |
575 | pos.move (op->direction); |
580 | m = op->map; |
|
|
581 | mflags = get_map_flags (m, &m, new_x, new_y, &new_x, &new_y); |
|
|
582 | |
576 | |
583 | if (mflags & P_OUT_OF_MAP) |
577 | if (!pos.normalise ()) |
584 | { |
578 | { |
585 | op->destroy (); |
579 | op->destroy (); |
586 | return; |
580 | return; |
587 | } |
581 | } |
588 | |
582 | |
589 | if (!op->direction || OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (m, new_x, new_y))) |
583 | mapspace &ms = pos.ms (); |
|
|
584 | |
|
|
585 | ms.update (); |
|
|
586 | |
|
|
587 | if (!op->direction || OB_TYPE_MOVE_BLOCK (op, ms.move_block)) |
590 | { |
588 | { |
591 | if (op->other_arch) |
589 | if (op->other_arch) |
592 | explode_bullet (op); |
590 | explode_bullet (op); |
593 | else |
591 | else |
594 | op->destroy (); |
592 | op->destroy (); |
595 | |
593 | |
596 | return; |
594 | return; |
597 | } |
595 | } |
598 | |
596 | |
599 | if (!(op = m->insert (op, new_x, new_y, op))) |
597 | if (!(op = pos.insert (op, op))) |
600 | return; |
598 | return; |
601 | |
599 | |
602 | if (reflwall (op->map, op->x, op->y, op)) |
600 | if (reflwall (op->map, op->x, op->y, op)) |
603 | { |
601 | { |
604 | op->direction = absdir (op->direction + 4); |
602 | op->direction = absdir (op->direction + 4); |
… | |
… | |
1908 | |
1906 | |
1909 | tmp->stats.food = spell->duration + SP_level_duration_adjust (caster, spell); |
1907 | tmp->stats.food = spell->duration + SP_level_duration_adjust (caster, spell); |
1910 | |
1908 | |
1911 | if (tmp->glow_radius) |
1909 | if (tmp->glow_radius) |
1912 | tmp->set_glow_radius ( |
1910 | tmp->set_glow_radius ( |
1913 | min (MAX_LIGHT_RADIUS, spell->range + SP_level_range_adjust (caster, spell)) |
1911 | clamp (spell->range + SP_level_range_adjust (caster, spell), 1, MAX_LIGHT_RADIUS) |
1914 | ); |
1912 | ); |
1915 | |
1913 | |
1916 | if (dir) |
1914 | if (dir) |
1917 | m->insert (tmp, x, y, op); |
1915 | m->insert (tmp, x, y, op); |
1918 | else |
1916 | else |
1919 | caster->outer_env ()->insert (tmp); |
1917 | caster->outer_env_or_self ()->insert (tmp); |
1920 | |
1918 | |
1921 | return 1; |
1919 | return 1; |
1922 | } |
1920 | } |
1923 | |
1921 | |
1924 | /* cast_cause_disease: this spell looks along <dir> from the |
1922 | /* cast_cause_disease: this spell looks along <dir> from the |