Difference for server/spell_effect.c from version 1.59 to 1.60


version 1.59 version 1.60
Line 1
 
Line 1
 /*  /*
  * static char *rcsid_spell_effect_c =   * static char *rcsid_spell_effect_c =
  *   "$Id: spell_effect.c,v 1.59 2001/06/30 19:36:42 gros Exp $";   *   "$Id: spell_effect.c,v 1.60 2001/07/14 04:11:18 mwedel Exp $";
  */   */
   
   
Line 86
 
Line 86
      else tmp->stats.dam=power; /* nasty recoils! */       else tmp->stats.dam=power; /* nasty recoils! */
   
      tmp->stats.maxhp=tmp->count; /*??*/       tmp->stats.maxhp=tmp->count; /*??*/
      insert_ob_in_map(tmp,op->map,NULL);       insert_ob_in_map(tmp,op->map,NULL,0);
  }   }
     }      }
 }  }
Line 143
 
Line 143
     tmp->stats.hp+=lvl/5;  /* increase the area of destruction */      tmp->stats.hp+=lvl/5;  /* increase the area of destruction */
     tmp->stats.dam=lvl; /* nasty recoils! */      tmp->stats.dam=lvl; /* nasty recoils! */
     tmp->stats.maxhp=tmp->count; /*??*/       tmp->stats.maxhp=tmp->count; /*??*/
     insert_ob_in_map(tmp,op->map,op);       insert_ob_in_map(tmp,op->map,op,0);
   
 }  }
   
Line 153
 
Line 153
   
   spell_effect(SP_AGGRAVATION, op->x, op->y, op->map, op);    spell_effect(SP_AGGRAVATION, op->x, op->y, op->map, op);
   
   for (i = 0; i < op->map->map_object->x; i++)    for (i = 0; i < MAP_WIDTH(op->map); i++)
     for (j = 0; j < op->map->map_object->y; j++) {      for (j = 0; j < MAP_HEIGHT(op->map); j++) {
       if (out_of_map(op->map, op->x + i , op->y + j))        if (out_of_map(op->map, op->x + i , op->y + j))
         continue;          continue;
       for (tmp = get_map_ob(op->map, op->x + i, op->y + j);        for (tmp = get_map_ob(op->map, op->x + i, op->y + j);
Line 283
 
Line 283
   
     /* Put the new creature on the map */      /* Put the new creature on the map */
     op->x = x; op->y = y;      op->x = x; op->y = y;
     if ((op = insert_ob_in_map (op, map, owner)) == NULL)      if ((op = insert_ob_in_map (op, map, owner,0)) == NULL)
         return;          return;
   
     if(op->randomitems != NULL)      if(op->randomitems != NULL)
Line 393
 
Line 393
     new_ob->y = op->y;      new_ob->y = op->y;
     remove_ob(op);      remove_ob(op);
     free_object(op);      free_object(op);
     /* insert_ob_in_map_simple is caused so that objects don't get      /*
      * merged/rearranged.       * Don't want objects merged or re-arranged, as it then messes up the
        * order
      */       */
     insert_ob_in_map_simple(new_ob,who->map);      insert_ob_in_map(new_ob,who->map,new_ob,INS_NO_MERGE | INS_NO_WALK_ON);
 }  }
   
 /* polymorh - caster who has hit object op. */  /* polymorh - caster who has hit object op. */
Line 479
 
Line 480
  */   */
  image->stats.food += range;   image->stats.food += range;
  image->speed_left = 0.1;   image->speed_left = 0.1;
  insert_ob_in_map(image,op->map,op);   insert_ob_in_map(image,op->map,op,0);
     }      }
     return 1;      return 1;
 }  }
Line 557
 
Line 558
   spb->speed_left= -0.1;    spb->speed_left= -0.1;
   if(type==SP_LARGE_SPEEDBALL)    if(type==SP_LARGE_SPEEDBALL)
     spb->stats.dam=30;      spb->stats.dam=30;
   insert_ob_in_map(spb,op->map,op);    insert_ob_in_map(spb,op->map,op,0);
   return 1;    return 1;
 }  }
   
