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

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