diff options
| author | Derek Hensley <hensley.derek58@gmail.com> | 2024-04-06 10:23:06 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-06 10:23:06 -0700 |
| commit | e3ce14c932b80e5ed4c7680cb9dd9f638d739541 (patch) | |
| tree | 0bca0376b6b8000c83bcaa6b50da17927bcec84c /src/code | |
| parent | 47d43f2fa1b0a35b02a1186fb94e5bd227c92219 (diff) | |
Misc Clean (#1602)
* thiefbird
* eff_ss_dead
* PreRender_AntiAliasFilterPixel tmp -> invCvg
* Skin_InitAnimatedLimb
* gfxalloc
* loadfragment
* loadfragment strings
Diffstat (limited to 'src/code')
| -rw-r--r-- | src/code/PreRender.c | 12 | ||||
| -rw-r--r-- | src/code/flg_set.c | 4 | ||||
| -rw-r--r-- | src/code/game.c | 8 | ||||
| -rw-r--r-- | src/code/gfxalloc.c (renamed from src/code/graphalloc.c) | 16 | ||||
| -rw-r--r-- | src/code/z_debug_mode.c | 4 | ||||
| -rw-r--r-- | src/code/z_eff_ss_dead.c | 52 | ||||
| -rw-r--r-- | src/code/z_kankyo.c | 4 | ||||
| -rw-r--r-- | src/code/z_message.c | 4 | ||||
| -rw-r--r-- | src/code/z_play.c | 16 | ||||
| -rw-r--r-- | src/code/z_rcp.c | 2 | ||||
| -rw-r--r-- | src/code/z_skin_awb.c | 9 | ||||
| -rw-r--r-- | src/code/z_visfbuf.c | 2 | ||||
| -rw-r--r-- | src/code/z_vismono.c | 4 |
13 files changed, 68 insertions, 69 deletions
diff --git a/src/code/PreRender.c b/src/code/PreRender.c index 6d4e52cf4..936efbcb2 100644 --- a/src/code/PreRender.c +++ b/src/code/PreRender.c @@ -404,7 +404,7 @@ void PreRender_AntiAliasFilterPixel(PreRender* this, s32 x, s32 y) { s32 buffB[3 * 5]; s32 xi; s32 yi; - s32 temp; + s32 invCvg; s32 pmaxR; s32 pmaxG; s32 pmaxB; @@ -511,10 +511,10 @@ void PreRender_AntiAliasFilterPixel(PreRender* this, s32 x, s32 y) { // BackGround = (pMax + pMin) - (ForeGround) * 2 // OutputColor = cvg * ForeGround + (1.0 - cvg) * BackGround - temp = 7 - buffCvg[7]; - outR = buffR[7] + ((s32)(temp * (pmaxR + pminR - (buffR[7] * 2)) + 4) >> 3); - outG = buffG[7] + ((s32)(temp * (pmaxG + pminG - (buffG[7] * 2)) + 4) >> 3); - outB = buffB[7] + ((s32)(temp * (pmaxB + pminB - (buffB[7] * 2)) + 4) >> 3); + invCvg = 7 - buffCvg[7]; + outR = buffR[7] + ((s32)(invCvg * (pmaxR + pminR - (buffR[7] * 2)) + 4) >> 3); + outG = buffG[7] + ((s32)(invCvg * (pmaxG + pminG - (buffG[7] * 2)) + 4) >> 3); + outB = buffB[7] + ((s32)(invCvg * (pmaxB + pminB - (buffB[7] * 2)) + 4) >> 3); pxOut.r = outR >> 3; pxOut.g = outG >> 3; @@ -768,7 +768,7 @@ void Prerender_DrawBackground2DImpl(PreRenderBackground2DParams* bg2D, Gfx** gfx alphaCompare = (bg2D->flags & BG2D_FLAGS_AC_THRESHOLD) ? G_AC_THRESHOLD : G_AC_NONE; gfxTemp = *gfxp; - bg = Graph_DlistAlloc(&gfxTemp, sizeof(uObjBg)); + bg = Gfx_Alloc(&gfxTemp, sizeof(uObjBg)); gfx = gfxTemp; bg->b.imageX = 0; diff --git a/src/code/flg_set.c b/src/code/flg_set.c index 9929cbb47..138aa0254 100644 --- a/src/code/flg_set.c +++ b/src/code/flg_set.c @@ -277,7 +277,7 @@ void FlagSet_Draw(GameState* gameState) { s32 pad; polyOpa = POLY_OPA_DISP; - gfx = Graph_GfxPlusOne(polyOpa); + gfx = Gfx_Open(polyOpa); gSPDisplayList(OVERLAY_DISP++, gfx); GfxPrint_Init(&printer); @@ -313,7 +313,7 @@ void FlagSet_Draw(GameState* gameState) { GfxPrint_Destroy(&printer); gSPEndDisplayList(gfx++); - Graph_BranchDlist(polyOpa, gfx); + Gfx_Close(polyOpa, gfx); POLY_OPA_DISP = gfx; CLOSE_DISPS(gfxCtx); diff --git a/src/code/game.c b/src/code/game.c index 434337615..90b9b106b 100644 --- a/src/code/game.c +++ b/src/code/game.c @@ -83,7 +83,7 @@ void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx) { OPEN_DISPS(gfxCtx); - gfx = Graph_GfxPlusOne(gfxHead = POLY_OPA_DISP); + gfx = Gfx_Open(gfxHead = POLY_OPA_DISP); gSPDisplayList(OVERLAY_DISP++, gfx); if ((R_FB_FILTER_TYPE != 0) && (R_FB_FILTER_ENV_COLOR(3) == 0)) { @@ -95,7 +95,7 @@ void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx) { } gSPEndDisplayList(gfx++); - Graph_BranchDlist(gfxHead, gfx); + Gfx_Close(gfxHead, gfx); POLY_OPA_DISP = gfx; CLOSE_DISPS(gfxCtx); @@ -127,10 +127,10 @@ void GameState_DrawEnd(GraphicsContext* gfxCtx) { OPEN_DISPS(gfxCtx); - gfx = Graph_GfxPlusOne(gfxHead = POLY_OPA_DISP); + gfx = Gfx_Open(gfxHead = POLY_OPA_DISP); gSPDisplayList(OVERLAY_DISP++, gfx); gSPEndDisplayList(gfx++); - Graph_BranchDlist(gfxHead, gfx); + Gfx_Close(gfxHead, gfx); POLY_OPA_DISP = gfx; diff --git a/src/code/graphalloc.c b/src/code/gfxalloc.c index cbae8ebe4..07070e964 100644 --- a/src/code/graphalloc.c +++ b/src/code/gfxalloc.c @@ -1,10 +1,10 @@ #include "global.h" -Gfx* Graph_GfxPlusOne(Gfx* gfx) { +Gfx* Gfx_Open(Gfx* gfx) { return &gfx[1]; } -Gfx* Graph_BranchDlist(Gfx* gfx, Gfx* dst) { +Gfx* Gfx_Close(Gfx* gfx, Gfx* dst) { gSPBranchList(gfx, dst); return dst; } @@ -15,15 +15,15 @@ Gfx* Graph_BranchDlist(Gfx* gfx, Gfx* dst) { * Since the alloc may not itself be display list commands, a BranchList * command is used to step over this region. */ -void* Graph_DlistAlloc(Gfx** gfx, size_t size) { +void* Gfx_Alloc(Gfx** gfxP, size_t size) { u8* start; - Gfx* end; + Gfx* gfx; size = ALIGN8(size); - start = (u8*)&(*gfx)[1]; - end = (Gfx*)(start + size); - gSPBranchList(*gfx, end); + start = (u8*)&(*gfxP)[1]; + gfx = (Gfx*)(start + size); + gSPBranchList(*gfxP, gfx); - *gfx = end; + *gfxP = gfx; return start; } diff --git a/src/code/z_debug_mode.c b/src/code/z_debug_mode.c index a40bd29bd..9e9c2abba 100644 --- a/src/code/z_debug_mode.c +++ b/src/code/z_debug_mode.c @@ -134,7 +134,7 @@ void Debug_DrawText(GraphicsContext* gfxCtx) { OPEN_DISPS(gfxCtx); gfxHead = POLY_OPA_DISP; - gfx = Graph_GfxPlusOne(gfxHead); + gfx = Gfx_Open(gfxHead); gSPDisplayList(DEBUG_DISP++, gfx); GfxPrint_Open(&printer, gfx); @@ -150,7 +150,7 @@ void Debug_DrawText(GraphicsContext* gfxCtx) { gfx = GfxPrint_Close(&printer); gSPEndDisplayList(gfx++); - Graph_BranchDlist(gfxHead, gfx); + Gfx_Close(gfxHead, gfx); POLY_OPA_DISP = gfx; CLOSE_DISPS(gfxCtx); diff --git a/src/code/z_eff_ss_dead.c b/src/code/z_eff_ss_dead.c index b34c38a69..57e2451fc 100644 --- a/src/code/z_eff_ss_dead.c +++ b/src/code/z_eff_ss_dead.c @@ -3,44 +3,44 @@ void func_800AE2A0(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3) { f32 cos; - Gfx* displayListHead; + Gfx* gfx; f32 absCos; OPEN_DISPS(play->state.gfxCtx); - displayListHead = POLY_OPA_DISP; + gfx = POLY_OPA_DISP; cos = Math_CosS((0x8000 / arg3) * arg2); absCos = fabsf(cos); - gDPPipeSync(displayListHead++); + gDPPipeSync(gfx++); if (color == NULL) { - gDPSetFogColor(displayListHead++, 255, 0, 0, 0); + gDPSetFogColor(gfx++, 255, 0, 0, 0); } else { - gDPSetFogColor(displayListHead++, color->r, color->g, color->b, color->a); + gDPSetFogColor(gfx++, color->r, color->g, color->b, color->a); } - gSPFogPosition(displayListHead++, 0, TRUNCF_BINANG(absCos * 3000.0f) + 1500); + gSPFogPosition(gfx++, 0, TRUNCF_BINANG(absCos * 3000.0f) + 1500); - POLY_OPA_DISP = displayListHead; + POLY_OPA_DISP = gfx; CLOSE_DISPS(play->state.gfxCtx); } void func_800AE434(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3) { - Gfx* displayListHead; + Gfx* gfx; f32 cos; OPEN_DISPS(play->state.gfxCtx); cos = Math_CosS((0x4000 / arg3) * arg2); - displayListHead = POLY_OPA_DISP; + gfx = POLY_OPA_DISP; - gDPPipeSync(displayListHead++); - gDPSetFogColor(displayListHead++, color->r, color->g, color->b, color->a); - gSPFogPosition(displayListHead++, 0, TRUNCF_BINANG(2800.0f * fabsf(cos)) + 1700); + gDPPipeSync(gfx++); + gDPSetFogColor(gfx++, color->r, color->g, color->b, color->a); + gSPFogPosition(gfx++, 0, TRUNCF_BINANG(2800.0f * fabsf(cos)) + 1700); - POLY_OPA_DISP = displayListHead; + POLY_OPA_DISP = gfx; CLOSE_DISPS(play->state.gfxCtx); } @@ -58,44 +58,44 @@ void func_800AE5A0(PlayState* play) { void func_800AE5E4(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3) { f32 cos; - Gfx* displayListHead; + Gfx* gfx; f32 absCos; OPEN_DISPS(play->state.gfxCtx); - displayListHead = POLY_XLU_DISP; + gfx = POLY_XLU_DISP; cos = Math_CosS((0x8000 / arg3) * arg2); absCos = fabsf(cos); - gDPPipeSync(displayListHead++); + gDPPipeSync(gfx++); if (color == NULL) { - gDPSetFogColor(displayListHead++, 255, 0, 0, 0); + gDPSetFogColor(gfx++, 255, 0, 0, 0); } else { - gDPSetFogColor(displayListHead++, color->r, color->g, color->b, color->a); + gDPSetFogColor(gfx++, color->r, color->g, color->b, color->a); } - gSPFogPosition(displayListHead++, 0, TRUNCF_BINANG(absCos * 3000.0f) + 1500); + gSPFogPosition(gfx++, 0, TRUNCF_BINANG(absCos * 3000.0f) + 1500); - POLY_XLU_DISP = displayListHead; + POLY_XLU_DISP = gfx; CLOSE_DISPS(play->state.gfxCtx); } void func_800AE778(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3) { f32 cos; - Gfx* displayListHead; + Gfx* gfx; OPEN_DISPS(play->state.gfxCtx); - displayListHead = POLY_XLU_DISP; + gfx = POLY_XLU_DISP; cos = Math_CosS((0x4000 / arg3) * arg2); - gDPPipeSync(displayListHead++); - gDPSetFogColor(displayListHead++, color->r, color->g, color->b, color->a); - gSPFogPosition(displayListHead++, 0, TRUNCF_BINANG(2800.0f * fabsf(cos)) + 1700); + gDPPipeSync(gfx++); + gDPSetFogColor(gfx++, color->r, color->g, color->b, color->a); + gSPFogPosition(gfx++, 0, TRUNCF_BINANG(2800.0f * fabsf(cos)) + 1700); - POLY_XLU_DISP = displayListHead; + POLY_XLU_DISP = gfx; CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index 4bb5afa5e..45cb55586 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -3308,7 +3308,7 @@ void Environment_DrawSkyboxStars(PlayState* play) { OPEN_DISPS(play->state.gfxCtx); gfxHead = POLY_OPA_DISP; - gfx = Graph_GfxPlusOne(gfxHead); + gfx = Gfx_Open(gfxHead); gSPDisplayList(sSkyboxStarsDList, gfx); @@ -3316,7 +3316,7 @@ void Environment_DrawSkyboxStars(PlayState* play) { gSPEndDisplayList(gfx++); - Graph_BranchDlist(gfxHead, gfx); + Gfx_Close(gfxHead, gfx); POLY_OPA_DISP = gfx; sSkyboxStarsDList = NULL; diff --git a/src/code/z_message.c b/src/code/z_message.c index 1b5964273..3d75d5325 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -5117,7 +5117,7 @@ void Message_Draw(PlayState* play) { OPEN_DISPS(gfxCtx); gfxHead = POLY_OPA_DISP; - gfx = Graph_GfxPlusOne(gfxHead); + gfx = Gfx_Open(gfxHead); gSPDisplayList(OVERLAY_DISP++, gfx); if ((play->msgCtx.currentTextId != 0x5E6) || !Play_InCsMode(play)) { @@ -5125,7 +5125,7 @@ void Message_Draw(PlayState* play) { } gSPEndDisplayList(gfx++); - Graph_BranchDlist(gfxHead, gfx); + Gfx_Close(gfxHead, gfx); POLY_OPA_DISP = gfx; CLOSE_DISPS(gfxCtx); diff --git a/src/code/z_play.c b/src/code/z_play.c index 70b241759..4824769c9 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -71,7 +71,7 @@ void Play_DrawMotionBlur(PlayState* this) { OPEN_DISPS(gfxCtx); gfxHead = POLY_OPA_DISP; - gfx = Graph_GfxPlusOne(gfxHead); + gfx = Gfx_Open(gfxHead); gSPDisplayList(OVERLAY_DISP++, gfx); @@ -88,7 +88,7 @@ void Play_DrawMotionBlur(PlayState* this) { gSPEndDisplayList(gfx++); - Graph_BranchDlist(gfxHead, gfx); + Gfx_Close(gfxHead, gfx); POLY_OPA_DISP = gfx; @@ -1113,13 +1113,13 @@ void Play_PostWorldDraw(PlayState* this) { OPEN_DISPS(gfxCtx); gfxHead = POLY_OPA_DISP; - gfx = Graph_GfxPlusOne(gfxHead); + gfx = Gfx_Open(gfxHead); gSPDisplayList(OVERLAY_DISP++, gfx); VisFbuf_Draw(sPlayVisFbufInstance, &gfx, this->unk_18E60); gSPEndDisplayList(gfx++); - Graph_BranchDlist(gfxHead, gfx); + Gfx_Close(gfxHead, gfx); POLY_OPA_DISP = gfx; CLOSE_DISPS(gfxCtx); @@ -1211,7 +1211,7 @@ void Play_DrawMain(PlayState* this) { Gfx* sp218; Gfx* sp214 = POLY_OPA_DISP; - sp218 = Graph_GfxPlusOne(sp214); + sp218 = Gfx_Open(sp214); gSPDisplayList(OVERLAY_DISP++, sp218); if (((this->transitionMode == TRANS_MODE_INSTANCE_RUNNING) || @@ -1236,7 +1236,7 @@ void Play_DrawMain(PlayState* this) { } gSPEndDisplayList(sp218++); - Graph_BranchDlist(sp214, sp218); + Gfx_Close(sp214, sp218); POLY_OPA_DISP = sp218; } @@ -1383,7 +1383,7 @@ void Play_DrawMain(PlayState* this) { Gfx* sp74; Gfx* sp70 = POLY_OPA_DISP; - sp74 = Graph_GfxPlusOne(sp70); + sp74 = Gfx_Open(sp70); gSPDisplayList(OVERLAY_DISP++, sp74); this->pauseBgPreRender.fbuf = gfxCtx->curFrameBuffer; @@ -1408,7 +1408,7 @@ void Play_DrawMain(PlayState* this) { } gSPEndDisplayList(sp74++); - Graph_BranchDlist(sp70, sp74); + Gfx_Close(sp70, sp74); POLY_OPA_DISP = sp74; this->unk_18B49 = 2; SREG(33) |= 1; diff --git a/src/code/z_rcp.c b/src/code/z_rcp.c index 11736a176..31bc01942 100644 --- a/src/code/z_rcp.c +++ b/src/code/z_rcp.c @@ -1357,7 +1357,7 @@ void Gfx_SetupDL59_Opa(GraphicsContext* gfxCtx) { } Gfx* Gfx_BranchTexScroll(Gfx** gfxp, u32 x, u32 y, s32 width, s32 height) { - Gfx* gfx = Graph_DlistAlloc(gfxp, 3 * sizeof(Gfx)); + 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))); diff --git a/src/code/z_skin_awb.c b/src/code/z_skin_awb.c index 8425d961a..cd753fc8b 100644 --- a/src/code/z_skin_awb.c +++ b/src/code/z_skin_awb.c @@ -31,12 +31,11 @@ void Skin_InitAnimatedLimb(GameState* gameState, Skin* skin, s32 limbIndex) { for (skinVtxEntry = skinVertices; skinVtxEntry < &skinVertices[modifEntry->vtxCount];) { Vtx* vtx = &vertices[skinVtxEntry->index]; - skinVtxEntry++; - vtx->n.flag = 0; - vtx->n.tc[0] = skinVtxEntry[-1].s; - vtx->n.tc[1] = skinVtxEntry[-1].t; - vtx->n.a = skinVtxEntry[-1].alpha; + vtx->n.tc[0] = skinVtxEntry->s; + vtx->n.tc[1] = skinVtxEntry->t; + vtx->n.a = skinVtxEntry->alpha; + skinVtxEntry++; } } } diff --git a/src/code/z_visfbuf.c b/src/code/z_visfbuf.c index 62242bcec..63d2cd8c5 100644 --- a/src/code/z_visfbuf.c +++ b/src/code/z_visfbuf.c @@ -84,7 +84,7 @@ void VisFbuf_SetBg(Gfx** gfxP, void* source, void* img, s32 width, s32 height, f // Allocate for BG gfxTemp = gfx; - bg = Graph_DlistAlloc(&gfxTemp, sizeof(uObjBg)); + bg = Gfx_Alloc(&gfxTemp, sizeof(uObjBg)); gfx = gfxTemp; // Set up BG diff --git a/src/code/z_vismono.c b/src/code/z_vismono.c index 5e4330786..c898882b1 100644 --- a/src/code/z_vismono.c +++ b/src/code/z_vismono.c @@ -144,14 +144,14 @@ void VisMono_Draw(VisMono* this, Gfx** gfxP) { if (this->tlut) { tlut = this->tlut; } else { - tlut = Graph_DlistAlloc(&gfx, 256 * G_IM_SIZ_16b_BYTES); + tlut = Gfx_Alloc(&gfx, 256 * G_IM_SIZ_16b_BYTES); VisMono_DesaturateTLUT(tlut); } if (this->dList) { dList = this->dList; } else { - dList = Graph_DlistAlloc(&gfx, VISMONO_DLSIZE * sizeof(Gfx)); + dList = Gfx_Alloc(&gfx, VISMONO_DLSIZE * sizeof(Gfx)); dListEnd = VisMono_DesaturateDList(dList); } |
