version 1.55 | | version 1.56 |
---|
| | |
/* | | /* |
* static char *rcsid_spell_util_c = | | * static char *rcsid_spell_util_c = |
* "$Id: spell_util.c,v 1.55 2001/06/13 12:51:58 michtoen Exp $"; | | * "$Id: spell_util.c,v 1.56 2001/07/14 04:11:18 mwedel Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
#endif | | #endif |
#include <sounds.h> | | #include <sounds.h> |
| | |
#ifdef sequent | | |
/* stoopid sequent includes don't do this like they should */ | | |
extern char * sys_errlist[]; | | |
extern int sys_nerr; | | |
#endif | | |
| | |
char *range_name[range_size] = { | | char *range_name[range_size] = { |
"none", "bow", "magic", "wand", "rod", "scroll", "horn" | | "none", "bow", "magic", "wand", "rod", "scroll", "horn" |
,"steal" | | ,"steal" |
| | |
effect->x = x; | | effect->x = x; |
effect->y = y; | | effect->y = y; |
| | |
insert_ob_in_map(effect, map, originator); | | insert_ob_in_map(effect, map, originator,0); |
} | | } |
} | | } |
| | |
| | |
} | | } |
new_op->x=op->x+freearr_x[dir]; | | new_op->x=op->x+freearr_x[dir]; |
new_op->y=op->y+freearr_y[dir]; | | new_op->y=op->y+freearr_y[dir]; |
insert_ob_in_map(new_op,op->map,op); | | insert_ob_in_map(new_op,op->map,op,0); |
return dir; | | return dir; |
} | | } |
| | |
| | |
tmp->speed_left= -1; | | tmp->speed_left= -1; |
tmp->x=op->x+freearr_x[dir],tmp->y=op->y+freearr_y[dir]; | | tmp->x=op->x+freearr_x[dir],tmp->y=op->y+freearr_y[dir]; |
tmp->direction=dir; | | tmp->direction=dir; |
insert_ob_in_map(tmp,op->map,op); | | insert_ob_in_map(tmp,op->map,op,0); |
return 1; | | return 1; |
} | | } |
| | |
| | |
tmp->x=op->x,tmp->y=op->y; | | tmp->x=op->x,tmp->y=op->y; |
tmp->direction=absdir(tmp->direction+4); | | tmp->direction=absdir(tmp->direction+4); |
} | | } |
if ((tmp = insert_ob_in_map(tmp,op->map,op)) != NULL) | | if ((tmp = insert_ob_in_map(tmp,op->map,op,0)) != NULL) |
move_bolt (tmp); | | move_bolt (tmp); |
return 1; | | return 1; |
} | | } |
| | |
if(QUERY_FLAG(tmp, FLAG_IS_TURNABLE)) | | if(QUERY_FLAG(tmp, FLAG_IS_TURNABLE)) |
SET_ANIMATION(tmp, dir); | | SET_ANIMATION(tmp, dir); |
| | |
if ((tmp = insert_ob_in_map (tmp, op->map, op)) == NULL) | | if ((tmp = insert_ob_in_map (tmp, op->map, op,0)) == NULL) |
return 1; | | return 1; |
switch(type) { | | switch(type) { |
case SP_M_MISSILE: | | case SP_M_MISSILE: |
| | |
&& tmp->stats.dam) | | && tmp->stats.dam) |
LOG (llevDebug, "cast_cone(): arch %s doesn't have walk_on 1 and " | | LOG (llevDebug, "cast_cone(): arch %s doesn't have walk_on 1 and " |
"fly_on 1\n", spell_arch->name); | | "fly_on 1\n", spell_arch->name); |
insert_ob_in_map(tmp,op->map,op); | | insert_ob_in_map(tmp,op->map,op,0); |
if(tmp->other_arch) cone_drop(tmp); | | if(tmp->other_arch) cone_drop(tmp); |
} | | } |
return success; | | return success; |
| | |
remove_ob(tmp); | | remove_ob(tmp); |
tmp->x = nx; | | tmp->x = nx; |
tmp->y = ny; | | tmp->y = ny; |
insert_ob_in_map(tmp,op->map,op); | | insert_ob_in_map(tmp,op->map,op,0); |
} | | } |
#endif | | #endif |
} | | } |
| | |
new_ob->chosen_skill=op->chosen_skill; | | new_ob->chosen_skill=op->chosen_skill; |
new_ob->exp_obj = op->chosen_skill->exp_obj; | | new_ob->exp_obj = op->chosen_skill->exp_obj; |
} | | } |
insert_ob_in_map(new_ob,op->map,op); | | insert_ob_in_map(new_ob,op->map,op,0); |
| | |
} | | } |
| | |
| | |
tmp->stats.maxhp=op->stats.maxhp; | | tmp->stats.maxhp=op->stats.maxhp; |
tmp->stats.dam = op->stats.dam; | | tmp->stats.dam = op->stats.dam; |
tmp->attacktype=op->attacktype; | | tmp->attacktype=op->attacktype; |
insert_ob_in_map(tmp,op->map,op); | | insert_ob_in_map(tmp,op->map,op,0); |
if(tmp->other_arch) { cone_drop(tmp);} | | if(tmp->other_arch) { cone_drop(tmp);} |
} | | } |
} | | } |
| | |
tmp->level = op->level; | | tmp->level = op->level; |
SET_ANIMATION(tmp, dir); | | SET_ANIMATION(tmp, dir); |
SET_FLAG(tmp, FLAG_FLYING); | | SET_FLAG(tmp, FLAG_FLYING); |
if ((tmp = insert_ob_in_map (tmp, op->map, op)) != NULL) | | if ((tmp = insert_ob_in_map (tmp, op->map, op,0)) != NULL) |
move_fired_arch (tmp); | | move_fired_arch (tmp); |
} | | } |
| | |
| | |
if(op->above!=NULL&&op->above->type!=PLAYER) { | | if(op->above!=NULL&&op->above->type!=PLAYER) { |
SET_FLAG (op, FLAG_NO_APPLY); | | SET_FLAG (op, FLAG_NO_APPLY); |
remove_ob(op); | | remove_ob(op); |
insert_ob_in_map(op,op->map,op); | | insert_ob_in_map(op,op->map,op,0); |
CLEAR_FLAG (op, FLAG_NO_APPLY); | | CLEAR_FLAG (op, FLAG_NO_APPLY); |
} | | } |
hit_map(op,0,op->attacktype); | | hit_map(op,0,op->attacktype); |
| | |
tmp->stats.hp--; | | tmp->stats.hp--; |
tmp->value=0; | | tmp->value=0; |
tmp->x=dx,tmp->y=dy; | | tmp->x=dx,tmp->y=dy; |
insert_ob_in_map(tmp,m,op); | | insert_ob_in_map(tmp,m,op,0); |
} | | } |
} | | } |
} | | } |
| | |
new_bolt->stats.dam++; | | new_bolt->stats.dam++; |
tmp->stats.dam /= 2; /* reduce father bolt damage */ | | tmp->stats.dam /= 2; /* reduce father bolt damage */ |
tmp->stats.dam++; | | tmp->stats.dam++; |
new_bolt = insert_ob_in_map(new_bolt,op->map,op); | | new_bolt = insert_ob_in_map(new_bolt,op->map,op,0); |
update_turn_face(new_bolt); | | update_turn_face(new_bolt); |
} | | } |
} | | } |
| | |
tmp->value=0; | | tmp->value=0; |
tmp->stats.hp++; | | tmp->stats.hp++; |
tmp->x+=DIRX(tmp),tmp->y+=DIRY(tmp); | | tmp->x+=DIRX(tmp),tmp->y+=DIRY(tmp); |
tmp = insert_ob_in_map(tmp,op->map,op); | | tmp = insert_ob_in_map(tmp,op->map,op,0); |
| | |
/* New forking code. Possibly create forks of this object | | /* New forking code. Possibly create forks of this object |
going off in other directions. */ | | going off in other directions. */ |
| | |
} | | } |
} /* If victim */ | | } /* If victim */ |
} | | } |
if(made_attack) update_object(op); | | if(made_attack) update_object(op,UP_OBJ_FACE); |
} | | } |
| | |
void control_golem(object *op,int dir) { | | void control_golem(object *op,int dir) { |
| | |
op->direction=absdir(op->direction+((op->direction-i+8)%8<4?-1:1)); | | op->direction=absdir(op->direction+((op->direction-i+8)%8<4?-1:1)); |
SET_ANIMATION(op, op->direction); | | SET_ANIMATION(op, op->direction); |
} | | } |
insert_ob_in_map(op,op->map,op); | | insert_ob_in_map(op,op->map,op,0); |
} | | } |
| | |
void explode_object(object *op) | | void explode_object(object *op) |
| | |
remove_ob (op); | | remove_ob (op); |
op->x = env->x; | | op->x = env->x; |
op->y = env->y; | | op->y = env->y; |
insert_ob_in_map_simple (op, env->map); | | insert_ob_in_map(op, env->map, op, INS_NO_MERGE | INS_NO_WALK_ON); |
} else if (out_of_map (op->map, op->x, op->y)) { | | } else if (out_of_map (op->map, op->x, op->y)) { |
LOG (llevError, "BUG: explode_object(): op out of map\n"); | | LOG (llevError, "BUG: explode_object(): op out of map\n"); |
remove_ob (op); | | remove_ob (op); |
| | |
CLEAR_FLAG (op, FLAG_WALK_ON); | | CLEAR_FLAG (op, FLAG_WALK_ON); |
CLEAR_FLAG (op, FLAG_FLY_ON); | | CLEAR_FLAG (op, FLAG_FLY_ON); |
| | |
insert_ob_in_map (tmp, op->map, op); | | insert_ob_in_map (tmp, op->map, op,0); |
break; | | break; |
} | | } |
case CONE: | | case CONE: |
| | |
remove_ob (op); | | remove_ob (op); |
op->x = new_x; | | op->x = new_x; |
op->y = new_y; | | op->y = new_y; |
if ((op = insert_ob_in_map (op, op->map, op)) == NULL) | | if ((op = insert_ob_in_map (op, op->map, op,0)) == NULL) |
return; | | return; |
| | |
if (reflwall (op->map, op->x, op->y, op)) { | | if (reflwall (op->map, op->x, op->y, op)) { |
| | |
remove_ob(op); | | remove_ob(op); |
op->y=ny; | | op->y=ny; |
op->x=nx; | | op->x=nx; |
insert_ob_in_map(op,op->map,op); | | insert_ob_in_map(op,op->map,op,0); |
| | |
dam_save = op->stats.dam; /* save the original dam: we do halfdam on | | dam_save = op->stats.dam; /* save the original dam: we do halfdam on |
surrounding squares */ | | surrounding squares */ |
| | |
new_ob = arch_to_object(op->other_arch); | | new_ob = arch_to_object(op->other_arch); |
new_ob->x = hx; | | new_ob->x = hx; |
new_ob->y = hy; | | new_ob->y = hy; |
insert_ob_in_map(new_ob,op->map,op); | | insert_ob_in_map(new_ob,op->map,op,0); |
} | | } |
} | | } |
/* restore to the center location and damage*/ | | /* restore to the center location and damage*/ |
| | |
tmp->other_arch=swarm_type; /* the archetype of the things to be fired*/ | | tmp->other_arch=swarm_type; /* the archetype of the things to be fired*/ |
tmp->direction=dir; | | tmp->direction=dir; |
tmp->invisible=1; | | tmp->invisible=1; |
insert_ob_in_map(tmp,op->map,op); | | insert_ob_in_map(tmp,op->map,op,0); |
} | | } |
| | |
/* create an aura spell object and put it in the player's inventory. */ | | /* create an aura spell object and put it in the player's inventory. */ |
| | |
| | |
if (head->randomitems) | | if (head->randomitems) |
create_treasure(head->randomitems, head, GT_INVISIBLE, op->map->difficulty,0); | | create_treasure(head->randomitems, head, GT_INVISIBLE, op->map->difficulty,0); |
insert_ob_in_map(head,op->map,op); | | insert_ob_in_map(head,op->map,op,0); |
| | |
/* thought it'd be cool to insert a burnout, too.*/ | | /* thought it'd be cool to insert a burnout, too.*/ |
tmp=get_archetype("burnout"); | | tmp=get_archetype("burnout"); |
tmp->map = op->map; | | tmp->map = op->map; |
tmp->x=op->x+freearr_x[dir]; | | tmp->x=op->x+freearr_x[dir]; |
tmp->y=op->y+freearr_y[dir]; | | tmp->y=op->y+freearr_y[dir]; |
insert_ob_in_map(tmp,op->map,op); | | insert_ob_in_map(tmp,op->map,op,0); |
} | | } |
} | | } |
| | |
| | |
| | |
/* ok, tell it where to be, and insert! */ | | /* ok, tell it where to be, and insert! */ |
effect->x=target->x;effect->y=target->y; | | effect->x=target->x;effect->y=target->y; |
insert_ob_in_map(effect,op->map,op); | | insert_ob_in_map(effect,op->map,op,0); |
| | |
return 1; | | return 1; |
} | | } |