2019-08-25 04:46:40 +00:00
|
|
|
// star_door.c.inc
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
void star_door_update_pos(void) {
|
2019-08-25 04:46:40 +00:00
|
|
|
o->oVelX = (o->oUnkBC) * coss(o->oMoveAngleYaw);
|
|
|
|
o->oVelZ = (o->oUnkBC) * -sins(o->oMoveAngleYaw);
|
|
|
|
o->oPosX += o->oVelX;
|
|
|
|
o->oPosZ += o->oVelZ;
|
|
|
|
}
|
|
|
|
|
|
|
|
void bhv_star_door_loop(void) {
|
|
|
|
UNUSED u8 pad[4];
|
|
|
|
struct Object *sp18;
|
2020-03-02 03:42:52 +00:00
|
|
|
sp18 = cur_obj_nearest_object_with_behavior(bhvStarDoor);
|
2019-08-25 04:46:40 +00:00
|
|
|
switch (o->oAction) {
|
|
|
|
case 0:
|
2020-03-02 03:42:52 +00:00
|
|
|
cur_obj_become_tangible();
|
2019-08-25 04:46:40 +00:00
|
|
|
if (0x30000 & o->oInteractStatus)
|
|
|
|
o->oAction = 1;
|
|
|
|
if (sp18 != NULL && sp18->oAction != 0)
|
|
|
|
o->oAction = 1;
|
|
|
|
break;
|
|
|
|
case 1:
|
2020-04-03 18:57:26 +00:00
|
|
|
if (o->oTimer == 0 && (s16)(o->oMoveAngleYaw) >= 0) {
|
2020-03-02 03:42:52 +00:00
|
|
|
cur_obj_play_sound_2(SOUND_GENERAL_STAR_DOOR_OPEN);
|
2020-04-03 18:57:26 +00:00
|
|
|
#ifdef VERSION_SH
|
|
|
|
queue_rumble_data(35, 30);
|
|
|
|
#endif
|
|
|
|
}
|
2020-03-02 03:42:52 +00:00
|
|
|
cur_obj_become_intangible();
|
2019-08-25 04:46:40 +00:00
|
|
|
o->oUnkBC = -8.0f;
|
2020-03-02 03:42:52 +00:00
|
|
|
star_door_update_pos();
|
2019-08-25 04:46:40 +00:00
|
|
|
if (o->oTimer >= 16)
|
|
|
|
o->oAction++;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
if (o->oTimer >= 31)
|
|
|
|
o->oAction++;
|
|
|
|
break;
|
|
|
|
case 3:
|
2020-04-03 18:57:26 +00:00
|
|
|
if (o->oTimer == 0 && (s16)(o->oMoveAngleYaw) >= 0) {
|
2020-03-02 03:42:52 +00:00
|
|
|
cur_obj_play_sound_2(SOUND_GENERAL_STAR_DOOR_CLOSE);
|
2020-04-03 18:57:26 +00:00
|
|
|
#ifdef VERSION_SH
|
|
|
|
queue_rumble_data(35, 30);
|
|
|
|
#endif
|
|
|
|
}
|
2019-08-25 04:46:40 +00:00
|
|
|
o->oUnkBC = 8.0f;
|
2020-03-02 03:42:52 +00:00
|
|
|
star_door_update_pos();
|
2019-08-25 04:46:40 +00:00
|
|
|
if (o->oTimer >= 16)
|
|
|
|
o->oAction++;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
o->oInteractStatus = 0;
|
|
|
|
o->oAction = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|