… | |
… | |
256 | object *tmp, *next; |
256 | object *tmp, *next; |
257 | sint16 x, y; |
257 | sint16 x, y; |
258 | maptile *m; |
258 | maptile *m; |
259 | int mflags; |
259 | int mflags; |
260 | |
260 | |
261 | x = op->x + freearr_x[dir]; |
261 | x = op->x + DIRX (dir); |
262 | y = op->y + freearr_y[dir]; |
262 | y = op->y + DIRY (dir); |
263 | |
263 | |
264 | if (dir == 0) |
264 | if (dir == 0) |
265 | return 0; // you can't steal from ourself! |
265 | return 0; // you can't steal from ourself! |
266 | |
266 | |
267 | m = op->map; |
267 | m = op->map; |
… | |
… | |
485 | |
485 | |
486 | static int |
486 | static int |
487 | attempt_jump (object *pl, int dir, int spaces, object *skill) |
487 | attempt_jump (object *pl, int dir, int spaces, object *skill) |
488 | { |
488 | { |
489 | object *tmp; |
489 | object *tmp; |
490 | int i, dx = freearr_x[dir], dy = freearr_y[dir], mflags; |
490 | int i, dx = DIRX (dir), dy = DIRY (dir), mflags; |
491 | sint16 x, y; |
491 | sint16 x, y; |
492 | maptile *m; |
492 | maptile *m; |
493 | |
493 | |
494 | /* Jump loop. Go through spaces object wants to jump. Halt the |
494 | /* Jump loop. Go through spaces object wants to jump. Halt the |
495 | * jump if a wall or creature is in the way. We set FLAG_FLYING |
495 | * jump if a wall or creature is in the way. We set FLAG_FLYING |
… | |
… | |
799 | { |
799 | { |
800 | pl->failmsg ("In what direction?"); |
800 | pl->failmsg ("In what direction?"); |
801 | return 0; |
801 | return 0; |
802 | } |
802 | } |
803 | |
803 | |
804 | sint16 x = pl->x + freearr_x[dir], |
804 | sint16 x = pl->x + DIRX (dir), |
805 | y = pl->y + freearr_y[dir]; |
805 | y = pl->y + DIRY (dir); |
806 | maptile *m = pl->map; |
806 | maptile *m = pl->map; |
807 | |
807 | |
808 | int mflags = get_map_flags (m, &m, x, y, &x, &y); |
808 | int mflags = get_map_flags (m, &m, x, y, &x, &y); |
809 | if (mflags & P_OUT_OF_MAP) |
809 | if (mflags & P_OUT_OF_MAP) |
810 | return 0; |
810 | return 0; |
… | |
… | |
944 | new_draw_info_format (NDI_UNIQUE, 0, pl, "You sing."); |
944 | new_draw_info_format (NDI_UNIQUE, 0, pl, "You sing."); |
945 | for (int i = skill->level >= SIZEOFFREE1 ? 0 : dir; |
945 | for (int i = skill->level >= SIZEOFFREE1 ? 0 : dir; |
946 | i < min (skill->level, SIZEOFFREE); |
946 | i < min (skill->level, SIZEOFFREE); |
947 | i++) |
947 | i++) |
948 | { |
948 | { |
949 | x = pl->x + freearr_x[i]; |
949 | x = pl->x + DIRX (i); |
950 | y = pl->y + freearr_y[i]; |
950 | y = pl->y + DIRY (i); |
951 | m = pl->map; |
951 | m = pl->map; |
952 | |
952 | |
953 | int mflags = get_map_flags (m, &m, x, y, &x, &y); |
953 | int mflags = get_map_flags (m, &m, x, y, &x, &y); |
954 | if (mflags & P_OUT_OF_MAP) |
954 | if (mflags & P_OUT_OF_MAP) |
955 | continue; |
955 | continue; |
… | |
… | |
1016 | /* First we search all around us for runes and traps, which are |
1016 | /* First we search all around us for runes and traps, which are |
1017 | * all type RUNE |
1017 | * all type RUNE |
1018 | */ |
1018 | */ |
1019 | for (i = 0; i < 9; i++) |
1019 | for (i = 0; i < 9; i++) |
1020 | { |
1020 | { |
1021 | x = pl->x + freearr_x[i]; |
1021 | x = pl->x + DIRX (i); |
1022 | y = pl->y + freearr_y[i]; |
1022 | y = pl->y + DIRY (i); |
1023 | m = pl->map; |
1023 | m = pl->map; |
1024 | |
1024 | |
1025 | mflags = get_map_flags (m, &m, x, y, &x, &y); |
1025 | mflags = get_map_flags (m, &m, x, y, &x, &y); |
1026 | if (mflags & P_OUT_OF_MAP) |
1026 | if (mflags & P_OUT_OF_MAP) |
1027 | continue; |
1027 | continue; |
… | |
… | |
1077 | maptile *m; |
1077 | maptile *m; |
1078 | sint16 x, y; |
1078 | sint16 x, y; |
1079 | |
1079 | |
1080 | for (i = 0; i < 9; i++) |
1080 | for (i = 0; i < 9; i++) |
1081 | { |
1081 | { |
1082 | x = op->x + freearr_x[i]; |
1082 | x = op->x + DIRX (i); |
1083 | y = op->y + freearr_y[i]; |
1083 | y = op->y + DIRY (i); |
1084 | m = op->map; |
1084 | m = op->map; |
1085 | |
1085 | |
1086 | mflags = get_map_flags (m, &m, x, y, &x, &y); |
1086 | mflags = get_map_flags (m, &m, x, y, &x, &y); |
1087 | if (mflags & P_OUT_OF_MAP) |
1087 | if (mflags & P_OUT_OF_MAP) |
1088 | continue; |
1088 | continue; |
… | |
… | |
1634 | |
1634 | |
1635 | /* 3 things here prevent a throw, you aimed at your feet, you |
1635 | /* 3 things here prevent a throw, you aimed at your feet, you |
1636 | * have no effective throwing strength, or you threw at something |
1636 | * have no effective throwing strength, or you threw at something |
1637 | * that flying objects can't get through. |
1637 | * that flying objects can't get through. |
1638 | */ |
1638 | */ |
1639 | mflags = get_map_flags (part->map, &m, part->x + freearr_x[dir], part->y + freearr_y[dir], &sx, &sy); |
1639 | mflags = get_map_flags (part->map, &m, part->x + DIRX (dir), part->y + DIRY (dir), &sx, &sy); |
1640 | |
1640 | |
1641 | if (!dir || (eff_str <= 1) || (mflags & P_OUT_OF_MAP) || (GET_MAP_MOVE_BLOCK (m, sx, sy) & MOVE_FLY_LOW)) |
1641 | if (!dir || (eff_str <= 1) || (mflags & P_OUT_OF_MAP) || (GET_MAP_MOVE_BLOCK (m, sx, sy) & MOVE_FLY_LOW)) |
1642 | { |
1642 | { |
1643 | /* bounces off 'wall', and drops to feet */ |
1643 | /* bounces off 'wall', and drops to feet */ |
1644 | throw_ob->insert_at (part, op); |
1644 | throw_ob->insert_at (part, op); |