ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/button.C
(Generate patch)

Comparing deliantra/server/common/button.C (file contents):
Revision 1.74 by root, Sat Nov 17 23:39:59 2018 UTC vs.
Revision 1.75 by root, Sun Nov 18 15:19:48 2018 UTC

78 tmp->value = tmp->stats.maxsp ? !state : state; 78 tmp->value = tmp->stats.maxsp ? !state : state;
79 tmp->set_speed (0.5); 79 tmp->set_speed (0.5);
80 break; 80 break;
81 81
82 case T_HANDLE: 82 case T_HANDLE:
83 SET_ANIMATION (tmp, (tmp->value = tmp->stats.maxsp ? !state : state)); 83 tmp->value = tmp->stats.maxsp ? !state : state;
84 update_object (tmp, UP_OBJ_FACE); 84 tmp->update_anim_frame (tmp->value);
85 break; 85 break;
86 86
87 case SIGN: 87 case SIGN:
88 if (!tmp->stats.food || tmp->last_eat < tmp->stats.food) 88 if (!tmp->stats.food || tmp->last_eat < tmp->stats.food)
89 { 89 {
100 break; 100 break;
101 101
102 case ALTAR: 102 case ALTAR:
103 tmp->play_sound (tmp->sound ? tmp->sound : sound_find ("trigger_altar")); 103 tmp->play_sound (tmp->sound ? tmp->sound : sound_find ("trigger_altar"));
104 tmp->value = 1; 104 tmp->value = 1;
105 SET_ANIMATION (tmp, tmp->value); 105 tmp->update_anim_frame (tmp->value);
106 update_object (tmp, UP_OBJ_FACE);
107 break; 106 break;
108 107
109 case BUTTON: 108 case BUTTON:
110 case PEDESTAL: 109 case PEDESTAL:
111 tmp->play_sound (tmp->sound ? tmp->sound : sound_find ("trigger_button")); 110 tmp->play_sound (tmp->sound ? tmp->sound : sound_find ("trigger_button"));
112 tmp->value = state; 111 tmp->value = state;
113 SET_ANIMATION (tmp, tmp->value); 112 tmp->update_anim_frame (tmp->value);
114 update_object (tmp, UP_OBJ_FACE);
115 break; 113 break;
116 114
117 case MOOD_FLOOR: 115 case MOOD_FLOOR:
118 do_mood_floor (tmp, activator); 116 do_mood_floor (tmp, activator);
119 break; 117 break;
306 //LOG(llevDebug, "update_button: %s (%d, %d=%d)\n", &op->name, op->count, op->value, old_value); 304 //LOG(llevDebug, "update_button: %s (%d, %d=%d)\n", &op->name, op->count, op->value, old_value);
307 305
308 /* If this button hasn't changed, don't do anything */ 306 /* If this button hasn't changed, don't do anything */
309 if (op->value != old_value) 307 if (op->value != old_value)
310 { 308 {
311 SET_ANIMATION (op, op->value); 309 op->update_anim_frame (op->value);
312 update_object (op, UP_OBJ_FACE);
313 push_button (op, originator); /* Make all other buttons the same */ 310 push_button (op, originator); /* Make all other buttons the same */
314 } 311 }
315} 312}
316 313
317void 314void
328 * but it can't handle animations in the 8 directions 325 * but it can't handle animations in the 8 directions
329 */ 326 */
330void 327void
331animate_turning (object *op) /* only one part objects */ 328animate_turning (object *op) /* only one part objects */
332{ 329{
333 if (++op->state >= NUM_ANIMATIONS (op) / 8) 330 if (++op->state >= op->anim_frames () / 8)
334 op->state = 0; 331 op->state = 0;
335 SET_ANIMATION (op, (op->stats.sp - 1) * NUM_ANIMATIONS (op) / 8 + op->state); 332
336 update_object (op, UP_OBJ_FACE); 333 op->update_anim_frame ((op->stats.sp - 1) * op->anim_frames () / 8 + op->state);
337} 334}
338 335
339#define ARCH_SACRIFICE(xyz) ((xyz)->slaying) 336#define ARCH_SACRIFICE(xyz) ((xyz)->slaying)
340#define NROF_SACRIFICE(xyz) ((uint32)(xyz)->stats.food) 337#define NROF_SACRIFICE(xyz) ((uint32)(xyz)->stats.food)
341 338
487 484
488 if (op->stats.ac == push) 485 if (op->stats.ac == push)
489 return 0; 486 return 0;
490 487
491 op->stats.ac = push; 488 op->stats.ac = push;
492 if (NUM_ANIMATIONS (op) > 1) 489 op->update_anim_frame (push);
493 {
494 SET_ANIMATION (op, push);
495 update_object (op, UP_OBJ_FACE);
496 }
497 490
498 if (in_movement || !push) 491 if (in_movement || !push)
499 return 0; 492 return 0;
500 } 493 }
501 494
522 515
523 if (op->stats.ac == push) 516 if (op->stats.ac == push)
524 return 0; 517 return 0;
525 518
526 op->stats.ac = push; 519 op->stats.ac = push;
527 520 op->update_anim_frame (push);
528 if (NUM_ANIMATIONS (op) > 1)
529 {
530 SET_ANIMATION (op, push);
531 update_object (op, UP_OBJ_FACE);
532 }
533
534 update_object (op, UP_OBJ_FACE);
535 521
536 if (in_movement || !push) 522 if (in_movement || !push)
537 return 0; 523 return 0;
538 } 524 }
539 525
546 if (in_movement) 532 if (in_movement)
547 return 0; 533 return 0;
548 534
549 if (operate_altar (op, &cause)) /* TODO: originator? */ 535 if (operate_altar (op, &cause)) /* TODO: originator? */
550 { 536 {
551 if (NUM_ANIMATIONS (op) > 1) 537 op->update_anim_frame (1);
552 {
553 SET_ANIMATION (op, 1);
554 update_object (op, UP_OBJ_FACE);
555 }
556 538
557 if (op->last_sp >= 0) 539 if (op->last_sp >= 0)
558 { 540 {
559 trigger_move (op, 1, cause); 541 trigger_move (op, 1, cause);
560 542
577 else 559 else
578 return 0; 560 return 0;
579 } 561 }
580 else 562 else
581 { 563 {
582 if (NUM_ANIMATIONS (op) > 1) 564 op->update_anim_frame (0);
583 {
584 SET_ANIMATION (op, 0);
585 update_object (op, UP_OBJ_FACE);
586 }
587 565
588 /* If trigger_altar has "last_sp > 0" set on the map, 566 /* If trigger_altar has "last_sp > 0" set on the map,
589 * it will push the connected value only once per sacrifice. 567 * it will push the connected value only once per sacrifice.
590 * Otherwise (default), the connected value will be 568 * Otherwise (default), the connected value will be
591 * pushed twice: First by sacrifice, second by reset! -AV 569 * pushed twice: First by sacrifice, second by reset! -AV
608 return 0; 586 return 0;
609 587
610 push = 1; 588 push = 1;
611 } 589 }
612 590
613 if (NUM_ANIMATIONS (op) > 1) 591 op->update_anim_frame (push);
614 {
615 SET_ANIMATION (op, push);
616 update_object (op, UP_OBJ_FACE);
617 }
618 592
619 trigger_move (op, push, cause); 593 trigger_move (op, push, cause);
620 return 1; 594 return 1;
621 595
622 default: 596 default:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines