Prevent dying/bubbling from replaying intro level cutscene

This commit is contained in:
MysterD 2020-10-03 10:15:21 -07:00
parent 9e2b28008b
commit b9813acbc5
5 changed files with 14 additions and 3 deletions

View file

@ -32,6 +32,8 @@
#define CBUTTON_MASK (U_CBUTTONS | D_CBUTTONS | L_CBUTTONS | R_CBUTTONS)
static u8 sSoftResettingCamera = FALSE;
/**
* @file camera.c
* Implements the camera system, including C-button input, camera modes, camera triggers, and cutscenes.
@ -3252,6 +3254,10 @@ void update_camera(struct Camera *c) {
gLakituState.lastFrameAction = sMarioCamState->action;
}
void soft_reset_camera(struct Camera* c) {
reset_camera(c);
sSoftResettingCamera = TRUE;
}
/**
* Reset all the camera variables to their arcane defaults
*/
@ -3456,6 +3462,10 @@ void init_camera(struct Camera *c) {
break;
}
if (sSoftResettingCamera) {
c->cutscene = 0;
}
// Set the camera pos to marioOffset (relative to Mario), added to Mario's position
offset_rotated(c->pos, sMarioCamState->pos, marioOffset, sMarioCamState->faceAngle);
if (c->mode != CAMERA_MODE_BEHIND_MARIO) {

View file

@ -687,6 +687,7 @@ void move_mario_head_c_up(UNUSED struct Camera *c);
void transition_next_state(UNUSED struct Camera *c, s16 frames);
void set_camera_mode(struct Camera *c, s16 mode, s16 frames);
void update_camera(struct Camera *c);
void soft_reset_camera(struct Camera* c);
void reset_camera(struct Camera *c);
void init_camera(struct Camera *c);
void select_mario_cam_mode(void);

View file

@ -403,7 +403,7 @@ void mario_set_bubbled(struct MarioState* m) {
gCutsceneTimer = 0;
if (m->playerIndex == 0) {
reset_camera(m->area->camera);
soft_reset_camera(m->area->camera);
}
}

View file

@ -953,7 +953,7 @@ s32 act_bubbled(struct MarioState* m) {
m->vel[2] = 0;
m->marioObj->header.gfx.node.flags &= ~GRAPH_RENDER_INVISIBLE;
if (m->playerIndex == 0) {
reset_camera(m->area->camera);
soft_reset_camera(m->area->camera);
}
return force_idle_state(m);
}

View file

@ -710,7 +710,7 @@ void general_star_dance_handler(struct MarioState *m, s32 isInWater) {
set_mario_action(m, isInWater ? ACT_WATER_IDLE : ACT_IDLE, 0);
}
if (gServerSettings.stayInLevelAfterStar) {
reset_camera(m->area->camera);
soft_reset_camera(m->area->camera);
}
}
}