Line 622
 
Line 623
     break;      break;
   }    }
   new_draw_info(NDI_UNIQUE, 0,op,"You can't see your hands!");    new_draw_info(NDI_UNIQUE, 0,op,"You can't see your hands!");
   update_object(op);    update_object(op,UP_OBJ_FACE);
   for (tmp = objects; tmp != NULL; tmp = tmp->next)    for (tmp = objects; tmp != NULL; tmp = tmp->next)
     if (tmp->enemy == op)      if (tmp->enemy == op)
       tmp->enemy = NULL;        tmp->enemy = NULL;
Line 967
 
Line 968
    dummy->y=exity;     dummy->y=exity;
    dummy->stats.exp=1; /*Set as a 2 ways exit (see manual_apply & is_legal_2ways_exit funcs)*/     dummy->stats.exp=1; /*Set as a 2 ways exit (see manual_apply & is_legal_2ways_exit funcs)*/
    dummy->race=add_string (op->name);  /*Save the owner of the portal*/     dummy->race=add_string (op->name);  /*Save the owner of the portal*/
    insert_ob_in_map(dummy,exitmap,op);     insert_ob_in_map(dummy,exitmap,op,0);
    force=get_archetype("force");              /*The force*/     force=get_archetype("force");              /*The force*/
    if(force == NULL){     if(force == NULL){
      new_draw_info(NDI_UNIQUE, 0,op,"Oops, program error!");       new_draw_info(NDI_UNIQUE, 0,op,"Oops, program error!");
Line 1113
 
Line 1114
      return 0;       return 0;
     }      }
     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];
     if ((tmp = insert_ob_in_map (tmp, op->map, op)) == NULL) {      if ((tmp = insert_ob_in_map (tmp, op->map, op,0)) == NULL) {
  new_draw_info(NDI_UNIQUE, 0,op,"Something destroys your wall");   new_draw_info(NDI_UNIQUE, 0,op,"Something destroys your wall");
  return 0;   return 0;
     }      }
Line 1134
 
Line 1135
  tmp2 = get_object();   tmp2 = get_object();
  copy_object(tmp,tmp2);   copy_object(tmp,tmp2);
  tmp2->x = x; tmp2->y = y;   tmp2->x = x; tmp2->y = y;
  insert_ob_in_map(tmp2,op->map,op);   insert_ob_in_map(tmp2,op->map,op,0);
  } else posblocked=1;   } else posblocked=1;
  x = tmp->x-i*freearr_x[dir2]; y = tmp->y-i*freearr_y[dir2];   x = tmp->x-i*freearr_x[dir2]; y = tmp->y-i*freearr_y[dir2];
  if(!blocked(op->map,x,y)&&!negblocked) {   if(!blocked(op->map,x,y)&&!negblocked) {
  tmp2 = get_object();   tmp2 = get_object();
  copy_object(tmp,tmp2);   copy_object(tmp,tmp2);
  tmp2->x = x; tmp2->y = y;   tmp2->x = x; tmp2->y = y;
  insert_ob_in_map(tmp2,op->map,op);   insert_ob_in_map(tmp2,op->map,op,0);
  } else negblocked=1;   } else negblocked=1;
     }      }
   
   
     if(QUERY_FLAG(tmp, FLAG_BLOCKSVIEW))      if(QUERY_FLAG(tmp, FLAG_BLOCKSVIEW))
  update_all_los(op->map);   update_all_los(op->map, op->x, op->y);
     if(op->type==PLAYER)      if(op->type==PLAYER)
  draw(op);   draw(op);
     else      else
Line 1197
 
Line 1198
   if (tmp->speed < MIN_ACTIVE_SPEED) tmp->speed = MIN_ACTIVE_SPEED;    if (tmp->speed < MIN_ACTIVE_SPEED) tmp->speed = MIN_ACTIVE_SPEED;
   tmp->glow_radius=dam;    tmp->glow_radius=dam;
   tmp->x=x,tmp->y=y;    tmp->x=x,tmp->y=y;
   insert_ob_in_map(tmp,op->map,op);    insert_ob_in_map(tmp,op->map,op,0);
   
   if(op->type==PLAYER) draw(op);    if(op->type==PLAYER) draw(op);
   return 1;    return 1;
