Permalink
Browse files

SUPERNOVA: Removes 'inverse section' case

This code section was converted from the original source, where the
sections are directly drawn to the screen instead of buffered.
If a section > 128 is set as parameter, the function takes the
dimensions of section - 128 and draws this region of section 0 to the
screen, thus restoring it.
It would not make sense loading part of section 0 in seperate Surfaces
especially since kMaxSection is smaller than 128 the else branch is
never entered so removing it doesn't change the programs behavior.
  • Loading branch information...
Joefish committed Jul 17, 2017
1 parent c314338 commit ea064e17c1830950f76cbee51715a3f7e4156245
Showing with 17 additions and 35 deletions.
  1. +17 −35 engines/supernova/graphics.cpp
@@ -164,41 +164,23 @@ bool MSNImageDecoder::loadSections() {
}
} else {
uint image = section;
if (image < 128) {
do {
uint32 offset = (_section[image].addressHigh << 16) + _section[image].addressLow;
if (offset == kInvalidAddress || _section[image].x2 == 0) {
return false;
}
int width = _section[image].x2 - _section[image].x1 + 1;
int height = _section[image].y2 - _section[image].y1 + 1;
uint32 destAddress = imageWidth * _section[image].y1 + _section[image].x1;
while (height) {
Common::copy(_encodedImage + offset, _encodedImage + offset + width, surfacePixels + destAddress);
offset += width;
destAddress += imageWidth;
--height;
}
image = _section[image].next;
} while (image != 0);
} else {
image -= 128;
do {
int width = _section[image].x2 - _section[image].x1 + 1;
int height = _section[image].y2 - _section[image].y1 + 1;
uint32 destAddress = imageWidth * _section[image].y1 + _section[image].x1;
uint32 offset = (_section[image].addressHigh << 16) + _section[image].addressLow + destAddress;
while (height) {
Common::copy(_encodedImage + offset, _encodedImage + offset + width, surfacePixels + destAddress);
offset += imageWidth;
destAddress += imageWidth;
--height;
}
image = _section[image].next;
} while (image != 0);
}
do {
uint32 offset = (_section[image].addressHigh << 16) + _section[image].addressLow;
if (offset == kInvalidAddress || _section[image].x2 == 0) {
return false;
}
int width = _section[image].x2 - _section[image].x1 + 1;
int height = _section[image].y2 - _section[image].y1 + 1;
uint32 destAddress = imageWidth * _section[image].y1 + _section[image].x1;
while (height) {
Common::copy(_encodedImage + offset, _encodedImage + offset + width, surfacePixels + destAddress);
offset += width;
destAddress += imageWidth;
--height;
}
image = _section[image].next;
} while (image != 0);
}
}

0 comments on commit ea064e1

Please sign in to comment.