mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-25 05:25:14 +00:00
Fix camera reset bug (#499)
* Move camera down if hanging with romhack camera * Fix camera reset bug From issue #494 * Isaac's suggestions
This commit is contained in:
parent
693a77078d
commit
eb6183e87a
2 changed files with 104 additions and 97 deletions
|
@ -122,11 +122,12 @@ s16 newcam_saved_defmode = -1;
|
|||
extern bool gDjuiInMainMenu;
|
||||
|
||||
///This is called at every level initialisation.
|
||||
void newcam_init(struct Camera *c, UNUSED u8 dv) {
|
||||
void newcam_init(struct Camera *c, u8 isSoftReset) {
|
||||
newcam_tilt = 1500;
|
||||
newcam_yaw = -c->yaw+0x4000; //Mario and the camera's yaw have this offset between them.
|
||||
newcam_mode = NC_MODE_NORMAL;
|
||||
///This here will dictate what modes the camera will start in at the beginning of a level. Below are some examples.
|
||||
if (!isSoftReset) {
|
||||
switch (gCurrLevelNum) {
|
||||
case LEVEL_BITDW: newcam_yaw = 0x4000; /*newcam_mode = NC_MODE_8D;*/ newcam_tilt = 4000; break;
|
||||
case LEVEL_BITFS: newcam_yaw = 0x4000; /*newcam_mode = NC_MODE_8D;*/ newcam_tilt = 4000; break;
|
||||
|
@ -142,6 +143,7 @@ void newcam_init(struct Camera *c, UNUSED u8 dv) {
|
|||
// clear these out when entering a new level to prevent "camera mode buffering"
|
||||
newcam_saved_defmode = -1;
|
||||
newcam_saved_mode = -1;
|
||||
}
|
||||
|
||||
// this will be set in init_settings() if enabled
|
||||
newcam_active = 0;
|
||||
|
|
|
@ -3506,6 +3506,7 @@ void init_camera(struct Camera *c) {
|
|||
marioOffset[2] = 400.f;
|
||||
|
||||
// Set the camera's starting position or start a cutscene for certain levels
|
||||
if (!sSoftResettingCamera) {
|
||||
switch (gCurrLevelNum) {
|
||||
case LEVEL_BOWSER_1:
|
||||
#ifndef VERSION_JP
|
||||
|
@ -3571,9 +3572,11 @@ void init_camera(struct Camera *c) {
|
|||
vec3f_set(sFixedModeBasePosition, -2985.f, 478.f, -5568.f);
|
||||
break;
|
||||
}
|
||||
|
||||
if ((c->mode == CAMERA_MODE_8_DIRECTIONS) || c->mode == CAMERA_MODE_ROM_HACK) {
|
||||
gCameraMovementFlags |= CAM_MOVE_ZOOMED_OUT;
|
||||
}
|
||||
|
||||
switch (gCurrLevelArea) {
|
||||
case AREA_SSL_EYEROK:
|
||||
vec3f_set(marioOffset, 0.f, 500.f, -100.f);
|
||||
|
@ -3599,10 +3602,10 @@ void init_camera(struct Camera *c) {
|
|||
gLakituState.mode = CAMERA_MODE_RADIAL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (sSoftResettingCamera) {
|
||||
c->cutscene = 0;
|
||||
sSoftResettingCamera = FALSE;
|
||||
} else {
|
||||
// Set the camera pos to marioOffset (relative to Mario), added to Mario's position
|
||||
offset_rotated(c->pos, sMarioCamState->pos, marioOffset, sMarioCamState->faceAngle);
|
||||
|
@ -3627,8 +3630,10 @@ void init_camera(struct Camera *c) {
|
|||
c->yaw = gLakituState.yaw;
|
||||
c->nextYaw = gLakituState.yaw;
|
||||
|
||||
newcam_init(c, 0);
|
||||
newcam_init(c, sSoftResettingCamera);
|
||||
newcam_init_settings();
|
||||
|
||||
sSoftResettingCamera = FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue