rotating_platform.inc.c (1440B)
1 // rotating_platform.inc.c 2 3 #include "levels/wf/header.h" 4 #include "levels/wdw/header.h" 5 6 struct RotatingPlatformData { 7 s16 unused; 8 s16 scale; 9 const Collision *collisionData; 10 s16 collisionDistance; 11 }; 12 13 struct RotatingPlatformData sRotatingPlatformData[] = { 14 /* ROTATING_PLATFORM_BP_WF */ { 0, 100, wf_seg7_collision_rotating_platform, 2000 }, 15 /* ROTATING_PLATFORM_BP_WDW */ { 0, 150, wdw_seg7_collision_070186B4, 1000 }, 16 }; 17 18 void bhv_wf_rotating_wooden_platform_loop(void) { 19 if (o->oAction == WF_ROTATING_WOODEN_PLATFORM_ACT_IDLE) { 20 o->oAngleVelYaw = 0; 21 if (o->oTimer > 60) { 22 o->oAction++; 23 } 24 } else { // WF_ROTATING_WOODEN_PLATFORM_ACT_ROTATING 25 o->oAngleVelYaw = 0x100; 26 if (o->oTimer > 126) { 27 o->oAction = WF_ROTATING_WOODEN_PLATFORM_ACT_IDLE; 28 } 29 cur_obj_play_sound_1(SOUND_ENV_ELEVATOR2); 30 } 31 cur_obj_rotate_face_angle_using_vel(); 32 } 33 34 void bhv_rotating_platform_loop(void) { 35 s8 bhvParams1stByte = o->oBhvParams >> 24; 36 if (o->oTimer == 0) { 37 obj_set_collision_data(o, sRotatingPlatformData[o->oBhvParams2ndByte].collisionData); 38 o->oCollisionDistance = sRotatingPlatformData[o->oBhvParams2ndByte].collisionDistance; 39 cur_obj_scale(sRotatingPlatformData[o->oBhvParams2ndByte].scale * 0.01f); 40 } 41 o->oAngleVelYaw = bhvParams1stByte << 4; 42 o->oFaceAngleYaw += o->oAngleVelYaw; 43 }