… | |
… | |
372 | int distance_y; |
372 | int distance_y; |
373 | int direction; |
373 | int direction; |
374 | object *part; |
374 | object *part; |
375 | }; |
375 | }; |
376 | |
376 | |
|
|
377 | //TODO: these should be refactored into things like xy_normalise |
|
|
378 | // and so on. |
|
|
379 | int get_map_flags(maptile *oldmap, maptile **newmap, sint16 x, sint16 y, sint16 *nx, sint16 *ny); |
|
|
380 | int ob_blocked(const object *ob, maptile *m, sint16 x, sint16 y); |
|
|
381 | int out_of_map(maptile *m, int x, int y); |
|
|
382 | maptile *get_map_from_coord(maptile *m, sint16 *x, sint16 *y); |
|
|
383 | void get_rangevector(object *op1, object *op2, rv_vector *retval, int flags); |
|
|
384 | void get_rangevector_from_mapcoord(const maptile *m, int x, int y, const object *op2, rv_vector *retval, int flags); |
|
|
385 | int on_same_map(const object *op1, const object *op2); |
|
|
386 | |
|
|
387 | // adjust map, x and y for tiled maps and return true if the position is valid at all |
|
|
388 | inline bool |
|
|
389 | xy_normalise (maptile *&map, sint16 &x, sint16 &y) |
|
|
390 | { |
|
|
391 | // when in range, do a quick return, otherwise go the slow route |
|
|
392 | return |
|
|
393 | (IN_RANGE_EXC (x, 0, map->width) && IN_RANGE_EXC (y, 0, map->height)) |
|
|
394 | || !(get_map_flags (map, &map, x, y, &x, &y) & P_OUT_OF_MAP); |
|
|
395 | } |
|
|
396 | |
377 | inline mapspace & |
397 | inline mapspace & |
378 | object::ms () const |
398 | object::ms () const |
379 | { |
399 | { |
380 | return map->at (x, y); |
400 | return map->at (x, y); |
381 | } |
401 | } |