Path: blob/master/src/game/behaviors/bowser_falling_platform.inc.c
7861 views
struct BowserFallingPlatformData {1const Collision *collision;2s16 posX;3s16 posZ;4s16 angle;5};67struct BowserFallingPlatformData sBowserFallingPlatform[] = {8{ NULL, 0, 0, 0 },9{ bowser_3_seg7_collision_07004B94, -800, -1000, -20992 },10{ bowser_3_seg7_collision_07004C18, -1158, 390, -18432 },11{ bowser_3_seg7_collision_07004C9C, -1158, 390, -7680 },12{ bowser_3_seg7_collision_07004D20, 0, 1240, -6144 },13{ bowser_3_seg7_collision_07004DA4, 0, 1240, 6144 },14{ bowser_3_seg7_collision_07004E28, 1158, 390, 7680 },15{ bowser_3_seg7_collision_07004EAC, 1158, 390, 18432 },16{ bowser_3_seg7_collision_07004F30, 800, -1000, 20992 },17{ bowser_3_seg7_collision_07004FB4, 800, -1000, -31744 },18{ bowser_3_seg7_collision_07005038, -800, -1000, 31744 }19};2021void falling_bowser_plat_act_start(void) {22o->oBitsPlatformBowser = cur_obj_nearest_object_with_behavior(bhvBowser);23obj_set_collision_data(o, sBowserFallingPlatform[o->oBehParams2ndByte].collision);24if (o->oBitsPlatformBowser != 0)25o->oAction = BOWSER_BITS_PLAT_ACT_CHECK;26}2728void falling_bowser_plat_act_check(void) {29UNUSED s32 unused;30struct Object *bowser = o->oBitsPlatformBowser;31if (bowser->platform == o) {32if (bowser->oAction == BOWSER_ACT_BIG_JUMP && bowser->oBowserStatus & BOWSER_STATUS_BIG_JUMP) {33o->oAction = BOWSER_BITS_PLAT_ACT_FALL;34}35}36if (bowser->oHealth == 1 && (bowser->oAction == BOWSER_ACT_DANCE || bowser->oHeldState != HELD_FREE)) {37o->oSubAction = 1;38}39if (o->oSubAction == 0) {40o->oBitsPlatformTimer = 0;41} else {42if ((gDebugInfo[4][6] + 20) * (o->oBehParams2ndByte - 1) < o->oBitsPlatformTimer)43o->oAction = BOWSER_BITS_PLAT_ACT_FALL;44o->oBitsPlatformTimer++;45}46}4748void falling_bowser_plat_act_fall(void) {49Vec3f pos;50s16 angle;51f32 val;52UNUSED struct Object *bowser = o->oBitsPlatformBowser;53if (o->oTimer == 0 || o->oTimer == 22) {54cur_obj_play_sound_2(SOUND_GENERAL_BOWSER_PLATFORM_2);55}56if (o->oTimer < 22) {57set_environmental_camera_shake(SHAKE_ENV_FALLING_BITS_PLAT);58o->oVelY = 8.0f;59o->oGravity = 0.0f;60} else61o->oGravity = -4.0f;62if ((o->oTimer & 1) == 0 && o->oTimer < 14) {63angle = sBowserFallingPlatform[o->oBehParams2ndByte].angle + (gDebugInfo[4][1] << 8);64val = -(o->oTimer / 2) * 290 + 1740;65vec3f_copy_2(pos, &o->oPosX);66o->oPosX = sBowserFallingPlatform[o->oBehParams2ndByte].posX + sins(angle + 0x14B0) * val;67o->oPosZ = sBowserFallingPlatform[o->oBehParams2ndByte].posZ + coss(angle + 0x14B0) * val;68o->oPosY = 307.0f;69spawn_mist_particles_variable(4, 0, 100.0f);70o->oPosX = sBowserFallingPlatform[o->oBehParams2ndByte].posX + sins(angle - 0x14B0) * val;71o->oPosZ = sBowserFallingPlatform[o->oBehParams2ndByte].posZ + coss(angle - 0x14B0) * val;72spawn_mist_particles_variable(4, 0, 100);73vec3f_copy_2(&o->oPosX, pos);74}75cur_obj_move_using_fvel_and_gravity();76if (o->oTimer > 300) {77obj_mark_for_deletion(o);78}79}8081void (*sFallingBowserPlatformActions[])(void) = {82falling_bowser_plat_act_start,83falling_bowser_plat_act_check,84falling_bowser_plat_act_fall,85};8687void bhv_falling_bowser_platform_loop(void) {88cur_obj_call_action_function(sFallingBowserPlatformActions);89}909192