Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
MorsGames
GitHub Repository: MorsGames/sm64plus
Path: blob/master/src/game/behaviors/celebration_star.inc.c
7861 views
1
// celebration_star.c.inc
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 ((!configReplaceKeysWithStars) && (gCurrLevelNum == LEVEL_BOWSER_1 || gCurrLevelNum == LEVEL_BOWSER_2)) {
11
o->header.gfx.sharedChild = gLoadedGraphNodes[MODEL_BOWSER_KEY];
12
o->oFaceAnglePitch = 0;
13
o->oFaceAngleRoll = 49152;
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
if (o->oTimer < 35) {
41
spawn_object(o, MODEL_SPARKLES, bhvCelebrationStarSparkle);
42
o->oCelebStarDiameterOfRotation++;
43
} else
44
o->oCelebStarDiameterOfRotation -= 20;
45
}
46
47
void celeb_star_act_face_camera(void) {
48
49
if (o->oTimer < 10) {
50
#if BUGFIX_STAR_BOWSER_KEY
51
if (o->oCelebStarUnkF4 == 0) {
52
cur_obj_scale((f32) o->oTimer / 10.0);
53
} else {
54
cur_obj_scale((f32) o->oTimer / 30.0);
55
}
56
#else
57
cur_obj_scale((f32) o->oTimer / 10.0);
58
#endif
59
o->oFaceAngleYaw += 0x1000;
60
} else {
61
o->oFaceAngleYaw = gMarioObject->header.gfx.angle[1];
62
}
63
64
if (o->oTimer == 59)
65
o->activeFlags = ACTIVE_FLAG_DEACTIVATED;
66
}
67
68
void bhv_celebration_star_loop(void) {
69
switch (o->oAction) {
70
case CELEB_STAR_ACT_SPIN_AROUND_MARIO:
71
celeb_star_act_spin_around_mario();
72
break;
73
74
case CELEB_STAR_ACT_FACE_CAMERA:
75
celeb_star_act_face_camera();
76
break;
77
}
78
}
79
80
void bhv_celebration_star_sparkle_loop(void) {
81
o->oPosY -= 15.0f;
82
83
if (o->oTimer == 12)
84
o->activeFlags = ACTIVE_FLAG_DEACTIVATED;
85
}
86
87
void bhv_star_key_collection_puff_spawner_loop(void) {
88
spawn_mist_particles_variable(0, 10, 30.0f);
89
o->activeFlags = ACTIVE_FLAG_DEACTIVATED;
90
}
91
92