Motion Blur

This commit is contained in:
Derek Hensley
2022-10-04 20:29:59 -07:00
parent a82d37825c
commit 4e809f1c17
17 changed files with 112 additions and 107 deletions
+5 -5
View File
@@ -554,7 +554,7 @@ void Cutscene_Command_SetTime(PlayState* play, CutsceneContext* csCtx, CsCmdDayT
void Cutscene_TerminatorImpl(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) {
csCtx->state = CS_STATE_4;
func_80165690();
Play_MotionBlurDisable();
Audio_SetCutsceneFlag(false);
gSaveContext.cutsceneTransitionControl = 1;
@@ -593,7 +593,7 @@ void Cutscene_Command_Terminator(PlayState* play, CutsceneContext* csCtx, CsCmdB
}
} else if (cmd->base == 2) {
if (csCtx->frames == cmd->startFrame) {
func_80165690();
Play_MotionBlurDisable();
switch (D_801F4DE2) {
case 0x1F:
@@ -763,16 +763,16 @@ void Cutscene_Command_ChooseCreditsScenes(PlayState* play, CutsceneContext* csCt
void Cutscene_Command_MotionBlur(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) {
if ((csCtx->frames >= cmd->startFrame) && (cmd->endFrame >= csCtx->frames)) {
if ((csCtx->frames == cmd->startFrame) && (cmd->base == 1)) {
func_8016566C(180);
Play_MotionBlurEnable(180);
}
if (cmd->base == 2) {
f32 progress = Environment_LerpWeight(cmd->endFrame, cmd->startFrame, csCtx->frames);
if (progress >= 0.9f) {
func_80165690();
Play_MotionBlurDisable();
} else {
func_80165658((1.0f - progress) * 180.0f);
Play_MotionBlurSetAlpha((1.0f - progress) * 180.0f);
}
}
}
+45 -45
View File
@@ -25,33 +25,38 @@ extern Struct_80140E80 D_801F6D38;
extern Struct_80140E80* D_801F6D4C;
extern HiresoStruct D_801F6D50;
extern u8 D_801F6DFC;
extern u8 D_801F6DFD; // motion blur "status"?
extern u8 sMotionBlurStatus;
// Draw Motion Blur
void func_80165460(PlayState* this) {
typedef enum {
/* 0 */ MOTION_BLUR_STOPPED,
/* 1 */ MOTION_BLUR_INITALIZING,
/* 2 */ MOTION_BLUR_RUNNING
} MotionBlurStatus;
void Play_MotionBlurDraw(PlayState* this) {
GraphicsContext* gfxCtx = this->state.gfxCtx;
s32 alpha;
Gfx* gfx;
Gfx* dlistHead;
if (SREG(93) != 0) {
alpha = SREG(92);
if (R_MOTION_BLUR_PRIORITY_ENABLED) {
alpha = R_MOTION_BLUR_PRIORITY_ALPHA;
if (D_801F6DFD == 0) {
D_801F6DFD = 1;
if (sMotionBlurStatus == MOTION_BLUR_STOPPED) {
sMotionBlurStatus = MOTION_BLUR_INITALIZING;
}
} else if (SREG(91) != 0) {
alpha = SREG(90);
} else if (R_MOTION_BLUR_ENABLED) {
alpha = R_MOTION_BLUR_ALPHA;
if (D_801F6DFD == 0) {
D_801F6DFD = 1;
if (sMotionBlurStatus == MOTION_BLUR_STOPPED) {
sMotionBlurStatus = MOTION_BLUR_INITALIZING;
}
} else {
alpha = 0;
D_801F6DFD = 0;
sMotionBlurStatus = MOTION_BLUR_STOPPED;
}
if (D_801F6DFD != 0) {
if (sMotionBlurStatus != MOTION_BLUR_STOPPED) {
OPEN_DISPS(gfxCtx);
dlistHead = POLY_OPA_DISP;
@@ -62,10 +67,10 @@ void func_80165460(PlayState* this) {
this->pauseBgPreRender.fbuf = gfxCtx->curFrameBuffer;
this->pauseBgPreRender.fbufSave = this->unk_18E64;
if (D_801F6DFD == 2) {
if (sMotionBlurStatus == MOTION_BLUR_RUNNING) {
func_80170AE0(&this->pauseBgPreRender, &gfx, alpha);
} else {
D_801F6DFD = 2;
sMotionBlurStatus = MOTION_BLUR_RUNNING;
}
func_801705B4(&this->pauseBgPreRender, &gfx);
@@ -80,34 +85,29 @@ void func_80165460(PlayState* this) {
}
}
// Motion Blur Init?
void func_80165608(void) {
SREG(91) = 0;
SREG(93) = 0;
D_801F6DFD = 0;
void Play_MotionBlurInit(void) {
R_MOTION_BLUR_ENABLED = false;
R_MOTION_BLUR_PRIORITY_ENABLED = false;
sMotionBlurStatus = MOTION_BLUR_STOPPED;
}
// Motion Blur Destroy?
void func_80165630(void) {
SREG(91) = 0;
SREG(93) = 0;
D_801F6DFD = 0;
void Play_MotionBlurDestroy(void) {
R_MOTION_BLUR_ENABLED = false;
R_MOTION_BLUR_PRIORITY_ENABLED = false;
sMotionBlurStatus = MOTION_BLUR_STOPPED;
}
// Sets Motion Blur Alpha
void func_80165658(u32 motionBlurAlpha) {
SREG(90) = motionBlurAlpha;
void Play_MotionBlurSetAlpha(u32 alpha) {
R_MOTION_BLUR_ALPHA = alpha;
}
// Sets Motion Blur Alpha and Enables
void func_8016566C(u32 motionBlurAlpha) {
SREG(90) = motionBlurAlpha;
SREG(91) = true;
void Play_MotionBlurEnable(u32 alpha) {
R_MOTION_BLUR_ALPHA = alpha;
R_MOTION_BLUR_ENABLED = true;
}
// Disables Motion Blur
void func_80165690(void) {
SREG(91) = false;
void Play_MotionBlurDisable(void) {
R_MOTION_BLUR_ENABLED = false;
}
void func_801656A4(void* arg0, u16* arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6, s32 arg7) {
@@ -193,17 +193,17 @@ void func_801656A4(void* arg0, u16* arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5
}
}
void func_80165DB8(s32 arg0) {
SREG(92) = arg0;
void Play_MotionBlurPrioritySetAlpha(u32 alpha) {
R_MOTION_BLUR_PRIORITY_ALPHA = alpha;
}
void func_80165DCC(s32 arg0) {
SREG(92) = arg0;
SREG(93) = 1;
void Play_MotionBlurPriorityEnable(u32 alpha) {
R_MOTION_BLUR_PRIORITY_ALPHA = alpha;
R_MOTION_BLUR_PRIORITY_ENABLED = true;
}
void func_80165DF0(void) {
SREG(93) = 0;
void Play_MotionBlurPriorityDisable(void) {
R_MOTION_BLUR_PRIORITY_ENABLED = false;
}
void func_80165E04(void) {
@@ -414,7 +414,7 @@ void Play_Destroy(GameState* thisx) {
func_8016FC98(&D_801F6D50);
this->state.gfxCtx->callback = NULL;
this->state.gfxCtx->callbackParam = 0;
func_80165630();
Play_MotionBlurDestroy();
if (SREG(94) != 0) {
PreRender_ApplyFiltersSlowlyDestroy(&this->pauseBgPreRender);
@@ -1376,7 +1376,7 @@ void Play_Draw(PlayState* this) {
}
DebugDisplay_DrawObjects(this);
func_80165460(this);
Play_MotionBlurDraw(this);
if (((SREG(94) == 1) || (gTrnsnUnkState == 1)) || (SREG(89) == 1)) {
Gfx* sp74;
@@ -2232,7 +2232,7 @@ void Play_Init(GameState* thisx) {
}
}
func_80165608();
Play_MotionBlurInit();
SREG(94) = 0;
SREG(89) = 0;
+2 -2
View File
@@ -1637,7 +1637,7 @@ void func_809DD934(Boss02* this, PlayState* play) {
this->subCamId = Play_CreateSubCamera(play);
Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT);
Play_ChangeCameraStatus(play, this->subCamId, CAM_STATUS_ACTIVE);
func_8016566C(150);
Play_MotionBlurEnable(150);
this->unk_1D14 = 0;
this->subCamAtVel = 0.0f;
this->unk_1D58 = 0.0f;
@@ -1757,7 +1757,7 @@ void func_809DD934(Boss02* this, PlayState* play) {
this->actor.flags |= ACTOR_FLAG_1;
player->stateFlags1 &= ~0x100;
this->unk_1D70 = 0.01f;
func_80165690();
Play_MotionBlurDisable();
break;
}
+8 -8
View File
@@ -784,7 +784,7 @@ void Boss03_CatchPlayer(Boss03* this, PlayState* play) {
player->unk_AE8 = 101;
player->actor.parent = NULL;
player->csMode = 0;
func_80165690();
Play_MotionBlurDisable();
}
func_809E344C(this, play);
@@ -856,7 +856,7 @@ void Boss03_ChewPlayer(Boss03* this, PlayState* play) {
this->unk_25C = 15;
if (this->workTimer[WORK_TIMER_CURRENT_ACTION] == 90) {
func_8016566C(0x96);
Play_MotionBlurEnable(0x96);
}
SkelAnime_Update(&this->skelAnime);
@@ -912,7 +912,7 @@ void Boss03_ChewPlayer(Boss03* this, PlayState* play) {
player->unk_AE8 = 101;
player->actor.parent = NULL;
player->csMode = 0;
func_80165690();
Play_MotionBlurDisable();
func_800B8D50(play, NULL, 10.0f, this->actor.shape.rot.y, 0.0f, 0x20);
}
@@ -1191,7 +1191,7 @@ void Boss03_IntroCutscene(Boss03* this, PlayState* play) {
this->csState = 2;
this->csTimer = 0;
this->unk_240 = 0;
func_8016566C(0x96);
Play_MotionBlurEnable(0x96);
this->subCamFov = 80.0f;
case 2:
@@ -1284,7 +1284,7 @@ void Boss03_IntroCutscene(Boss03* this, PlayState* play) {
this->actor.speedXZ = -200.0f;
Actor_MoveWithoutGravityReverse(&this->actor);
this->actor.world.pos.y = this->waterHeight - 150.0f;
func_80165690();
Play_MotionBlurDisable();
case 5:
SkelAnime_Update(&this->skelAnime);
@@ -1631,7 +1631,7 @@ void Boss03_DeathCutscene(Boss03* this, PlayState* play) {
Cutscene_End(play, &play->csCtx);
func_800B7298(play, &this->actor, 6);
this->csState = 3;
func_80165690();
Play_MotionBlurDisable();
Boss03_PlayUnderwaterSfx(&this->actor.projectedPos, NA_SE_EN_KONB_INIT_OLD);
Boss03_PlayUnderwaterSfx(&D_809E9848, NA_SE_EN_KONB_INIT_OLD);
}
@@ -1755,7 +1755,7 @@ void Boss03_SetupStunned(Boss03* this, PlayState* play) {
player->unk_AE8 = 101;
player->actor.parent = NULL;
player->csMode = 0;
func_80165690();
Play_MotionBlurDisable();
}
this->unk_240 = 0;
@@ -1907,7 +1907,7 @@ void Boss03_UpdateCollision(Boss03* this, PlayState* play) {
player->unk_AE8 = 101;
player->actor.parent = NULL;
player->csMode = 0;
func_80165690();
Play_MotionBlurDisable();
}
continue;
+2 -2
View File
@@ -271,7 +271,7 @@ void func_809EC568(Boss04* this, PlayState* play) {
Math_Vec3f_Copy(&this->subCamEye, &player->actor.world.pos);
this->subCamEye.y += 100.0f;
Math_Vec3f_Copy(&this->subCamAt, &this->actor.world.pos);
func_8016566C(150);
Play_MotionBlurEnable(150);
this->subCamFov = 60.0f;
boss = play->actorCtx.actorLists[ACTORCAT_BOSS].first;
@@ -391,7 +391,7 @@ void func_809EC568(Boss04* this, PlayState* play) {
this->subCamId = SUB_CAM_ID_DONE;
Cutscene_End(play, &play->csCtx);
func_800B7298(play, &this->actor, 6);
func_80165690();
Play_MotionBlurDisable();
gSaveContext.eventInf[6] |= 1;
}
break;
+5 -5
View File
@@ -170,7 +170,7 @@ void EnGs_Destroy(Actor* thisx, PlayState* play) {
EnGs* this = THIS;
Collider_DestroyCylinder(play, &this->collider);
func_80165690();
Play_MotionBlurDisable();
}
void func_80997D14(EnGs* this, PlayState* play) {
@@ -902,16 +902,16 @@ void func_80999AC0(EnGs* this) {
void func_80999B34(EnGs* this) {
if (this->unk_216 > 0) {
if (this->unk_218 == 0) {
func_8016566C(this->unk_216);
Play_MotionBlurEnable(this->unk_216);
this->unk_218 = this->unk_216;
} else {
func_80165658(this->unk_218);
Play_MotionBlurSetAlpha(this->unk_218);
}
} else if (this->unk_218 > 0) {
Math_StepToS(&this->unk_218, this->unk_216, 20);
func_80165658(this->unk_218);
Play_MotionBlurSetAlpha(this->unk_218);
if (this->unk_218 <= 0) {
func_80165690();
Play_MotionBlurDisable();
}
}
}
+2 -2
View File
@@ -110,7 +110,7 @@ void EnJs_Init(Actor* thisx, PlayState* play) {
this->actionFunc = func_8096A6F4;
Animation_PlayLoop(&this->skelAnime, &gMoonChildSittingAnim);
func_8016566C(0x3C);
Play_MotionBlurEnable(0x3C);
if (gSaveContext.save.weekEventReg[84] & 0x20) {
Inventory_DeleteItem(ITEM_MASK_FIERCE_DEITY, SLOT(ITEM_MASK_FIERCE_DEITY));
@@ -151,7 +151,7 @@ void EnJs_Destroy(Actor* thisx, PlayState* play) {
paramsF = ENJS_GET_TYPE(&this->actor);
switch (paramsF) {
case 0:
func_80165690();
Play_MotionBlurDisable();
break;
case 5:
case 6:
@@ -813,7 +813,7 @@ void EnKakasi_SetupDanceNightAway(EnKakasi* this) {
this->subCamFovNext = 60.0f;
EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_TWIRL);
Math_Vec3f_Copy(&this->unk22C, &this->picto.actor.home.pos);
func_8016566C(0xB4);
Play_MotionBlurEnable(0xB4);
this->actionFunc = EnKakasi_DancingNightAway;
}
@@ -917,7 +917,7 @@ void EnKakasi_DancingNightAway(EnKakasi* this, PlayState* play) {
this->unk204 = 0xA;
if (this->unk190 == 0xE) {
func_800B7298(play, &this->picto.actor, 0x49);
func_80165690();
Play_MotionBlurDisable();
this->unk204 = 0x14;
}
}
@@ -184,11 +184,11 @@ void func_80A90730(EnTest6* this, PlayState* play) {
}
void func_80A90C08(s16 arg0) {
func_8016566C(arg0);
Play_MotionBlurEnable(arg0);
}
void func_80A90C34(void) {
func_80165690();
Play_MotionBlurDisable();
}
void func_80A90C54(PlayState* play, f32 arg1) {
@@ -461,7 +461,7 @@ void func_80AF1A2C(EnTest7* this, PlayState* play) {
func_80AF082C(this, func_80AF1CA0);
this->unk_144 |= 0x20;
Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_PL_WARP_WING_OPEN);
func_8016566C(0x78);
Play_MotionBlurEnable(0x78);
}
}
@@ -602,7 +602,7 @@ void func_80AF2030(EnTest7* this, PlayState* play) {
play->unk_18844 = false;
this->unk_144 &= ~4;
func_80AF082C(this, func_80AF21E8);
func_80165690();
Play_MotionBlurDisable();
}
}
@@ -157,7 +157,7 @@ void EnWarpTag_RespawnPlayer(EnWarptag* this, PlayState* play) {
} else {
ActorCutscene_StartAndSetUnkLinkFields(play->playerActorCsIds[4], &this->dyna.actor);
func_800B8E58(player, NA_SE_PL_WARP_PLATE);
func_8016566C(0);
Play_MotionBlurEnable(0);
}
} else {
@@ -215,7 +215,7 @@ void EnWarpTag_RespawnPlayer(EnWarptag* this, PlayState* play) {
Play_TriggerVoidOut(&play->state);
gSaveContext.respawnFlag = ~0x4;
func_80165690();
Play_MotionBlurDisable();
}
}
@@ -224,7 +224,7 @@ void EnWarpTag_RespawnPlayer(EnWarptag* this, PlayState* play) {
if (new15E < 0) {
new15E = 0;
}
func_80165658(new15E * 0.04f); // unknown Play_ function
Play_MotionBlurSetAlpha(new15E * 0.04f); // unknown Play_ function
}
}
@@ -67,7 +67,7 @@ void func_808A7AAC(ObjWturn* this, PlayState* play) {
Vec3f subCamAt;
ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor);
func_8016566C(140);
Play_MotionBlurEnable(140);
this->subCamId = ActorCutscene_GetCurrentSubCamId(this->actor.cutscene);
func_800B7298(play, &this->actor, 21);
subCamAt.x = player->actor.focus.pos.x;
@@ -96,7 +96,7 @@ void func_808A7C04(ObjWturn* this, PlayState* play) {
func_800B7298(play, &this->actor, 0x54);
func_800B8E58(player, NA_SE_VO_NAVY_ENEMY);
this->unk_14A = 0;
func_80165690();
Play_MotionBlurDisable();
this->actionFunc = func_808A7C78;
}