From 81a3c3da32033c22fa59f0b3065a302eaac02a04 Mon Sep 17 00:00:00 2001 From: engineer124 <47598039+engineer124@users.noreply.github.com> Date: Sun, 19 Nov 2023 12:17:32 +1100 Subject: More Camera Flags (#1453) * 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 * More Camera Flags * PR Suggestions * More flag style change * Small cleanup * More flag docs * Another flag * Fix flags * 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 * cleanup * fix macro arg * fix func declaration * many more docs * better docs? * missed some * oops, revert * add flags to name * cleanup * flag * double signal * simplify cam func name * more suggestions * PR Suggestion --- docs/tutorial/other_functions.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'docs/tutorial') diff --git a/docs/tutorial/other_functions.md b/docs/tutorial/other_functions.md index ec886e175..9c1916ee6 100644 --- a/docs/tutorial/other_functions.md +++ b/docs/tutorial/other_functions.md @@ -380,7 +380,7 @@ void func_80A87CEC(EnJj *this, PlayState *play) { play->csCtx.script = &D_80A88164; gSaveContext.cutsceneTrigger = (u8)1U; func_8003EBF8(play, &play->colCtx.dyna, (s32) temp_v1->bgId); - func_8005B1A4(play->cameraPtrs[play->activeCamId]); + Camera_SetFinishedFlag(play->cameraPtrs[play->activeCamId]); gSaveContext.unkEDA = (u16) (gSaveContext.unkEDA | 0x400); Sfx_PlaySfxCentered((u16)0x4802U); } @@ -396,7 +396,7 @@ Easy things to sort out: - `play->cameraPtrs[play->activeCamId]` has a macro: it is `GET_ACTIVE_CAM(play)`, so this line can be written as ```C -func_8005B1A4(GET_ACTIVE_CAM(play)); +Camera_SetFinishedFlag(GET_ACTIVE_CAM(play)); ``` - `gSaveContext.unkEDA` we have dealt with before: it is `gSaveContext.save.info.eventChkInf[3]`. This is a flag-setting function; it can be written more compactly as @@ -418,13 +418,13 @@ void func_80A87CEC(EnJj *this, PlayState *play) { play->csCtx.script = &D_80A88164; gSaveContext.cutsceneTrigger = 1; func_8003EBF8(play, &play->colCtx.dyna, child->bgId); - func_8005B1A4(GET_ACTIVE_CAM(play)); + Camera_SetFinishedFlag(GET_ACTIVE_CAM(play)); gSaveContext.save.info.eventChkInf[3] |= 0x400; Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME); } ``` -matches, but generates a complier warning for `func_8005B1A4`, which it can't find. To fix this, add it to `functions.h`, in as near as possible the correct position in numerical order. Some detective work with VSCode's Search shows that this function lives in `z_camera.c`, and its prototype is `s16 func_8005B1A4(Camera* camera)`, so add this line to `functions.h` at the bottom of the camera functions part. +matches, but generates a complier warning for `Camera_SetFinishedFlag`, which it can't find. To fix this, add it to `functions.h`, in as near as possible the correct position in numerical order. Some detective work with VSCode's Search shows that this function lives in `z_camera.c`, and its prototype is `s16 Camera_SetFinishedFlag(Camera* camera)`, so add this line to `functions.h` at the bottom of the camera functions part. Lastly, we prefer to limit use of early `return`s, and use `else`s instead if possible. That applies here: the function can be rewritten as ```C @@ -437,7 +437,7 @@ void func_80A87CEC(EnJj* this, PlayState* play) { play->csCtx.script = &D_80A88164; gSaveContext.cutsceneTrigger = 1; func_8003EBF8(play, &play->colCtx.dyna, child->bgId); - func_8005B1A4(GET_ACTIVE_CAM(play)); + Camera_SetFinishedFlag(GET_ACTIVE_CAM(play)); gSaveContext.save.info.eventChkInf[3] |= 0x400; Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME); } -- cgit v1.2.3