Move first_person_update() call

This commit is contained in:
Agent X 2023-11-18 15:00:03 -05:00
parent 72c58f722e
commit b552b9a8b3
4 changed files with 9 additions and 10 deletions

View file

@ -3193,7 +3193,7 @@ void update_camera(struct Camera *c) {
gCamera = c;
update_camera_hud_status(c);
if ((gOverrideFreezeCamera || first_person_update()) && !gDjuiInMainMenu) {
if ((gOverrideFreezeCamera || get_first_person_enabled()) && !gDjuiInMainMenu) {
return;
}

View file

@ -141,13 +141,13 @@ void first_person_camera_update(void) {
gFOVState.fov = gFirstPersonCamera.fov;
}
bool first_person_update(void) {
void first_person_update(void) {
if (gFirstPersonCamera.enabled && !gDjuiInMainMenu) {
struct MarioState *m = &gMarioStates[0];
// check cancels
bool cancel = first_person_check_cancels();
if (cancel) { return false; }
if (cancel) { return; }
struct MarioState *m = &gMarioStates[0];
if (m->action == ACT_SHOT_FROM_CANNON && m->area->camera->mode == CAMERA_MODE_INSIDE_CANNON) {
gFirstPersonCamera.yaw = m->faceAngle[1] + 0x8000;
@ -169,13 +169,9 @@ bool first_person_update(void) {
}
first_person_camera_update();
return true;
} else if (!camera_config_is_mouse_look_enabled()) {
gDjuiHudLockMouse = false;
}
return false;
}
void first_person_reset(void) {

View file

@ -19,7 +19,7 @@ extern struct FirstPersonCamera gFirstPersonCamera;
bool get_first_person_enabled(void);
void set_first_person_enabled(bool enable);
bool first_person_update(void);
void first_person_update(void);
void first_person_reset(void);
#endif

View file

@ -20,6 +20,7 @@
#include "platform_displacement.h"
#include "profiler.h"
#include "spawn_object.h"
#include "first_person_cam.h"
#include "engine/math_util.h"
#include "pc/network/network.h"
#include "pc/lua/smlua.h"
@ -293,6 +294,8 @@ void bhv_mario_update(void) {
particleFlags |= gMarioState->particleFlags;
gCurrentObject->oMarioParticleFlags = particleFlags;
if (stateIndex == 0) { first_person_update(); }
// This code is meant to preserve old Lua mods' ability to set overridePaletteIndex and paletteIndex and still work
// as they expected. USE_REAL_PALETTE_VAR is meant to help support cases where mods will do:
// np.overridePaletteIndex = np.paletteIndex