star_door.inc.c (1738B)
1 // star_door.inc.c 2 3 void star_door_update_pos(void) { 4 o->oVelX = (o->oLeftVel) * coss(o->oMoveAngleYaw); 5 o->oVelZ = (o->oLeftVel) * -sins(o->oMoveAngleYaw); 6 o->oPosX += o->oVelX; 7 o->oPosZ += o->oVelZ; 8 } 9 10 void bhv_star_door_loop(void) { 11 UNUSED u8 filler[4]; 12 struct Object *sp18 = cur_obj_nearest_object_with_behavior(bhvStarDoor); 13 14 switch (o->oAction) { 15 case 0: 16 cur_obj_become_tangible(); 17 if (o->oInteractStatus & (INT_STATUS_UNK16 | INT_STATUS_UNK17)) { 18 o->oAction = 1; 19 } 20 if (sp18 != NULL && sp18->oAction != 0) { 21 o->oAction = 1; 22 } 23 break; 24 25 case 1: 26 if (o->oTimer == 0 && (s16) o->oMoveAngleYaw >= 0) { 27 cur_obj_play_sound_2(SOUND_GENERAL_STAR_DOOR_OPEN); 28 #if ENABLE_RUMBLE 29 queue_rumble_data(35, 30); 30 #endif 31 } 32 cur_obj_become_intangible(); 33 o->oLeftVel = -8.0f; 34 star_door_update_pos(); 35 if (o->oTimer > 15) { 36 o->oAction++; 37 } 38 break; 39 40 case 2: 41 if (o->oTimer > 30) { 42 o->oAction++; 43 } 44 break; 45 46 case 3: 47 if (o->oTimer == 0 && (s16) o->oMoveAngleYaw >= 0) { 48 cur_obj_play_sound_2(SOUND_GENERAL_STAR_DOOR_CLOSE); 49 #if ENABLE_RUMBLE 50 queue_rumble_data(35, 30); 51 #endif 52 } 53 o->oLeftVel = 8.0f; 54 star_door_update_pos(); 55 if (o->oTimer > 15) { 56 o->oAction++; 57 } 58 break; 59 60 case 4: 61 o->oInteractStatus = 0; 62 o->oAction = 0; 63 break; 64 } 65 }