Line 1232
 
Line 1233
  * a no magic spot.   * a no magic spot.
  */   */
  if(blocked(op->map,op->x+freearr_x[dir]*dist, op->y+freearr_y[dir]*dist)){   if(blocked(op->map,op->x+freearr_x[dir]*dist, op->y+freearr_y[dir]*dist)){
      int x=RANDOM()%op->map->map_object->x,y=RANDOM()%op->map->map_object->y;       int x=RANDOM()%MAP_WIDTH(op->map),y=RANDOM()%MAP_HEIGHT(op->map);
   
      if(blocked(op->map,x,y) || blocks_magic(op->map,x,y)) {       if(blocked(op->map,x,y) || blocks_magic(op->map,x,y)) {
  new_draw_info(NDI_UNIQUE, 0,op,"You cast your spell, but nothing happens.\n");   new_draw_info(NDI_UNIQUE, 0,op,"You cast your spell, but nothing happens.\n");
Line 1241
 
Line 1242
   
      remove_ob(op);       remove_ob(op);
      op->x=x,op->y=y;       op->x=x,op->y=y;
      if ((op = insert_ob_in_map(op,op->map,op)) != NULL)       if ((op = insert_ob_in_map(op,op->map,op,0)) != NULL)
          draw(op);           draw(op);
      return 1;       return 1;
  }   }
Line 1269
 
Line 1270
     /* Actually move the player now */      /* Actually move the player now */
     remove_ob(op);      remove_ob(op);
     op->x+=freearr_x[dir]*dist,op->y+=freearr_y[dir]*dist;      op->x+=freearr_x[dir]*dist,op->y+=freearr_y[dir]*dist;
     if ((op = insert_ob_in_map(op,op->map,op)) == NULL)      if ((op = insert_ob_in_map(op,op->map,op,0)) == NULL)
         return 1;          return 1;
     draw(op);      draw(op);
     op->speed_left= -FABS(op->speed)*5; /* Freeze them for a short while */      op->speed_left= -FABS(op->speed)*5; /* Freeze them for a short while */
Line 1823
 
Line 1824
     head->direction = dir;      head->direction = dir;
     /* Some monsters are sleeping by default - clear that */      /* Some monsters are sleeping by default - clear that */
     CLEAR_FLAG(head, FLAG_SLEEP);      CLEAR_FLAG(head, FLAG_SLEEP);
     head = insert_ob_in_map (head, op->map, op);      head = insert_ob_in_map (head, op->map, op,0);
     if (head != NULL && head->randomitems != NULL) {      if (head != NULL && head->randomitems != NULL) {
       object *tmp;        object *tmp;
       create_treasure(head->randomitems,head,GT_APPLY,6,0);        create_treasure(head->randomitems,head,GT_APPLY,6,0);
Line 1869
 
Line 1870
   
   set_owner(tmp,op);    set_owner(tmp,op);
   tmp->x=dx,tmp->y=dy;    tmp->x=dx,tmp->y=dy;
   insert_ob_in_map(tmp,op->map,op);    insert_ob_in_map(tmp,op->map,op,0);
   return 1;    return 1;
 }  }
   
Line 1888
 
Line 1889
  if (env->type==PLAYER) drop(env,op);   if (env->type==PLAYER) drop(env,op);
  else {   else {
      remove_ob(op);       remove_ob(op);
      if ((op = insert_ob_in_map (op, env->map, op)) == NULL)       if ((op = insert_ob_in_map (op, env->map, op,0)) == NULL)
                 return;                  return;
  }   }
   }    }
Line 1918
 
Line 1919
     if(op->type==PLAYER)      if(op->type==PLAYER)
  set_owner(tmp,op);   set_owner(tmp,op);
   
     if ((tmp = insert_ob_in_map(tmp,op->map,op)) != NULL)      if ((tmp = insert_ob_in_map(tmp,op->map,op,0)) != NULL)
  move_cancellation(tmp);   move_cancellation(tmp);
     return 1;      return 1;
 }  }
