--- deliantra/server/server/spell_attack.C 2017/01/29 02:47:06 1.115 +++ deliantra/server/server/spell_attack.C 2017/09/16 22:17:42 1.116 @@ -131,7 +131,7 @@ /* check the new dir for a wall and in the map */ t_dir = absdir (tmp->direction + new_dir); - if (get_map_flags (tmp->map, &m, tmp->x + freearr_x[t_dir], tmp->y + freearr_y[t_dir], &sx, &sy) & P_OUT_OF_MAP) + if (get_map_flags (tmp->map, &m, tmp->x + DIRX (t_dir), tmp->y + DIRY (t_dir), &sx, &sy) & P_OUT_OF_MAP) return; if (OB_TYPE_MOVE_BLOCK (tmp, GET_MAP_MOVE_BLOCK (m, sx, sy))) @@ -181,8 +181,8 @@ op->range = 0; else { - x = op->x + DIRX (op); - y = op->y + DIRY (op); + x = op->x + DIRX (op->direction); + y = op->y + DIRY (op->direction); m = op->map; mflags = get_map_flags (m, &m, x, y, &x, &y); @@ -219,13 +219,13 @@ * op->direction is within an adjacent map but either * op->direction-1 or op->direction+1 does not exist. */ - mflags = get_map_flags (op->map, &m, op->x + freearr_x[absdir (op->direction - 1)], - op->y + freearr_y[absdir (op->direction - 1)], &x, &y); + mflags = get_map_flags (op->map, &m, op->x + DIRX (absdir (op->direction - 1)), + op->y + DIRY (absdir (op->direction - 1)), &x, &y); left = (mflags & P_OUT_OF_MAP) ? 0 : OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (m, x, y)); - mflags = get_map_flags (op->map, &m, op->x + freearr_x[absdir (op->direction + 1)], - op->y + freearr_y[absdir (op->direction + 1)], &x, &y); + mflags = get_map_flags (op->map, &m, op->x + DIRX (absdir (op->direction + 1)), + op->y + DIRY (absdir (op->direction + 1)), &x, &y); right = (mflags & P_OUT_OF_MAP) ? 0 : OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (m, x, y)); if (left == right) @@ -302,8 +302,8 @@ tmp->set_owner (op); set_spell_skill (op, caster, spob, tmp); - tmp->x = op->x + DIRX (tmp); - tmp->y = op->y + DIRY (tmp); + tmp->x = op->x + DIRX (tmp->direction); + tmp->y = op->y + DIRY (tmp->direction); tmp->map = op->map; maptile *newmap; @@ -366,8 +366,8 @@ { sint16 dx, dy; - dx = op->x + freearr_x[i]; - dy = op->y + freearr_y[i]; + dx = op->x + DIRX (i); + dy = op->y + DIRY (i); /* ok_to_put_more already does things like checks for walls, * out of map, etc. @@ -648,8 +648,8 @@ tmp->set_owner (op); set_spell_skill (op, caster, spob, tmp); - tmp->x = op->x + freearr_x[dir]; - tmp->y = op->y + freearr_y[dir]; + tmp->x = op->x + DIRX (dir); + tmp->y = op->y + DIRY (dir); tmp->map = op->map; maptile *newmap; @@ -783,7 +783,7 @@ for (int i = -1; i <= 1; i++) { - sint16 x = op->x + freearr_x[absdir (op->stats.sp + i)], y = op->y + freearr_y[absdir (op->stats.sp + i)]; + sint16 x = op->x + DIRX (absdir (op->stats.sp + i)), y = op->y + DIRY (absdir (op->stats.sp + i)); if (ok_to_put_more (op->map, x, y, op, op->attacktype)) { @@ -866,8 +866,8 @@ continue; } - x = op->x + freearr_x[d]; - y = op->y + freearr_y[d]; + x = op->x + DIRX (d); + y = op->y + DIRY (d); if (get_map_flags (op->map, &m, x, y, &sx, &sy) & P_OUT_OF_MAP) continue; @@ -985,7 +985,7 @@ { for (int i = 1; i < 9; i++) { - if (out_of_map (op->map, op->x + freearr_x[i], op->y + freearr_x[i])) + if (out_of_map (op->map, op->x + DIRX (i), op->y + DIRX (i))) continue; object *tmp = at->instance (); @@ -1001,7 +1001,7 @@ if (tmp->flag [FLAG_IS_TURNABLE]) SET_ANIMATION (tmp, i); - op->map->insert (tmp, op->x + freearr_x[i], op->y + freearr_x[i], op); + op->map->insert (tmp, op->x + DIRX (i), op->y + DIRX (i), op); move_bullet (tmp); } } @@ -1014,7 +1014,7 @@ { object *tmp; int mflags; - sint16 dx = op->x + freearr_x[dir], dy = op->y + freearr_y[dir]; + sint16 dx = op->x + DIRX (dir), dy = op->y + DIRY (dir); maptile *m; mflags = get_map_flags (op->map, &m, dx, dy, &dx, &dy); @@ -1075,8 +1075,8 @@ for (dist = 1; dist < range; dist++) { - x = op->x + freearr_x[dir] * dist; - y = op->y + freearr_y[dir] * dist; + x = op->x + DIRX (dir) * dist; + y = op->y + DIRY (dir) * dist; mp = op->map; mflags = get_map_flags (op->map, &mp, x, y, &x, &y); @@ -1623,8 +1623,8 @@ int offset = ((i ^ j) & 1) ? (i / 2) : -(i / 2); int tmpdir = absdir (op->direction + offset); - nx = op->x + freearr_x[tmpdir]; - ny = op->y + freearr_y[tmpdir]; + nx = op->x + DIRX (tmpdir); + ny = op->y + DIRY (tmpdir); if (!(get_map_flags (op->map, &m, nx, ny, &nx, &ny) & P_OUT_OF_MAP) && !(OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (m, nx, ny)))) { dir = tmpdir; @@ -1650,8 +1650,8 @@ */ for (j = 0; j < 9; j++) { - hx = nx + freearr_x[j]; - hy = ny + freearr_y[j]; + hx = nx + DIRX (j); + hy = ny + DIRY (j); m = op->map; mflags = get_map_flags (m, &m, hx, hy, &hx, &hy); @@ -1684,7 +1684,7 @@ if (i >= 0) { /* we have a preferred direction! */ /* pick another direction if the preferred dir is blocked. */ - if (get_map_flags (op->map, &m, nx + freearr_x[i], ny + freearr_y[i], &hx, &hy) & P_OUT_OF_MAP || + if (get_map_flags (op->map, &m, nx + DIRX (i), ny + DIRY (i), &hx, &hy) & P_OUT_OF_MAP || OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (m, hx, hy))) i = absdir (i + rndm (0, 2) - 1); /* -1, 0, +1 */ @@ -1761,14 +1761,14 @@ adjustdir = 0; /* fire the last one from forward. */ } - target_x = op->x + freearr_x[absdir (basedir + adjustdir)]; - target_y = op->y + freearr_y[absdir (basedir + adjustdir)]; + target_x = op->x + DIRX (absdir (basedir + adjustdir)); + target_y = op->y + DIRY (absdir (basedir + adjustdir)); /* back up one space so we can hit point-blank targets, but this * necessitates extra out_of_map check below */ - origin_x = target_x - freearr_x[basedir]; - origin_y = target_y - freearr_y[basedir]; + origin_x = target_x - DIRX (basedir); + origin_y = target_y - DIRY (basedir); /* spell pointer is set up for the spell this casts. Since this @@ -1864,8 +1864,8 @@ if (dir) { - x = op->x + freearr_x[dir]; - y = op->y + freearr_y[dir]; + x = op->x + DIRX (dir); + y = op->y + DIRY (dir); m = op->map; mflags = get_map_flags (m, &m, x, y, &x, &y); @@ -1955,8 +1955,8 @@ /* search in a line for a victim */ for (i = 1; i < range; i++) { - x = op->x + i * freearr_x[dir]; - y = op->y + i * freearr_y[dir]; + x = op->x + i * DIRX (dir); + y = op->y + i * DIRY (dir); m = op->map; mflags = get_map_flags (m, &m, x, y, &x, &y);