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:
engineer124
2022-12-04 23:02:24 -05:00
committed by GitHub
parent da2e8a8f2c
commit 8ff58118b3
15 changed files with 1091 additions and 673 deletions
+390 -351
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -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
View File
@@ -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;
+2 -2
View File
@@ -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
View File
@@ -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;
+1 -1
View File
@@ -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);
}