ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/spell_attack.C
(Generate patch)

Comparing deliantra/server/server/spell_attack.C (file contents):
Revision 1.21 by root, Wed Dec 20 09:14:22 2006 UTC vs.
Revision 1.24 by root, Tue Dec 26 08:55:00 2006 UTC

27 */ 27 */
28 28
29#include <global.h> 29#include <global.h>
30#include <object.h> 30#include <object.h>
31#include <living.h> 31#include <living.h>
32#ifndef __CEXTRACT__
33# include <sproto.h> 32#include <sproto.h>
34#endif
35#include <spells.h> 33#include <spells.h>
36#include <sounds.h> 34#include <sounds.h>
37 35
38/* this function checks to see if a spell pushes objects as well 36/* this function checks to see if a spell pushes objects as well
39 * as flies over and damages them (only used for cones for now) 37 * as flies over and damages them (only used for cones for now)
280 * we remove the magic flag - that can be derived from 278 * we remove the magic flag - that can be derived from
281 * spob->attacktype. 279 * spob->attacktype.
282 * This function sets up the appropriate owner and skill 280 * This function sets up the appropriate owner and skill
283 * pointers. 281 * pointers.
284 */ 282 */
285
286int 283int
287fire_bolt (object *op, object *caster, int dir, object *spob, object *skill) 284fire_bolt (object *op, object *caster, int dir, object *spob, object *skill)
288{ 285{
289 object *tmp = NULL; 286 object *tmp = NULL;
290 int mflags; 287 int mflags;
315 312
316 tmp->x = op->x + DIRX (tmp); 313 tmp->x = op->x + DIRX (tmp);
317 tmp->y = op->y + DIRY (tmp); 314 tmp->y = op->y + DIRY (tmp);
318 tmp->map = op->map; 315 tmp->map = op->map;
319 316
317 maptile *newmap;
320 mflags = get_map_flags (tmp->map, &tmp->map, tmp->x, tmp->y, &tmp->x, &tmp->y); 318 mflags = get_map_flags (tmp->map, &newmap, tmp->x, tmp->y, &tmp->x, &tmp->y);
321 if (mflags & P_OUT_OF_MAP) 319 if (mflags & P_OUT_OF_MAP)
322 { 320 {
323 tmp->destroy (); 321 tmp->destroy ();
324 return 0; 322 return 0;
325 } 323 }
324
325 tmp->map = newmap;
326 326
327 if (OB_TYPE_MOVE_BLOCK (tmp, GET_MAP_MOVE_BLOCK (tmp->map, tmp->x, tmp->y))) 327 if (OB_TYPE_MOVE_BLOCK (tmp, GET_MAP_MOVE_BLOCK (tmp->map, tmp->x, tmp->y)))
328 { 328 {
329 if (!QUERY_FLAG (tmp, FLAG_REFLECTING)) 329 if (!QUERY_FLAG (tmp, FLAG_REFLECTING))
330 { 330 {
553 } 553 }
554 } 554 }
555 } 555 }
556} 556}
557 557
558
559/* Basically, we move 'op' one square, and if it hits something, 558/* Basically, we move 'op' one square, and if it hits something,
560 * call check_bullet. 559 * call check_bullet.
561 * This function is only applicable to bullets, but not to all 560 * This function is only applicable to bullets, but not to all
562 * fired arches (eg, bolts). 561 * fired arches (eg, bolts).
563 */ 562 */
564
565void 563void
566move_bullet (object *op) 564move_bullet (object *op)
567{ 565{
568 sint16 new_x, new_y; 566 sint16 new_x, new_y;
569 int mflags; 567 int mflags;
624 { 622 {
625 op->direction = absdir (op->direction + 4); 623 op->direction = absdir (op->direction + 4);
626 update_turn_face (op); 624 update_turn_face (op);
627 } 625 }
628 else 626 else
629 {
630 check_bullet (op); 627 check_bullet (op);
631 }
632} 628}
633 629
634 630
635 631
636 632
678 674
679 tmp->x = op->x + freearr_x[dir]; 675 tmp->x = op->x + freearr_x[dir];
680 tmp->y = op->y + freearr_y[dir]; 676 tmp->y = op->y + freearr_y[dir];
681 tmp->map = op->map; 677 tmp->map = op->map;
682 678
679 maptile *newmap;
683 mflags = get_map_flags (tmp->map, &tmp->map, tmp->x, tmp->y, &tmp->x, &tmp->y); 680 mflags = get_map_flags (tmp->map, &newmap, tmp->x, tmp->y, &tmp->x, &tmp->y);
684 if (mflags & P_OUT_OF_MAP) 681 if (mflags & P_OUT_OF_MAP)
685 { 682 {
686 tmp->destroy (); 683 tmp->destroy ();
687 return 0; 684 return 0;
688 } 685 }
686
687 tmp->map = newmap;
689 688
690 if (OB_TYPE_MOVE_BLOCK (tmp, GET_MAP_MOVE_BLOCK (tmp->map, tmp->x, tmp->y))) 689 if (OB_TYPE_MOVE_BLOCK (tmp, GET_MAP_MOVE_BLOCK (tmp->map, tmp->x, tmp->y)))
691 { 690 {
692 if (!QUERY_FLAG (tmp, FLAG_REFLECTING)) 691 if (!QUERY_FLAG (tmp, FLAG_REFLECTING))
693 { 692 {
699 tmp->y = op->y; 698 tmp->y = op->y;
700 tmp->direction = absdir (tmp->direction + 4); 699 tmp->direction = absdir (tmp->direction + 4);
701 tmp->map = op->map; 700 tmp->map = op->map;
702 } 701 }
703 702
704 if ((tmp = insert_ob_in_map (tmp, tmp->map, op, 0)) != NULL) 703 if ((tmp = insert_ob_in_map (tmp, tmp->map, op, 0)))
705 check_bullet (tmp); 704 check_bullet (tmp);
706 705
707 return 1; 706 return 1;
708} 707}
709 708
746 745
747 /* if no map then hit_map will crash so just ignore object */ 746 /* if no map then hit_map will crash so just ignore object */
748 if (!op->map) 747 if (!op->map)
749 { 748 {
750 LOG (llevError, "Tried to move_cone object %s without a map.\n", op->name ? &op->name : "unknown"); 749 LOG (llevError, "Tried to move_cone object %s without a map.\n", op->name ? &op->name : "unknown");
751 op->speed = 0; 750 op->set_speed (0);
752 update_ob_speed (op);
753 return; 751 return;
754 } 752 }
755 753
756 /* lava saves it's life, but not yours :) */ 754 /* lava saves it's life, but not yours :) */
757 if (QUERY_FLAG (op, FLAG_LIFESAVE)) 755 if (QUERY_FLAG (op, FLAG_LIFESAVE))
1530 force->stats.ac = spell_ob->stats.ac; 1528 force->stats.ac = spell_ob->stats.ac;
1531 force->stats.wc = spell_ob->stats.wc; 1529 force->stats.wc = spell_ob->stats.wc;
1532 1530
1533 change_abil (tmp, force); /* Mostly to display any messages */ 1531 change_abil (tmp, force); /* Mostly to display any messages */
1534 insert_ob_in_ob (force, tmp); 1532 insert_ob_in_ob (force, tmp);
1535 fix_player (tmp); 1533 tmp->update_stats ();
1536 return 1; 1534 return 1;
1537 1535
1538} 1536}
1539 1537
1540 1538

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines