Allow other player to pass through door when it's being opened

Also disable the 'walking through door' cutscene when newcam is on
This commit is contained in:
MysterD 2020-09-07 16:35:42 -07:00
parent ddb5f1782f
commit d00945ec81
3 changed files with 35 additions and 20 deletions

View File

@ -14,11 +14,24 @@ s32 D_8032F330[] = { SOUND_GENERAL_CLOSE_WOOD_DOOR, SOUND_GENERAL_CLOSE_IRON_DOO
void door_animation_and_reset(s32 sp18) {
cur_obj_init_animation_with_sound(sp18);
if (cur_obj_check_if_near_animation_end())
if (cur_obj_check_if_near_animation_end()) {
o->oAction = 0;
}
}
u8 door_allow_walk_through(void) {
if (gCurrCourseNum != COURSE_NONE && gMarioStates[0].action == ACT_BUBBLED) { return TRUE; }
if (o->oAction == 0 || o->oAction > 2) { return FALSE; }
s32 cur = o->header.gfx.unk38.animFrame;
s32 max = o->header.gfx.unk38.curAnim->unk08 - 2;
return (cur >= max / 4 && cur <= 7 * max / 8);
}
void set_door_camera_event(void) {
if (gCamera->mode == CAMERA_MODE_NEWCAM) {
return;
}
if (segmented_to_virtual(bhvDoor) == o->behavior)
gPlayerCameraState->cameraEvent = CAM_EVENT_DOOR;
else
@ -46,6 +59,7 @@ void play_warp_door_open_noise(void) {
void bhv_door_loop(void) {
s32 sp1C = 0;
if (o->oAction != 100) {
while (D_8032F300[sp1C].flag != (u32)~0) {
if (cur_obj_clear_interact_status_flag(D_8032F300[sp1C].flag)) {
if (gMarioStates[0].usedObj == o) {
@ -61,6 +75,7 @@ void bhv_door_loop(void) {
}
sp1C++;
}
}
switch (o->oAction) {
case 0:
@ -85,14 +100,12 @@ void bhv_door_loop(void) {
}
// make doors intangible when you're bubbled
if (o->oAction == 0) {
if (gCurrCourseNum != COURSE_NONE && gMarioStates[0].action == ACT_BUBBLED) {
if (door_allow_walk_through()) {
o->oIntangibleTimer = -1;
} else {
load_object_collision_model();
o->oIntangibleTimer = 0;
}
}
bhv_star_door_loop_2();
}

View File

@ -1059,6 +1059,8 @@ u32 interact_door(struct MarioState *m, UNUSED u32 interactType, struct Object *
s16 requiredNumStars = o->oBehParams >> 24;
s16 numStars = save_file_get_total_star_count(gCurrSaveFileNum - 1, COURSE_MIN - 1, COURSE_MAX - 1);
if (o->oAction != 0) { return FALSE; }
if (m->action == ACT_WALKING || m->action == ACT_DECELERATING) {
if (numStars >= requiredNumStars) {
u32 actionArg = should_push_or_pull_door(m, o);

View File

@ -1036,7 +1036,7 @@ s32 act_warp_door_spawn(struct MarioState *m) {
m->usedObj->oInteractStatus = 0x00080000;
}
}
} else if (m->usedObj == NULL || m->usedObj->oAction == 0) {
} else if (m->usedObj == NULL || (m->usedObj->oAction == 0 || m->usedObj->oAction == 100)) {
if (gShouldNotPlayCastleMusic == TRUE && gCurrLevelNum == LEVEL_CASTLE) {
set_mario_action(m, ACT_READING_AUTOMATIC_DIALOG, DIALOG_021);
} else {