1 | /* |
1 | /* |
2 | * static char *rcsid_button_c = |
2 | * static char *rcsid_button_c = |
3 | * "$Id: button.c,v 1.1.1.2 2006/02/22 18:01:17 elmex Exp $"; |
3 | * "$Id: button.c,v 1.3 2006/08/13 17:16:00 elmex dead $"; |
4 | */ |
4 | */ |
5 | |
5 | |
6 | /* |
6 | /* |
7 | CrossFire, A Multiplayer game for X-windows |
7 | CrossFire, A Multiplayer game for X-windows |
8 | |
8 | |
… | |
… | |
399 | if (tot >= op->weight) |
399 | if (tot >= op->weight) |
400 | push = 1; |
400 | push = 1; |
401 | if (op->stats.ac == push) |
401 | if (op->stats.ac == push) |
402 | return 0; |
402 | return 0; |
403 | op->stats.ac = push; |
403 | op->stats.ac = push; |
404 | SET_ANIMATION (op, push); |
404 | if (NUM_ANIMATIONS(op) > 1) { |
|
|
405 | SET_ANIMATION (op, push); |
405 | update_object (op, UP_OBJ_FACE); |
406 | update_object (op, UP_OBJ_FACE); |
|
|
407 | } |
406 | if (in_movement || ! push) |
408 | if (in_movement || ! push) |
407 | return 0; |
409 | return 0; |
408 | } |
410 | } |
409 | trigger_move (op, push); |
411 | trigger_move (op, push); |
410 | } |
412 | } |
… | |
… | |
424 | } |
426 | } |
425 | } |
427 | } |
426 | if (op->stats.ac == push) |
428 | if (op->stats.ac == push) |
427 | return 0; |
429 | return 0; |
428 | op->stats.ac = push; |
430 | op->stats.ac = push; |
429 | SET_ANIMATION (op, push); |
431 | if (NUM_ANIMATIONS(op) > 1) { |
|
|
432 | SET_ANIMATION (op, push); |
|
|
433 | update_object (op, UP_OBJ_FACE); |
|
|
434 | } |
430 | update_object(op,UP_OBJ_FACE); |
435 | update_object(op,UP_OBJ_FACE); |
431 | if (in_movement || ! push) |
436 | if (in_movement || ! push) |
432 | return 0; |
437 | return 0; |
433 | } |
438 | } |
434 | trigger_move (op, push); |
439 | trigger_move (op, push); |
… | |
… | |
437 | case TRIGGER_ALTAR: |
442 | case TRIGGER_ALTAR: |
438 | if (cause) { |
443 | if (cause) { |
439 | if (in_movement) |
444 | if (in_movement) |
440 | return 0; |
445 | return 0; |
441 | if (operate_altar (op, &cause)) { |
446 | if (operate_altar (op, &cause)) { |
442 | SET_ANIMATION (op, 1); |
447 | if (NUM_ANIMATIONS(op) > 1) { |
443 | update_object(op,UP_OBJ_FACE); |
448 | SET_ANIMATION (op, 1); |
444 | |
449 | update_object(op, UP_OBJ_FACE); |
|
|
450 | } |
445 | if (op->last_sp >= 0) { |
451 | if (op->last_sp >= 0) { |
446 | trigger_move (op, 1); |
452 | trigger_move (op, 1); |
447 | if (op->last_sp > 0) |
453 | if (op->last_sp > 0) |
448 | op->last_sp = -op->last_sp; |
454 | op->last_sp = -op->last_sp; |
449 | } |
455 | } |
… | |
… | |
459 | return cause == NULL; |
465 | return cause == NULL; |
460 | } else { |
466 | } else { |
461 | return 0; |
467 | return 0; |
462 | } |
468 | } |
463 | } else { |
469 | } else { |
464 | SET_ANIMATION (op, 0); |
470 | if (NUM_ANIMATIONS(op) > 1) { |
465 | update_object(op,UP_OBJ_FACE); |
471 | SET_ANIMATION (op, 0); |
|
|
472 | update_object(op, UP_OBJ_FACE); |
|
|
473 | } |
466 | |
474 | |
467 | /* If trigger_altar has "last_sp > 0" set on the map, |
475 | /* If trigger_altar has "last_sp > 0" set on the map, |
468 | * it will push the connected value only once per sacrifice. |
476 | * it will push the connected value only once per sacrifice. |
469 | * Otherwise (default), the connected value will be |
477 | * Otherwise (default), the connected value will be |
470 | * pushed twice: First by sacrifice, second by reset! -AV |
478 | * pushed twice: First by sacrifice, second by reset! -AV |
… | |
… | |
484 | if (cause) { |
492 | if (cause) { |
485 | if (in_movement) |
493 | if (in_movement) |
486 | return 0; |
494 | return 0; |
487 | push = 1; |
495 | push = 1; |
488 | } |
496 | } |
|
|
497 | if (NUM_ANIMATIONS(op) > 1) { |
489 | SET_ANIMATION (op, push); |
498 | SET_ANIMATION (op, push); |
490 | update_object(op,UP_OBJ_FACE); |
499 | update_object(op, UP_OBJ_FACE); |
|
|
500 | } |
491 | trigger_move (op, push); |
501 | trigger_move (op, push); |
492 | return 1; |
502 | return 1; |
493 | |
503 | |
494 | default: |
504 | default: |
495 | LOG(llevDebug, "Unknown trigger type: %s (%d)\n", op->name, op->type); |
505 | LOG(llevDebug, "Unknown trigger type: %s (%d)\n", op->name, op->type); |