… | |
… | |
77 | * bail now - we know it can't work. |
77 | * bail now - we know it can't work. |
78 | */ |
78 | */ |
79 | if (mflags & P_OUT_OF_MAP) |
79 | if (mflags & P_OUT_OF_MAP) |
80 | return 0; |
80 | return 0; |
81 | |
81 | |
82 | |
|
|
83 | /* Is this space blocked? Players with wizpass are immune to |
82 | /* Is this space blocked? Players with wizpass are immune to |
84 | * this condition. |
83 | * this condition. |
85 | */ |
84 | */ |
86 | if (blocked_link (op, m, newx, newy) && !QUERY_FLAG (op, FLAG_WIZPASS)) |
85 | if (blocked_link (op, m, newx, newy) && !QUERY_FLAG (op, FLAG_WIZPASS)) |
87 | return 0; |
86 | return 0; |
88 | |
87 | |
89 | /* 0.94.2 - we need to set the direction for the new animation code. |
88 | /* 0.94.2 - we need to set the direction for the new animation code. |
90 | * it uses it to figure out face to use - I can't see it |
89 | * it uses it to figure out face to use - I can't see it |
91 | * breaking anything, but it might. |
90 | * breaking anything, but it might. |
92 | */ |
91 | */ |
93 | if (op->more != NULL && !move_ob (op->more, dir, op->more->head)) |
92 | if (op->more && !move_ob (op->more, dir, op->more->head)) |
94 | return 0; |
93 | return 0; |
95 | |
94 | |
96 | op->direction = dir; |
95 | op->direction = dir; |
97 | |
96 | |
98 | if (op->will_apply & 4) |
97 | if (op->will_apply & 4) |
99 | check_earthwalls (op, m, newx, newy); |
98 | check_earthwalls (op, m, newx, newy); |
|
|
99 | |
100 | if (op->will_apply & 8) |
100 | if (op->will_apply & 8) |
101 | check_doors (op, m, newx, newy); |
101 | check_doors (op, m, newx, newy); |
102 | |
102 | |
103 | /* 0.94.1 - I got a stack trace that showed it crash with remove_ob trying |
103 | /* 0.94.1 - I got a stack trace that showed it crash with remove_ob trying |
104 | * to remove a removed object, and this function was the culprit. A possible |
104 | * to remove a removed object, and this function was the culprit. A possible |
… | |
… | |
121 | * ok - the caller will deal with actual object removal/insertion |
121 | * ok - the caller will deal with actual object removal/insertion |
122 | */ |
122 | */ |
123 | if (op->head) |
123 | if (op->head) |
124 | return 1; |
124 | return 1; |
125 | |
125 | |
|
|
126 | if (m != op->map && op->contr) |
|
|
127 | { |
|
|
128 | if (INVOKE_MAP (LEAVE, op->map, ARG_PLAYER (op->contr))) |
|
|
129 | return 0; |
|
|
130 | |
|
|
131 | op->remove (); |
|
|
132 | |
|
|
133 | if (INVOKE_PLAYER (MAP_CHANGE, op->contr, ARG_MAP (m), ARG_INT (newx), ARG_INT (newy))) |
|
|
134 | return 0; |
|
|
135 | |
|
|
136 | if (INVOKE_MAP (ENTER, m, ARG_PLAYER (op->contr), ARG_INT (newx), ARG_INT (newy))) |
|
|
137 | return 0; |
|
|
138 | } |
|
|
139 | else |
126 | op->remove (); |
140 | op->remove (); |
127 | |
141 | |
128 | /* we already have newx, newy, and m, so lets use them. |
142 | /* we already have newx, newy, and m, so lets use them. |
129 | * In addition, this fixes potential crashes, because multipart object was |
143 | * In addition, this fixes potential crashes, because multipart object was |
130 | * on edge of map, +=x, +=y doesn't make correct coordinates. |
144 | * on edge of map, +=x, +=y doesn't make correct coordinates. |
131 | */ |
145 | */ |
… | |
… | |
219 | if (i == 0 && j == 0) |
233 | if (i == 0 && j == 0) |
220 | continue; |
234 | continue; |
221 | /* Perhaps this should be extended to support tiled maps */ |
235 | /* Perhaps this should be extended to support tiled maps */ |
222 | if (OUT_OF_REAL_MAP (teleporter->map, teleporter->x + i, teleporter->y + j)) |
236 | if (OUT_OF_REAL_MAP (teleporter->map, teleporter->x + i, teleporter->y + j)) |
223 | continue; |
237 | continue; |
224 | other_teleporter = get_map_ob (teleporter->map, teleporter->x + i, teleporter->y + j); |
238 | other_teleporter = GET_MAP_OB (teleporter->map, teleporter->x + i, teleporter->y + j); |
225 | |
239 | |
226 | while (other_teleporter) |
240 | while (other_teleporter) |
227 | { |
241 | { |
228 | if (other_teleporter->type == tele_type) |
242 | if (other_teleporter->type == tele_type) |
229 | break; |
243 | break; |
… | |
… | |
327 | mflags = get_map_flags (m, &m2, tx, ty, &tx, &ty); |
341 | mflags = get_map_flags (m, &m2, tx, ty, &tx, &ty); |
328 | |
342 | |
329 | if (mflags & P_OUT_OF_MAP) |
343 | if (mflags & P_OUT_OF_MAP) |
330 | return 1; |
344 | return 1; |
331 | |
345 | |
332 | for (tmp = get_map_ob (m2, tx, ty); tmp; tmp = tmp->above) |
346 | for (tmp = GET_MAP_OB (m2, tx, ty); tmp; tmp = tmp->above) |
333 | { |
347 | { |
334 | if (tmp->head == op || tmp == op) |
348 | if (tmp->head == op || tmp == op) |
335 | continue; |
349 | continue; |
336 | |
350 | |
337 | if ((QUERY_FLAG (tmp, FLAG_ALIVE) && tmp->type != DOOR)) |
351 | if ((QUERY_FLAG (tmp, FLAG_ALIVE) && tmp->type != DOOR)) |
… | |
… | |
378 | move_block = GET_MAP_MOVE_BLOCK (m, x, y); |
392 | move_block = GET_MAP_MOVE_BLOCK (m, x, y); |
379 | |
393 | |
380 | /* If the target space is not blocked, no need to look at the objects on it */ |
394 | /* If the target space is not blocked, no need to look at the objects on it */ |
381 | if ((op->move_type & move_block) == op->move_type) |
395 | if ((op->move_type & move_block) == op->move_type) |
382 | { |
396 | { |
383 | for (tmp = get_map_ob (m, x, y); tmp != NULL; tmp = tmp->above) |
397 | for (tmp = GET_MAP_OB (m, x, y); tmp != NULL; tmp = tmp->above) |
384 | { |
398 | { |
385 | if (tmp->head == op) |
399 | if (tmp->head == op) |
386 | continue; |
400 | continue; |
387 | if (OB_MOVE_BLOCK (op, tmp) && !roll_ob (tmp, dir, pusher)) |
401 | if (OB_MOVE_BLOCK (op, tmp) && !roll_ob (tmp, dir, pusher)) |
388 | return 0; |
402 | return 0; |
… | |
… | |
405 | int str1, str2; |
419 | int str1, str2; |
406 | object *owner; |
420 | object *owner; |
407 | |
421 | |
408 | if (who->head != NULL) |
422 | if (who->head != NULL) |
409 | who = who->head; |
423 | who = who->head; |
410 | owner = get_owner (who); |
424 | owner = who->owner; |
411 | |
425 | |
412 | /* Wake up sleeping monsters that may be pushed */ |
426 | /* Wake up sleeping monsters that may be pushed */ |
413 | CLEAR_FLAG (who, FLAG_SLEEP); |
427 | CLEAR_FLAG (who, FLAG_SLEEP); |
414 | |
428 | |
415 | /* player change place with his pets or summoned creature */ |
429 | /* player change place with his pets or summoned creature */ |