mirror of
https://github.com/zeldaret/oot
synced 2026-08-18 21:48:08 -04:00
Camera Flags (#1225)
* Generic Camera Flags * New flag names * Add flags to functions * Finish flag docs * More docs * More cleanup * More clarity * Better shrinkwindow flag docs * Improve name * CAM_INTERFACE_FLAGS * Better approach to edge cases * Change ordering for consistency * Oops * Add masks to macro * PR/Discord discussions * cleanup comment * Oops * PR Suggestions * More PR Feedback * More PR Suggestions * PR Suggestions * More flag style change * Small cleanup * sync names with other PRs * more fixes * fix comments * update with hud visibility mode docs * missed one * fix comments * Roman PR Suggestions * interfaceField * small fix * letterbox cleanup * fix macro arg * fix func declaration
This commit is contained in:
+390
-351
File diff suppressed because it is too large
Load Diff
+398
-189
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -1430,7 +1430,7 @@ s32 Cutscene_Command_07(PlayState* play, CutsceneContext* csCtx, u8* cmd, u8 unu
|
||||
Play_ChangeCameraStatus(play, csCtx->subCamId, CAM_STAT_ACTIVE);
|
||||
Play_CameraChangeSetting(play, csCtx->subCamId, CAM_SET_FREE0);
|
||||
sp28 = csCtx->subCamLookAtPoints->cameraRoll * 1.40625f;
|
||||
Camera_SetParam(subCam, 64, &sp28);
|
||||
Camera_SetViewParam(subCam, CAM_VIEW_ROLL, &sp28);
|
||||
sp3C.x = csCtx->subCamLookAtPoints->pos.x;
|
||||
sp3C.y = csCtx->subCamLookAtPoints->pos.y;
|
||||
sp3C.z = csCtx->subCamLookAtPoints->pos.z;
|
||||
|
||||
+2
-1
@@ -1700,7 +1700,8 @@ void Environment_DrawRain(PlayState* play, View* view, GraphicsContext* gfxCtx)
|
||||
Vec3f windDirection = { 0.0f, 0.0f, 0.0f };
|
||||
Player* player = GET_PLAYER(play);
|
||||
|
||||
if (!(play->cameraPtrs[0]->unk_14C & 0x100) && (play->envCtx.precipitation[PRECIP_SNOW_CUR] == 0)) {
|
||||
if (!(play->cameraPtrs[CAM_ID_MAIN]->stateFlags & CAM_STATE_8) &&
|
||||
(play->envCtx.precipitation[PRECIP_SNOW_CUR] == 0)) {
|
||||
OPEN_DISPS(gfxCtx, "../z_kankyo.c", 2799);
|
||||
|
||||
vec.x = view->at.x - view->eye.x;
|
||||
|
||||
@@ -482,7 +482,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
|
||||
case 3120:
|
||||
csInfo->keyFrames = D_80121954[-(timer + 101)];
|
||||
subCam->timer = 100;
|
||||
subCam->unk_14C |= 2;
|
||||
subCam->stateFlags |= CAM_STATE_1;
|
||||
csInfo->keyFrameCnt = 2;
|
||||
|
||||
func_8002DF54(play, NULL, 8);
|
||||
@@ -494,7 +494,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
|
||||
|
||||
func_8002DF54(play, NULL, 8);
|
||||
func_800C0808(play, subCamId, player, CAM_SET_CS_C);
|
||||
subCam->unk_14C |= 2;
|
||||
subCam->stateFlags |= CAM_STATE_1;
|
||||
break;
|
||||
case 3140:
|
||||
D_80121C24[0].atTargetInit = play->view.at;
|
||||
|
||||
+8
-7
@@ -255,7 +255,8 @@ void Play_Init(GameState* thisx) {
|
||||
this->cameraPtrs[CAM_ID_MAIN] = &this->mainCamera;
|
||||
this->cameraPtrs[CAM_ID_MAIN]->uid = 0;
|
||||
this->activeCamId = CAM_ID_MAIN;
|
||||
func_8005AC48(&this->mainCamera, 0xFF);
|
||||
Camera_OverwriteStateFlags(&this->mainCamera, CAM_STATE_0 | CAM_STATE_1 | CAM_STATE_2 | CAM_STATE_3 | CAM_STATE_4 |
|
||||
CAM_STATE_5 | CAM_STATE_6 | CAM_STATE_7);
|
||||
Sram_Init(this, &this->sramCtx);
|
||||
Regs_InitData(this);
|
||||
Message_Init(this);
|
||||
@@ -1539,9 +1540,9 @@ s32 Play_CameraSetAtEye(PlayState* this, s16 camId, Vec3f* at, Vec3f* eye) {
|
||||
Camera* camera = this->cameraPtrs[camIdx];
|
||||
Player* player;
|
||||
|
||||
ret |= Camera_SetParam(camera, 1, at);
|
||||
ret |= Camera_SetViewParam(camera, CAM_VIEW_AT, at);
|
||||
ret <<= 1;
|
||||
ret |= Camera_SetParam(camera, 2, eye);
|
||||
ret |= Camera_SetViewParam(camera, CAM_VIEW_EYE, eye);
|
||||
|
||||
camera->dist = Math3D_Vec3f_DistXYZ(at, eye);
|
||||
|
||||
@@ -1565,11 +1566,11 @@ s32 Play_CameraSetAtEyeUp(PlayState* this, s16 camId, Vec3f* at, Vec3f* eye, Vec
|
||||
Camera* camera = this->cameraPtrs[camIdx];
|
||||
Player* player;
|
||||
|
||||
ret |= Camera_SetParam(camera, 1, at);
|
||||
ret |= Camera_SetViewParam(camera, CAM_VIEW_AT, at);
|
||||
ret <<= 1;
|
||||
ret |= Camera_SetParam(camera, 2, eye);
|
||||
ret |= Camera_SetViewParam(camera, CAM_VIEW_EYE, eye);
|
||||
ret <<= 1;
|
||||
ret |= Camera_SetParam(camera, 4, up);
|
||||
ret |= Camera_SetViewParam(camera, CAM_VIEW_UP, up);
|
||||
|
||||
camera->dist = Math3D_Vec3f_DistXYZ(at, eye);
|
||||
|
||||
@@ -1588,7 +1589,7 @@ s32 Play_CameraSetAtEyeUp(PlayState* this, s16 camId, Vec3f* at, Vec3f* eye, Vec
|
||||
}
|
||||
|
||||
s32 Play_CameraSetFov(PlayState* this, s16 camId, f32 fov) {
|
||||
s32 ret = Camera_SetParam(this->cameraPtrs[camId], 0x20, &fov) & 1;
|
||||
s32 ret = Camera_SetViewParam(this->cameraPtrs[camId], CAM_VIEW_FOV, &fov) & 1;
|
||||
|
||||
if (1) {}
|
||||
return ret;
|
||||
|
||||
@@ -624,7 +624,7 @@ void func_8008EEAC(PlayState* play, Actor* actor) {
|
||||
this->unk_664 = actor;
|
||||
this->unk_684 = actor;
|
||||
this->stateFlags1 |= PLAYER_STATE1_16;
|
||||
Camera_SetParam(Play_GetCamera(play, CAM_ID_MAIN), 8, actor);
|
||||
Camera_SetViewParam(Play_GetCamera(play, CAM_ID_MAIN), CAM_VIEW_TARGET, actor);
|
||||
Camera_ChangeMode(Play_GetCamera(play, CAM_ID_MAIN), CAM_MODE_FOLLOWTARGET);
|
||||
}
|
||||
|
||||
|
||||
@@ -355,7 +355,7 @@ void func_8086C874(BgBdanObjects* this, PlayState* play) {
|
||||
if (DynaPolyActor_IsPlayerOnTop(&this->dyna)) {
|
||||
this->cameraSetting = play->cameraPtrs[CAM_ID_MAIN]->setting;
|
||||
Camera_ChangeSetting(play->cameraPtrs[CAM_ID_MAIN], CAM_SET_NORMAL2);
|
||||
func_8005AD1C(play->cameraPtrs[CAM_ID_MAIN], 4);
|
||||
Camera_UnsetStateFlag(play->cameraPtrs[CAM_ID_MAIN], CAM_STATE_2);
|
||||
this->switchFlag = 10;
|
||||
}
|
||||
} else {
|
||||
@@ -368,7 +368,7 @@ void func_8086C874(BgBdanObjects* this, PlayState* play) {
|
||||
if (this->switchFlag == 0) {
|
||||
if (1) {}
|
||||
Camera_ChangeSetting(play->cameraPtrs[CAM_ID_MAIN], this->cameraSetting);
|
||||
func_8005ACFC(play->cameraPtrs[CAM_ID_MAIN], 4);
|
||||
Camera_SetStateFlag(play->cameraPtrs[CAM_ID_MAIN], CAM_STATE_2);
|
||||
}
|
||||
}
|
||||
this->dyna.actor.world.pos.y =
|
||||
|
||||
@@ -641,7 +641,7 @@ void func_809BE26C(EnBigokuta* this, PlayState* play) {
|
||||
if (this->unk_198 == 0 && Math_StepToF(&this->actor.scale.y, 0.0f, 0.001f)) {
|
||||
Flags_SetClear(play, this->actor.room);
|
||||
Camera_ChangeSetting(play->cameraPtrs[CAM_ID_MAIN], CAM_SET_DUNGEON0);
|
||||
func_8005ACFC(play->cameraPtrs[CAM_ID_MAIN], 4);
|
||||
Camera_SetStateFlag(play->cameraPtrs[CAM_ID_MAIN], CAM_STATE_2);
|
||||
SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 50, NA_SE_EN_OCTAROCK_BUBLE);
|
||||
Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0xB0);
|
||||
Actor_Kill(&this->actor);
|
||||
@@ -778,7 +778,7 @@ void EnBigokuta_Update(Actor* thisx, PlayState* play2) {
|
||||
func_809BD2E4(this);
|
||||
func_809BE568(this);
|
||||
Camera_ChangeSetting(play->cameraPtrs[CAM_ID_MAIN], CAM_SET_BIG_OCTO);
|
||||
func_8005AD1C(play->cameraPtrs[CAM_ID_MAIN], 4);
|
||||
Camera_UnsetStateFlag(play->cameraPtrs[CAM_ID_MAIN], CAM_STATE_2);
|
||||
|
||||
if (this->cylinder[0].base.atFlags & AT_ON) {
|
||||
if (this->actionFunc != func_809BE058) {
|
||||
|
||||
@@ -1163,10 +1163,10 @@ s32 EnGo2_IsCameraModified(EnGo2* this, PlayState* play) {
|
||||
if ((this->actor.params & 0x1F) == GORON_DMT_BIGGORON) {
|
||||
if (EnGo2_IsWakingUp(this)) {
|
||||
Camera_ChangeSetting(mainCam, CAM_SET_DIRECTED_YAW);
|
||||
func_8005AD1C(mainCam, 4);
|
||||
Camera_UnsetStateFlag(mainCam, CAM_STATE_2);
|
||||
} else if (!EnGo2_IsWakingUp(this) && (mainCam->setting == CAM_SET_DIRECTED_YAW)) {
|
||||
Camera_ChangeSetting(mainCam, CAM_SET_DUNGEON1);
|
||||
func_8005ACFC(mainCam, 4);
|
||||
Camera_SetStateFlag(mainCam, CAM_STATE_2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1752,7 +1752,7 @@ void EnHorse_Inactive(EnHorse* this, PlayState* play2) {
|
||||
gSaveContext.horseData.sceneId = play->sceneId;
|
||||
|
||||
// Focus the camera on Epona
|
||||
Camera_SetParam(play->cameraPtrs[CAM_ID_MAIN], 8, this);
|
||||
Camera_SetViewParam(play->cameraPtrs[CAM_ID_MAIN], CAM_VIEW_TARGET, &this->actor);
|
||||
Camera_ChangeSetting(play->cameraPtrs[CAM_ID_MAIN], CAM_SET_TURN_AROUND);
|
||||
Camera_SetCameraData(play->cameraPtrs[CAM_ID_MAIN], 4, NULL, NULL, 0x51, 0, 0);
|
||||
}
|
||||
@@ -1826,7 +1826,7 @@ void EnHorse_Idle(EnHorse* this, PlayState* play) {
|
||||
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
||||
this->followTimer = 0;
|
||||
EnHorse_SetFollowAnimation(this, play);
|
||||
Camera_SetParam(play->cameraPtrs[CAM_ID_MAIN], 8, this);
|
||||
Camera_SetViewParam(play->cameraPtrs[CAM_ID_MAIN], CAM_VIEW_TARGET, &this->actor);
|
||||
Camera_ChangeSetting(play->cameraPtrs[CAM_ID_MAIN], CAM_SET_TURN_AROUND);
|
||||
Camera_SetCameraData(play->cameraPtrs[CAM_ID_MAIN], 4, NULL, NULL, 0x51, 0, 0);
|
||||
}
|
||||
|
||||
@@ -501,7 +501,7 @@ void ObjectKankyo_DrawFairies(Actor* thisx, PlayState* play2) {
|
||||
Vec3f vec2 = { 0.0f, 0.0f, 0.0f };
|
||||
s16 i;
|
||||
|
||||
if (!(play->cameraPtrs[CAM_ID_MAIN]->unk_14C & 0x100)) {
|
||||
if (!(play->cameraPtrs[CAM_ID_MAIN]->stateFlags & CAM_STATE_8)) {
|
||||
OPEN_DISPS(play->state.gfxCtx, "../z_object_kankyo.c", 807);
|
||||
POLY_XLU_DISP = Gfx_SetupDL(POLY_XLU_DISP, SETUPDL_20);
|
||||
gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gSun1Tex));
|
||||
@@ -596,7 +596,7 @@ void ObjectKankyo_DrawSnow(Actor* thisx, PlayState* play2) {
|
||||
s32 pad;
|
||||
s32 pad2;
|
||||
|
||||
if (!(play->cameraPtrs[CAM_ID_MAIN]->unk_14C & 0x100)) {
|
||||
if (!(play->cameraPtrs[CAM_ID_MAIN]->stateFlags & CAM_STATE_8)) {
|
||||
OPEN_DISPS(play->state.gfxCtx, "../z_object_kankyo.c", 958);
|
||||
if (play->envCtx.precipitation[PRECIP_SNOW_CUR] < play->envCtx.precipitation[PRECIP_SNOW_MAX]) {
|
||||
if (play->state.frames % 16 == 0) {
|
||||
|
||||
@@ -5321,7 +5321,7 @@ s32 func_8083B040(Player* this, PlayState* play) {
|
||||
func_80835EA4(play, (this->unk_6A8 != NULL) ? 0x5B : 0x5A);
|
||||
if (this->unk_6A8 != NULL) {
|
||||
this->stateFlags2 |= PLAYER_STATE2_25;
|
||||
Camera_SetParam(Play_GetCamera(play, CAM_ID_MAIN), 8, this->unk_6A8);
|
||||
Camera_SetViewParam(Play_GetCamera(play, CAM_ID_MAIN), CAM_VIEW_TARGET, this->unk_6A8);
|
||||
}
|
||||
}
|
||||
} else if (func_8083AD4C(play, this)) {
|
||||
@@ -9206,7 +9206,7 @@ void func_80845CA4(Player* this, PlayState* play) {
|
||||
temp = func_80845BA0(play, this, &sp34, sp30);
|
||||
|
||||
if ((this->unk_850 == 0) || ((temp == 0) && (this->linearVelocity == 0.0f) &&
|
||||
(Play_GetCamera(play, CAM_ID_MAIN)->unk_14C & 0x10))) {
|
||||
(Play_GetCamera(play, CAM_ID_MAIN)->stateFlags & CAM_STATE_4))) {
|
||||
|
||||
func_8005B1A4(Play_GetCamera(play, CAM_ID_MAIN));
|
||||
func_80845C68(play, gSaveContext.respawn[RESPAWN_MODE_DOWN].data);
|
||||
@@ -10230,7 +10230,7 @@ void Player_UpdateCamAndSeqModes(PlayState* play, Player* this) {
|
||||
} else if (!(this->stateFlags1 & PLAYER_STATE1_20)) {
|
||||
if ((this->actor.parent != NULL) && (this->stateFlags3 & PLAYER_STATE3_7)) {
|
||||
camMode = CAM_MODE_HOOKSHOT;
|
||||
Camera_SetParam(Play_GetCamera(play, CAM_ID_MAIN), 8, this->actor.parent);
|
||||
Camera_SetViewParam(Play_GetCamera(play, CAM_ID_MAIN), CAM_VIEW_TARGET, this->actor.parent);
|
||||
} else if (func_8084377C == this->func_674) {
|
||||
camMode = CAM_MODE_STILL;
|
||||
} else if (this->stateFlags2 & PLAYER_STATE2_8) {
|
||||
@@ -10247,12 +10247,12 @@ void Player_UpdateCamAndSeqModes(PlayState* play, Player* this) {
|
||||
} else {
|
||||
camMode = CAM_MODE_BATTLE;
|
||||
}
|
||||
Camera_SetParam(Play_GetCamera(play, CAM_ID_MAIN), 8, unk_664);
|
||||
Camera_SetViewParam(Play_GetCamera(play, CAM_ID_MAIN), CAM_VIEW_TARGET, unk_664);
|
||||
} else if (this->stateFlags1 & PLAYER_STATE1_12) {
|
||||
camMode = CAM_MODE_CHARGE;
|
||||
} else if (this->stateFlags1 & PLAYER_STATE1_25) {
|
||||
camMode = CAM_MODE_FOLLOWBOOMERANG;
|
||||
Camera_SetParam(Play_GetCamera(play, CAM_ID_MAIN), 8, this->boomerangActor);
|
||||
Camera_SetViewParam(Play_GetCamera(play, CAM_ID_MAIN), CAM_VIEW_TARGET, this->boomerangActor);
|
||||
} else if (this->stateFlags1 & (PLAYER_STATE1_13 | PLAYER_STATE1_14)) {
|
||||
if (func_80833B2C(this)) {
|
||||
camMode = CAM_MODE_HANGZ;
|
||||
@@ -12549,7 +12549,7 @@ void func_8084E3C4(Player* this, PlayState* play) {
|
||||
this->stateFlags1 &= ~PLAYER_STATE1_29;
|
||||
|
||||
func_80852FFC(play, NULL, 8);
|
||||
play->mainCamera.unk_14C &= ~8;
|
||||
play->mainCamera.stateFlags &= ~CAM_STATE_3;
|
||||
|
||||
this->stateFlags1 |= PLAYER_STATE1_28 | PLAYER_STATE1_29;
|
||||
this->stateFlags2 |= PLAYER_STATE2_27;
|
||||
|
||||
Reference in New Issue
Block a user