SCUMM: Fix Full Throttle drawing glitch (bug #13419)

The drawObject() function would always mask out the last three bits of
the object height. This is correct for many versions of SCUMM, but not
for SCUMM v7-v8. In Full Throttle, it caused a glitch when drawing the
open doors to the Corley Motors building late in the game.

So far, this is the only glitch known to have been caused by this. Maybe
the developers generally adjusted the height of their objects out of
habit when creating the games?
This commit is contained in:
Torbjörn Andersson 2022-04-17 06:40:57 +02:00 committed by Torbjörn Andersson
parent 6bdb93bcce
commit 195238f8c5

View file

@ -624,8 +624,16 @@ void ScummEngine::drawObject(int obj, int arg) {
const int xpos = od.x_pos / 8;
const int ypos = od.y_pos;
// In most cases we want to mask out the last three bits, though it is
// possible that this has already been done by resetRoomObject(). In
// later versions we need to keep those bits intact. See bug #13419 for
// an example of where this is important.
if (_game.version < 7)
od.height &= 0xFFFFFFF8;
width = od.width / 8;
height = od.height &= 0xFFFFFFF8; // Mask out last 3 bits
height = od.height;
// Short circuit for objects which aren't visible at all.
if (width == 0 || xpos > _screenEndStrip || xpos + width < _screenStartStrip)