Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
MorsGames
GitHub Repository: MorsGames/sm64plus
Path: blob/master/src/game/behaviors/bouncing_fireball.inc.c
7861 views
1
// bouncing_fireball.c.inc
2
3
void bhv_bouncing_fireball_flame_loop(void) {
4
o->activeFlags |= ACTIVE_FLAG_UNK10;
5
cur_obj_update_floor_and_walls();
6
switch (o->oAction) {
7
case 0:
8
if (o->oTimer == 0) {
9
o->oAnimState = random_float() * 10.0f;
10
o->oVelY = 30.0f;
11
}
12
if (o->oMoveFlags & OBJ_MOVE_LANDED)
13
o->oAction++;
14
break;
15
case 1:
16
if (o->oTimer == 0) {
17
o->oVelY = 50.0f;
18
o->oForwardVel = 30.0f;
19
}
20
if (o->oMoveFlags & (OBJ_MOVE_UNDERWATER_ON_GROUND | OBJ_MOVE_AT_WATER_SURFACE | OBJ_MOVE_ON_GROUND) && o->oTimer > 100)
21
obj_mark_for_deletion(o);
22
break;
23
}
24
if (o->oTimer > 300)
25
obj_mark_for_deletion(o);
26
cur_obj_move_standard(78);
27
o->oInteractStatus = 0;
28
}
29
30
void bhv_bouncing_fireball_loop(void) {
31
struct Object *sp2C;
32
f32 sp28;
33
switch (o->oAction) {
34
case 0:
35
if (o->oDistanceToMario < 2000.0f)
36
o->oAction = 1;
37
break;
38
case 1:
39
sp2C = spawn_object(o, MODEL_RED_FLAME, bhvBouncingFireballFlame);
40
sp28 = (10 - o->oTimer) * 0.5;
41
obj_scale_xyz(sp2C, sp28, sp28, sp28);
42
if (o->oTimer == 0)
43
obj_become_tangible(sp2C);
44
if (o->oTimer > 10)
45
o->oAction++;
46
break;
47
case 2:
48
if (o->oTimer == 0)
49
o->oBouncingFireBallUnkF4 = random_float() * 100.0f;
50
if (o->oBouncingFireBallUnkF4 + 100 < o->oTimer)
51
o->oAction = 0;
52
break;
53
}
54
}
55
56