… | |
… | |
117 | void |
117 | void |
118 | forklightning (object *op, object *tmp) |
118 | forklightning (object *op, object *tmp) |
119 | { |
119 | { |
120 | int new_dir = 1; /* direction or -1 for left, +1 for right 0 if no new bolt */ |
120 | int new_dir = 1; /* direction or -1 for left, +1 for right 0 if no new bolt */ |
121 | int t_dir; /* stores temporary dir calculation */ |
121 | int t_dir; /* stores temporary dir calculation */ |
122 | mapstruct *m; |
122 | maptile *m; |
123 | sint16 sx, sy; |
123 | sint16 sx, sy; |
124 | object *new_bolt; |
124 | object *new_bolt; |
125 | |
125 | |
126 | /* pick a fork direction. tmp->stats.Con is the left bias |
126 | /* pick a fork direction. tmp->stats.Con is the left bias |
127 | * i.e., the chance in 100 of forking LEFT |
127 | * i.e., the chance in 100 of forking LEFT |
… | |
… | |
170 | move_bolt (object *op) |
170 | move_bolt (object *op) |
171 | { |
171 | { |
172 | object *tmp; |
172 | object *tmp; |
173 | int mflags; |
173 | int mflags; |
174 | sint16 x, y; |
174 | sint16 x, y; |
175 | mapstruct *m; |
175 | maptile *m; |
176 | |
176 | |
177 | if (--(op->duration) < 0) |
177 | if (--(op->duration) < 0) |
178 | { |
178 | { |
179 | remove_ob (op); |
179 | op->remove (); |
180 | free_object (op); |
180 | op->destroy (0); |
181 | return; |
181 | return; |
182 | } |
182 | } |
183 | |
183 | |
184 | hit_map (op, 0, op->attacktype, 1); |
184 | hit_map (op, 0, op->attacktype, 1); |
185 | |
185 | |
… | |
… | |
320 | tmp->map = op->map; |
320 | tmp->map = op->map; |
321 | |
321 | |
322 | mflags = get_map_flags (tmp->map, &tmp->map, tmp->x, tmp->y, &tmp->x, &tmp->y); |
322 | mflags = get_map_flags (tmp->map, &tmp->map, tmp->x, tmp->y, &tmp->x, &tmp->y); |
323 | if (mflags & P_OUT_OF_MAP) |
323 | if (mflags & P_OUT_OF_MAP) |
324 | { |
324 | { |
325 | free_object (tmp); |
325 | tmp->destroy (0); |
326 | return 0; |
326 | return 0; |
327 | } |
327 | } |
328 | if (OB_TYPE_MOVE_BLOCK (tmp, GET_MAP_MOVE_BLOCK (tmp->map, tmp->x, tmp->y))) |
328 | if (OB_TYPE_MOVE_BLOCK (tmp, GET_MAP_MOVE_BLOCK (tmp->map, tmp->x, tmp->y))) |
329 | { |
329 | { |
330 | if (!QUERY_FLAG (tmp, FLAG_REFLECTING)) |
330 | if (!QUERY_FLAG (tmp, FLAG_REFLECTING)) |
331 | { |
331 | { |
332 | free_object (tmp); |
332 | tmp->destroy (0); |
333 | return 0; |
333 | return 0; |
334 | } |
334 | } |
335 | tmp->x = op->x; |
335 | tmp->x = op->x; |
336 | tmp->y = op->y; |
336 | tmp->y = op->y; |
337 | tmp->direction = absdir (tmp->direction + 4); |
337 | tmp->direction = absdir (tmp->direction + 4); |
… | |
… | |
356 | */ |
356 | */ |
357 | void |
357 | void |
358 | explosion (object *op) |
358 | explosion (object *op) |
359 | { |
359 | { |
360 | object *tmp; |
360 | object *tmp; |
361 | mapstruct *m = op->map; |
361 | maptile *m = op->map; |
362 | int i; |
362 | int i; |
363 | |
363 | |
364 | if (--(op->duration) < 0) |
364 | if (--(op->duration) < 0) |
365 | { |
365 | { |
366 | remove_ob (op); |
366 | op->remove (); |
367 | free_object (op); |
367 | op->destroy (0); |
368 | return; |
368 | return; |
369 | } |
369 | } |
370 | hit_map (op, 0, op->attacktype, 0); |
370 | hit_map (op, 0, op->attacktype, 0); |
371 | |
371 | |
372 | if (op->range > 0) |
372 | if (op->range > 0) |
… | |
… | |
407 | object *tmp, *owner; |
407 | object *tmp, *owner; |
408 | |
408 | |
409 | if (op->other_arch == NULL) |
409 | if (op->other_arch == NULL) |
410 | { |
410 | { |
411 | LOG (llevError, "BUG: explode_bullet(): op without other_arch\n"); |
411 | LOG (llevError, "BUG: explode_bullet(): op without other_arch\n"); |
412 | remove_ob (op); |
412 | op->remove (); |
413 | free_object (op); |
413 | op->destroy (0); |
414 | return; |
414 | return; |
415 | } |
415 | } |
416 | |
416 | |
417 | if (op->env) |
417 | if (op->env) |
418 | { |
418 | { |
… | |
… | |
420 | |
420 | |
421 | env = object_get_env_recursive (op); |
421 | env = object_get_env_recursive (op); |
422 | if (env->map == NULL || out_of_map (env->map, env->x, env->y)) |
422 | if (env->map == NULL || out_of_map (env->map, env->x, env->y)) |
423 | { |
423 | { |
424 | LOG (llevError, "BUG: explode_bullet(): env out of map\n"); |
424 | LOG (llevError, "BUG: explode_bullet(): env out of map\n"); |
425 | remove_ob (op); |
425 | op->remove (); |
426 | free_object (op); |
426 | op->destroy (0); |
427 | return; |
427 | return; |
428 | } |
428 | } |
429 | remove_ob (op); |
429 | op->remove (); |
430 | op->x = env->x; |
430 | op->x = env->x; |
431 | op->y = env->y; |
431 | op->y = env->y; |
432 | insert_ob_in_map (op, env->map, op, INS_NO_MERGE | INS_NO_WALK_ON); |
432 | insert_ob_in_map (op, env->map, op, INS_NO_MERGE | INS_NO_WALK_ON); |
433 | } |
433 | } |
434 | else if (out_of_map (op->map, op->x, op->y)) |
434 | else if (out_of_map (op->map, op->x, op->y)) |
435 | { |
435 | { |
436 | LOG (llevError, "BUG: explode_bullet(): op out of map\n"); |
436 | LOG (llevError, "BUG: explode_bullet(): op out of map\n"); |
437 | remove_ob (op); |
437 | op->remove (); |
438 | free_object (op); |
438 | op->destroy (0); |
439 | return; |
439 | return; |
440 | } |
440 | } |
441 | |
441 | |
442 | // elmex Tue Aug 15 17:46:51 CEST 2006: Prevent explosions of any kind on safe maps |
442 | // elmex Tue Aug 15 17:46:51 CEST 2006: Prevent explosions of any kind on safe maps |
443 | // NOTE: If this breaks something important: remove this. I can't think of anything |
443 | // NOTE: If this breaks something important: remove this. I can't think of anything |
444 | // bad at the moment that might happen from this. |
444 | // bad at the moment that might happen from this. |
445 | if (get_map_flags (op->map, NULL, op->x, op->y, NULL, NULL) & P_SAFE) |
445 | if (get_map_flags (op->map, NULL, op->x, op->y, NULL, NULL) & P_SAFE) |
446 | { |
446 | { |
447 | remove_ob (op); |
447 | op->remove (); |
448 | free_object (op); |
448 | op->destroy (0); |
449 | return; |
449 | return; |
450 | } |
450 | } |
451 | |
451 | |
452 | if (op->attacktype) |
452 | if (op->attacktype) |
453 | { |
453 | { |
… | |
… | |
464 | |
464 | |
465 | owner = get_owner (op); |
465 | owner = get_owner (op); |
466 | |
466 | |
467 | if ((tmp->attacktype & AT_HOLYWORD || tmp->attacktype & AT_GODPOWER) && owner && !tailor_god_spell (tmp, owner)) |
467 | if ((tmp->attacktype & AT_HOLYWORD || tmp->attacktype & AT_GODPOWER) && owner && !tailor_god_spell (tmp, owner)) |
468 | { |
468 | { |
469 | remove_ob (op); |
469 | op->remove (); |
470 | free_object (op); |
470 | op->destroy (0); |
471 | return; |
471 | return; |
472 | } |
472 | } |
473 | |
473 | |
474 | tmp->x = op->x; |
474 | tmp->x = op->x; |
475 | tmp->y = op->y; |
475 | tmp->y = op->y; |
… | |
… | |
505 | |
505 | |
506 | insert_ob_in_map (tmp, op->map, op, 0); |
506 | insert_ob_in_map (tmp, op->map, op, 0); |
507 | /* remove the firebullet */ |
507 | /* remove the firebullet */ |
508 | if (!op->destroyed ()) |
508 | if (!op->destroyed ()) |
509 | { |
509 | { |
510 | remove_ob (op); |
510 | op->remove (); |
511 | free_object (op); |
511 | op->destroy (0); |
512 | } |
512 | } |
513 | } |
513 | } |
514 | |
514 | |
515 | |
515 | |
516 | |
516 | |
… | |
… | |
521 | void |
521 | void |
522 | check_bullet (object *op) |
522 | check_bullet (object *op) |
523 | { |
523 | { |
524 | object *tmp; |
524 | object *tmp; |
525 | int dam, mflags; |
525 | int dam, mflags; |
526 | mapstruct *m; |
526 | maptile *m; |
527 | sint16 sx, sy; |
527 | sint16 sx, sy; |
528 | |
528 | |
529 | mflags = get_map_flags (op->map, &m, op->x, op->y, &sx, &sy); |
529 | mflags = get_map_flags (op->map, &m, op->x, op->y, &sx, &sy); |
530 | |
530 | |
531 | if (!(mflags & P_IS_ALIVE) && !OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (m, sx, sy))) |
531 | if (!(mflags & P_IS_ALIVE) && !OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (m, sx, sy))) |
… | |
… | |
549 | dam = hit_player (tmp, op->stats.dam, op, op->attacktype, 1); |
549 | dam = hit_player (tmp, op->stats.dam, op, op->attacktype, 1); |
550 | if (op->destroyed () || !tmp->destroyed () || (op->stats.dam -= dam) < 0) |
550 | if (op->destroyed () || !tmp->destroyed () || (op->stats.dam -= dam) < 0) |
551 | { |
551 | { |
552 | if (!QUERY_FLAG (op, FLAG_REMOVED)) |
552 | if (!QUERY_FLAG (op, FLAG_REMOVED)) |
553 | { |
553 | { |
554 | remove_ob (op); |
554 | op->remove (); |
555 | free_object (op); |
555 | op->destroy (0); |
556 | return; |
556 | return; |
557 | } |
557 | } |
558 | } |
558 | } |
559 | } |
559 | } |
560 | } |
560 | } |
… | |
… | |
570 | void |
570 | void |
571 | move_bullet (object *op) |
571 | move_bullet (object *op) |
572 | { |
572 | { |
573 | sint16 new_x, new_y; |
573 | sint16 new_x, new_y; |
574 | int mflags; |
574 | int mflags; |
575 | mapstruct *m; |
575 | maptile *m; |
576 | |
576 | |
577 | #if 0 |
577 | #if 0 |
578 | /* We need a better general purpose way to do this */ |
578 | /* We need a better general purpose way to do this */ |
579 | |
579 | |
580 | /* peterm: added to make comet leave a trail of burnouts |
580 | /* peterm: added to make comet leave a trail of burnouts |
… | |
… | |
594 | { |
594 | { |
595 | explode_bullet (op); |
595 | explode_bullet (op); |
596 | } |
596 | } |
597 | else |
597 | else |
598 | { |
598 | { |
599 | remove_ob (op); |
599 | op->remove (); |
600 | free_object (op); |
600 | op->destroy (0); |
601 | } |
601 | } |
602 | return; |
602 | return; |
603 | } |
603 | } |
604 | |
604 | |
605 | new_x = op->x + DIRX (op); |
605 | new_x = op->x + DIRX (op); |
… | |
… | |
607 | m = op->map; |
607 | m = op->map; |
608 | mflags = get_map_flags (m, &m, new_x, new_y, &new_x, &new_y); |
608 | mflags = get_map_flags (m, &m, new_x, new_y, &new_x, &new_y); |
609 | |
609 | |
610 | if (mflags & P_OUT_OF_MAP) |
610 | if (mflags & P_OUT_OF_MAP) |
611 | { |
611 | { |
612 | remove_ob (op); |
612 | op->remove (); |
613 | free_object (op); |
613 | op->destroy (0); |
614 | return; |
614 | return; |
615 | } |
615 | } |
616 | |
616 | |
617 | if (!op->direction || OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (m, new_x, new_y))) |
617 | if (!op->direction || OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (m, new_x, new_y))) |
618 | { |
618 | { |
… | |
… | |
620 | { |
620 | { |
621 | explode_bullet (op); |
621 | explode_bullet (op); |
622 | } |
622 | } |
623 | else |
623 | else |
624 | { |
624 | { |
625 | remove_ob (op); |
625 | op->remove (); |
626 | free_object (op); |
626 | op->destroy (0); |
627 | } |
627 | } |
628 | return; |
628 | return; |
629 | } |
629 | } |
630 | |
630 | |
631 | remove_ob (op); |
631 | op->remove (); |
632 | op->x = new_x; |
632 | op->x = new_x; |
633 | op->y = new_y; |
633 | op->y = new_y; |
634 | if ((op = insert_ob_in_map (op, m, op, 0)) == NULL) |
634 | if ((op = insert_ob_in_map (op, m, op, 0)) == NULL) |
635 | return; |
635 | return; |
636 | |
636 | |
… | |
… | |
695 | tmp->map = op->map; |
695 | tmp->map = op->map; |
696 | |
696 | |
697 | mflags = get_map_flags (tmp->map, &tmp->map, tmp->x, tmp->y, &tmp->x, &tmp->y); |
697 | mflags = get_map_flags (tmp->map, &tmp->map, tmp->x, tmp->y, &tmp->x, &tmp->y); |
698 | if (mflags & P_OUT_OF_MAP) |
698 | if (mflags & P_OUT_OF_MAP) |
699 | { |
699 | { |
700 | free_object (tmp); |
700 | tmp->destroy (0); |
701 | return 0; |
701 | return 0; |
702 | } |
702 | } |
703 | if (OB_TYPE_MOVE_BLOCK (tmp, GET_MAP_MOVE_BLOCK (tmp->map, tmp->x, tmp->y))) |
703 | if (OB_TYPE_MOVE_BLOCK (tmp, GET_MAP_MOVE_BLOCK (tmp->map, tmp->x, tmp->y))) |
704 | { |
704 | { |
705 | if (!QUERY_FLAG (tmp, FLAG_REFLECTING)) |
705 | if (!QUERY_FLAG (tmp, FLAG_REFLECTING)) |
706 | { |
706 | { |
707 | free_object (tmp); |
707 | tmp->destroy (0); |
708 | return 0; |
708 | return 0; |
709 | } |
709 | } |
710 | tmp->x = op->x; |
710 | tmp->x = op->x; |
711 | tmp->y = op->y; |
711 | tmp->y = op->y; |
712 | tmp->direction = absdir (tmp->direction + 4); |
712 | tmp->direction = absdir (tmp->direction + 4); |
… | |
… | |
777 | * when their cone dies when they die. |
777 | * when their cone dies when they die. |
778 | */ |
778 | */ |
779 | /* If no owner left, the spell dies out. */ |
779 | /* If no owner left, the spell dies out. */ |
780 | if (get_owner (op) == NULL) |
780 | if (get_owner (op) == NULL) |
781 | { |
781 | { |
782 | remove_ob (op); |
782 | op->remove (); |
783 | free_object (op); |
783 | op->destroy (0); |
784 | return; |
784 | return; |
785 | } |
785 | } |
786 | #endif |
786 | #endif |
787 | |
787 | |
788 | hit_map (op, 0, op->attacktype, 0); |
788 | hit_map (op, 0, op->attacktype, 0); |
… | |
… | |
797 | if (op->destroyed ()) |
797 | if (op->destroyed ()) |
798 | return; |
798 | return; |
799 | |
799 | |
800 | if ((op->duration--) < 0) |
800 | if ((op->duration--) < 0) |
801 | { |
801 | { |
802 | remove_ob (op); |
802 | op->remove (); |
803 | free_object (op); |
803 | op->destroy (0); |
804 | return; |
804 | return; |
805 | } |
805 | } |
806 | /* Object has hit maximum range, so don't have it move |
806 | /* Object has hit maximum range, so don't have it move |
807 | * any further. When the duration above expires, |
807 | * any further. When the duration above expires, |
808 | * then the object will get removed. |
808 | * then the object will get removed. |
… | |
… | |
847 | int |
847 | int |
848 | cast_cone (object *op, object *caster, int dir, object *spell) |
848 | cast_cone (object *op, object *caster, int dir, object *spell) |
849 | { |
849 | { |
850 | object *tmp; |
850 | object *tmp; |
851 | int i, success = 0, range_min = -1, range_max = 1; |
851 | int i, success = 0, range_min = -1, range_max = 1; |
852 | mapstruct *m; |
852 | maptile *m; |
853 | sint16 sx, sy; |
853 | sint16 sx, sy; |
854 | MoveType movetype; |
854 | MoveType movetype; |
855 | |
855 | |
856 | if (!spell->other_arch) |
856 | if (!spell->other_arch) |
857 | return 0; |
857 | return 0; |
… | |
… | |
1012 | return; |
1012 | return; |
1013 | |
1013 | |
1014 | if (env->type == PLAYER) |
1014 | if (env->type == PLAYER) |
1015 | esrv_del_item (env->contr, op->count); |
1015 | esrv_del_item (env->contr, op->count); |
1016 | |
1016 | |
1017 | remove_ob (op); |
1017 | op->remove (); |
1018 | op->x = env->x; |
1018 | op->x = env->x; |
1019 | op->y = env->y; |
1019 | op->y = env->y; |
1020 | if ((op = insert_ob_in_map (op, env->map, op, 0)) == NULL) |
1020 | if ((op = insert_ob_in_map (op, env->map, op, 0)) == NULL) |
1021 | return; |
1021 | return; |
1022 | } |
1022 | } |
… | |
… | |
1024 | // elmex Tue Aug 15 17:46:51 CEST 2006: Prevent bomb from exploding |
1024 | // elmex Tue Aug 15 17:46:51 CEST 2006: Prevent bomb from exploding |
1025 | // on a safe map. I don't like this special casing, but it seems to be neccessary |
1025 | // on a safe map. I don't like this special casing, but it seems to be neccessary |
1026 | // as bombs can be carried. |
1026 | // as bombs can be carried. |
1027 | if (get_map_flags (op->map, NULL, op->x, op->y, NULL, NULL) & P_SAFE) |
1027 | if (get_map_flags (op->map, NULL, op->x, op->y, NULL, NULL) & P_SAFE) |
1028 | { |
1028 | { |
1029 | remove_ob (op); |
1029 | op->remove (); |
1030 | free_object (op); |
1030 | op->destroy (0); |
1031 | return; |
1031 | return; |
1032 | } |
1032 | } |
1033 | |
1033 | |
1034 | /* This copies a lot of the code from the fire bullet, |
1034 | /* This copies a lot of the code from the fire bullet, |
1035 | * but using the cast_bullet isn't really feasible, |
1035 | * but using the cast_bullet isn't really feasible, |
… | |
… | |
1070 | { |
1070 | { |
1071 | |
1071 | |
1072 | object *tmp; |
1072 | object *tmp; |
1073 | int mflags; |
1073 | int mflags; |
1074 | sint16 dx = op->x + freearr_x[dir], dy = op->y + freearr_y[dir]; |
1074 | sint16 dx = op->x + freearr_x[dir], dy = op->y + freearr_y[dir]; |
1075 | mapstruct *m; |
1075 | maptile *m; |
1076 | |
1076 | |
1077 | mflags = get_map_flags (op->map, &m, dx, dy, &dx, &dy); |
1077 | mflags = get_map_flags (op->map, &m, dx, dy, &dx, &dy); |
1078 | if ((mflags & P_OUT_OF_MAP) || (GET_MAP_MOVE_BLOCK (m, dx, dy) & MOVE_WALK)) |
1078 | if ((mflags & P_OUT_OF_MAP) || (GET_MAP_MOVE_BLOCK (m, dx, dy) & MOVE_WALK)) |
1079 | { |
1079 | { |
1080 | new_draw_info (NDI_UNIQUE, 0, op, "There is something in the way."); |
1080 | new_draw_info (NDI_UNIQUE, 0, op, "There is something in the way."); |
… | |
… | |
1116 | get_pointed_target (object *op, int dir, int range, int type) |
1116 | get_pointed_target (object *op, int dir, int range, int type) |
1117 | { |
1117 | { |
1118 | object *target; |
1118 | object *target; |
1119 | sint16 x, y; |
1119 | sint16 x, y; |
1120 | int dist, mflags; |
1120 | int dist, mflags; |
1121 | mapstruct *mp; |
1121 | maptile *mp; |
1122 | |
1122 | |
1123 | if (dir == 0) |
1123 | if (dir == 0) |
1124 | return NULL; |
1124 | return NULL; |
1125 | |
1125 | |
1126 | for (dist = 1; dist < range; dist++) |
1126 | for (dist = 1; dist < range; dist++) |
… | |
… | |
1229 | } |
1229 | } |
1230 | else |
1230 | else |
1231 | { |
1231 | { |
1232 | new_draw_info_format (NDI_UNIQUE, 0, op, "The %s looks stronger!", query_name (target)); |
1232 | new_draw_info_format (NDI_UNIQUE, 0, op, "The %s looks stronger!", query_name (target)); |
1233 | target->stats.hp = target->stats.maxhp * 2; |
1233 | target->stats.hp = target->stats.maxhp * 2; |
1234 | free_object (effect); |
1234 | effect->destroy (0); |
1235 | return 0; |
1235 | return 0; |
1236 | } |
1236 | } |
1237 | } |
1237 | } |
1238 | } |
1238 | } |
1239 | else |
1239 | else |
… | |
… | |
1266 | move_missile (object *op) |
1266 | move_missile (object *op) |
1267 | { |
1267 | { |
1268 | int i, mflags; |
1268 | int i, mflags; |
1269 | object *owner; |
1269 | object *owner; |
1270 | sint16 new_x, new_y; |
1270 | sint16 new_x, new_y; |
1271 | mapstruct *m; |
1271 | maptile *m; |
1272 | |
1272 | |
1273 | if (op->range-- <= 0) |
1273 | if (op->range-- <= 0) |
1274 | { |
1274 | { |
1275 | remove_ob (op); |
1275 | op->remove (); |
1276 | free_object (op); |
1276 | op->destroy (0); |
1277 | return; |
1277 | return; |
1278 | } |
1278 | } |
1279 | |
1279 | |
1280 | owner = get_owner (op); |
1280 | owner = get_owner (op); |
1281 | #if 0 |
1281 | #if 0 |
1282 | /* It'd make things nastier if this wasn't here - spells cast by |
1282 | /* It'd make things nastier if this wasn't here - spells cast by |
1283 | * monster that are then killed would continue to survive |
1283 | * monster that are then killed would continue to survive |
1284 | */ |
1284 | */ |
1285 | if (owner == NULL) |
1285 | if (owner == NULL) |
1286 | { |
1286 | { |
1287 | remove_ob (op); |
1287 | op->remove (); |
1288 | free_object (op); |
1288 | op->destroy (0); |
1289 | return; |
1289 | return; |
1290 | } |
1290 | } |
1291 | #endif |
1291 | #endif |
1292 | |
1292 | |
1293 | new_x = op->x + DIRX (op); |
1293 | new_x = op->x + DIRX (op); |
… | |
… | |
1300 | hit_map (op, op->direction, AT_MAGIC, 1); |
1300 | hit_map (op, op->direction, AT_MAGIC, 1); |
1301 | /* Basically, missile only hits one thing then goes away. |
1301 | /* Basically, missile only hits one thing then goes away. |
1302 | * we need to remove it if someone hasn't already done so. |
1302 | * we need to remove it if someone hasn't already done so. |
1303 | */ |
1303 | */ |
1304 | if (!op->destroyed ()) |
1304 | if (!op->destroyed ()) |
1305 | free_object (op); |
1305 | op->destroy (0); |
1306 | |
1306 | |
1307 | return; |
1307 | return; |
1308 | } |
1308 | } |
1309 | |
1309 | |
1310 | remove_ob (op); |
1310 | op->remove (); |
1311 | |
1311 | |
1312 | if (!op->direction || (mflags & P_OUT_OF_MAP)) |
1312 | if (!op->direction || (mflags & P_OUT_OF_MAP)) |
1313 | { |
1313 | { |
1314 | free_object (op); |
1314 | op->destroy (0); |
1315 | return; |
1315 | return; |
1316 | } |
1316 | } |
1317 | |
1317 | |
1318 | op->x = new_x; |
1318 | op->x = new_x; |
1319 | op->y = new_y; |
1319 | op->y = new_y; |
… | |
… | |
1378 | int |
1378 | int |
1379 | cast_destruction (object *op, object *caster, object *spell_ob) |
1379 | cast_destruction (object *op, object *caster, object *spell_ob) |
1380 | { |
1380 | { |
1381 | int i, j, range, mflags, friendly = 0, dam, dur; |
1381 | int i, j, range, mflags, friendly = 0, dam, dur; |
1382 | sint16 sx, sy; |
1382 | sint16 sx, sy; |
1383 | mapstruct *m; |
1383 | maptile *m; |
1384 | object *tmp; |
1384 | object *tmp; |
1385 | const char *skill; |
1385 | const char *skill; |
1386 | |
1386 | |
1387 | range = spell_ob->range + SP_level_range_adjust (caster, spell_ob); |
1387 | range = spell_ob->range + SP_level_range_adjust (caster, spell_ob); |
1388 | dam = spell_ob->stats.dam + SP_level_dam_adjust (caster, spell_ob); |
1388 | dam = spell_ob->stats.dam + SP_level_dam_adjust (caster, spell_ob); |
… | |
… | |
1570 | mood_change (object *op, object *caster, object *spell) |
1570 | mood_change (object *op, object *caster, object *spell) |
1571 | { |
1571 | { |
1572 | object *tmp, *god, *head; |
1572 | object *tmp, *god, *head; |
1573 | int done_one, range, mflags, level, at, best_at; |
1573 | int done_one, range, mflags, level, at, best_at; |
1574 | sint16 x, y, nx, ny; |
1574 | sint16 x, y, nx, ny; |
1575 | mapstruct *m; |
1575 | maptile *m; |
1576 | const char *race; |
1576 | const char *race; |
1577 | |
1577 | |
1578 | /* We precompute some values here so that we don't have to keep |
1578 | /* We precompute some values here so that we don't have to keep |
1579 | * doing it over and over again. |
1579 | * doing it over and over again. |
1580 | */ |
1580 | */ |
… | |
… | |
1744 | move_ball_spell (object *op) |
1744 | move_ball_spell (object *op) |
1745 | { |
1745 | { |
1746 | int i, j, dam_save, dir, mflags; |
1746 | int i, j, dam_save, dir, mflags; |
1747 | sint16 nx, ny, hx, hy; |
1747 | sint16 nx, ny, hx, hy; |
1748 | object *owner; |
1748 | object *owner; |
1749 | mapstruct *m; |
1749 | maptile *m; |
1750 | |
1750 | |
1751 | owner = get_owner (op); |
1751 | owner = get_owner (op); |
1752 | |
1752 | |
1753 | /* the following logic makes sure that the ball doesn't move into a wall, |
1753 | /* the following logic makes sure that the ball doesn't move into a wall, |
1754 | * and makes sure that it will move along a wall to try and get at it's |
1754 | * and makes sure that it will move along a wall to try and get at it's |
… | |
… | |
1785 | nx = op->x; |
1785 | nx = op->x; |
1786 | ny = op->y; |
1786 | ny = op->y; |
1787 | m = op->map; |
1787 | m = op->map; |
1788 | } |
1788 | } |
1789 | |
1789 | |
1790 | remove_ob (op); |
1790 | op->remove (); |
1791 | op->y = ny; |
1791 | op->y = ny; |
1792 | op->x = nx; |
1792 | op->x = nx; |
1793 | insert_ob_in_map (op, m, op, 0); |
1793 | insert_ob_in_map (op, m, op, 0); |
1794 | |
1794 | |
1795 | dam_save = op->stats.dam; /* save the original dam: we do halfdam on |
1795 | dam_save = op->stats.dam; /* save the original dam: we do halfdam on |
… | |
… | |
1866 | #if 0 |
1866 | #if 0 |
1867 | static int cardinal_adjust[9] = { -3, -2, -1, 0, 0, 0, 1, 2, 3 }; |
1867 | static int cardinal_adjust[9] = { -3, -2, -1, 0, 0, 0, 1, 2, 3 }; |
1868 | static int diagonal_adjust[10] = { -3, -2, -2, -1, 0, 0, 1, 2, 2, 3 }; |
1868 | static int diagonal_adjust[10] = { -3, -2, -2, -1, 0, 0, 1, 2, 2, 3 }; |
1869 | sint16 target_x, target_y, origin_x, origin_y; |
1869 | sint16 target_x, target_y, origin_x, origin_y; |
1870 | int adjustdir; |
1870 | int adjustdir; |
1871 | mapstruct *m; |
1871 | maptile *m; |
1872 | #endif |
1872 | #endif |
1873 | int basedir; |
1873 | int basedir; |
1874 | object *owner; |
1874 | object *owner; |
1875 | |
1875 | |
1876 | owner = get_owner (op); |
1876 | owner = get_owner (op); |
1877 | if (op->duration == 0 || owner == NULL) |
1877 | if (op->duration == 0 || owner == NULL) |
1878 | { |
1878 | { |
1879 | remove_ob (op); |
1879 | op->remove (); |
1880 | free_object (op); |
1880 | op->destroy (0); |
1881 | return; |
1881 | return; |
1882 | } |
1882 | } |
1883 | op->duration--; |
1883 | op->duration--; |
1884 | |
1884 | |
1885 | basedir = op->direction; |
1885 | basedir = op->direction; |
… | |
… | |
2019 | cast_light (object *op, object *caster, object *spell, int dir) |
2019 | cast_light (object *op, object *caster, object *spell, int dir) |
2020 | { |
2020 | { |
2021 | object *target = NULL, *tmp = NULL; |
2021 | object *target = NULL, *tmp = NULL; |
2022 | sint16 x, y; |
2022 | sint16 x, y; |
2023 | int dam, mflags; |
2023 | int dam, mflags; |
2024 | mapstruct *m; |
2024 | maptile *m; |
2025 | |
2025 | |
2026 | dam = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
2026 | dam = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
2027 | |
2027 | |
2028 | if (!dir) |
2028 | if (!dir) |
2029 | { |
2029 | { |
… | |
… | |
2097 | cast_cause_disease (object *op, object *caster, object *spell, int dir) |
2097 | cast_cause_disease (object *op, object *caster, object *spell, int dir) |
2098 | { |
2098 | { |
2099 | sint16 x, y; |
2099 | sint16 x, y; |
2100 | int i, mflags, range, dam_mod, dur_mod; |
2100 | int i, mflags, range, dam_mod, dur_mod; |
2101 | object *walk; |
2101 | object *walk; |
2102 | mapstruct *m; |
2102 | maptile *m; |
2103 | |
2103 | |
2104 | x = op->x; |
2104 | x = op->x; |
2105 | y = op->y; |
2105 | y = op->y; |
2106 | |
2106 | |
2107 | /* If casting from a scroll, no direction will be available, so refer to the |
2107 | /* If casting from a scroll, no direction will be available, so refer to the |
… | |
… | |
2199 | { |
2199 | { |
2200 | object *flash; /* visual effect for inflicting disease */ |
2200 | object *flash; /* visual effect for inflicting disease */ |
2201 | |
2201 | |
2202 | new_draw_info_format (NDI_UNIQUE, 0, op, "You inflict %s on %s!", &disease->name, &walk->name); |
2202 | new_draw_info_format (NDI_UNIQUE, 0, op, "You inflict %s on %s!", &disease->name, &walk->name); |
2203 | |
2203 | |
2204 | free_object (disease); /* don't need this one anymore */ |
2204 | disease->destroy (0); /* don't need this one anymore */ |
2205 | flash = get_archetype (ARCH_DETECT_MAGIC); |
2205 | flash = get_archetype (ARCH_DETECT_MAGIC); |
2206 | flash->x = x; |
2206 | flash->x = x; |
2207 | flash->y = y; |
2207 | flash->y = y; |
2208 | flash->map = walk->map; |
2208 | flash->map = walk->map; |
2209 | insert_ob_in_map (flash, walk->map, op, 0); |
2209 | insert_ob_in_map (flash, walk->map, op, 0); |
2210 | return 1; |
2210 | return 1; |
2211 | } |
2211 | } |
2212 | free_object (disease); |
2212 | disease->destroy (0); |
2213 | } |
2213 | } |
2214 | } /* if living creature */ |
2214 | } /* if living creature */ |
2215 | } /* for range of spaces */ |
2215 | } /* for range of spaces */ |
2216 | new_draw_info (NDI_UNIQUE, 0, op, "No one caught anything!"); |
2216 | new_draw_info (NDI_UNIQUE, 0, op, "No one caught anything!"); |
2217 | return 1; |
2217 | return 1; |