mirror of
https://github.com/zeldaret/mm.git
synced 2026-07-08 13:26:14 -04:00
Misc Clean (#1602)
* thiefbird * eff_ss_dead * PreRender_AntiAliasFilterPixel tmp -> invCvg * Skin_InitAnimatedLimb * gfxalloc * loadfragment * loadfragment strings
This commit is contained in:
@@ -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;
|
||||
|
||||
+2
-2
@@ -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);
|
||||
|
||||
+4
-4
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
+26
-26
@@ -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);
|
||||
}
|
||||
|
||||
+2
-2
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
+8
-8
@@ -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;
|
||||
|
||||
+1
-1
@@ -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)));
|
||||
|
||||
@@ -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++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user