… | |
… | |
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 | remove_ob (op); |
180 | free_object (op); |
180 | free_object (op); |
… | |
… | |
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 | remove_ob (op); |
… | |
… | |
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))) |
… | |
… | |
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 |
… | |
… | |
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; |
… | |
… | |
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++) |
… | |
… | |
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 | remove_ob (op); |
1276 | free_object (op); |
1276 | free_object (op); |
… | |
… | |
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 |
… | |
… | |
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); |
… | |
… | |
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 |