diff options
Diffstat (limited to 'engines/sword1')
-rw-r--r-- | engines/sword1/resman.cpp | 11 | ||||
-rw-r--r-- | engines/sword1/screen.cpp | 4 |
2 files changed, 9 insertions, 6 deletions
diff --git a/engines/sword1/resman.cpp b/engines/sword1/resman.cpp index 41f952c3f4..228cd28bb7 100644 --- a/engines/sword1/resman.cpp +++ b/engines/sword1/resman.cpp @@ -332,10 +332,13 @@ Common::File *ResMan::resFile(uint32 id) { Clu *closeClu = _openCluStart; _openCluStart = _openCluStart->nextOpen; - closeClu->file->close(); - delete closeClu->file; - closeClu->file = NULL; - closeClu->nextOpen = NULL; + if (closeClu) { + if (closeClu->file) + closeClu->file->close(); + delete closeClu->file; + closeClu->file = NULL; + closeClu->nextOpen = NULL; + } _openClus--; } } diff --git a/engines/sword1/screen.cpp b/engines/sword1/screen.cpp index b07acf9a0b..9fa808d561 100644 --- a/engines/sword1/screen.cpp +++ b/engines/sword1/screen.cpp @@ -886,8 +886,8 @@ uint8* Screen::psxBackgroundToIndexed(uint8 *psxBackground, uint32 bakXres, uint // needed because some psx backgrounds are half width and half height uint8* Screen::psxShrinkedBackgroundToIndexed(uint8 *psxBackground, uint32 bakXres, uint32 bakYres) { - uint32 xresInTiles = (bakXres / 2) % 16 ? (bakXres / 32) + 1 : (bakXres / 32); - uint32 yresInTiles = (bakYres / 2) % 16 ? (bakYres / 32) + 1 : (bakYres / 32); + uint32 xresInTiles = ((bakXres / 2) % 16) ? (bakXres / 32) + 1 : (bakXres / 32); + uint32 yresInTiles = ((bakYres / 2) % 16) ? (bakYres / 32) + 1 : (bakYres / 32); uint32 totTiles = xresInTiles * yresInTiles; uint32 tileYpos = 0; //tile position in a virtual xresInTiles * yresInTiles grid uint32 tileXpos = 0; |