1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-25 09:45:02 +00:00

Match functions using gDPSetTileCustom (#2100)

This commit is contained in:
cadmic 2024-08-27 14:08:41 -07:00 committed by GitHub
parent 6b58a15fc0
commit 17debe8620
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 28 additions and 19 deletions

View file

@ -273,17 +273,24 @@ extern struct GraphicsContext* __gfxCtx;
#define VTX_T(x,y,z,s,t,cr,cg,cb,a) { { x, y, z }, 0, { s, t }, { cr, cg, cb, a } } #define VTX_T(x,y,z,s,t,cr,cg,cb,a) { { x, y, z }, 0, { s, t }, { cr, cg, cb, a } }
#define gDPSetTileCustom(pkt, fmt, siz, width, height, pal, cms, cmt, masks, maskt, shifts, shiftt) \ #define gDPSetTileCustom(pkt, fmt, siz, uls, ult, lrs, lrt, pal, \
do { \ cms, cmt, masks, maskt, shifts, shiftt) \
gDPPipeSync(pkt); \ _DW({ \
gDPTileSync(pkt); \ gDPPipeSync(pkt); \
gDPSetTile(pkt, fmt, siz, (((width)*siz##_TILE_BYTES) + 7) >> 3, 0, G_TX_LOADTILE, 0, cmt, maskt, shiftt, cms, \ gDPTileSync(pkt); \
masks, shifts); \ gDPSetTile(pkt, fmt, siz, \
gDPTileSync(pkt); \ (((((lrs) - (uls) + 1) * siz##_TILE_BYTES) + 7) >> 3), 0, \
gDPSetTile(pkt, fmt, siz, (((width)*siz##_TILE_BYTES) + 7) >> 3, 0, G_TX_RENDERTILE, pal, cmt, maskt, shiftt, \ G_TX_LOADTILE, 0, cmt, maskt, shiftt, cms, masks, \
cms, masks, shifts); \ shifts); \
gDPSetTileSize(pkt, G_TX_RENDERTILE, 0, 0, ((width)-1) << G_TEXTURE_IMAGE_FRAC, \ gDPTileSync(pkt); \
((height)-1) << G_TEXTURE_IMAGE_FRAC); \ gDPSetTile(pkt, fmt, siz, \
} while (0) (((((lrs) - (uls) + 1) * siz##_LINE_BYTES) + 7) >> 3), 0, \
G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, masks, shifts); \
gDPSetTileSize(pkt, G_TX_RENDERTILE, \
(uls) << G_TEXTURE_IMAGE_FRAC, \
(ult) << G_TEXTURE_IMAGE_FRAC, \
(lrs) << G_TEXTURE_IMAGE_FRAC, \
(lrt) << G_TEXTURE_IMAGE_FRAC); \
})
#endif #endif

View file

@ -429,16 +429,17 @@ void EnMag_DrawImageRGBA32(Gfx** gfxP, s16 centerX, s16 centerY, u8* source, u32
curTexture = source; curTexture = source;
rectLeft = centerX - (width / 2); rectLeft = centerX - (width / 2);
rectTop = centerY - (height / 2); rectTop = centerY - (height / 2);
textureHeight = 4096 / (width << 2);
remainingSize = (width * height) << 2; remainingSize = (width * height) << 2;
textureHeight = 4096 / (width << 2);
textureSize = (width * textureHeight) << 2; textureSize = (width * textureHeight) << 2;
textureCount = remainingSize / textureSize; textureCount = remainingSize / textureSize;
if ((remainingSize % textureSize) != 0) { if ((remainingSize % textureSize) != 0) {
textureCount += 1; textureCount += 1;
} }
gDPSetTileCustom(gfx++, G_IM_FMT_RGBA, G_IM_SIZ_32b, width, textureHeight, 0, G_TX_NOMIRROR | G_TX_CLAMP, gDPSetTileCustom(gfx++, G_IM_FMT_RGBA, G_IM_SIZ_32b, 0, 0, width - 1, textureHeight - 1, 0,
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD,
G_TX_NOLOD);
remainingSize -= textureSize; remainingSize -= textureSize;
@ -459,7 +460,7 @@ void EnMag_DrawImageRGBA32(Gfx** gfxP, s16 centerX, s16 centerY, u8* source, u32
textureHeight = remainingSize / (s32)(width << 2); textureHeight = remainingSize / (s32)(width << 2);
remainingSize -= textureSize; remainingSize -= textureSize;
gDPSetTileCustom(gfx++, G_IM_FMT_RGBA, G_IM_SIZ_32b, width, textureHeight, 0, gDPSetTileCustom(gfx++, G_IM_FMT_RGBA, G_IM_SIZ_32b, 0, 0, width - 1, textureHeight - 1, 0,
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK,
G_TX_NOLOD, G_TX_NOLOD); G_TX_NOLOD, G_TX_NOLOD);
} }

View file

@ -45,8 +45,9 @@ void KaleidoScope_DrawEquipmentImage(PlayState* play, void* source, u32 width, u
vtxIndex = 80; vtxIndex = 80;
gDPSetTileCustom(POLY_OPA_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_16b, width, textureHeight, 0, G_TX_NOMIRROR | G_TX_CLAMP, gDPSetTileCustom(POLY_OPA_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 0, 0, width - 1, textureHeight - 1, 0,
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD,
G_TX_NOLOD);
remainingSize -= textureSize; remainingSize -= textureSize;
@ -67,7 +68,7 @@ void KaleidoScope_DrawEquipmentImage(PlayState* play, void* source, u32 width, u
textureHeight = remainingSize / (s32)(width * 2); textureHeight = remainingSize / (s32)(width * 2);
remainingSize -= textureSize; remainingSize -= textureSize;
gDPSetTileCustom(POLY_OPA_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_16b, width, textureHeight, 0, gDPSetTileCustom(POLY_OPA_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 0, 0, width - 1, textureHeight - 1, 0,
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK,
G_TX_NOLOD, G_TX_NOLOD); G_TX_NOLOD, G_TX_NOLOD);
} }