Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
MorsGames
GitHub Repository: MorsGames/sm64plus
Path: blob/master/src/game/behaviors/bbh_haunted_bookshelf.inc.c
7861 views
1
/**
2
* Behavior for bhvHauntedBookshelf.
3
* This is the bookshelf that recedes after solving the puzzle of the haunted books.
4
* Its sole purpose is to recede when its action is set to 1 by a bhvHauntedBookshelfManager.
5
*/
6
7
/**
8
* Update function for bhvHauntedBookshelf.
9
*/
10
void bhv_haunted_bookshelf_loop(void) {
11
// oDistanceToMario is unused by this object.
12
// This may have been used for revealing the books when Mario comes near,
13
// but in the final game this is done by bhvHauntedBookshelfManager.
14
o->oDistanceToMario = dist_between_objects(o, gMarioObject);
15
16
o->oFaceAngleYaw = 0;
17
18
switch (o->oAction) {
19
case HAUNTED_BOOKSHELF_ACT_IDLE:
20
// ???
21
if (o->oTimer == 0) {
22
}
23
24
// This code never runs, since the action is set to 1 directly
25
// by bhvHauntedBookshelfManager. Maybe this was
26
// intended to be used to set the action instead?
27
if (o->oHauntedBookshelfShouldOpen != FALSE) {
28
o->oAction++;
29
}
30
31
break;
32
case HAUNTED_BOOKSHELF_ACT_RECEDE:
33
// Move the bookshelf and play the sound
34
o->oPosX += 5.0f;
35
cur_obj_play_sound_1(SOUND_ENV_ELEVATOR4_2);
36
37
// Delete the object after 102 frames
38
if (o->oTimer > 101) {
39
obj_mark_for_deletion(o);
40
}
41
42
break;
43
default:
44
break;
45
}
46
}
47
48