… | |
… | |
297 | } |
297 | } |
298 | else |
298 | else |
299 | { /* The gate is still going up */ |
299 | { /* The gate is still going up */ |
300 | op->stats.wc++; |
300 | op->stats.wc++; |
301 | |
301 | |
302 | if ((int) op->stats.wc >= (NUM_ANIMATIONS (op))) |
302 | if (op->stats.wc >= NUM_ANIMATIONS (op)) |
303 | op->stats.wc = (signed char) NUM_ANIMATIONS (op) - 1; |
303 | op->stats.wc = NUM_ANIMATIONS (op) - 1; |
304 | |
304 | |
305 | /* If there is something on top of the gate, we try to roll it off. |
305 | /* If there is something on top of the gate, we try to roll it off. |
306 | * If a player/monster, we don't roll, we just hit them with damage |
306 | * If a player/monster, we don't roll, we just hit them with damage |
307 | */ |
307 | */ |
308 | if ((int) op->stats.wc >= NUM_ANIMATIONS (op) / 2) |
308 | if (op->stats.wc >= NUM_ANIMATIONS (op) / 2) |
309 | { |
309 | { |
310 | /* Halfway or further, check blocks */ |
310 | /* Halfway or further, check blocks */ |
311 | /* First, get the top object on the square. */ |
311 | /* First, get the top object on the square. */ |
312 | for (tmp = op->above; tmp && tmp->above; tmp = tmp->above) |
312 | for (tmp = op->above; tmp && tmp->above; tmp = tmp->above) |
313 | ; |
313 | ; |
… | |
… | |
327 | * off the gate. |
327 | * off the gate. |
328 | */ |
328 | */ |
329 | else if (!QUERY_FLAG (tmp, FLAG_ALIVE) && (!QUERY_FLAG (tmp, FLAG_NO_PICK) || QUERY_FLAG (tmp, FLAG_CAN_ROLL))) |
329 | else if (!QUERY_FLAG (tmp, FLAG_ALIVE) && (!QUERY_FLAG (tmp, FLAG_NO_PICK) || QUERY_FLAG (tmp, FLAG_CAN_ROLL))) |
330 | { |
330 | { |
331 | /* If it has speed, it should move itself, otherwise: */ |
331 | /* If it has speed, it should move itself, otherwise: */ |
332 | int i = find_free_spot (tmp, op->map, op->x, op->y, 1, 9); |
332 | int i = find_free_spot (tmp, op->map, op->x, op->y, 1, SIZEOFFREE1 + 1); |
333 | |
333 | |
334 | /* If there is a free spot, move the object someplace */ |
334 | /* If there is a free spot, move the object someplace */ |
335 | if (i != -1) |
335 | if (i > 0) |
336 | { |
336 | { |
|
|
337 | mapxy pos (tmp); |
|
|
338 | pos.move (i); |
|
|
339 | if (pos.normalise ()) |
337 | tmp->remove (); |
340 | tmp->move_to (pos); |
338 | tmp->x += freearr_x[i], tmp->y += freearr_y[i]; |
|
|
339 | insert_ob_in_map (tmp, op->map, op, 0); |
|
|
340 | } |
341 | } |
341 | } |
342 | } |
342 | } |
343 | } |
343 | |
344 | |
344 | /* See if there is still anything blocking the gate */ |
345 | /* See if there is still anything blocking the gate */ |