… | |
… | |
220 | } |
220 | } |
221 | |
221 | |
222 | |
222 | |
223 | void |
223 | void |
224 | move_gate (object *op) |
224 | move_gate (object *op) |
225 | { /* 1 = going down, 0 = goind up */ |
225 | { /* 1 = going down, 0 = going up */ |
226 | object *tmp; |
226 | object *tmp; |
227 | |
227 | |
228 | if (op->stats.wc < 0 || (int) op->stats.wc >= NUM_ANIMATIONS (op)) |
228 | if (op->stats.wc < 0 || (int) op->stats.wc >= NUM_ANIMATIONS (op)) |
229 | { |
229 | { |
230 | LOG (llevError, "Gate error: animation was %d, max=%d\n", op->stats.wc, NUM_ANIMATIONS (op)); |
230 | LOG (llevError, "Gate error: animation was %d, max=%d\n", op->stats.wc, NUM_ANIMATIONS (op)); |
… | |
… | |
302 | */ |
302 | */ |
303 | if ((int) op->stats.wc >= NUM_ANIMATIONS (op) / 2) |
303 | if ((int) op->stats.wc >= NUM_ANIMATIONS (op) / 2) |
304 | { |
304 | { |
305 | /* Halfway or further, check blocks */ |
305 | /* Halfway or further, check blocks */ |
306 | /* First, get the top object on the square. */ |
306 | /* First, get the top object on the square. */ |
307 | for (tmp = op->above; tmp != NULL && tmp->above != NULL; tmp = tmp->above); |
307 | for (tmp = op->above; tmp && tmp->above; tmp = tmp->above) |
|
|
308 | ; |
308 | |
309 | |
309 | if (tmp != NULL) |
310 | if (tmp) |
310 | { |
311 | { |
311 | if (QUERY_FLAG (tmp, FLAG_ALIVE)) |
312 | if (QUERY_FLAG (tmp, FLAG_ALIVE)) |
312 | { |
313 | { |
313 | hit_player (tmp, random_roll (1, op->stats.dam, tmp, PREFER_LOW), op, AT_PHYSICAL, 1); |
314 | hit_player (tmp, random_roll (0, op->stats.dam, tmp, PREFER_LOW), op, AT_PHYSICAL, 1); |
|
|
315 | |
314 | if (tmp->type == PLAYER) |
316 | if (tmp->type == PLAYER) |
315 | new_draw_info_format (NDI_UNIQUE, 0, tmp, "You are crushed by the %s!", &op->name); |
317 | new_draw_info_format (NDI_UNIQUE, 0, tmp, "You are crushed by the %s!", &op->name); |
316 | } |
318 | } |
317 | else |
319 | else |
318 | /* If the object is not alive, and the object either can |
320 | /* If the object is not alive, and the object either can |
… | |
… | |
572 | return NULL; |
574 | return NULL; |
573 | } |
575 | } |
574 | |
576 | |
575 | op->set_speed (0); |
577 | op->set_speed (0); |
576 | op->direction = 0; |
578 | op->direction = 0; |
577 | op->move_on = 0; |
579 | op->move_on = 0; |
578 | op->move_type = 0; |
580 | op->move_type = 0; |
|
|
581 | op->skill = 0; // really? |
|
|
582 | |
|
|
583 | // restore original wc, dam, attacktype and slaying |
579 | op->stats.wc = op->stats.sp; |
584 | op->stats.wc = op->stats.sp; |
580 | op->stats.dam = op->stats.hp; |
585 | op->stats.dam = op->stats.hp; |
581 | op->attacktype = op->stats.grace; |
586 | op->attacktype = op->stats.grace; |
582 | op->slaying = 0; |
|
|
583 | op->skill = 0; |
|
|
584 | |
587 | |
585 | if (op->spellarg != NULL) |
588 | if (op->spellarg) |
586 | { |
589 | { |
587 | op->slaying = op->spellarg; |
590 | op->slaying = op->spellarg; |
588 | free (op->spellarg); |
591 | free (op->spellarg); |
589 | op->spellarg = NULL; |
592 | op->spellarg = 0; |
590 | } |
593 | } |
591 | else |
594 | else |
592 | op->slaying = NULL; |
595 | op->slaying = 0; |
593 | |
596 | |
594 | /* Reset these to zero, so that object::can_merge will work properly */ |
597 | /* Reset these to zero, so that object::can_merge will work properly */ |
595 | op->spellarg = NULL; |
598 | op->spellarg = NULL; |
596 | op->stats.sp = 0; |
599 | op->stats.sp = 0; |
597 | op->stats.hp = 0; |
600 | op->stats.hp = 0; |
… | |
… | |
626 | op->destroy (); |
629 | op->destroy (); |
627 | } |
630 | } |
628 | else |
631 | else |
629 | { |
632 | { |
630 | op = fix_stopped_arrow (op); |
633 | op = fix_stopped_arrow (op); |
|
|
634 | |
631 | if (op) |
635 | if (op) |
632 | merge_ob (op, NULL); |
636 | merge_ob (op, 0); |
633 | } |
637 | } |
634 | } |
638 | } |
635 | |
639 | |
636 | /* Move an arrow along its course. op is the arrow or thrown object. |
640 | /* Move an arrow along its course. op is the arrow or thrown object. |
637 | */ |
641 | */ |