SUPERNOVA: add renderBox()

This commit is contained in:
Joseph-Eugene Winzer 2017-06-07 18:34:11 +02:00 committed by Thierry Crozat
parent 9b4bade4f6
commit 332763e825
4 changed files with 12 additions and 13 deletions

View File

@ -72,8 +72,7 @@ bool MSNImageDecoder::loadStream(Common::SeekableReadStream &stream) {
_clickField[i].next = stream.readByte();
}
byte zwCodes[256];
Common::fill(zwCodes, zwCodes + 256, 0);
byte zwCodes[256] = {0};
byte numRepeat = stream.readByte();
byte numZw = stream.readByte();
stream.read(zwCodes, numZw);

View File

@ -14,16 +14,6 @@ struct Surface;
namespace Supernova {
const byte initPalette[48] = {
// r g b
0, 0, 0, 16, 16, 16, 22, 22, 22,
28, 28, 28, 63, 63, 63, 0, 52, 0,
0, 63, 0, 54, 0, 0, 63, 0, 0,
0, 0, 30, 0, 0, 45, 40, 40, 40,
20, 50, 63, 10, 63, 10, 60, 60, 0,
63, 10, 10
};
class MSNImageDecoder : public Image::ImageDecoder {
public:
MSNImageDecoder();

View File

@ -74,7 +74,6 @@ Common::Error SupernovaEngine::run() {
_gameRunning = true;
while (_gameRunning) {
updateEvents();
renderImage(31, 0);
_system->updateScreen();
_system->delayMillis(10);
@ -217,4 +216,14 @@ void SupernovaEngine::renderImage(int filenumber, int section) {
_system->copyRectToScreen(_image.getSurface()->getPixels(), 320, 0, 0, 320, 200);
}
void SupernovaEngine::renderBox(int x, int y, int width, int height, byte color) {
Graphics::Surface *screen = _system->lockScreen();
screen->drawLine(x, y, x + width, y, color);
screen->drawLine(x + width, y, x + width, y + height, color);
screen->drawLine(x + width, y + height, x, y + height, color);
screen->drawLine(x, y + height, x, y, color);
_system->unlockScreen();
}
}

View File

@ -62,6 +62,7 @@ private:
void playSoundMod(int filenumber);
void stopSound();
void renderImage(int filenumber, int section);
void renderBox(int x, int y, int width, int height, byte color);
};
}