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,12 +349,14 @@ 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 tim mode == 0 | 1, set CLUT coordinates if (mesh->tim){
if ( (mesh->tim->mode & 0x3) < 2 ) { // If tim mode == 0 | 1, set CLUT coordinates
setClut(poly4, if ( (mesh->tim->mode & 0x3) < 2 ) {
mesh->tim->crect->x, setClut(poly4,
mesh->tim->crect->y mesh->tim->crect->x,
); mesh->tim->crect->y
);
}
} }
if (mesh->isSprite){ if (mesh->isSprite){
// Turn off shading on sprite // Turn off shading on sprite
@ -426,15 +428,17 @@ 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 );
// CLUT setup if (mesh->tim){
// If tim mode == 0 | 1 (4bits/8bits image), set CLUT coordinates // CLUT setup
if ( (mesh->tim->mode & 0x3 ) < 2){ // If tim mode == 0 | 1 (4bits/8bits image), set CLUT coordinates
setClut(poly, if ( (mesh->tim->mode & 0x3 ) < 2){
mesh->tim->crect->x, setClut(poly,
mesh->tim->crect->y); mesh->tim->crect->x,
} mesh->tim->crect->y);
if ( mesh->isSprite ) { }
SetShadeTex( poly, 1 ); if ( mesh->isSprite ) {
SetShadeTex( poly, 1 );
}
} }
// If isPrism flag is set, use it // If isPrism flag is set, use it
if ( mesh->isPrism ) { if ( mesh->isPrism ) {