Crossfire Server, Trunk
|
Go to the source code of this file.
Functions | |
int | move_ob (object *op, int dir, object *originator) |
int | move_object (object *op, int dir) |
int | move_to (object *op, int x, int y) |
int | object_teleport (object *op, mapstruct *map, int x, int y) |
int | push_ob (object *who, int dir, object *pusher) |
void | recursive_roll (object *op, int dir, object *pusher) |
static int | roll_ob (object *op, int dir, object *pusher) |
int | teleport (object *teleporter, uint8_t tele_type, object *user) |
int | transfer_ob (object *op, int x, int y, int randomly, object *originator) |
static int | try_fit (object *op, mapstruct *m, int x, int y) |
Those functions handle object moving and pushing.
Definition in file move.cpp.
Op is trying to move in direction dir.
op | what is moving. |
dir | what direction op wants to move. |
originator | typically the same as op, but can be different if originator is causing op to move (originator is pushing op). |
0 | op is not able to move to the desired space. |
1 | op was moved. |
Definition at line 58 of file move.cpp.
References blocked_link(), esrv_map_scroll(), FLAG_ALIVE, FLAG_WIZPASS, FOR_INV_FINISH, FOR_INV_PREPARE, freearr_x, freearr_y, get_map_flags(), m, object::map, monster_check_doors(), monster_check_earthwalls(), object::more, MOVE_WALK, object_insert_in_map_at(), object_remove(), object_was_destroyed, give::op, P_OUT_OF_MAP, altar_valkyrie::pl, play_sound_map(), PLAYER, QUERY_FLAG, SOUND_TYPE_GROUND, TRANSPORT, WILL_APPLY_DOOR, WILL_APPLY_EARTHWALL, diamondslots::x, object::x, diamondslots::y, and object::y.
Referenced by cfapi_object_move(), eventListener(), flee_player(), move_object(), move_player_attack(), move_to(), pets_move(), pets_move_golem(), and recursive_roll().
int move_object | ( | object * | op, |
int | dir | ||
) |
Try to move op in the direction "dir".
op | what to move. |
dir | moving direction. |
0 | something blocks the passage. |
1 | op was moved.. |
Definition at line 39 of file move.cpp.
References move_ob(), and give::op.
Referenced by check_spell_knockback(), monster_circ1_move(), monster_circ2_move(), monster_move(), monster_move_randomly(), monster_pace2_moveh(), monster_pace2_movev(), monster_pace_moveh(), monster_pace_movev(), monster_rand_move(), move_player_mover(), and push_ob().
int move_to | ( | object * | op, |
int | x, | ||
int | y | ||
) |
Move an object one square toward a specified destination on the same map. The move takes into account blocked squares for op, and things like that. No check is done to know if the object has enough speed to move.
op | object to move |
x | |
y | destination coordinates |
Definition at line 563 of file move.cpp.
References animate_object(), give::direction, get_map_flags(), GET_MAP_OB, monster_compute_path(), move_ob(), give::op, P_OUT_OF_MAP, diamondslots::x, and diamondslots::y.
Referenced by cfapi_object_transfer().
Move the specified object in a free spot around the map's x & y.
op | object to move, may be REMOVED or not. |
map | map to move op to. |
x | coordinate to move op to. |
y | coordinate to move op to. |
Definition at line 597 of file move.cpp.
References FLAG_REMOVED, disinfect::map, map_newmap_cmd(), object_find_first_free_spot(), object_insert_in_map_at(), object_remove(), give::op, out_of_map(), PLAYER, player_update_bg_music(), QUERY_FLAG, diamondslots::x, and diamondslots::y.
Referenced by add_npc_to_point(), add_npc_to_zone(), and cfapi_object_teleport().
Something is pushing some other object.
who | object being pushed. |
dir | pushing direction. |
pusher | what is pushing who. |
1 | if pushing invokes a attack |
0 | no attack during pushing. |
Definition at line 434 of file move.cpp.
References CLEAR_FLAG, object::contr, draw_ext_info_format(), esrv_map_scroll(), FLAG_FRIENDLY, FLAG_NEUTRAL, FLAG_SLEEP, FLAG_STAND_STILL, FLAG_UNAGGRESSIVE, FLAG_WIZ, freearr_x, freearr_y, HEAD, object::level, socket_struct::look_position, m, object::map, monster_npc_call_help(), move_object(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_FAILURE, MSG_TYPE_VICTIM, MSG_TYPE_VICTIM_WAS_PUSHED, object::name, NDI_UNIQUE, object_get_owner(), object_insert_in_map_at(), object_remove(), object_set_enemy(), player::party, PLAYER, PREFER_HIGH, QUERY_FLAG, random_roll(), player::run_on, player::socket, object::stats, living::Str, guildbuy::temp, object::type, socket_struct::update_look, autojail::who, object::x, and object::y.
Referenced by move_player_attack().
An object is pushed by another which is trying to take its place.
op | what is being pushed. |
dir | pushing direction. |
pusher | what is pushing op. |
Definition at line 293 of file move.cpp.
References draw_ext_info_format(), MAX_BUF, move_ob(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_FAILURE, MSG_TYPE_COMMAND_SUCCESS, give::name, NDI_BLACK, NDI_UNIQUE, give::op, query_name(), roll_ob(), and nlohmann::detail::void().
Referenced by move_player_attack().
An object is being pushed, and may push other objects.
This is not perfect yet. it does not roll objects behind multipart objects properly. Support for rolling multipart objects is questionable.
op | what is being pushed. |
dir | pushing direction. |
pusher | what is pushing op. |
0 | op couldn't move. |
1 | op, and potentially other objects, moved. |
Definition at line 380 of file move.cpp.
References FLAG_CAN_ROLL, flags, FOR_MAP_FINISH, FOR_MAP_PREPARE, freearr_x, freearr_y, get_map_flags(), GET_MAP_MOVE_BLOCK, HEAD, m, MAX, OB_MOVE_BLOCK, object_insert_in_map_at(), object_remove(), give::op, P_IS_ALIVE, P_OUT_OF_MAP, PREFER_LOW, QUERY_FLAG, random_roll(), object::stats, living::Str, Ice::tmp, try_fit(), diamondslots::x, and diamondslots::y.
Referenced by recursive_roll().
Teleport an item around a nearby random teleporter of specified type.
It is basically used so that shop_mats and normal teleporters can be used close to each other and not have the player put to the one of another type.
teleporter | what is teleporting user. |
tele_type | what object type user can be put on. this is either set to SHOP_MAT or TELEPORTER. |
user | what object to teleport. |
1 | user was destroyed. |
0 | user is still valid, but may have moved or not. |
Definition at line 204 of file move.cpp.
References object::contr, FOR_MAP_FINISH, FOR_MAP_PREPARE, freearr_x, freearr_y, get_map_flags(), GET_MAP_MOVE_BLOCK, HEAD, llevError, LOG(), m, object::map, map_newmap_cmd(), object::name, OB_TYPE_MOVE_BLOCK, object_find_free_spot(), object_insert_in_map_at(), object_remove(), OUT_OF_REAL_MAP, P_OUT_OF_MAP, pets_attempt_follow(), PLAYER, player_update_bg_music(), RANDOM, SHOP_MAT, player::socket, Ice::tmp, object::type, object::x, and object::y.
Referenced by initteleport(), move_teleporter(), runteleport(), and shop_mat_type_move_on().
Move an object (even linked objects) to another spot on the same map.
Does nothing if there is no free spot.
op | what to move. |
x | |
y | new coordinates. |
randomly | if true, use object_find_free_spot() to find the destination, otherwise use object_find_first_free_spot(). |
originator | what is causing op to move. |
1 | op was destroyed. |
0 | op was moved. |
Definition at line 163 of file move.cpp.
References freearr_x, freearr_y, HEAD, map_newmap_cmd(), object_find_first_free_spot(), object_find_free_spot(), object_insert_in_map_at(), object_remove(), give::op, pets_attempt_follow(), PLAYER, player_update_bg_music(), SIZEOFFREE, diamondslots::x, and diamondslots::y.
Referenced by cfapi_object_transfer(), hole_type_move_on(), kill_player(), move_teleporter(), shop_mat_type_move_on(), and trapdoor_type_move_on().
Checks if an objects fits on a specified spot.
This is a new version of blocked, this one handles objects that can be passed through by monsters with the CAN_PASS_THRU defined.
Very new version handles also multipart objects This is currently only used for the boulder roll code.
op | what object to fit. |
m | |
x | |
y | where to put op. |
1 | object does not fit. |
0 | object fits. |
Definition at line 331 of file move.cpp.
References DOOR, FLAG_ALIVE, FOR_MAP_FINISH, FOR_MAP_PREPARE, get_map_flags(), HEAD, m, object::more, OB_MOVE_BLOCK, give::op, P_OUT_OF_MAP, QUERY_FLAG, Ice::tmp, diamondslots::x, object::x, diamondslots::y, and object::y.
Referenced by roll_ob().