MCPcopy Create free account
hub / github.com/doldecomp/mkdd / getUsableTlut

Method getUsableTlut

libs/JSystem/J2DGraph/J2DPictureEx.cpp:1220–1248  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1218}
1219
1220u8 J2DPictureEx::getUsableTlut(u8 id)
1221{
1222 u8 usedTexFlags = 0;
1223 u32 texNum = mMaterial->getTexGenBlock()->getTexGenNum();
1224 for (u8 i = 0; i < texNum; i++) {
1225 JUTTexture* texture = mMaterial->getTevBlock()->getTexture(i);
1226 if (i != id && texture != nullptr) {
1227 const ResTIMG* img = texture->getTexInfo();
1228
1229 if (img != nullptr && img->mPaletteFormat != 0) {
1230 int name = texture->getTlutName();
1231 int tlutID = name >= GX_BIGTLUT0 ? GX_BIGTLUT0 : GX_TLUT0;
1232
1233 u8 diffID = name - tlutID;
1234 if (diffID < 8) {
1235 usedTexFlags |= (1 << diffID);
1236 }
1237 }
1238 }
1239 }
1240
1241 for (u8 i = 0; i < 8; i++) {
1242 if (!(usedTexFlags & (1 << i))) {
1243 return i;
1244 }
1245 }
1246
1247 return 0;
1248}

Callers

nothing calls this directly

Calls 6

getTexInfoMethod · 0.80
getTexGenNumMethod · 0.45
getTexGenBlockMethod · 0.45
getTextureMethod · 0.45
getTevBlockMethod · 0.45
getTlutNameMethod · 0.45

Tested by

no test coverage detected