sm64coopdx/src/game/behaviors/bbh_haunted_bookshelf.inc.c
MysterD d2a2a80d56 Synchronized Big Boo's Haunt + major changes
Synchronized currentRoom per-player
Synchronized haunted bookshelf, and the bookshelf manager
Synchronized haunted chairs
Synchronized mad piano
Synchronized BBH's tilting trap, and made the physics multiple-player-aware
Synchronized scuttlebugs
Synchronized every variety of Boo
Synchronized elevators
Synchronized flamethrowers
Synchronized the various types of enemy books
Synchronized the book switches
Synchronized jumping box
Made coffins multiple-player-aware

Fixed everything that used gMarioState as an array instead of gMarioStates
Prevented some NPC-dialog softlocks
Prevented the remote player from messing up the local's camera settings
Possibly fixed the relatively rare chain chomp softlock
Possibly fixed the relatively rare chain hoot softlock
Fixed the first-person-camera softlock
Forced camera code to use the correct mario struct
2020-08-26 23:29:40 -07:00

54 lines
1.7 KiB
C

/**
* Behavior for bhvHauntedBookshelf.
* This is the bookshelf that recedes after solving the puzzle of the haunted books.
* Its sole purpose is to recede when its action is set to 1 by a bhvHauntedBookshelfManager.
*/
/**
* Update function for bhvHauntedBookshelf.
*/
void bhv_haunted_bookshelf_loop(void) {
if (!network_sync_object_initialized(o)) {
network_init_object(o, SYNC_DISTANCE_ONLY_EVENTS);
network_init_object_field(o, &o->oAction);
network_init_object_field(o, &o->oTimer);
network_init_object_field(o, &o->oPosX);
network_init_object_field(o, &o->oHauntedBookshelfShouldOpen);
}
// oDistanceToMario is unused by this object.
// This may have been used for revealing the books when Mario comes near,
// but in the final game this is done by bhvHauntedBookshelfManager.
o->oDistanceToMario = dist_between_objects(o, gMarioObject);
o->oFaceAngleYaw = 0;
switch (o->oAction) {
case HAUNTED_BOOKSHELF_ACT_IDLE:
// ???
if (o->oTimer == 0) {
}
// This code never runs, since the action is set to 1 directly
// by bhvHauntedBookshelfManager. Maybe this was
// intended to be used to set the action instead?
if (o->oHauntedBookshelfShouldOpen != FALSE) {
o->oAction++;
}
break;
case HAUNTED_BOOKSHELF_ACT_RECEDE:
// Move the bookshelf and play the sound
o->oPosX += 5.0f;
cur_obj_play_sound_1(SOUND_ENV_ELEVATOR4_2);
// Delete the object after 102 frames
if (o->oTimer > 101) {
obj_mark_for_deletion(o);
}
break;
default:
break;
}
}