… | |
… | |
110 | tmp->stats.sp = 1; |
110 | tmp->stats.sp = 1; |
111 | tmp->stats.hp = tmp->stats.maxhp; |
111 | tmp->stats.hp = tmp->stats.maxhp; |
112 | /* Handle multipart gates. We copy the value for the other parts |
112 | /* Handle multipart gates. We copy the value for the other parts |
113 | * from the head - this ensures that the data will consistent |
113 | * from the head - this ensures that the data will consistent |
114 | */ |
114 | */ |
115 | for (tmp = tmp->more; tmp; tmp = tmp->more) |
115 | for (object *part = tmp->more; part; part = part->more) |
116 | { |
116 | { |
117 | tmp->value = tmp->head->value; |
117 | part->value = tmp->value; |
118 | tmp->stats.sp = tmp->head->stats.sp; |
118 | part->stats.sp = tmp->stats.sp; |
119 | tmp->stats.hp = tmp->head->stats.hp; |
119 | part->stats.hp = tmp->stats.hp; |
120 | tmp->set_speed (tmp->head->speed); |
120 | part->set_speed (tmp->speed); |
121 | } |
121 | } |
122 | break; |
122 | break; |
123 | |
123 | |
124 | case DIRECTOR: |
124 | case DIRECTOR: |
125 | case FIREWALL: |
125 | case FIREWALL: |
… | |
… | |
127 | move_firewall (tmp); |
127 | move_firewall (tmp); |
128 | else |
128 | else |
129 | { |
129 | { |
130 | if ((tmp->stats.sp += tmp->stats.maxsp) > 8) /* next direction */ |
130 | if ((tmp->stats.sp += tmp->stats.maxsp) > 8) /* next direction */ |
131 | tmp->stats.sp = ((tmp->stats.sp - 1) % 8) + 1; |
131 | tmp->stats.sp = ((tmp->stats.sp - 1) % 8) + 1; |
|
|
132 | |
132 | animate_turning (tmp); |
133 | animate_turning (tmp); |
133 | } |
134 | } |
134 | break; |
135 | break; |
135 | |
136 | |
136 | case TELEPORTER: |
137 | case TELEPORTER: |
… | |
… | |
250 | else if (tmp->type == PEDESTAL) |
251 | else if (tmp->type == PEDESTAL) |
251 | { |
252 | { |
252 | tmp->value = 0; |
253 | tmp->value = 0; |
253 | for (ab = tmp->above; ab != NULL; ab = ab->above) |
254 | for (ab = tmp->above; ab != NULL; ab = ab->above) |
254 | { |
255 | { |
255 | head = ab->head ? ab->head : ab; |
256 | head = ab->head_ (); |
256 | /* Same note regarding move_type for buttons above apply here. */ |
257 | /* Same note regarding move_type for buttons above apply here. */ |
257 | if (((head->move_type & tmp->move_on) || ab->move_type == 0) && |
258 | if (((head->move_type & tmp->move_on) || ab->move_type == 0) && |
258 | (head->race == tmp->slaying || |
259 | (head->race == tmp->slaying || |
259 | ((head->type == SPECIAL_KEY) && (head->slaying == tmp->slaying)) || |
260 | ((head->type == SPECIAL_KEY) && (head->slaying == tmp->slaying)) || |
260 | (!strcmp (tmp->slaying, "player") && head->type == PLAYER))) |
261 | (!strcmp (tmp->slaying, "player") && head->type == PLAYER))) |
261 | tmp->value = 1; |
262 | tmp->value = 1; |
262 | } |
263 | } |
|
|
264 | |
263 | if (tmp->value) |
265 | if (tmp->value) |
264 | any_down = 1; |
266 | any_down = 1; |
265 | } |
267 | } |
266 | } |
268 | } |
267 | if (any_down) /* If any other buttons were down, force this to remain down */ |
269 | if (any_down) /* If any other buttons were down, force this to remain down */ |
… | |
… | |
454 | case TRIGGER_PEDESTAL: |
456 | case TRIGGER_PEDESTAL: |
455 | if (cause) |
457 | if (cause) |
456 | { |
458 | { |
457 | for (tmp = op->above; tmp; tmp = tmp->above) |
459 | for (tmp = op->above; tmp; tmp = tmp->above) |
458 | { |
460 | { |
459 | object *head = tmp->head ? tmp->head : tmp; |
461 | object *head = tmp->head_ (); |
460 | |
462 | |
461 | /* See comment in TRIGGER_BUTTON about move_types */ |
463 | /* See comment in TRIGGER_BUTTON about move_types */ |
462 | if (((head->move_type & op->move_on) || head->move_type == 0) |
464 | if (((head->move_type & op->move_on) || head->move_type == 0) |
463 | && (head->race == op->slaying || (!strcmp (op->slaying, "player") && head->type == PLAYER))) |
465 | && (head->race == op->slaying || (!strcmp (op->slaying, "player") && head->type == PLAYER))) |
464 | { |
466 | { |
465 | push = 1; |
467 | push = 1; |
466 | break; |
468 | break; |
467 | } |
469 | } |
468 | } |
470 | } |
|
|
471 | |
469 | if (op->stats.ac == push) |
472 | if (op->stats.ac == push) |
470 | return 0; |
473 | return 0; |
|
|
474 | |
471 | op->stats.ac = push; |
475 | op->stats.ac = push; |
|
|
476 | |
472 | if (NUM_ANIMATIONS (op) > 1) |
477 | if (NUM_ANIMATIONS (op) > 1) |
473 | { |
478 | { |
474 | SET_ANIMATION (op, push); |
479 | SET_ANIMATION (op, push); |
475 | update_object (op, UP_OBJ_FACE); |
480 | update_object (op, UP_OBJ_FACE); |
476 | } |
481 | } |
|
|
482 | |
477 | update_object (op, UP_OBJ_FACE); |
483 | update_object (op, UP_OBJ_FACE); |
|
|
484 | |
478 | if (in_movement || !push) |
485 | if (in_movement || !push) |
479 | return 0; |
486 | return 0; |
480 | } |
487 | } |
|
|
488 | |
481 | trigger_move (op, push); |
489 | trigger_move (op, push); |
482 | return 0; |
490 | return 0; |
483 | |
491 | |
484 | case TRIGGER_ALTAR: |
492 | case TRIGGER_ALTAR: |
485 | if (cause) |
493 | if (cause) |
486 | { |
494 | { |
487 | if (in_movement) |
495 | if (in_movement) |
488 | return 0; |
496 | return 0; |
|
|
497 | |
489 | if (operate_altar (op, &cause)) |
498 | if (operate_altar (op, &cause)) |
490 | { |
499 | { |
491 | if (NUM_ANIMATIONS (op) > 1) |
500 | if (NUM_ANIMATIONS (op) > 1) |
492 | { |
501 | { |
493 | SET_ANIMATION (op, 1); |
502 | SET_ANIMATION (op, 1); |
494 | update_object (op, UP_OBJ_FACE); |
503 | update_object (op, UP_OBJ_FACE); |
495 | } |
504 | } |
|
|
505 | |
496 | if (op->last_sp >= 0) |
506 | if (op->last_sp >= 0) |
497 | { |
507 | { |
498 | trigger_move (op, 1); |
508 | trigger_move (op, 1); |
499 | if (op->last_sp > 0) |
509 | if (op->last_sp > 0) |
500 | op->last_sp = -op->last_sp; |
510 | op->last_sp = -op->last_sp; |
… | |
… | |
507 | op->value = !op->value; |
517 | op->value = !op->value; |
508 | trigger_move (op, 1); |
518 | trigger_move (op, 1); |
509 | op->last_sp = -op->last_sp; |
519 | op->last_sp = -op->last_sp; |
510 | op->value = !op->value; |
520 | op->value = !op->value; |
511 | } |
521 | } |
|
|
522 | |
512 | return cause == NULL; |
523 | return cause == NULL; |
513 | } |
524 | } |
514 | else |
525 | else |
515 | { |
|
|
516 | return 0; |
526 | return 0; |
517 | } |
|
|
518 | } |
527 | } |
519 | else |
528 | else |
520 | { |
529 | { |
521 | if (NUM_ANIMATIONS (op) > 1) |
530 | if (NUM_ANIMATIONS (op) > 1) |
522 | { |
531 | { |