From 89f684b02622811b15d021ecb36e3fd2dadb00b7 Mon Sep 17 00:00:00 2001 From: Zelllll <56516451+Zelllll@users.noreply.github.com> Date: Sun, 4 Jul 2021 08:58:19 -0700 Subject: [PATCH] Change PreRenderContext to just be PreRender (#862) --- include/functions.h | 40 +++++++++--------- include/z64.h | 4 +- src/code/PreRender.c | 42 +++++++++---------- src/code/z_play.c | 24 +++++------ .../ovl_kaleido_scope/z_kaleido_scope_PAL.c | 16 +++---- 5 files changed, 63 insertions(+), 63 deletions(-) diff --git a/include/functions.h b/include/functions.h index 18c6b48053..ee4382a769 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1531,26 +1531,26 @@ s32 func_800C0CB8(GlobalContext* globalCtx); s32 FrameAdvance_IsEnabled(GlobalContext* globalCtx); s32 func_800C0D34(GlobalContext* globalCtx, Actor* actor, s16* yaw); s32 func_800C0DB4(GlobalContext* globalCtx, Vec3f* pos); -void PreRender_SetValuesSave(PreRenderContext* this, u32 width, u32 height, void* fbuf, void* zbuf, void* cvg); -void PreRender_Init(PreRenderContext* this); -void PreRender_SetValues(PreRenderContext* this, u32 width, u32 height, void* fbuf, void* zbuf); -void PreRender_Destroy(PreRenderContext* this); -void func_800C0F28(PreRenderContext* this, Gfx** gfxp, void* buf, void* bufSave); -void func_800C1258(PreRenderContext* this, Gfx** gfxp); -void func_800C170C(PreRenderContext* this, Gfx** gfxp, void* fbuf, void* fbufSave, u32 r, u32 g, u32 b, u32 a); -void func_800C1AE8(PreRenderContext* this, Gfx** gfxp, void* fbuf, void* fbufSave); -void func_800C1B24(PreRenderContext* this, Gfx** gfxp, void* fbuf, void* cvgSave); -void func_800C1E9C(PreRenderContext* this, Gfx** gfxp); -void func_800C1F20(PreRenderContext* this, Gfx** gfxp); -void func_800C1FA4(PreRenderContext* this, Gfx** gfxp); -void func_800C20B4(PreRenderContext* this, Gfx** gfxp); -void func_800C2118(PreRenderContext* this, Gfx** gfxp); -void func_800C213C(PreRenderContext* this, Gfx** gfxp); -void func_800C24BC(PreRenderContext* this, Gfx** gfxp); -void func_800C24E0(PreRenderContext* this, Gfx** gfxp); -void func_800C2500(PreRenderContext* this, s32 x, s32 y); -void func_800C2FE4(PreRenderContext* this); -void PreRender_Calc(PreRenderContext* this); +void PreRender_SetValuesSave(PreRender* this, u32 width, u32 height, void* fbuf, void* zbuf, void* cvg); +void PreRender_Init(PreRender* this); +void PreRender_SetValues(PreRender* this, u32 width, u32 height, void* fbuf, void* zbuf); +void PreRender_Destroy(PreRender* this); +void func_800C0F28(PreRender* this, Gfx** gfxp, void* buf, void* bufSave); +void func_800C1258(PreRender* this, Gfx** gfxp); +void func_800C170C(PreRender* this, Gfx** gfxp, void* fbuf, void* fbufSave, u32 r, u32 g, u32 b, u32 a); +void func_800C1AE8(PreRender* this, Gfx** gfxp, void* fbuf, void* fbufSave); +void func_800C1B24(PreRender* this, Gfx** gfxp, void* fbuf, void* cvgSave); +void func_800C1E9C(PreRender* this, Gfx** gfxp); +void func_800C1F20(PreRender* this, Gfx** gfxp); +void func_800C1FA4(PreRender* this, Gfx** gfxp); +void func_800C20B4(PreRender* this, Gfx** gfxp); +void func_800C2118(PreRender* this, Gfx** gfxp); +void func_800C213C(PreRender* this, Gfx** gfxp); +void func_800C24BC(PreRender* this, Gfx** gfxp); +void func_800C24E0(PreRender* this, Gfx** gfxp); +void func_800C2500(PreRender* this, s32 x, s32 y); +void func_800C2FE4(PreRender* this); +void PreRender_Calc(PreRender* this); void THGA_Ct(TwoHeadGfxArena* thga, Gfx* start, u32 size); void THGA_Dt(TwoHeadGfxArena* thga); u32 THGA_IsCrash(TwoHeadGfxArena* thga); diff --git a/include/z64.h b/include/z64.h index 450f553d5f..3acdb65a1f 100644 --- a/include/z64.h +++ b/include/z64.h @@ -795,7 +795,7 @@ typedef struct { /* 0x40 */ s32 lry; /* 0x44 */ ListAlloc alloc; /* 0x4C */ u32 unk_4C; -} PreRenderContext; // size = 0x50 +} PreRender; // size = 0x50 typedef struct { union { @@ -1012,7 +1012,7 @@ typedef struct GlobalContext { /* 0x11E5E */ u8 fadeTransition; /* 0x11E60 */ CollisionCheckContext colChkCtx; /* 0x120FC */ u16 envFlags[20]; - /* 0x12124 */ PreRenderContext preRenderCtx; + /* 0x12124 */ PreRender pauseBgPreRender; /* 0x12174 */ char unk_12174[0x53]; /* 0x121C7 */ s8 unk_121C7; /* 0x121C8 */ TransitionContext transitionCtx; diff --git a/src/code/PreRender.c b/src/code/PreRender.c index 38f3b28fe7..ec502596fa 100644 --- a/src/code/PreRender.c +++ b/src/code/PreRender.c @@ -1,7 +1,7 @@ #include "global.h" #include "alloca.h" -void PreRender_SetValuesSave(PreRenderContext* this, u32 width, u32 height, void* fbuf, void* zbuf, void* cvg) { +void PreRender_SetValuesSave(PreRender* this, u32 width, u32 height, void* fbuf, void* zbuf, void* cvg) { this->widthSave = width; this->heightSave = height; this->fbufSave = fbuf; @@ -13,12 +13,12 @@ void PreRender_SetValuesSave(PreRenderContext* this, u32 width, u32 height, void this->lrySave = height - 1; } -void PreRender_Init(PreRenderContext* this) { - bzero(this, sizeof(PreRenderContext)); +void PreRender_Init(PreRender* this) { + bzero(this, sizeof(PreRender)); ListAlloc_Init(&this->alloc); } -void PreRender_SetValues(PreRenderContext* this, u32 width, u32 height, void* fbuf, void* zbuf) { +void PreRender_SetValues(PreRender* this, u32 width, u32 height, void* fbuf, void* zbuf) { this->width = width; this->height = height; this->fbuf = fbuf; @@ -29,11 +29,11 @@ void PreRender_SetValues(PreRenderContext* this, u32 width, u32 height, void* fb this->lry = height - 1; } -void PreRender_Destroy(PreRenderContext* this) { +void PreRender_Destroy(PreRender* this) { ListAlloc_FreeAll(&this->alloc); } -void func_800C0F28(PreRenderContext* this, Gfx** gfxp, void* buf, void* bufSave) { +void func_800C0F28(PreRender* this, Gfx** gfxp, void* buf, void* bufSave) { Gfx* gfx; s32 x; s32 x2; @@ -81,7 +81,7 @@ void func_800C0F28(PreRenderContext* this, Gfx** gfxp, void* buf, void* bufSave) *gfxp = gfx; } -void func_800C1258(PreRenderContext* this, Gfx** gfxp) { +void func_800C1258(PreRender* this, Gfx** gfxp) { Gfx* gfx; s32 y; s32 y2; @@ -131,7 +131,7 @@ void func_800C1258(PreRenderContext* this, Gfx** gfxp) { *gfxp = gfx; } -void func_800C170C(PreRenderContext* this, Gfx** gfxp, void* fbuf, void* fbufSave, u32 r, u32 g, u32 b, u32 a) { +void func_800C170C(PreRender* this, Gfx** gfxp, void* fbuf, void* fbufSave, u32 r, u32 g, u32 b, u32 a) { Gfx* gfx; s32 x; s32 x2; @@ -183,11 +183,11 @@ void func_800C170C(PreRenderContext* this, Gfx** gfxp, void* fbuf, void* fbufSav *gfxp = gfx; } -void func_800C1AE8(PreRenderContext* this, Gfx** gfxp, void* fbuf, void* fbufSave) { +void func_800C1AE8(PreRender* this, Gfx** gfxp, void* fbuf, void* fbufSave) { func_800C170C(this, gfxp, fbuf, fbufSave, 255, 255, 255, 255); } -void func_800C1B24(PreRenderContext* this, Gfx** gfxp, void* fbuf, void* cvgSave) { +void func_800C1B24(PreRender* this, Gfx** gfxp, void* fbuf, void* cvgSave) { Gfx* gfx; s32 x; s32 x2; @@ -236,7 +236,7 @@ void func_800C1B24(PreRenderContext* this, Gfx** gfxp, void* fbuf, void* cvgSave *gfxp = gfx; } -void func_800C1E9C(PreRenderContext* this, Gfx** gfxp) { +void func_800C1E9C(PreRender* this, Gfx** gfxp) { LogUtils_CheckNullPointer("this->zbuf_save", this->zbufSave, "../PreRender.c", 481); LogUtils_CheckNullPointer("this->zbuf", this->zbuf, "../PreRender.c", 482); @@ -245,7 +245,7 @@ void func_800C1E9C(PreRenderContext* this, Gfx** gfxp) { } } -void func_800C1F20(PreRenderContext* this, Gfx** gfxp) { +void func_800C1F20(PreRender* this, Gfx** gfxp) { LogUtils_CheckNullPointer("this->fbuf_save", this->fbufSave, "../PreRender.c", 495); LogUtils_CheckNullPointer("this->fbuf", this->fbuf, "../PreRender.c", 496); @@ -254,7 +254,7 @@ void func_800C1F20(PreRenderContext* this, Gfx** gfxp) { } } -void func_800C1FA4(PreRenderContext* this, Gfx** gfxp) { +void func_800C1FA4(PreRender* this, Gfx** gfxp) { Gfx* gfx = *gfxp; gDPPipeSync(gfx++); @@ -271,7 +271,7 @@ void func_800C1FA4(PreRenderContext* this, Gfx** gfxp) { *gfxp = gfx; } -void func_800C20B4(PreRenderContext* this, Gfx** gfxp) { +void func_800C20B4(PreRender* this, Gfx** gfxp) { func_800C1FA4(this, gfxp); LogUtils_CheckNullPointer("this->cvg_save", this->cvgSave, "../PreRender.c", 532); if (this->cvgSave != NULL) { @@ -279,11 +279,11 @@ void func_800C20B4(PreRenderContext* this, Gfx** gfxp) { } } -void func_800C2118(PreRenderContext* this, Gfx** gfxp) { +void func_800C2118(PreRender* this, Gfx** gfxp) { func_800C0F28(this, gfxp, this->zbufSave, this->zbuf); } -void func_800C213C(PreRenderContext* this, Gfx** gfxp) { +void func_800C213C(PreRender* this, Gfx** gfxp) { Gfx* gfx; s32 y; s32 y2; @@ -341,15 +341,15 @@ void func_800C213C(PreRenderContext* this, Gfx** gfxp) { } } -void func_800C24BC(PreRenderContext* this, Gfx** gfxp) { +void func_800C24BC(PreRender* this, Gfx** gfxp) { func_800C0F28(this, gfxp, this->fbufSave, this->fbuf); } -void func_800C24E0(PreRenderContext* this, Gfx** gfxp) { +void func_800C24E0(PreRender* this, Gfx** gfxp) { func_800C1258(this, gfxp); } -void func_800C2500(PreRenderContext* this, s32 x, s32 y) { +void func_800C2500(PreRender* this, s32 x, s32 y) { s32 i; s32 j; s32 buffA[3 * 5]; @@ -469,7 +469,7 @@ void func_800C2500(PreRenderContext* this, s32 x, s32 y) { this->fbufSave[x + y * this->width] = pxOut.rgba; } -void func_800C2FE4(PreRenderContext* this) { +void func_800C2FE4(PreRender* this) { s32 x; s32 y; s32 phi_v0; @@ -539,7 +539,7 @@ void func_800C2FE4(PreRenderContext* this) { } } -void PreRender_Calc(PreRenderContext* this) { +void PreRender_Calc(PreRender* this) { s32 x; s32 y; diff --git a/src/code/z_play.c b/src/code/z_play.c index 56fb61faaa..6788a652b6 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -149,7 +149,7 @@ void Gameplay_Destroy(GameState* thisx) { SREG(91) = 0; R_PAUSE_MENU_MODE = 0; - PreRender_Destroy(&globalCtx->preRenderCtx); + PreRender_Destroy(&globalCtx->pauseBgPreRender); Effect_DeleteAll(globalCtx); EffectSs_ClearAll(globalCtx); CollisionCheck_DestroyContext(globalCtx, &globalCtx->colChkCtx); @@ -321,9 +321,9 @@ void Gameplay_Init(GameState* thisx) { SREG(91) = -1; R_PAUSE_MENU_MODE = 0; - PreRender_Init(&globalCtx->preRenderCtx); - PreRender_SetValuesSave(&globalCtx->preRenderCtx, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0, 0); - PreRender_SetValues(&globalCtx->preRenderCtx, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + PreRender_Init(&globalCtx->pauseBgPreRender); + PreRender_SetValuesSave(&globalCtx->pauseBgPreRender, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0, 0); + PreRender_SetValues(&globalCtx->pauseBgPreRender, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); gTrnsnUnkState = 0; globalCtx->transitionMode = 0; FrameAdvance_Init(&globalCtx->frameAdvCtx); @@ -1139,12 +1139,12 @@ void Gameplay_Draw(GlobalContext* globalCtx) { POLY_OPA_DISP = sp88; goto Gameplay_Draw_DrawOverlayElements; } else { - PreRender_SetValues(&globalCtx->preRenderCtx, SCREEN_WIDTH, SCREEN_HEIGHT, gfxCtx->curFrameBuffer, + PreRender_SetValues(&globalCtx->pauseBgPreRender, SCREEN_WIDTH, SCREEN_HEIGHT, gfxCtx->curFrameBuffer, gZBuffer); if (R_PAUSE_MENU_MODE == 2) { MsgEvent_SendNullTask(); - PreRender_Calc(&globalCtx->preRenderCtx); + PreRender_Calc(&globalCtx->pauseBgPreRender); R_PAUSE_MENU_MODE = 3; } else if (R_PAUSE_MENU_MODE >= 4) { R_PAUSE_MENU_MODE = 0; @@ -1153,7 +1153,7 @@ void Gameplay_Draw(GlobalContext* globalCtx) { if (R_PAUSE_MENU_MODE == 3) { Gfx* sp84 = POLY_OPA_DISP; - func_800C24BC(&globalCtx->preRenderCtx, &sp84); + func_800C24BC(&globalCtx->pauseBgPreRender, &sp84); POLY_OPA_DISP = sp84; goto Gameplay_Draw_DrawOverlayElements; } else { @@ -1271,12 +1271,12 @@ void Gameplay_Draw(GlobalContext* globalCtx) { Gfx* sp70 = OVERLAY_DISP; s32 pad[4]; - globalCtx->preRenderCtx.fbuf = gfxCtx->curFrameBuffer; - globalCtx->preRenderCtx.fbufSave = (u16*)gZBuffer; - func_800C1F20(&globalCtx->preRenderCtx, &sp70); + globalCtx->pauseBgPreRender.fbuf = gfxCtx->curFrameBuffer; + globalCtx->pauseBgPreRender.fbufSave = (u16*)gZBuffer; + func_800C1F20(&globalCtx->pauseBgPreRender, &sp70); if (R_PAUSE_MENU_MODE == 1) { - globalCtx->preRenderCtx.cvgSave = (u8*)gfxCtx->curFrameBuffer; - func_800C20B4(&globalCtx->preRenderCtx, &sp70); + globalCtx->pauseBgPreRender.cvgSave = (u8*)gfxCtx->curFrameBuffer; + func_800C20B4(&globalCtx->pauseBgPreRender, &sp70); R_PAUSE_MENU_MODE = 2; } else { gTrnsnUnkState = 2; diff --git a/src/overlays/actors/ovl_kaleido_scope/z_kaleido_scope_PAL.c b/src/overlays/actors/ovl_kaleido_scope/z_kaleido_scope_PAL.c index a99009ec38..e75448c03e 100644 --- a/src/overlays/actors/ovl_kaleido_scope/z_kaleido_scope_PAL.c +++ b/src/overlays/actors/ovl_kaleido_scope/z_kaleido_scope_PAL.c @@ -227,7 +227,7 @@ static void* sPromptChoiceTexs[][2] = { }; static u8 D_808321A8[5]; -static PreRenderContext sPlayerPreRenderCtx; +static PreRender sPlayerPreRender; static void* sPreRenderCvg; void KaleidoScope_SetupPlayerPreRender(GlobalContext* globalCtx) { @@ -243,9 +243,9 @@ void KaleidoScope_SetupPlayerPreRender(GlobalContext* globalCtx) { gfx = Graph_GfxPlusOne(gfxRef); gSPDisplayList(WORK_DISP++, gfx); - PreRender_SetValues(&sPlayerPreRenderCtx, 64, 112, fbuf, NULL); - func_800C1F20(&sPlayerPreRenderCtx, &gfx); - func_800C20B4(&sPlayerPreRenderCtx, &gfx); + PreRender_SetValues(&sPlayerPreRender, 64, 112, fbuf, NULL); + func_800C1F20(&sPlayerPreRender, &gfx); + func_800C20B4(&sPlayerPreRender, &gfx); gSPEndDisplayList(gfx++); Graph_BranchDlist(gfxRef, gfx); @@ -258,8 +258,8 @@ void KaleidoScope_SetupPlayerPreRender(GlobalContext* globalCtx) { void KaleidoScope_ProcessPlayerPreRender(void) { Sleep_Msec(50); - PreRender_Calc(&sPlayerPreRenderCtx); - PreRender_Destroy(&sPlayerPreRenderCtx); + PreRender_Calc(&sPlayerPreRender); + PreRender_Destroy(&sPlayerPreRender); } Gfx* KaleidoScope_QuadTextureIA4(Gfx* gfx, void* texture, s16 width, s16 height, u16 point) { @@ -2636,8 +2636,8 @@ void KaleidoScope_Update(GlobalContext* globalCtx) { sPreRenderCvg = (void*)(((u32)pauseCtx->nameSegment + 0x400 + 0xA00 + 0xF) & ~0xF); - PreRender_Init(&sPlayerPreRenderCtx); - PreRender_SetValuesSave(&sPlayerPreRenderCtx, 64, 112, pauseCtx->playerSegment, NULL, sPreRenderCvg); + PreRender_Init(&sPlayerPreRender); + PreRender_SetValuesSave(&sPlayerPreRender, 64, 112, pauseCtx->playerSegment, NULL, sPreRenderCvg); KaleidoScope_DrawPlayerWork(globalCtx); KaleidoScope_SetupPlayerPreRender(globalCtx);