Line 1933
 
Line 1934
   if(reflwall(op->map,op->x,op->y, op)) {    if(reflwall(op->map,op->x,op->y, op)) {
   
     op->direction=absdir(op->direction+4);      op->direction=absdir(op->direction+4);
     insert_ob_in_map(op,op->map,op);      insert_ob_in_map(op,op->map,op,0);
     return;      return;
   }    }
   if ((op = insert_ob_in_map (op, op->map, op)) != NULL)    if ((op = insert_ob_in_map (op, op->map, op,0)) != NULL)
     hit_map (op, 0, op->attacktype);      hit_map (op, 0, op->attacktype);
 }  }
   
Line 2132
 
Line 2133
  tmp-> nrof = small_nuggets;   tmp-> nrof = small_nuggets;
  tmp->x = x;   tmp->x = x;
  tmp->y = y;   tmp->y = y;
  insert_ob_in_map(tmp, op->map, op);   insert_ob_in_map(tmp, op->map, op,0);
  }   }
  if (large_nuggets) {   if (large_nuggets) {
  tmp = get_object();   tmp = get_object();
Line 2140
 
Line 2141
  tmp-> nrof = large_nuggets;   tmp-> nrof = large_nuggets;
  tmp->x = x;   tmp->x = x;
  tmp->y = y;   tmp->y = y;
  insert_ob_in_map(tmp, op->map, op);   insert_ob_in_map(tmp, op->map, op,0);
  }   }
 }  }
   
Line 2397
 
Line 2398
           object *detect_ob = arch_to_object(detect_arch);            object *detect_ob = arch_to_object(detect_arch);
           detect_ob->x = x;            detect_ob->x = x;
           detect_ob->y = y;            detect_ob->y = y;
           insert_ob_in_map(detect_ob, op->map, op);            insert_ob_in_map(detect_ob, op->map, op,0);
       }        }
     }      }
   if ((type == SP_DETECT_MAGIC || type == SP_DETECT_CURSE) &&    if ((type == SP_DETECT_MAGIC || type == SP_DETECT_CURSE) &&
Line 2472
 
Line 2473
         if((effect=get_archetype("detect_magic"))){          if((effect=get_archetype("detect_magic"))){
                 effect->x = tmp->x;                  effect->x = tmp->x;
                 effect->y = tmp->y;                  effect->y = tmp->y;
                 insert_ob_in_map(effect,tmp->map,op);                  insert_ob_in_map(effect,tmp->map,op,0);
         }          }
         SET_FLAG(tmp,FLAG_UNAGGRESSIVE);          SET_FLAG(tmp,FLAG_UNAGGRESSIVE);
   }          }      
Line 2510
 
Line 2511
  /* that players will garner much exp with */   /* that players will garner much exp with */
  /* this spell */   /* this spell */
 #endif  #endif
      insert_ob_in_map(tmp,op->map,op);       insert_ob_in_map(tmp,op->map,op,0);
   }    }
   
   return 1;    return 1;
Line 2595
 
Line 2596
  free_object(tmp);   free_object(tmp);
  return 0;   return 0;
     }      }
     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;
     if(QUERY_FLAG(tmp, FLAG_BLOCKSVIEW))      if(QUERY_FLAG(tmp, FLAG_BLOCKSVIEW))
  update_all_los(op->map);   update_all_los(op->map, op->x, op->y);
     if(op->type==PLAYER)      if(op->type==PLAYER)
  draw(op);   draw(op);
     else      else
Line 2811
 
Line 2812
  if((effect=get_archetype("detect_magic"))){   if((effect=get_archetype("detect_magic"))){
  effect->x = tmp->x;   effect->x = tmp->x;
  effect->y = tmp->y;   effect->y = tmp->y;
  insert_ob_in_map(effect,tmp->map,op);   insert_ob_in_map(effect,tmp->map,op,0);
  }   }
  set_owner(tmp,op);   set_owner(tmp,op);
  SET_FLAG(tmp,FLAG_MONSTER);   SET_FLAG(tmp,FLAG_MONSTER);
