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.19 by root, Mon Dec 25 11:25:49 2006 UTC vs.
Revision 1.20 by root, Tue Dec 26 08:54:58 2006 UTC

67 switch (tmp->type) 67 switch (tmp->type)
68 { 68 {
69 case GATE: 69 case GATE:
70 case HOLE: 70 case HOLE:
71 tmp->value = tmp->stats.maxsp ? !state : state; 71 tmp->value = tmp->stats.maxsp ? !state : state;
72 tmp->speed = 0.5; 72 tmp->set_speed (0.5);
73 update_ob_speed (tmp);
74 break; 73 break;
75 74
76 case CF_HANDLE: 75 case CF_HANDLE:
77 SET_ANIMATION (tmp, (tmp->value = tmp->stats.maxsp ? !state : state)); 76 SET_ANIMATION (tmp, (tmp->value = tmp->stats.maxsp ? !state : state));
78 update_object (tmp, UP_OBJ_FACE); 77 update_object (tmp, UP_OBJ_FACE);
103 case MOOD_FLOOR: 102 case MOOD_FLOOR:
104 do_mood_floor (tmp, source); 103 do_mood_floor (tmp, source);
105 break; 104 break;
106 105
107 case TIMED_GATE: 106 case TIMED_GATE:
108 tmp->speed = tmp->arch->clone.speed; 107 tmp->set_speed (tmp->arch->clone.speed);
109 update_ob_speed (tmp); /* original values */
110 tmp->value = tmp->arch->clone.value; 108 tmp->value = tmp->arch->clone.value;
111 tmp->stats.sp = 1; 109 tmp->stats.sp = 1;
112 tmp->stats.hp = tmp->stats.maxhp; 110 tmp->stats.hp = tmp->stats.maxhp;
113 /* Handle multipart gates. We copy the value for the other parts 111 /* Handle multipart gates. We copy the value for the other parts
114 * from the head - this ensures that the data will consistent 112 * from the head - this ensures that the data will consistent
115 */ 113 */
116 for (tmp = tmp->more; tmp != NULL; tmp = tmp->more) 114 for (tmp = tmp->more; tmp; tmp = tmp->more)
117 { 115 {
118 tmp->speed = tmp->head->speed;
119 tmp->value = tmp->head->value; 116 tmp->value = tmp->head->value;
120 tmp->stats.sp = tmp->head->stats.sp; 117 tmp->stats.sp = tmp->head->stats.sp;
121 tmp->stats.hp = tmp->head->stats.hp; 118 tmp->stats.hp = tmp->head->stats.hp;
122 update_ob_speed (tmp); 119 tmp->set_speed (tmp->head->speed);
123 } 120 }
124 break; 121 break;
125 122
126 case DIRECTOR: 123 case DIRECTOR:
127 case FIREWALL: 124 case FIREWALL:
414{ 411{
415 op->stats.wc = state; 412 op->stats.wc = state;
416 if (state) 413 if (state)
417 { 414 {
418 use_trigger (op); 415 use_trigger (op);
419 if (op->stats.exp > 0) /* check sanity */ 416 op->set_speed (op->stats.exp > 0 ? 1. / op->stats.exp : 1.);
420 op->speed = 1.0 / op->stats.exp;
421 else
422 op->speed = 1.0;
423 update_ob_speed (op);
424 op->speed_left = -1; 417 op->speed_left = -1;
425 } 418 }
426 else 419 else
427 { 420 {
428 use_trigger (op); 421 use_trigger (op);
429 op->speed = 0; 422 op->set_speed (0);
430 update_ob_speed (op);
431 } 423 }
432} 424}
433 425
434 426
435/* 427/*
570 trigger_move (op, 0); 562 trigger_move (op, 0);
571 else 563 else
572 { 564 {
573 op->stats.wc = 0; 565 op->stats.wc = 0;
574 op->value = !op->value; 566 op->value = !op->value;
575 op->speed = 0; 567 op->set_speed (0);
576 update_ob_speed (op);
577 } 568 }
578 } 569 }
579 return 0; 570 return 0;
580 571
581 case TRIGGER: 572 case TRIGGER:
582 if (cause) 573 if (cause)
583 { 574 {
584 if (in_movement) 575 if (in_movement)
585 return 0; 576 return 0;
577
586 push = 1; 578 push = 1;
587 } 579 }
580
588 if (NUM_ANIMATIONS (op) > 1) 581 if (NUM_ANIMATIONS (op) > 1)
589 { 582 {
590 SET_ANIMATION (op, push); 583 SET_ANIMATION (op, push);
591 update_object (op, UP_OBJ_FACE); 584 update_object (op, UP_OBJ_FACE);
592 } 585 }
586
593 trigger_move (op, push); 587 trigger_move (op, push);
594 return 1; 588 return 1;
595 589
596 default: 590 default:
597 LOG (llevDebug, "Unknown trigger type: %s (%d)\n", &op->name, op->type); 591 LOG (llevDebug, "Unknown trigger type: %s (%d)\n", &op->name, op->type);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines