Really fixes #6: Trying to load CLUT in non existent TIM

This commit is contained in:
ABelliqueux 2021-07-02 19:21:09 +02:00
parent 7817c495f8
commit 93331f49fa
1 changed files with 19 additions and 15 deletions

View File

@ -349,6 +349,7 @@ long drawQuad(MESH * mesh, long * Flag, int atime, int * camMode, char ** nextpr
}
if (nclip > 0 && mesh->OTz > 0 && (mesh->p < 4096)) {
SetPolyGT4(poly4);
if (mesh->tim){
// If tim mode == 0 | 1, set CLUT coordinates
if ( (mesh->tim->mode & 0x3) < 2 ) {
setClut(poly4,
@ -356,6 +357,7 @@ long drawQuad(MESH * mesh, long * Flag, int atime, int * camMode, char ** nextpr
mesh->tim->crect->y
);
}
}
if (mesh->isSprite){
// Turn off shading on sprite
SetShadeTex( poly4, 1 );
@ -426,6 +428,7 @@ long drawTri(MESH * mesh, long * Flag, int atime, int * camMode, char ** nextpri
// Do not draw invisible meshes
if ( nclip > 0 && mesh->OTz > 0 && (mesh->p < 4096) ) {
SetPolyGT3( poly );
if (mesh->tim){
// CLUT setup
// If tim mode == 0 | 1 (4bits/8bits image), set CLUT coordinates
if ( (mesh->tim->mode & 0x3 ) < 2){
@ -436,6 +439,7 @@ long drawTri(MESH * mesh, long * Flag, int atime, int * camMode, char ** nextpri
if ( mesh->isSprite ) {
SetShadeTex( poly, 1 );
}
}
// If isPrism flag is set, use it
if ( mesh->isPrism ) {
set3Prism(poly, mesh, draw, db, i);