1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-14 21:40:03 +00:00

[ntsc-1.2] Match remaining functions (#2182)

* Match remaining ntsc-1.2 functions

* "fake" -> "Fake match?"
This commit is contained in:
cadmic 2024-09-11 03:07:25 -07:00 committed by GitHub
parent 76d97ac18a
commit fd7b92dac8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 54 additions and 19 deletions

View file

@ -80,7 +80,9 @@ void PreRender_CopyImage(PreRender* this, Gfx** gfxP, void* img, void* imgDst) {
s32 lrt;
// Make sure that we don't load past the end of the source image
nRows = MIN(rowsRemaining, nRows);
if (nRows > rowsRemaining) {
nRows = rowsRemaining;
}
// Determine the upper and lower bounds of the rect to draw
ult = curRow;
@ -215,7 +217,9 @@ void func_800C170C(PreRender* this, Gfx** gfxP, void* buf, void* bufSave, u32 r,
s32 lrt;
// Make sure that we don't load past the end of the source image
nRows = MIN(rowsRemaining, nRows);
if (nRows > rowsRemaining) {
nRows = rowsRemaining;
}
// Determine the upper and lower bounds of the rect to draw
ult = curRow;
@ -457,15 +461,16 @@ void func_800C213C(PreRender* this, Gfx** gfxP) {
curRow = 0;
while (rowsRemaining > 0) {
s32 uls = 0;
s32 ult = curRow;
s32 lrs = this->width - 1;
s32 ult;
s32 lrt;
// Make sure that we don't load past the end of the source image
nRows = MIN(rowsRemaining, nRows);
if (nRows > rowsRemaining) {
nRows = rowsRemaining;
}
// Determine the upper and lower bounds of the rect to draw
ult = curRow;
// Determine the lower bound of the rect to draw
lrt = curRow + nRows - 1;
// Load the frame buffer line
@ -473,11 +478,15 @@ void func_800C213C(PreRender* this, Gfx** gfxP) {
this->height, uls, ult, lrs, lrt, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
rtile = rtile; // Fake match?
// Load the coverage line
gDPLoadMultiTile(gfx++, this->cvgSave, 0x0160, rtile, G_IM_FMT_I, G_IM_SIZ_8b, this->width, this->height,
uls, ult, lrs, lrt, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK,
G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
rtile = rtile; // Fake match?
// Draw a texture for which the rgb channels come from the framebuffer and the alpha channel comes from
// coverage, modulated by env color
gSPTextureRectangle(gfx++, uls << 2, ult << 2, (lrs + 1) << 2, (lrt + 1) << 2, G_TX_RENDERTILE, uls << 5,

View file

@ -132,9 +132,17 @@ static u8 sDefaultSpecialFlags;
#endif
void GfxPrint_Setup(GfxPrint* this) {
s32 width = 16;
s32 height = 256;
s32 width;
s32 height;
s32 i;
s32 pal;
s32 cm;
s32 masks;
s32 maskt;
s32 shift;
s32 line;
s32 tmem = 0;
s32 fmt = G_IM_FMT_CI;
gDPPipeSync(this->dList++);
gDPSetOtherMode(this->dList++,
@ -142,27 +150,41 @@ void GfxPrint_Setup(GfxPrint* this) {
G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE,
G_AC_NONE | G_ZS_PRIM | G_RM_XLU_SURF | G_RM_XLU_SURF2);
gDPSetCombineMode(this->dList++, G_CC_DECALRGBA, G_CC_DECALRGBA);
gDPLoadTextureBlock_4b(this->dList++, sGfxPrintFontData, G_IM_FMT_CI, width, height, 0, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
width = 16;
height = 256;
cm = G_TX_NOMIRROR | G_TX_WRAP;
masks = G_TX_NOMASK;
maskt = G_TX_NOMASK;
shift = G_TX_NOLOD;
gDPLoadMultiBlock_4b(this->dList++, sGfxPrintFontData, 0, G_TX_RENDERTILE, G_IM_FMT_CI, width, height, 0, cm, cm,
masks, maskt, shift, shift);
gDPLoadTLUT(this->dList++, 64, 0x100, sGfxPrintFontTLUT);
for (i = 1; i < 4; i++) {
gDPSetTile(this->dList++, G_IM_FMT_CI, G_IM_SIZ_4b, 1, 0, i * 2, i, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK,
G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD);
gDPSetTileSize(this->dList++, i * 2, 0, 0, 15 << 2, 255 << 2);
gDPSetTile(this->dList++, G_IM_FMT_CI, G_IM_SIZ_4b, 1, 0, i * 2, i, cm, maskt, shift, cm, masks, shift);
gDPSetTileSize(this->dList++, i * 2, 0 << 2, 0 << 2, (width - 1) << 2, (height - 1) << 2);
}
gDPSetColor(this->dList++, G_SETPRIMCOLOR, this->color.rgba);
gDPLoadMultiTile_4b(this->dList++, sGfxPrintRainbowData, 0, 1, G_IM_FMT_CI, 2, 8, 0, 0, 1, 7, 4,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 1, 3, G_TX_NOLOD, G_TX_NOLOD);
width = 2;
height = 8;
cm = G_TX_NOMIRROR | G_TX_WRAP;
masks = 1;
maskt = 3;
shift = G_TX_NOLOD;
pal = 4;
line = 1;
gDPLoadMultiTile_4b(this->dList++, sGfxPrintRainbowData, 0, 1, G_IM_FMT_CI, width, height, 0, 0, width - 1,
height - 1, pal, cm, cm, masks, maskt, shift, shift);
gDPLoadTLUT(this->dList++, 16, 0x140, sGfxPrintRainbowTLUT);
for (i = 1; i < 4; i++) {
gDPSetTile(this->dList++, G_IM_FMT_CI, G_IM_SIZ_4b, 1, 0, i * 2 + 1, 4, G_TX_NOMIRROR | G_TX_WRAP, 3,
G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, 1, G_TX_NOLOD);
gDPSetTileSize(this->dList++, i * 2 + 1, 0, 0, 1 << 2, 7 << 2);
gDPSetTile(this->dList++, fmt, G_IM_SIZ_4b, line, tmem, i * 2 + 1, pal, cm, maskt, shift, cm, masks, shift);
gDPSetTileSize(this->dList++, i * 2 + 1, 0 << 2, 0 << 2, (width - 1) << 2, (height - 1) << 2);
}
}

View file

@ -1577,7 +1577,9 @@ void Environment_DrawLensFlare(PlayState* play, EnvironmentContext* envCtx, View
sqrtf((SQ(lookDirX) + SQ(lookDirY) + SQ(lookDirZ)) * (SQ(posDirX) + SQ(posDirY) + SQ(posDirZ)));
lensFlareAlphaScaleTarget = cosAngle * 3.5f;
lensFlareAlphaScaleTarget = CLAMP_MAX(lensFlareAlphaScaleTarget, 1.0f);
if (lensFlareAlphaScaleTarget > 1.0f) {
lensFlareAlphaScaleTarget = 1.0f;
}
if (!isSun) {
lensFlareAlphaScaleTarget = cosAngle;
@ -1625,7 +1627,9 @@ void Environment_DrawLensFlare(PlayState* play, EnvironmentContext* envCtx, View
alpha *= 1.0f - fogInfluence;
#if !PLATFORM_N64
if (1) {}
#endif
if (!(isOffScreen ^ 0)) {
Math_SmoothStepToF(&envCtx->lensFlareAlphaScale, lensFlareAlphaScaleTarget, 0.5f, 0.05f, 0.001f);