mirror of
https://github.com/pmret/papermario.git
synced 2024-11-08 12:02:30 +01:00
matched func_801180E8 (#867)
* matched func_801180E8 * fixed braces and field name
This commit is contained in:
parent
78c30637f2
commit
ff4034651c
@ -975,17 +975,22 @@ typedef struct BattleStatus {
|
|||||||
// alternative name: TileDescriptor
|
// alternative name: TileDescriptor
|
||||||
typedef struct TextureHeader {
|
typedef struct TextureHeader {
|
||||||
/* 0x00 */ s8 name[32];
|
/* 0x00 */ s8 name[32];
|
||||||
/* 0x20 */ s16 auxW;
|
/* 0x20 */ u16 auxW;
|
||||||
/* 0x22 */ s16 mainW;
|
/* 0x22 */ u16 mainW;
|
||||||
/* 0x24 */ s16 auxH;
|
/* 0x24 */ u16 auxH;
|
||||||
/* 0x26 */ s16 mainH;
|
/* 0x26 */ u16 mainH;
|
||||||
/* 0x28 */ char unk_28;
|
/* 0x28 */ char unk_28;
|
||||||
/* 0x29 */ u8 extraTiles;
|
/* 0x29 */ u8 extraTiles; // 0 - none, 1 - mipmap, 2 - ?, 3 - use aux tile
|
||||||
/* 0x2A */ u8 colorCombine;
|
/* 0x2A */ u8 colorCombineType : 6;
|
||||||
/* 0x2B */ u8 fmt;
|
/* 0x2A */ u8 colorCombineSubType : 2;
|
||||||
/* 0x2C */ u8 bitDepth;
|
/* 0x2B */ u8 auxFmt : 4;
|
||||||
/* 0x2D */ u8 wrapH;
|
/* 0x2B */ u8 mainFmt : 4;
|
||||||
/* 0x2E */ u8 wrapV;
|
/* 0x2C */ u8 auxBitDepth : 4;
|
||||||
|
/* 0x2C */ u8 mainBitDepth : 4;
|
||||||
|
/* 0x2D */ u8 auxWrapW : 4;
|
||||||
|
/* 0x2D */ u8 mainWrapW : 4;
|
||||||
|
/* 0x2E */ u8 auxWrapH : 4;
|
||||||
|
/* 0x2E */ u8 mainWrapH : 4;
|
||||||
/* 0x2F */ u8 filtering;
|
/* 0x2F */ u8 filtering;
|
||||||
} TextureHeader; // size = 0x30
|
} TextureHeader; // size = 0x30
|
||||||
|
|
||||||
|
@ -85,4 +85,118 @@
|
|||||||
((height)-1 + scrollt) << G_TEXTURE_IMAGE_FRAC) \
|
((height)-1 + scrollt) << G_TEXTURE_IMAGE_FRAC) \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define gDPScrollMultiTile_4b(pkt, timg, tmem, rtile, fmt, width, height, \
|
||||||
|
uls, ult, lrs, lrt, pal, \
|
||||||
|
cms, cmt, masks, maskt, shifts, shiftt,\
|
||||||
|
scrolls, scrollt) \
|
||||||
|
{ \
|
||||||
|
gDPSetTextureImage(pkt, fmt, G_IM_SIZ_8b, ((width)>>1), timg); \
|
||||||
|
gDPSetTile(pkt, fmt, G_IM_SIZ_8b, \
|
||||||
|
(((((lrs)-(uls)+1)>>1)+7)>>3), tmem, \
|
||||||
|
G_TX_LOADTILE, 0 , cmt, maskt, shiftt, cms, masks, \
|
||||||
|
shifts); \
|
||||||
|
gDPLoadSync(pkt); \
|
||||||
|
gDPLoadTile( pkt, G_TX_LOADTILE, \
|
||||||
|
(uls)<<(G_TEXTURE_IMAGE_FRAC-1), \
|
||||||
|
(ult)<<(G_TEXTURE_IMAGE_FRAC), \
|
||||||
|
(lrs)<<(G_TEXTURE_IMAGE_FRAC-1), \
|
||||||
|
(lrt)<<(G_TEXTURE_IMAGE_FRAC)); \
|
||||||
|
gDPPipeSync(pkt); \
|
||||||
|
gDPSetTile(pkt, fmt, G_IM_SIZ_4b, \
|
||||||
|
(((((lrs)-(uls)+1)>>1)+7)>>3), tmem, \
|
||||||
|
rtile, pal, cmt, maskt, shiftt, cms, masks, \
|
||||||
|
shifts); \
|
||||||
|
gDPSetTileSize(pkt, rtile, \
|
||||||
|
((uls)<<G_TEXTURE_IMAGE_FRAC) + scrolls, \
|
||||||
|
((ult)<<G_TEXTURE_IMAGE_FRAC) + scrollt, \
|
||||||
|
((lrs)<<G_TEXTURE_IMAGE_FRAC) + scrolls, \
|
||||||
|
((lrt)<<G_TEXTURE_IMAGE_FRAC) + scrollt); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define gDPScrollMultiTile(pkt, timg, tmem, rtile, fmt, siz, width, height,\
|
||||||
|
uls, ult, lrs, lrt, pal, \
|
||||||
|
cms, cmt, masks, maskt, shifts, shiftt, scrolls, scrollt) \
|
||||||
|
{ \
|
||||||
|
gDPSetTextureImage(pkt, fmt, siz, width, timg); \
|
||||||
|
gDPSetTile(pkt, fmt, siz, \
|
||||||
|
(((((lrs)-(uls)+1) * siz##_TILE_BYTES)+7)>>3), tmem, \
|
||||||
|
G_TX_LOADTILE, 0 , cmt, maskt, shiftt, cms, masks, \
|
||||||
|
shifts); \
|
||||||
|
gDPLoadSync(pkt); \
|
||||||
|
gDPLoadTile( pkt, G_TX_LOADTILE, \
|
||||||
|
(uls)<<G_TEXTURE_IMAGE_FRAC, \
|
||||||
|
(ult)<<G_TEXTURE_IMAGE_FRAC, \
|
||||||
|
(lrs)<<G_TEXTURE_IMAGE_FRAC, \
|
||||||
|
(lrt)<<G_TEXTURE_IMAGE_FRAC); \
|
||||||
|
gDPPipeSync(pkt); \
|
||||||
|
gDPSetTile(pkt, fmt, siz, \
|
||||||
|
(((((lrs)-(uls)+1) * siz##_LINE_BYTES)+7)>>3), tmem, \
|
||||||
|
rtile, pal, cmt, maskt, shiftt, cms, masks, \
|
||||||
|
shifts); \
|
||||||
|
gDPSetTileSize(pkt, rtile, \
|
||||||
|
((uls)<<G_TEXTURE_IMAGE_FRAC) + scrolls, \
|
||||||
|
((ult)<<G_TEXTURE_IMAGE_FRAC) + scrollt, \
|
||||||
|
((lrs)<<G_TEXTURE_IMAGE_FRAC) + scrolls, \
|
||||||
|
((lrt)<<G_TEXTURE_IMAGE_FRAC) + scrollt); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define gDPScrollTextureBlockHalfHeight(pkt, timg, fmt, siz, width, height, \
|
||||||
|
pal, cms, cmt, masks, maskt, shifts, shiftt, scrolls, scrollt, shifts2, shiftt2) \
|
||||||
|
{ \
|
||||||
|
gDPSetTextureImage(pkt, fmt, siz##_LOAD_BLOCK, 1, timg); \
|
||||||
|
gDPSetTile(pkt, fmt, siz##_LOAD_BLOCK, 0, 0, G_TX_LOADTILE, \
|
||||||
|
0 , cmt, maskt, shiftt, cms, masks, shifts); \
|
||||||
|
gDPLoadSync(pkt); \
|
||||||
|
gDPLoadBlock(pkt, G_TX_LOADTILE, 0, 0, \
|
||||||
|
(((width)*(height) + siz##_INCR) >> siz##_SHIFT) -1, \
|
||||||
|
CALC_DXT(width, siz##_BYTES)); \
|
||||||
|
gDPPipeSync(pkt); \
|
||||||
|
gDPSetTile(pkt, fmt, siz, \
|
||||||
|
(((width) * siz##_LINE_BYTES)+7)>>3, 0, \
|
||||||
|
G_TX_RENDERTILE, pal, cmt, maskt - 1, shiftt, cms, masks, \
|
||||||
|
shifts); \
|
||||||
|
gDPSetTileSize(pkt, G_TX_RENDERTILE, 0, 0, \
|
||||||
|
((width)-1) << G_TEXTURE_IMAGE_FRAC, \
|
||||||
|
(((height) >> 1)-1) << G_TEXTURE_IMAGE_FRAC) \
|
||||||
|
gDPSetTile(pkt, fmt, siz, \
|
||||||
|
(((width) * siz##_LINE_BYTES)+7)>>3, \
|
||||||
|
(((width) * ((height) >> 1) * siz##_LINE_BYTES)+7)>>3, \
|
||||||
|
G_TX_RENDERTILE + 1, pal, cmt, maskt - 1, shiftt2, cms, masks, \
|
||||||
|
shifts2); \
|
||||||
|
gDPSetTileSize(pkt, G_TX_RENDERTILE + 1, \
|
||||||
|
(scrolls),\
|
||||||
|
(scrollt), \
|
||||||
|
(((width)-1) << G_TEXTURE_IMAGE_FRAC) + (scrolls), \
|
||||||
|
((((height) >> 1)-1) << G_TEXTURE_IMAGE_FRAC) + (scrollt) ); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define gDPScrollTextureBlockHalfHeight_4b(pkt, timg, fmt, width, height, \
|
||||||
|
pal, cms, cmt, masks, maskt, shifts, shiftt, scrolls, scrollt, shifts2, shiftt2) \
|
||||||
|
{ \
|
||||||
|
gDPSetTextureImage(pkt, fmt, G_IM_SIZ_16b, 1, timg); \
|
||||||
|
gDPSetTile(pkt, fmt, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0, \
|
||||||
|
cmt, maskt, shiftt, cms, masks, shifts); \
|
||||||
|
gDPLoadSync(pkt); \
|
||||||
|
gDPLoadBlock(pkt, G_TX_LOADTILE, 0, 0, \
|
||||||
|
(((width)*(height)+3)>>2)-1, \
|
||||||
|
CALC_DXT_4b(width)); \
|
||||||
|
gDPPipeSync(pkt); \
|
||||||
|
gDPSetTile(pkt, fmt, G_IM_SIZ_4b, ((((width)>>1)+7)>>3), 0, \
|
||||||
|
G_TX_RENDERTILE, pal, cmt, maskt - 1, shiftt, cms, masks, \
|
||||||
|
shifts); \
|
||||||
|
gDPSetTileSize(pkt, G_TX_RENDERTILE, 0, 0, \
|
||||||
|
((width)-1) << G_TEXTURE_IMAGE_FRAC, \
|
||||||
|
(((height) >> 1)-1) << G_TEXTURE_IMAGE_FRAC) \
|
||||||
|
gDPSetTile(pkt, fmt, G_IM_SIZ_4b, \
|
||||||
|
(((width)>>1)+7)>>3, \
|
||||||
|
(((width) * ((height) >> 1) / 2)+7)>>3, \
|
||||||
|
G_TX_RENDERTILE + 1, pal, cmt, maskt - 1, shiftt2, cms, masks, \
|
||||||
|
shifts2); \
|
||||||
|
gDPSetTileSize(pkt, G_TX_RENDERTILE + 1, \
|
||||||
|
scrolls,\
|
||||||
|
scrollt, \
|
||||||
|
(((width)-1) << G_TEXTURE_IMAGE_FRAC) + scrolls, \
|
||||||
|
((((height) >> 1)-1) << G_TEXTURE_IMAGE_FRAC) + scrollt) \
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -170,4 +170,6 @@
|
|||||||
#define VAR_PROJECTILE_HITBOX_STATE varTable[0]
|
#define VAR_PROJECTILE_HITBOX_STATE varTable[0]
|
||||||
#define AI_PROJECTILE_AMMO_COUNT varTable[3]
|
#define AI_PROJECTILE_AMMO_COUNT varTable[3]
|
||||||
|
|
||||||
|
#define INTEGER_LOG2(x) ((x) <= 2 ? 1 : (x) <= 4 ? 2 : (x) <= 8 ? 3 : (x) <= 16 ? 4 : (x) <= 32 ? 5 : (x) <= 64 ? 6 : (x) <= 128 ? 7 : (x) <= 256 ? 8 : (x) <= 512 ? 9 : 10)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1097,7 +1097,7 @@ void func_80117D00(Model* model);
|
|||||||
void appendGfx_model_group(void* model);
|
void appendGfx_model_group(void* model);
|
||||||
void render_transform_group_node(ModelNode* node);
|
void render_transform_group_node(ModelNode* node);
|
||||||
void render_transform_group(void* group);
|
void render_transform_group(void* group);
|
||||||
void func_801180E8(TextureHeader*, void**, u8* raster, u16* palette, u8* auxRaster, u16* auxPalette, s32, s32, s32, s32);
|
void func_801180E8(TextureHeader*, Gfx**, IMG_PTR raster, PAL_PTR palette, IMG_PTR auxRaster, PAL_PTR auxPalette, u8, u8, u16, u16);
|
||||||
void load_model_transforms(ModelNode* model, ModelNode* parent, Matrix4f mdlTxMtx, s32 treeDepth);
|
void load_model_transforms(ModelNode* model, ModelNode* parent, Matrix4f mdlTxMtx, s32 treeDepth);
|
||||||
s32 is_identity_fixed_mtx(Mtx* mtx);
|
s32 is_identity_fixed_mtx(Mtx* mtx);
|
||||||
|
|
||||||
@ -2987,7 +2987,7 @@ void func_80114B58(u32 romOffset, TextureHandle* handle, TextureHeader* header,
|
|||||||
|
|
||||||
handle->gfx = (Gfx*) mdl_nextTextureAddress;
|
handle->gfx = (Gfx*) mdl_nextTextureAddress;
|
||||||
memcpy(&handle->header, header, sizeof(*header));
|
memcpy(&handle->header, header, sizeof(*header));
|
||||||
func_801180E8(header, &mdl_nextTextureAddress, handle->raster, handle->palette, handle->auxRaster, handle->auxPalette, 0, 0, 0, 0);
|
func_801180E8(header, (Gfx**)&mdl_nextTextureAddress, handle->raster, handle->palette, handle->auxRaster, handle->auxPalette, 0, 0, 0, 0);
|
||||||
gSPEndDisplayList(((Gfx*) mdl_nextTextureAddress)++);
|
gSPEndDisplayList(((Gfx*) mdl_nextTextureAddress)++);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3643,7 +3643,260 @@ void render_transform_group(void* data) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
INCLUDE_ASM(s32, "a5dd0_len_114e0", func_801180E8);
|
void func_801180E8(TextureHeader* header, Gfx** gfxPos, IMG_PTR raster, PAL_PTR palette, IMG_PTR auxRaster, PAL_PTR auxPalette, u8 arg6, u8 arg7, u16 arg8, u16 arg9) {
|
||||||
|
s32 mainWidth, mainHeight;
|
||||||
|
s32 auxWidth, auxHeight;
|
||||||
|
s32 mainFmt;
|
||||||
|
s32 auxFmt;
|
||||||
|
s32 mainWrapW, mainWrapH;
|
||||||
|
s32 auxWrapW, auxWrapH;
|
||||||
|
s32 extraTileType;
|
||||||
|
u32 renderType;
|
||||||
|
s32 lod;
|
||||||
|
s32 lodDivisor;
|
||||||
|
IMG_PTR rasterPtr;
|
||||||
|
s32 filteringMode;
|
||||||
|
s32 auxPaletteIndex;
|
||||||
|
s32 lutMode;
|
||||||
|
s32 lodMode;
|
||||||
|
s32 mainMasks, mainMaskt;
|
||||||
|
s32 auxMasks, auxMaskt;
|
||||||
|
s32 mainBitDepth;
|
||||||
|
s32 auxBitDepth;
|
||||||
|
s32 temp;
|
||||||
|
|
||||||
|
mainWidth = header->mainW;
|
||||||
|
mainHeight = header->mainH;
|
||||||
|
|
||||||
|
lod = 0;
|
||||||
|
auxPaletteIndex = 0;
|
||||||
|
|
||||||
|
mainMasks = INTEGER_LOG2(mainWidth);
|
||||||
|
mainMaskt = INTEGER_LOG2(mainHeight);
|
||||||
|
|
||||||
|
mainWrapW = header->mainWrapW;
|
||||||
|
mainWrapH = header->mainWrapH;
|
||||||
|
|
||||||
|
mainFmt = header->mainFmt;
|
||||||
|
mainBitDepth = header->mainBitDepth;
|
||||||
|
|
||||||
|
extraTileType = header->extraTiles;
|
||||||
|
filteringMode = header->filtering << G_MDSFT_TEXTFILT;
|
||||||
|
|
||||||
|
auxWidth = header->auxW;
|
||||||
|
auxHeight = header->auxH;
|
||||||
|
|
||||||
|
auxMasks = INTEGER_LOG2(auxWidth);
|
||||||
|
auxMaskt = INTEGER_LOG2(auxHeight);
|
||||||
|
|
||||||
|
auxWrapW = header->auxWrapW;
|
||||||
|
auxWrapH = header->auxWrapH;
|
||||||
|
auxFmt = header->auxFmt;
|
||||||
|
auxBitDepth = header->auxBitDepth;
|
||||||
|
|
||||||
|
|
||||||
|
if (extraTileType == 3) {
|
||||||
|
if (palette != NULL) {
|
||||||
|
auxPaletteIndex = 1;
|
||||||
|
} else {
|
||||||
|
auxPaletteIndex = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (palette != NULL || auxPalette != NULL) {
|
||||||
|
lutMode = G_TT_RGBA16;
|
||||||
|
if (palette != NULL) {
|
||||||
|
if (mainBitDepth == G_IM_SIZ_4b) {
|
||||||
|
gDPLoadTLUT_pal16((*gfxPos)++, 0, palette);
|
||||||
|
} else if (mainBitDepth == G_IM_SIZ_8b) {
|
||||||
|
gDPLoadTLUT_pal256((*gfxPos)++, palette);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (auxPalette != NULL) {
|
||||||
|
if (auxBitDepth == G_IM_SIZ_4b) {
|
||||||
|
gDPLoadTLUT_pal16((*gfxPos)++, auxPaletteIndex, auxPalette);
|
||||||
|
} else if (auxBitDepth == G_IM_SIZ_8b) {
|
||||||
|
gDPLoadTLUT_pal256((*gfxPos)++, auxPalette);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
lutMode = G_TT_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
renderType = header->colorCombineType;
|
||||||
|
if (renderType >= 3) {
|
||||||
|
renderType += 10;
|
||||||
|
} else {
|
||||||
|
renderType = header->extraTiles * 3 + 1 + header->colorCombineSubType;
|
||||||
|
}
|
||||||
|
|
||||||
|
**gfxPos = D_8014B0B8[renderType][0];
|
||||||
|
(*gfxPos)++;
|
||||||
|
|
||||||
|
switch (extraTileType) {
|
||||||
|
case 0:
|
||||||
|
lodMode = G_TL_TILE;
|
||||||
|
gSPTexture((*gfxPos)++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
|
||||||
|
switch (mainBitDepth) {
|
||||||
|
case G_IM_SIZ_4b:
|
||||||
|
gDPLoadTextureBlock_4b((*gfxPos)++, raster, mainFmt,
|
||||||
|
mainWidth, mainHeight, 0,
|
||||||
|
mainWrapW, mainWrapH, mainMasks, mainMaskt, G_TX_NOLOD, G_TX_NOLOD);
|
||||||
|
break;
|
||||||
|
case G_IM_SIZ_8b:
|
||||||
|
gDPLoadTextureBlock((*gfxPos)++, raster, mainFmt, G_IM_SIZ_8b,
|
||||||
|
mainWidth, mainHeight, 0,
|
||||||
|
mainWrapW, mainWrapH, mainMasks, mainMaskt, G_TX_NOLOD, G_TX_NOLOD);
|
||||||
|
break;
|
||||||
|
case G_IM_SIZ_16b:
|
||||||
|
gDPLoadTextureBlock((*gfxPos)++, raster, mainFmt, G_IM_SIZ_16b,
|
||||||
|
mainWidth, mainHeight, 0,
|
||||||
|
mainWrapW, mainWrapH, mainMasks, mainMaskt, G_TX_NOLOD, G_TX_NOLOD);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
gDPLoadTextureBlock((*gfxPos)++, raster, mainFmt, G_IM_SIZ_32b,
|
||||||
|
mainWidth, mainHeight, 0,
|
||||||
|
mainWrapW, mainWrapH, mainMasks, mainMaskt, G_TX_NOLOD, G_TX_NOLOD);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
lodMode = G_TL_LOD;
|
||||||
|
switch (mainBitDepth) {
|
||||||
|
case G_IM_SIZ_4b:
|
||||||
|
for (rasterPtr = raster, lod = 0, lodDivisor = 1;
|
||||||
|
mainWidth / lodDivisor * 4 >= 64 && mainHeight / lodDivisor != 0;
|
||||||
|
rasterPtr += mainWidth / lodDivisor * mainHeight / lodDivisor / 2, lodDivisor *= 2, lod++)
|
||||||
|
{
|
||||||
|
gDPLoadMultiTile_4b((*gfxPos)++, rasterPtr, (u32)(rasterPtr - raster) >> 3, lod, mainFmt,
|
||||||
|
mainWidth / lodDivisor, mainHeight / lodDivisor,
|
||||||
|
0, 0, mainWidth / lodDivisor - 1, mainHeight / lodDivisor - 1, 0,
|
||||||
|
mainWrapW, mainWrapH, mainMasks - lod, mainMaskt - lod, lod, lod);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case G_IM_SIZ_8b:
|
||||||
|
for (rasterPtr = raster, lod = 0, lodDivisor = 1;
|
||||||
|
mainWidth / lodDivisor * 8 >= 64 && mainHeight / lodDivisor != 0;
|
||||||
|
rasterPtr += mainWidth / lodDivisor * mainHeight / lodDivisor, lodDivisor *= 2, lod++)
|
||||||
|
{
|
||||||
|
gDPLoadMultiTile((*gfxPos)++, rasterPtr, ((u32)(rasterPtr - raster)) >> 3, lod, mainFmt, G_IM_SIZ_8b,
|
||||||
|
mainWidth / lodDivisor, mainHeight / lodDivisor,
|
||||||
|
0, 0, mainWidth / lodDivisor - 1, mainHeight / lodDivisor - 1, 0,
|
||||||
|
mainWrapW, mainWrapH, mainMasks - lod, mainMaskt - lod, lod, lod);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case G_IM_SIZ_16b:
|
||||||
|
for (rasterPtr = raster, lod = 0, lodDivisor = 1;
|
||||||
|
mainWidth / lodDivisor * 16 >= 64 && mainHeight / lodDivisor != 0;
|
||||||
|
rasterPtr += mainWidth / lodDivisor * mainHeight / lodDivisor * 2, lodDivisor *= 2, lod++)
|
||||||
|
{
|
||||||
|
gDPLoadMultiTile((*gfxPos)++, rasterPtr, ((u32)(rasterPtr - raster)) >> 3, lod, mainFmt, G_IM_SIZ_16b,
|
||||||
|
mainWidth / lodDivisor, mainHeight / lodDivisor,
|
||||||
|
0, 0, mainWidth / lodDivisor - 1, mainHeight / lodDivisor - 1, 0,
|
||||||
|
mainWrapW, mainWrapH, mainMasks - lod, mainMaskt - lod, lod, lod);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case G_IM_SIZ_32b:
|
||||||
|
for (rasterPtr = raster, lod = 0, lodDivisor = 1;
|
||||||
|
mainWidth / lodDivisor * 32 >= 64 && mainHeight / lodDivisor != 0;
|
||||||
|
rasterPtr += mainWidth / lodDivisor * mainHeight / lodDivisor * 4, lodDivisor *= 2, lod++)
|
||||||
|
{
|
||||||
|
gDPLoadMultiTile((*gfxPos)++, rasterPtr, ((u32)(rasterPtr - raster)) >> 4, lod, mainFmt, G_IM_SIZ_32b,
|
||||||
|
mainWidth / lodDivisor, mainHeight / lodDivisor,
|
||||||
|
0, 0, mainWidth / lodDivisor - 1, mainHeight / lodDivisor - 1, 0,
|
||||||
|
mainWrapW, mainWrapH, mainMasks - lod, mainMaskt - lod, lod, lod);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// use tile with lowest quality
|
||||||
|
gSPTexture((*gfxPos)++, 0xFFFF, 0xFFFF, lod - 1, G_TX_RENDERTILE, G_ON);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
gSPTexture((*gfxPos)++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
|
||||||
|
gDPPipeSync((*gfxPos)++);
|
||||||
|
lodMode = G_TL_TILE;
|
||||||
|
switch (mainBitDepth) {
|
||||||
|
case G_IM_SIZ_4b:
|
||||||
|
gDPScrollTextureBlockHalfHeight_4b((*gfxPos)++, raster, mainFmt, mainWidth, mainHeight, 0,
|
||||||
|
mainWrapW, mainWrapH, mainMasks, mainMaskt, G_TX_NOLOD, G_TX_NOLOD,
|
||||||
|
arg8, arg9, arg6, arg7);
|
||||||
|
break;
|
||||||
|
case G_IM_SIZ_8b:
|
||||||
|
gDPScrollTextureBlockHalfHeight((*gfxPos)++, raster, mainFmt, G_IM_SIZ_8b, mainWidth, mainHeight, 0,
|
||||||
|
mainWrapW, mainWrapH, mainMasks, mainMaskt, G_TX_NOLOD, G_TX_NOLOD,
|
||||||
|
arg8, arg9, arg6, arg7);
|
||||||
|
break;
|
||||||
|
case G_IM_SIZ_16b:
|
||||||
|
gDPScrollTextureBlockHalfHeight((*gfxPos)++, raster, mainFmt, G_IM_SIZ_16b, mainWidth, mainHeight, 0,
|
||||||
|
mainWrapW, mainWrapH, mainMasks, mainMaskt, G_TX_NOLOD, G_TX_NOLOD,
|
||||||
|
arg8, arg9, arg6, arg7);
|
||||||
|
break;
|
||||||
|
case G_IM_SIZ_32b:
|
||||||
|
gDPScrollTextureBlockHalfHeight((*gfxPos)++, raster, mainFmt, G_IM_SIZ_32b, mainWidth, mainHeight, 0,
|
||||||
|
mainWrapW, mainWrapH, mainMasks, mainMaskt, G_TX_NOLOD, G_TX_NOLOD,
|
||||||
|
arg8, arg9, arg6, arg7);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
gSPTexture((*gfxPos)++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
|
||||||
|
lodMode = G_TL_TILE;
|
||||||
|
switch (mainBitDepth) {
|
||||||
|
case G_IM_SIZ_4b:
|
||||||
|
gDPLoadTextureTile_4b((*gfxPos)++, raster, mainFmt, mainWidth, mainHeight,
|
||||||
|
0, 0, mainWidth - 1, mainHeight - 1, 0,
|
||||||
|
mainWrapW, mainWrapH, mainMasks, mainMaskt, G_TX_NOLOD, G_TX_NOLOD);
|
||||||
|
lodDivisor = (((mainWidth * mainHeight) >> 1) + 7)>>3; // required to use lodDivisor here
|
||||||
|
break;
|
||||||
|
case G_IM_SIZ_8b:
|
||||||
|
gDPLoadTextureTile((*gfxPos)++, raster, mainFmt, G_IM_SIZ_8b, mainWidth, mainHeight,
|
||||||
|
0, 0, mainWidth - 1, mainHeight - 1, 0,
|
||||||
|
mainWrapW, mainWrapH, mainMasks, mainMaskt, G_TX_NOLOD, G_TX_NOLOD);
|
||||||
|
lodDivisor = ((mainWidth * mainHeight) + 7)>>3;
|
||||||
|
break;
|
||||||
|
case G_IM_SIZ_16b:
|
||||||
|
gDPLoadTextureTile((*gfxPos)++, raster, mainFmt, G_IM_SIZ_16b, mainWidth, mainHeight,
|
||||||
|
0, 0, mainWidth - 1, mainHeight - 1, 0,
|
||||||
|
mainWrapW, mainWrapH, mainMasks, mainMaskt, G_TX_NOLOD, G_TX_NOLOD);
|
||||||
|
lodDivisor = ((mainWidth * mainHeight) * 2 + 7)>>3;
|
||||||
|
break;
|
||||||
|
case G_IM_SIZ_32b:
|
||||||
|
gDPLoadTextureTile((*gfxPos)++, raster, mainFmt, G_IM_SIZ_32b, mainWidth, mainHeight,
|
||||||
|
0, 0, mainWidth - 1, mainHeight - 1, 0,
|
||||||
|
mainWrapW, mainWrapH, mainMasks, mainMaskt, G_TX_NOLOD, G_TX_NOLOD);
|
||||||
|
lodDivisor = ((mainWidth * mainHeight / 2) * 2 + 7)>>3;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (auxBitDepth) {
|
||||||
|
case G_IM_SIZ_4b:
|
||||||
|
gDPScrollMultiTile_4b((*gfxPos)++, auxRaster, lodDivisor, 1, auxFmt, auxWidth, auxHeight,
|
||||||
|
0, 0, auxWidth - 1, auxHeight - 1, auxPaletteIndex,
|
||||||
|
auxWrapW, auxWrapH, auxMasks, auxMaskt,
|
||||||
|
arg6, arg7, arg8, arg9);
|
||||||
|
break;
|
||||||
|
case G_IM_SIZ_8b:
|
||||||
|
gDPScrollMultiTile((*gfxPos)++, auxRaster, lodDivisor, 1, auxFmt, G_IM_SIZ_8b, auxWidth, auxHeight,
|
||||||
|
0, 0, auxWidth - 1, auxHeight - 1, auxPaletteIndex,
|
||||||
|
auxWrapW, auxWrapH, auxMasks, auxMaskt,
|
||||||
|
arg6, arg7, arg8, arg9);
|
||||||
|
break;
|
||||||
|
case G_IM_SIZ_16b:
|
||||||
|
gDPScrollMultiTile((*gfxPos)++, auxRaster, lodDivisor, 1, auxFmt, G_IM_SIZ_16b, auxWidth, auxHeight,
|
||||||
|
0, 0, auxWidth - 1, auxHeight - 1, auxPaletteIndex,
|
||||||
|
auxWrapW, auxWrapH, auxMasks, auxMaskt,
|
||||||
|
arg6, arg7, arg8, arg9);
|
||||||
|
break;
|
||||||
|
case G_IM_SIZ_32b:
|
||||||
|
gDPScrollMultiTile((*gfxPos)++, auxRaster, lodDivisor, 1, auxFmt, G_IM_SIZ_32b, auxWidth, auxHeight,
|
||||||
|
0, 0, auxWidth - 1, auxHeight - 1, auxPaletteIndex,
|
||||||
|
auxWrapW, auxWrapH, auxMasks, auxMaskt,
|
||||||
|
arg6, arg7, arg8, arg9);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
gSPSetOtherMode((*gfxPos)++, G_SETOTHERMODE_H, 4, 16, filteringMode | G_TC_FILT | lutMode | lodMode | G_TP_PERSP );
|
||||||
|
}
|
||||||
|
|
||||||
Model* get_model_from_list_index(s32 listIndex) {
|
Model* get_model_from_list_index(s32 listIndex) {
|
||||||
return (*gCurrentModels)[listIndex];
|
return (*gCurrentModels)[listIndex];
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user