Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
MorsGames
GitHub Repository: MorsGames/sm64plus
Path: blob/master/src/game/behaviors/boulder.inc.c
7861 views
1
// boulder.c.inc
2
3
void bhv_big_boulder_init(void) {
4
o->oHomeX = o->oPosX;
5
o->oHomeY = o->oPosY;
6
o->oHomeZ = o->oPosZ;
7
8
o->oGravity = 8.0f;
9
o->oFriction = 0.999f;
10
o->oBuoyancy = 2.0f;
11
}
12
13
void boulder_act_1(void) {
14
s16 sp1E;
15
16
sp1E = object_step_without_floor_orient();
17
if ((sp1E & 0x09) == 0x01 && o->oVelY > 10.0f) {
18
cur_obj_play_sound_2(SOUND_GENERAL_GRINDEL_ROLL);
19
spawn_mist_particles();
20
}
21
22
if (o->oForwardVel > 70.0)
23
o->oForwardVel = 70.0f;
24
25
if (o->oPosY < -1000.0f)
26
o->activeFlags = ACTIVE_FLAG_DEACTIVATED;
27
}
28
29
void bhv_big_boulder_loop(void) {
30
cur_obj_scale(1.5f);
31
o->oGraphYOffset = 270.0f;
32
switch (o->oAction) {
33
case 0:
34
o->oForwardVel = 40.0f;
35
o->oAction = 1;
36
break;
37
38
case 1:
39
boulder_act_1();
40
adjust_rolling_face_pitch(1.5f);
41
cur_obj_play_sound_1(SOUND_ENV_UNKNOWN2);
42
break;
43
}
44
45
set_rolling_sphere_hitbox();
46
}
47
48
void bhv_big_boulder_generator_loop(void) {
49
struct Object *sp1C;
50
if (o->oTimer >= 256) {
51
o->oTimer = 0;
52
}
53
54
if (!current_mario_room_check(4) || is_point_within_radius_of_mario(o->oPosX, o->oPosY, o->oPosZ, 1500))
55
return;
56
57
if (is_point_within_radius_of_mario(o->oPosX, o->oPosY, o->oPosZ, 6000)) {
58
if ((o->oTimer & 0x3F) == 0) {
59
sp1C = spawn_object(o, MODEL_HMC_ROLLING_ROCK, bhvBigBoulder);
60
sp1C->oMoveAngleYaw = random_float() * 4096.0f;
61
}
62
} else {
63
if ((o->oTimer & 0x7F) == 0) {
64
sp1C = spawn_object(o, MODEL_HMC_ROLLING_ROCK, bhvBigBoulder);
65
sp1C->oMoveAngleYaw = random_float() * 4096.0f;
66
}
67
}
68
}
69
70