Line 2851
 
Line 2852
         if((effect=get_archetype("detect_magic"))){          if((effect=get_archetype("detect_magic"))){
                 effect->x = tmp->x;                  effect->x = tmp->x;
                 effect->y = tmp->y;                  effect->y = tmp->y;
                 insert_ob_in_map(effect,tmp->map,op);                  insert_ob_in_map(effect,tmp->map,op,0);
         }          }
         set_owner(tmp,op);          set_owner(tmp,op);
         SET_FLAG(tmp,FLAG_MONSTER);          SET_FLAG(tmp,FLAG_MONSTER);
Line 3046
 
Line 3047
      }       }
  } /* if monster level is much less than character level */   } /* if monster level is much less than character level */
   
  head = insert_ob_in_map (head, op->map, op);   head = insert_ob_in_map (head, op->map, op,0);
  if (head != NULL && head->randomitems != NULL) {   if (head != NULL && head->randomitems != NULL) {
      object *tmp;       object *tmp;
      create_treasure(head->randomitems,head,GT_APPLY,6,0);       create_treasure(head->randomitems,head,GT_APPLY,6,0);
Line 3156
 
Line 3157
   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;
 }  }
    
Line 3304
 
Line 3305
       }        }
   }      } 
   
   insert_ob_in_map(hitter,op->map,op);     insert_ob_in_map(hitter,op->map,op,0);
    
   return success;    return success;
 }  }
Line 3545
 
Line 3546
   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;
 }  }
   
Line 3609
 
Line 3610
         tmp=tmp->above;          tmp=tmp->above;
       if(tmp==NULL)        if(tmp==NULL)
         continue;          continue;
 #ifndef USE_LIGHTING  
       success += hit_player(tmp,dam,op,AT_FIRE|AT_MAGIC);  
 #else  
       if(make_object_glow(tmp,1,factor)) {         if(make_object_glow(tmp,1,factor)) {
  object *effect=get_archetype("detect_magic");   object *effect=get_archetype("detect_magic");
  success++;   success++;
         if(effect){          if(effect){
                 effect->x = tmp->x;                  effect->x = tmp->x;
                 effect->y = tmp->y;                  effect->y = tmp->y;
                 insert_ob_in_map(effect,op->map,op);                  insert_ob_in_map(effect,op->map,op,0);
         }          }
       }        }
 #endif  
     }      }
   return success;    return success;
 }  }
Line 3780
 
Line 3777
  flash->x = x;   flash->x = x;
  flash->y = y;   flash->y = y;
  flash->map = walk->map;   flash->map = walk->map;
  insert_ob_in_map(flash,walk->map,op);   insert_ob_in_map(flash,walk->map,op,0);
  return 1;   return 1;
    }     }
    free_object(disease);     free_object(disease);
Line 3830
 
Line 3827
   
     /* we need to jump out of the inventory for a bit      /* we need to jump out of the inventory for a bit
        in order to hit the map conveniently. */         in order to hit the map conveniently. */
   insert_ob_in_map(aura,env->map,aura);    insert_ob_in_map(aura,env->map,aura,0);
   for(i=1;i<9;i++) {     for(i=1;i<9;i++) {
     hit_map(aura,i,aura->attacktype);      hit_map(aura,i,aura->attacktype);
     if(aura->other_arch) {      if(aura->other_arch) {
Line 3844
 
Line 3841
       new_ob = arch_to_object(aura->other_arch);        new_ob = arch_to_object(aura->other_arch);
       new_ob->x = nx;        new_ob->x = nx;
       new_ob->y = ny;        new_ob->y = ny;
       insert_ob_in_map(new_ob,env->map,aura);        insert_ob_in_map(new_ob,env->map,aura,0);
     }      }
   }    }
   /* put the aura back in the player's inventory */    /* put the aura back in the player's inventory */


Legend:
line(s) removed in v.1.59 
line(s) changed
 line(s) added in v.1.60

File made using version 1.98 of cvs2html by leaf at 2011-07-21 17:48