25 static int roll_ob(
object *op,
int dir,
object *pusher);
58 int move_ob(
object *op,
int dir,
object *originator) {
64 if (op->will_apply&(WILL_APPLY_EARTHWALL|WILL_APPLY_DOOR)) {
68 for (part = op; part != NULL; part = part->more) {
74 if (op->will_apply&WILL_APPLY_EARTHWALL) {
76 if (object_was_destroyed(op, op_tag))
80 if (op->will_apply&WILL_APPLY_DOOR) {
82 if (object_was_destroyed(op, op_tag))
88 for (part = op; part != NULL; part = part->more) {
108 if (op->type == PLAYER) {
110 op->contr->socket.update_look = 1;
111 op->contr->socket.look_position = 0;
112 }
else if (op->type == TRANSPORT) {
114 if (
pl->type == PLAYER) {
150 int transfer_ob(
object *op,
int x,
int y,
int randomly,
object *originator) {
165 if (op && op->type == PLAYER) {
196 int i, j, k, nrofalt = 0;
197 object *other_teleporter, *tmp;
209 for (i = -5; i < 6; i++)
210 for (j = -5; j < 6; j++) {
211 if (i == 0 && j == 0)
214 if (
OUT_OF_REAL_MAP(teleporter->map, teleporter->x+i, teleporter->y+j))
216 FOR_MAP_PREPARE(teleporter->map, teleporter->x+i, teleporter->y+j, tmp) {
217 if (tmp->type == tele_type) {
218 altern[nrofalt++] = tmp;
229 other_teleporter = altern[
RANDOM()%nrofalt];
230 k =
object_find_free_spot(user, other_teleporter->map, other_teleporter->x, other_teleporter->y, 1, 9);
240 if (tele_type == SHOP_MAT && user->type == PLAYER) {
241 for (k = 1; k < 9; k++) {
251 LOG(
llevError,
"Shop mat %s (%d, %d) is in solid rock?\n", other_teleporter->name, other_teleporter->x, other_teleporter->y);
265 if (tmp && tmp->type == PLAYER) {
269 return (tmp == NULL);
286 if (!
roll_ob(op, dir, pusher)) {
288 "You fail to push the %s.",
292 (void)
move_ob(pusher, dir, pusher);
327 for (more = op; more; more = more->more) {
328 tx = x+more->x-op->x;
329 ty = y+more->y-op->y;
337 if (tmp->head == op || tmp == op)
369 static int roll_ob(
object *op,
int dir,
object *pusher) {
392 if ((op->move_type&move_block) == op->move_type) {
423 int push_ob(
object *who,
int dir,
object *pusher) {
435 if (who->more == NULL
436 && (owner == pusher || (owner != NULL && owner->type == PLAYER && owner->contr->party != NULL && owner->contr->party == pusher->contr->party))) {
451 pusher->map = who->map;
461 if (pusher->type == PLAYER) {
463 pusher->contr->socket.update_look = 1;
464 pusher->contr->socket.look_position = 0;
474 && pusher->type == PLAYER
475 && who->type != PLAYER
478 if (pusher->contr->run_on) {
481 "You start to attack %s!",
489 "You avoid attacking %s.",
498 "You can't push %s.",
510 str1 = (who->stats.Str > 0 ? who->stats.Str : who->level);
511 str2 = (pusher->stats.Str > 0 ? pusher->stats.Str : pusher->level);
515 if (who->type == PLAYER) {
517 "%s tried to push you.",
526 if (who->type == PLAYER) {
531 if (pusher->type == PLAYER) {
533 "You pushed %s back.",
554 if (op->x == x && op->y == y)
564 op->direction = direction;
565 op->facing = direction;
571 if (
move_ob(op, direction, op) == 0)
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...)
#define MSG_TYPE_COMMAND_FAILURE
int monster_compute_path(object *source, object *target, int default_dir)
#define SOUND_TYPE_GROUND
static int try_fit(object *op, mapstruct *m, int x, int y)
short freearr_x[SIZEOFFREE]
int push_ob(object *who, int dir, object *pusher)
#define OUT_OF_REAL_MAP(M, X, Y)
int blocked_link(object *ob, mapstruct *m, int16_t sx, int16_t sy)
void recursive_roll(object *op, int dir, object *pusher)
short freearr_y[SIZEOFFREE]
void map_newmap_cmd(socket_struct *ns)
object * object_insert_in_map_at(object *op, mapstruct *m, object *originator, int flag, int x, int y)
int move_to(object *op, int x, int y)
#define MSG_TYPE_COMMAND_SUCCESS
#define FLAG_UNAGGRESSIVE
#define OB_TYPE_MOVE_BLOCK(ob1, type)
#define GET_MAP_MOVE_BLOCK(M, X, Y)
int teleport(object *teleporter, uint8_t tele_type, object *user)
#define QUERY_FLAG(xyz, p)
#define CLEAR_FLAG(xyz, p)
int transfer_ob(object *op, int x, int y, int randomly, object *originator)
void esrv_map_scroll(socket_struct *ns, int dx, int dy)
int object_find_first_free_spot(const object *ob, mapstruct *m, int x, int y)
static const flag_definition flags[]
void animate_object(object *op, int dir)
void object_set_enemy(object *op, object *enemy)
void monster_check_doors(object *op, mapstruct *m, int x, int y)
void monster_check_earthwalls(object *op, mapstruct *m, int x, int y)
#define GET_MAP_OB(M, X, Y)
int move_object(object *op, int dir)
int get_map_flags(mapstruct *oldmap, mapstruct **newmap, int16_t x, int16_t y, int16_t *nx, int16_t *ny)
#define OB_MOVE_BLOCK(ob1, ob2)
void player_update_bg_music(object *player)
void LOG(LogLevel logLevel, const char *format,...)
#define MSG_TYPE_VICTIM_WAS_PUSHED
#define FOR_MAP_PREPARE(map_, mx_, my_, it_)
void play_sound_map(int8_t sound_type, object *emitter, int dir, const char *action)
int object_find_free_spot(const object *ob, mapstruct *m, int x, int y, int start, int stop)
void query_name(const object *op, char *buf, size_t size)
int move_ob(object *op, int dir, object *originator)
int random_roll(int min, int max, const object *op, int goodbad)
object * object_get_owner(object *op)
#define FOR_INV_PREPARE(op_, it_)
void object_remove(object *op)
static int roll_ob(object *op, int dir, object *pusher)