Fix for bug #929724 (MI2: Intro regression) -> since _outheight can be negative, negative y values aren't filtered out automatically anymore, so we have to explicitly check for them

svn-id: r13478
This commit is contained in:
Max Horn 2004-04-06 01:06:54 +00:00
parent 92301bff74
commit cc954a70ae
2 changed files with 18 additions and 9 deletions

View File

@ -382,9 +382,9 @@ void AkosRenderer::codec1_genericDecode() {
return; return;
} }
} else { } else {
masked = (y < _outheight) && v1.mask_ptr && ((mask[0] | mask[v1.imgbufoffs]) & maskbit); masked = (y < 0 || y >= _outheight) || (v1.mask_ptr && ((mask[0] | mask[v1.imgbufoffs]) & maskbit));
if (color && y < _outheight && !masked && !skip_column) { if (color && !masked && !skip_column) {
pcolor = palette[color]; pcolor = palette[color];
if (_shadow_mode == 1) { if (_shadow_mode == 1) {
if (pcolor == 13) if (pcolor == 13)
@ -725,9 +725,15 @@ byte AkosRenderer::codec1(int xmoveCur, int ymoveCur) {
if (v1.skip_width <= 0 || _height <= 0) if (v1.skip_width <= 0 || _height <= 0)
return 0; return 0;
if (rect.top > _outheight) if (rect.left < 0)
rect.left = 0;
if (rect.top < 0)
rect.top = 0; rect.top = 0;
if (rect.top > _outheight)
rect.top = _outheight;
if (rect.bottom > _outheight) if (rect.bottom > _outheight)
rect.bottom = _outheight; rect.bottom = _outheight;

View File

@ -200,7 +200,7 @@ byte CostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) {
v1.scaleXstep = _mirror ? 1 : -1; v1.scaleXstep = _mirror ? 1 : -1;
if (_vm->_version == 1) if (_vm->_version == 1)
//HACK: it fix gfx glitches leaved by actor costume in V1 games, when actor moving to left //HACK: it fix gfx glitches left by actor costume in V1 games, when actor moving to left
_vm->markRectAsDirty(kMainVirtScreen, rect.left, rect.right + 8, rect.top, rect.bottom, _actorID); _vm->markRectAsDirty(kMainVirtScreen, rect.left, rect.right + 8, rect.top, rect.bottom, _actorID);
else else
_vm->markRectAsDirty(kMainVirtScreen, rect.left, rect.right + 1, rect.top, rect.bottom, _actorID); _vm->markRectAsDirty(kMainVirtScreen, rect.left, rect.right + 1, rect.top, rect.bottom, _actorID);
@ -254,9 +254,12 @@ byte CostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) {
if (rect.left < 0) if (rect.left < 0)
rect.left = 0; rect.left = 0;
if (rect.top > _outheight) if (rect.top < 0)
rect.top = 0; rect.top = 0;
if (rect.top > _outheight)
rect.top = _outheight;
if (rect.bottom > _outheight) if (rect.bottom > _outheight)
rect.bottom = _outheight; rect.bottom = _outheight;
@ -394,7 +397,7 @@ void CostumeRenderer::procC64(int actor) {
if (!rep) if (!rep)
color = *src++; color = *src++;
if (y < _outheight) { if (0 <= y && y < _outheight) {
if (!_mirror) { if (!_mirror) {
LINE(0, 0); LINE(2, 2); LINE(4, 4); LINE(6, 6); LINE(0, 0); LINE(2, 2); LINE(4, 4); LINE(6, 6);
} else { } else {
@ -455,9 +458,9 @@ void CostumeRenderer::proc3() {
do { do {
if (_scaleY == 255 || *scaleytab++ < _scaleY) { if (_scaleY == 255 || *scaleytab++ < _scaleY) {
masked = (y < _outheight) && v1.mask_ptr && ((mask[0] | mask[v1.imgbufoffs]) & maskbit); masked = (y < 0 || y >= _outheight) || (v1.mask_ptr && ((mask[0] | mask[v1.imgbufoffs]) & maskbit));
if (color && y < _outheight && !masked) { if (color && !masked) {
// FIXME: Fully implement _shadow_mode. // FIXME: Fully implement _shadow_mode.
// For now, it's enough for Sam & Max // For now, it's enough for Sam & Max
// transparency. // transparency.
@ -525,7 +528,7 @@ void CostumeRenderer::proc3_ami() {
len = *src++; len = *src++;
do { do {
if (_scaleY == 255 || cost_scaleTable[_scaleIndexY] < _scaleY) { if (_scaleY == 255 || cost_scaleTable[_scaleIndexY] < _scaleY) {
masked = (y >= _outheight) || v1.mask_ptr && ((mask[0] | mask[v1.imgbufoffs]) & maskbit); masked = (y < 0 || y >= _outheight) || (v1.mask_ptr && ((mask[0] | mask[v1.imgbufoffs]) & maskbit));
if (color && v1.x >= 0 && v1.x < _outwidth && !masked) { if (color && v1.x >= 0 && v1.x < _outwidth && !masked) {
*dst = _palette[color]; *dst = _palette[color];