sm64/src/game/behaviors/grill_door.inc.c

54 lines
2.0 KiB
C
Raw Normal View History

2019-08-25 00:46:40 -04:00
// grill_door.c.inc
extern u8 bob_seg7_collision_gate[];
extern u8 hmc_seg7_collision_0702B65C[];
struct Struct8032FCE8 D_8032FCE8[] = { { 320, MODEL_BOB_BARS_GRILLS, bob_seg7_collision_gate },
{ 410, MODEL_HMC_RED_GRILLS, hmc_seg7_collision_0702B65C } };
void bhv_openable_cage_door_loop(void) {
if (gCurrentObject->oAction == 0) {
2019-10-05 15:08:05 -04:00
if (gCurrentObject->parentObj->oOpenableGrillUnk88 != 0)
2019-08-25 00:46:40 -04:00
gCurrentObject->oAction++;
} else if (gCurrentObject->oAction == 1) {
if (gCurrentObject->oTimer < 64)
gCurrentObject->oMoveAngleYaw -= gCurrentObject->oBehParams2ndByte * 0x100;
else
gCurrentObject->oAction++;
}
}
void bhv_openable_grill_loop(void) {
struct Object *sp3C;
s32 sp38;
switch (o->oAction) {
case 0:
sp38 = o->oBehParams2ndByte;
sp3C = spawn_object_relative(-1, D_8032FCE8[sp38].unk0, 0, 0, o, D_8032FCE8[sp38].unk1,
bhvOpenableCageDoor);
sp3C->oMoveAngleYaw += 0x8000;
2020-03-01 22:42:52 -05:00
obj_set_collision_data(sp3C, D_8032FCE8[sp38].unk2);
2019-08-25 00:46:40 -04:00
sp3C = spawn_object_relative(1, -D_8032FCE8[sp38].unk0, 0, 0, o, D_8032FCE8[sp38].unk1,
bhvOpenableCageDoor);
2020-03-01 22:42:52 -05:00
obj_set_collision_data(sp3C, D_8032FCE8[sp38].unk2);
2019-08-25 00:46:40 -04:00
o->oAction++;
break;
case 1:
2020-03-01 22:42:52 -05:00
if ((o->oOpenableGrillUnkF4 = cur_obj_nearest_object_with_behavior(bhvFloorSwitchGrills))
2019-08-25 00:46:40 -04:00
!= NULL)
o->oAction++;
break;
case 2:
sp3C = o->oOpenableGrillUnkF4;
if (sp3C->oAction == 2) {
2019-10-05 15:08:05 -04:00
o->oOpenableGrillUnk88 = 2;
2020-03-01 22:42:52 -05:00
cur_obj_play_sound_2(SOUND_GENERAL_CAGE_OPEN);
2019-08-25 00:46:40 -04:00
o->oAction++;
if (o->oBehParams2ndByte != 0)
play_puzzle_jingle();
}
break;
case 3:
break;
}
}