… | |
… | |
28 | #endif |
28 | #endif |
29 | |
29 | |
30 | int |
30 | int |
31 | object::move (int dir, object *originator) |
31 | object::move (int dir, object *originator) |
32 | { |
32 | { |
33 | sint16 newx = x + freearr_x[dir]; |
33 | sint16 newx = x + DIRX (dir); |
34 | sint16 newy = y + freearr_y[dir]; |
34 | sint16 newy = y + DIRY (dir); |
35 | |
35 | |
36 | mapxy pos (this); |
36 | mapxy pos (this); |
37 | pos.move (dir); |
37 | pos.move (dir); |
38 | |
38 | |
39 | /* If the space the object is moving to is out of the map, |
39 | /* If the space the object is moving to is out of the map, |
… | |
… | |
120 | op = op->head_ (); |
120 | op = op->head_ (); |
121 | op->remove (); |
121 | op->remove (); |
122 | |
122 | |
123 | for (object *tmp = op; tmp; tmp = tmp->more) |
123 | for (object *tmp = op; tmp; tmp = tmp->more) |
124 | { |
124 | { |
125 | tmp->x = x + freearr_x[i] + tmp->arch->x; |
125 | tmp->x = x + DIRX (i) + tmp->arch->x; |
126 | tmp->y = y + freearr_y[i] + tmp->arch->y; |
126 | tmp->y = y + DIRY (i) + tmp->arch->y; |
127 | } |
127 | } |
128 | |
128 | |
129 | op = insert_ob_in_map (op, op->map, originator, 0); |
129 | op = insert_ob_in_map (op, op->map, originator, 0); |
130 | |
130 | |
131 | return !op; |
131 | return !op; |
… | |
… | |
196 | { |
196 | { |
197 | maptile *m; |
197 | maptile *m; |
198 | sint16 sx, sy; |
198 | sint16 sx, sy; |
199 | |
199 | |
200 | if (get_map_flags (other_teleporter->map, &m, |
200 | if (get_map_flags (other_teleporter->map, &m, |
201 | other_teleporter->x + freearr_x[k], other_teleporter->y + freearr_y[k], &sx, &sy) & P_OUT_OF_MAP) |
201 | other_teleporter->x + DIRX (k), other_teleporter->y + DIRY (k), &sx, &sy) & P_OUT_OF_MAP) |
202 | continue; |
202 | continue; |
203 | |
203 | |
204 | if (!OB_TYPE_MOVE_BLOCK (user, GET_MAP_MOVE_BLOCK (m, sx, sy))) |
204 | if (!OB_TYPE_MOVE_BLOCK (user, GET_MAP_MOVE_BLOCK (m, sx, sy))) |
205 | break; |
205 | break; |
206 | } |
206 | } |
… | |
… | |
215 | else |
215 | else |
216 | return 0; |
216 | return 0; |
217 | } |
217 | } |
218 | |
218 | |
219 | return !other_teleporter->map->insert ( |
219 | return !other_teleporter->map->insert ( |
220 | user, other_teleporter->x + freearr_x[k], other_teleporter->y + freearr_y[k] |
220 | user, other_teleporter->x + DIRX (k), other_teleporter->y + DIRY (k) |
221 | ); |
221 | ); |
222 | } |
222 | } |
223 | |
223 | |
224 | /* |
224 | /* |
225 | * This is a new version of blocked, this one handles objects |
225 | * This is a new version of blocked, this one handles objects |
… | |
… | |
280 | MoveType move_block; |
280 | MoveType move_block; |
281 | |
281 | |
282 | if (op->head) |
282 | if (op->head) |
283 | op = op->head; |
283 | op = op->head; |
284 | |
284 | |
285 | x = op->x + freearr_x[dir]; |
285 | x = op->x + DIRX (dir); |
286 | y = op->y + freearr_y[dir]; |
286 | y = op->y + DIRY (dir); |
287 | |
287 | |
288 | if (!op->flag [FLAG_CAN_ROLL] |
288 | if (!op->flag [FLAG_CAN_ROLL] |
289 | || (op->weight && random_roll (0, op->weight / 50000 - 1, pusher, PREFER_LOW) |
289 | || (op->weight && random_roll (0, op->weight / 50000 - 1, pusher, PREFER_LOW) |
290 | > pusher->stats.Str)) |
290 | > pusher->stats.Str)) |
291 | return 0; |
291 | return 0; |