Animation Cleanup: En_V* and En_W* (#1713)

* begin anim v and w

* structs

* bgId

* cleanup

* space

* more cleanup

* spacing

* Unsigned
This commit is contained in:
engineer124
2024-10-17 00:13:25 +11:00
committed by GitHub
parent 4a3f9b0f6b
commit 5dd4310285
85 changed files with 490 additions and 476 deletions
+38 -38
View File
@@ -59,8 +59,8 @@ void PreRender_Destroy(PreRender* this) {
ListAlloc_FreeAll(&this->alloc);
}
void PreRender_CopyImage(PreRender* this, Gfx** gfxp, void* img, void* imgDst, u32 useThresholdAlphaCompare) {
Gfx* gfx = *gfxp;
void PreRender_CopyImage(PreRender* this, Gfx** gfxP, void* img, void* imgDst, u32 useThresholdAlphaCompare) {
Gfx* gfx = *gfxP;
u32 flags;
gDPPipeSync(gfx++);
@@ -77,15 +77,15 @@ void PreRender_CopyImage(PreRender* this, Gfx** gfxp, void* img, void* imgDst, u
gDPPipeSync(gfx++);
gDPSetColorImage(gfx++, G_IM_FMT_RGBA, G_IM_SIZ_16b, this->width, this->fbuf);
*gfxp = gfx;
*gfxP = gfx;
}
void PreRender_RestoreBuffer(PreRender* this, Gfx** gfxp, void* buf, void* bufSave) {
PreRender_CopyImage(this, gfxp, buf, bufSave, false);
void PreRender_RestoreBuffer(PreRender* this, Gfx** gfxP, void* buf, void* bufSave) {
PreRender_CopyImage(this, gfxP, buf, bufSave, false);
}
void func_8016FF90(PreRender* this, Gfx** gfxp, void* buf, void* bufSave, s32 envR, s32 envG, s32 envB, s32 envA) {
Gfx* gfx = *gfxp;
void func_8016FF90(PreRender* this, Gfx** gfxP, void* buf, void* bufSave, s32 envR, s32 envG, s32 envB, s32 envA) {
Gfx* gfx = *gfxP;
gDPPipeSync(gfx++);
@@ -113,23 +113,23 @@ void func_8016FF90(PreRender* this, Gfx** gfxp, void* buf, void* bufSave, s32 en
gDPPipeSync(gfx++);
gDPSetColorImage(gfx++, G_IM_FMT_RGBA, G_IM_SIZ_16b, this->width, this->fbuf);
*gfxp = gfx;
*gfxP = gfx;
}
void func_80170200(PreRender* this, Gfx** gfxp, void* buf, void* bufSave) {
func_8016FF90(this, gfxp, buf, bufSave, 255, 255, 255, 255);
void func_80170200(PreRender* this, Gfx** gfxP, void* buf, void* bufSave) {
func_8016FF90(this, gfxP, buf, bufSave, 255, 255, 255, 255);
}
/**
* Reads the coverage values stored in the RGBA16 format `img` with dimensions `this->width`, `this->height` and
* converts it to an 8-bpp intensity image.
*
* @param gfxp Display list pointer
* @param gfxP Display list pointer
* @param img Image to read coverage from
* @param cvgDst Buffer to store coverage into
*/
void PreRender_CoverageRgba16ToI8(PreRender* this, Gfx** gfxp, void* img, void* cvgDst) {
Gfx* gfx = *gfxp;
void PreRender_CoverageRgba16ToI8(PreRender* this, Gfx** gfxP, void* img, void* cvgDst) {
Gfx* gfx = *gfxP;
s32 rowsRemaining;
s32 curRow;
s32 nRows;
@@ -202,24 +202,24 @@ void PreRender_CoverageRgba16ToI8(PreRender* this, Gfx** gfxp, void* img, void*
gDPPipeSync(gfx++);
gDPSetColorImage(gfx++, G_IM_FMT_RGBA, G_IM_SIZ_16b, this->width, this->fbuf);
*gfxp = gfx;
*gfxP = gfx;
}
/**
* Saves zbuf to zbufSave
*/
void PreRender_SaveZBuffer(PreRender* this, Gfx** gfxp) {
void PreRender_SaveZBuffer(PreRender* this, Gfx** gfxP) {
if ((this->zbufSave != NULL) && (this->zbuf != NULL)) {
PreRender_RestoreBuffer(this, gfxp, this->zbuf, this->zbufSave);
PreRender_RestoreBuffer(this, gfxP, this->zbuf, this->zbufSave);
}
}
/**
* Saves fbuf to fbufSave
*/
void PreRender_SaveFramebuffer(PreRender* this, Gfx** gfxp) {
void PreRender_SaveFramebuffer(PreRender* this, Gfx** gfxP) {
if ((this->fbufSave != NULL) && (this->fbuf != NULL)) {
func_80170200(this, gfxp, this->fbuf, this->fbufSave);
func_80170200(this, gfxP, this->fbuf, this->fbufSave);
}
}
@@ -227,8 +227,8 @@ void PreRender_SaveFramebuffer(PreRender* this, Gfx** gfxp) {
* Fetches the coverage of the current framebuffer into an image of the same format as the current color image, storing
* it over the framebuffer in memory.
*/
void PreRender_FetchFbufCoverage(PreRender* this, Gfx** gfxp) {
Gfx* gfx = *gfxp;
void PreRender_FetchFbufCoverage(PreRender* this, Gfx** gfxP) {
Gfx* gfx = *gfxP;
gDPPipeSync(gfx++);
// Set the blend color to full white and set maximum depth
@@ -257,33 +257,33 @@ void PreRender_FetchFbufCoverage(PreRender* this, Gfx** gfxp) {
gDPFillRectangle(gfx++, 0, 0, this->width, this->height);
gDPPipeSync(gfx++);
*gfxp = gfx;
*gfxP = gfx;
}
/**
* Draws the coverage of the current framebuffer `this->fbuf` to an I8 image at `this->cvgSave`. Overwrites
* `this->fbuf` in the process.
*/
void PreRender_DrawCoverage(PreRender* this, Gfx** gfxp) {
PreRender_FetchFbufCoverage(this, gfxp);
void PreRender_DrawCoverage(PreRender* this, Gfx** gfxP) {
PreRender_FetchFbufCoverage(this, gfxP);
if (this->cvgSave != NULL) {
PreRender_CoverageRgba16ToI8(this, gfxp, this->fbuf, this->cvgSave);
PreRender_CoverageRgba16ToI8(this, gfxP, this->fbuf, this->cvgSave);
}
}
/**
* Restores zbufSave to zbuf
*/
void PreRender_RestoreZBuffer(PreRender* this, Gfx** gfxp) {
PreRender_RestoreBuffer(this, gfxp, this->zbufSave, this->zbuf);
void PreRender_RestoreZBuffer(PreRender* this, Gfx** gfxP) {
PreRender_RestoreBuffer(this, gfxP, this->zbufSave, this->zbuf);
}
/**
* Draws a full-screen image to the current framebuffer, that sources the rgb channel from `this->fbufSave` and
* the alpha channel from `this->cvgSave` modulated by environment color.
*/
void func_80170798(PreRender* this, Gfx** gfxp) {
void func_80170798(PreRender* this, Gfx** gfxP) {
Gfx* gfx;
s32 rowsRemaining;
s32 curRow;
@@ -291,7 +291,7 @@ void func_80170798(PreRender* this, Gfx** gfxp) {
s32 rtile = 1;
if (this->cvgSave != NULL) {
gfx = *gfxp;
gfx = *gfxP;
gDPPipeSync(gfx++);
gDPSetEnvColor(gfx++, 255, 255, 255, 32);
@@ -347,19 +347,19 @@ void func_80170798(PreRender* this, Gfx** gfxp) {
}
gDPPipeSync(gfx++);
*gfxp = gfx;
*gfxP = gfx;
}
}
void func_80170AE0(PreRender* this, Gfx** gfxp, s32 alpha) {
func_8016FF90(this, gfxp, this->fbufSave, this->fbuf, 255, 255, 255, alpha);
void func_80170AE0(PreRender* this, Gfx** gfxP, s32 alpha) {
func_8016FF90(this, gfxP, this->fbufSave, this->fbuf, 255, 255, 255, alpha);
}
/**
* Copies fbufSave to fbuf
*/
void PreRender_RestoreFramebuffer(PreRender* this, Gfx** gfxp) {
PreRender_RestoreBuffer(this, gfxp, this->fbufSave, this->fbuf);
void PreRender_RestoreFramebuffer(PreRender* this, Gfx** gfxP) {
PreRender_RestoreBuffer(this, gfxP, this->fbufSave, this->fbuf);
}
/**
@@ -759,7 +759,7 @@ typedef struct {
/* 0x24 */ u32 flags;
} PreRenderBackground2DParams; // size = 0x28
void Prerender_DrawBackground2DImpl(PreRenderBackground2DParams* bg2D, Gfx** gfxp) {
void Prerender_DrawBackground2DImpl(PreRenderBackground2DParams* bg2D, Gfx** gfxP) {
Gfx* gfx;
uObjBg* bg;
u32 alphaCompare;
@@ -769,7 +769,7 @@ void Prerender_DrawBackground2DImpl(PreRenderBackground2DParams* bg2D, Gfx** gfx
loadS2DEX2 = (bg2D->flags & BG2D_FLAGS_LOAD_S2DEX2) != 0;
alphaCompare = (bg2D->flags & BG2D_FLAGS_AC_THRESHOLD) ? G_AC_THRESHOLD : G_AC_NONE;
gfxTemp = *gfxp;
gfxTemp = *gfxP;
bg = Gfx_Alloc(&gfxTemp, sizeof(uObjBg));
gfx = gfxTemp;
@@ -837,10 +837,10 @@ void Prerender_DrawBackground2DImpl(PreRenderBackground2DParams* bg2D, Gfx** gfx
gSPLoadUcode(gfx++, SysUcode_GetUCode(), SysUcode_GetUCodeData());
}
*gfxp = gfx;
*gfxP = gfx;
}
void Prerender_DrawBackground2D(Gfx** gfxp, void* timg, void* tlut, u16 width, u16 height, u8 fmt, u8 siz, u16 tt,
void Prerender_DrawBackground2D(Gfx** gfxP, void* timg, void* tlut, u16 width, u16 height, u8 fmt, u8 siz, u16 tt,
u16 tlutCount, f32 x, f32 y, f32 xScale, f32 yScale, u32 flags) {
PreRenderBackground2DParams bg2D;
PreRenderBackground2DParams* bg2DPtr = &bg2D;
@@ -859,5 +859,5 @@ void Prerender_DrawBackground2D(Gfx** gfxp, void* timg, void* tlut, u16 width, u
bg2D.yScale = yScale;
bg2D.flags = flags;
Prerender_DrawBackground2DImpl(bg2DPtr, gfxp);
Prerender_DrawBackground2DImpl(bg2DPtr, gfxP);
}
+4 -3
View File
@@ -2773,12 +2773,13 @@ void DynaPoly_EnableFloorCollision(PlayState* play, DynaCollisionContext* dyna,
void DynaPoly_DeleteBgActor(PlayState* play, DynaCollisionContext* dyna, s32 bgId) {
DynaPolyActor* actor;
if (DynaPoly_IsBgIdBgActor(bgId) == false) {
if (!DynaPoly_IsBgIdBgActor(bgId)) {
return;
}
actor = DynaPoly_GetActor(&play->colCtx, bgId);
if (actor != NULL) {
actor = DynaPoly_GetActor(&play->colCtx, bgId);
if (actor != NULL) {
actor->bgId = BGACTOR_NEG_ONE;
dyna->bgActors[bgId].actor = NULL;
dyna->bgActorFlags[bgId] |= BGACTOR_1;
+5 -4
View File
@@ -558,8 +558,8 @@ s32 func_800CBC84(Camera* camera, Vec3f* from, CameraCollision* to, s32 arg3) {
toPoint.y = to->pos.y + fromToNorm.y;
toPoint.z = to->pos.z + fromToNorm.z;
if (!BgCheck_CameraLineTest1(colCtx, from, &toPoint, &toNewPos, &to->poly, (arg3 & 1) ? 0 : 1, 1,
(arg3 & 2) ? 0 : 1, -1, &floorBgId)) {
if (!BgCheck_CameraLineTest1(colCtx, from, &toPoint, &toNewPos, &to->poly, (arg3 & 1) ? false : true, true,
(arg3 & 2) ? false : true, -1, &floorBgId)) {
toNewPos = to->pos;
toNewPos.y += 5.0f;
@@ -618,7 +618,8 @@ s32 Camera_BgCheckInfo(Camera* camera, Vec3f* from, CameraCollision* to) {
Vec3f toNewPos;
Vec3f fromToNorm;
if (BgCheck_CameraLineTest1(&camera->play->colCtx, from, &to->pos, &toNewPos, &to->poly, 1, 1, 1, -1, &to->bgId)) {
if (BgCheck_CameraLineTest1(&camera->play->colCtx, from, &to->pos, &toNewPos, &to->poly, true, true, true, -1,
&to->bgId)) {
floorPoly = to->poly;
to->norm.x = COLPOLY_GET_NORMAL(floorPoly->normal.x);
to->norm.y = COLPOLY_GET_NORMAL(floorPoly->normal.y);
@@ -665,7 +666,7 @@ s32 Camera_CheckOOB(Camera* camera, Vec3f* from, Vec3f* to) {
CollisionContext* colCtx = &camera->play->colCtx;
poly = NULL;
if ((BgCheck_CameraLineTest1(colCtx, from, to, &intersect, &poly, 1, 1, 1, 0, &bgId)) &&
if (BgCheck_CameraLineTest1(colCtx, from, to, &intersect, &poly, true, true, true, 0, &bgId) &&
(CollisionPoly_GetPointDistanceFromPlane(poly, from) < 0.0f)) {
return true;
}
+7 -7
View File
@@ -28,7 +28,7 @@ void TransitionCircle_Destroy(void* thisx);
void TransitionCircle_Update(void* thisx, s32 updateRate);
void TransitionCircle_SetColor(void* thisx, u32 color);
void TransitionCircle_SetType(void* thisx, s32 type);
void TransitionCircle_Draw(void* thisx, Gfx** gfxp);
void TransitionCircle_Draw(void* thisx, Gfx** gfxP);
s32 TransitionCircle_IsDone(void* thisx);
TransitionProfile TransitionCircle_Profile = {
@@ -93,9 +93,9 @@ void TransitionCircle_SetType(void* thisx, s32 type) {
}
}
void TransitionCircle_LoadAndSetTexture(Gfx** gfxp, void const* texture, s32 fmt, s32 arg3, s32 masks, s32 maskt,
void TransitionCircle_LoadAndSetTexture(Gfx** gfxP, void const* texture, s32 fmt, s32 arg3, s32 masks, s32 maskt,
f32 arg6) {
Gfx* gfx = *gfxp;
Gfx* gfx = *gfxP;
s32 xh = gCfbWidth;
s32 yh = gCfbHeight;
s32 width = 1 << masks;
@@ -132,11 +132,11 @@ void TransitionCircle_LoadAndSetTexture(Gfx** gfxp, void const* texture, s32 fmt
dtdy);
gDPPipeSync(gfx++);
*gfxp = gfx;
*gfxP = gfx;
}
void TransitionCircle_Draw(void* thisx, Gfx** gfxp) {
Gfx* gfx = *gfxp;
void TransitionCircle_Draw(void* thisx, Gfx** gfxP) {
Gfx* gfx = *gfxP;
TransitionCircle* this = (TransitionCircle*)thisx;
gDPPipeSync(gfx++);
@@ -153,7 +153,7 @@ void TransitionCircle_Draw(void* thisx, Gfx** gfxp) {
this->referenceRadius);
gDPPipeSync(gfx++);
*gfxp = gfx;
*gfxP = gfx;
}
s32 TransitionCircle_IsDone(void* thisx) {
+3 -3
View File
@@ -3124,8 +3124,8 @@ void Environment_SetupSkyboxStars(PlayState* play) {
}
}
void Environment_DrawSkyboxStar(Gfx** gfxp, f32 x, f32 y, s32 width, s32 height) {
Gfx* gfx = *gfxp;
void Environment_DrawSkyboxStar(Gfx** gfxP, f32 x, f32 y, s32 width, s32 height) {
Gfx* gfx = *gfxP;
u32 xl = x * 4.0f;
u32 yl = y * 4.0f;
u32 xd = width;
@@ -3133,7 +3133,7 @@ void Environment_DrawSkyboxStar(Gfx** gfxp, f32 x, f32 y, s32 width, s32 height)
gSPTextureRectangle(gfx++, xl, yl, xl + xd, yl + yd, 0, 0, 0, 0, 0);
*gfxp = gfx;
*gfxP = gfx;
}
void Environment_DrawSkyboxStarsImpl(PlayState* play, Gfx** gfxP) {
+12 -12
View File
@@ -908,8 +908,8 @@ Gfx* Gfx_SetupDL(Gfx* gfx, u32 i) {
return Gfx_SetupDLImpl(gfx, i);
}
void Gfx_SetupDLAtPtr(Gfx** gfxp, u32 i) {
*gfxp = Gfx_SetupDL(*gfxp, i);
void Gfx_SetupDLAtPtr(Gfx** gfxP, u32 i) {
*gfxP = Gfx_SetupDL(*gfxP, i);
}
Gfx* Gfx_SetupDL57(Gfx* gfx) {
@@ -1212,11 +1212,11 @@ void Gfx_SetupDL39_Overlay(GraphicsContext* gfxCtx) {
CLOSE_DISPS(gfxCtx);
}
void Gfx_SetupDL39_Ptr(Gfx** gfxp) {
Gfx* gfx = *gfxp;
void Gfx_SetupDL39_Ptr(Gfx** gfxP) {
Gfx* gfx = *gfxP;
gSPDisplayList(gfx++, gSetupDLs[SETUPDL_39]);
*gfxp = gfx;
*gfxP = gfx;
}
void Gfx_SetupDL40_Opa(GraphicsContext* gfxCtx) {
@@ -1347,11 +1347,11 @@ void Gfx_SetupDL56_Opa(GraphicsContext* gfxCtx) {
CLOSE_DISPS(gfxCtx);
}
void Gfx_SetupDL56_Ptr(Gfx** gfxp) {
Gfx* gfx = *gfxp;
void Gfx_SetupDL56_Ptr(Gfx** gfxP) {
Gfx* gfx = *gfxP;
gSPDisplayList(gfx++, gSetupDLs[SETUPDL_56]);
*gfxp = gfx;
*gfxP = gfx;
}
void Gfx_SetupDL59_Opa(GraphicsContext* gfxCtx) {
@@ -1362,8 +1362,8 @@ void Gfx_SetupDL59_Opa(GraphicsContext* gfxCtx) {
CLOSE_DISPS(gfxCtx);
}
Gfx* Gfx_BranchTexScroll(Gfx** gfxp, u32 x, u32 y, s32 width, s32 height) {
Gfx* gfx = Gfx_Alloc(gfxp, 3 * sizeof(Gfx));
Gfx* Gfx_BranchTexScroll(Gfx** gfxP, u32 x, u32 y, s32 width, s32 height) {
Gfx* gfx = Gfx_Alloc(gfxP, 3 * sizeof(Gfx));
gDPTileSync(&gfx[0]);
gDPSetTileSize(&gfx[1], 0, x, y, (x + ((width - 1) << 2)), (y + ((height - 1) << 2)));
@@ -1372,8 +1372,8 @@ Gfx* Gfx_BranchTexScroll(Gfx** gfxp, u32 x, u32 y, s32 width, s32 height) {
return gfx;
}
void func_8012CB04(Gfx** gfxp, u32 x, u32 y) {
Gfx_BranchTexScroll(gfxp, x, y, 0, 0);
void func_8012CB04(Gfx** gfxP, u32 x, u32 y) {
Gfx_BranchTexScroll(gfxP, x, y, 0, 0);
}
Gfx* func_8012CB28(GraphicsContext* gfxCtx, u32 x, u32 y) {
+10 -10
View File
@@ -129,24 +129,24 @@ void View_GetViewport(View* view, Viewport* viewport) {
}
void View_SetScissor(Gfx** gfx, s32 ulx, s32 uly, s32 lrx, s32 lry) {
Gfx* gfxp = *gfx;
Gfx* gfxP = *gfx;
gDPSetScissor(gfxp++, G_SC_NON_INTERLACE, ulx, uly, lrx, lry);
gDPSetScissor(gfxP++, G_SC_NON_INTERLACE, ulx, uly, lrx, lry);
*gfx = gfxp;
*gfx = gfxP;
}
void View_ClearScissor(View* view, Gfx** gfx) {
Gfx* gfxp = *gfx;
Gfx* gfxP = *gfx;
s32 ulx = view->viewport.leftX;
s32 uly = view->viewport.topY;
s32 lrx = view->viewport.rightX;
s32 lry = view->viewport.bottomY;
gDPPipeSync(gfxp++);
View_SetScissor(&gfxp, ulx, uly, lrx, lry);
gDPPipeSync(gfxP++);
View_SetScissor(&gfxP, ulx, uly, lrx, lry);
*gfx = gfxp;
*gfx = gfxP;
}
void View_ApplyLetterbox(View* view) {
@@ -523,8 +523,8 @@ s32 View_UpdateViewingMatrix(View* view) {
return 1;
}
s32 View_ApplyTo(View* view, Gfx** gfxp) {
Gfx* gfx = *gfxp;
s32 View_ApplyTo(View* view, Gfx** gfxP) {
Gfx* gfx = *gfxP;
GraphicsContext* gfxCtx = view->gfxCtx;
Viewport* viewport = &view->viewport;
Mtx* projection;
@@ -547,7 +547,7 @@ s32 View_ApplyTo(View* view, Gfx** gfxp) {
view->projection = *projection;
gSPMatrix(gfx++, projection, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
*gfxp = gfx;
*gfxP = gfx;
return 1;
}