celebration_star.inc.c (2745B)
1 // celebration_star.inc.c 2 3 void bhv_celebration_star_init(void) { 4 o->oHomeX = gMarioObject->header.gfx.pos[0]; 5 o->oPosY = gMarioObject->header.gfx.pos[1] + 30.0f; 6 o->oHomeZ = gMarioObject->header.gfx.pos[2]; 7 o->oMoveAngleYaw = gMarioObject->header.gfx.angle[1] + 0x8000; 8 o->oCelebStarDiameterOfRotation = 100; 9 #if BUGFIX_STAR_BOWSER_KEY 10 if (gCurrLevelNum == LEVEL_BOWSER_1 || gCurrLevelNum == LEVEL_BOWSER_2) { 11 o->header.gfx.sharedChild = gLoadedGraphNodes[MODEL_BOWSER_KEY]; 12 o->oFaceAnglePitch = 0; 13 o->oFaceAngleRoll = 0xC000; 14 cur_obj_scale(0.1f); 15 o->oCelebStarUnkF4 = 1; 16 } else { 17 o->header.gfx.sharedChild = gLoadedGraphNodes[MODEL_STAR]; 18 o->oFaceAnglePitch = 0; 19 o->oFaceAngleRoll = 0; 20 cur_obj_scale(0.4f); 21 o->oCelebStarUnkF4 = 0; 22 } 23 #else 24 o->header.gfx.sharedChild = gLoadedGraphNodes[MODEL_STAR]; 25 cur_obj_scale(0.4f); 26 o->oFaceAnglePitch = 0; 27 o->oFaceAngleRoll = 0; 28 #endif 29 } 30 31 void celeb_star_act_spin_around_mario(void) { 32 o->oPosX = o->oHomeX + sins(o->oMoveAngleYaw) * (f32)(o->oCelebStarDiameterOfRotation / 2); 33 o->oPosZ = o->oHomeZ + coss(o->oMoveAngleYaw) * (f32)(o->oCelebStarDiameterOfRotation / 2); 34 o->oPosY += 5.0f; 35 o->oFaceAngleYaw += 0x1000; 36 o->oMoveAngleYaw += 0x2000; 37 38 if (o->oTimer == 40) { 39 o->oAction = CELEB_STAR_ACT_FACE_CAMERA; 40 } 41 42 if (o->oTimer < 35) { 43 spawn_object(o, MODEL_SPARKLES, bhvCelebrationStarSparkle); 44 o->oCelebStarDiameterOfRotation++; 45 } else { 46 o->oCelebStarDiameterOfRotation -= 20; 47 } 48 } 49 50 void celeb_star_act_face_camera(void) { 51 if (o->oTimer < 10) { 52 #if BUGFIX_STAR_BOWSER_KEY 53 if (o->oCelebStarUnkF4 == 0) { 54 cur_obj_scale((f32) o->oTimer / 10.0); 55 } else { 56 cur_obj_scale((f32) o->oTimer / 30.0); 57 } 58 #else 59 cur_obj_scale((f32) o->oTimer / 10.0); 60 #endif 61 o->oFaceAngleYaw += 0x1000; 62 } else { 63 o->oFaceAngleYaw = gMarioObject->header.gfx.angle[1]; 64 } 65 66 if (o->oTimer == 59) { 67 o->activeFlags = ACTIVE_FLAG_DEACTIVATED; 68 } 69 } 70 71 void bhv_celebration_star_loop(void) { 72 switch (o->oAction) { 73 case CELEB_STAR_ACT_SPIN_AROUND_MARIO: 74 celeb_star_act_spin_around_mario(); 75 break; 76 77 case CELEB_STAR_ACT_FACE_CAMERA: 78 celeb_star_act_face_camera(); 79 break; 80 } 81 } 82 83 void bhv_celebration_star_sparkle_loop(void) { 84 o->oPosY -= 15.0f; 85 86 if (o->oTimer == 12) { 87 o->activeFlags = ACTIVE_FLAG_DEACTIVATED; 88 } 89 } 90 91 void bhv_star_key_collection_puff_spawner_loop(void) { 92 spawn_mist_particles_variable(0, 10, 30.0f); 93 o->activeFlags = ACTIVE_FLAG_DEACTIVATED; 94 }