diff options
Diffstat (limited to 'engines/avalanche')
-rw-r--r-- | engines/avalanche/dialogs.cpp | 30 | ||||
-rw-r--r-- | engines/avalanche/dialogs.h | 1 | ||||
-rw-r--r-- | engines/avalanche/graphics.cpp | 34 | ||||
-rw-r--r-- | engines/avalanche/graphics.h | 1 |
4 files changed, 37 insertions, 29 deletions
diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index 551b45e984..9557b36b74 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -381,32 +381,6 @@ void Dialogs::getIcon(int16 x, int16 y, byte which) { file.close(); } -void Dialogs::drawSign(Common::String fn, int16 xl, int16 yl, int16 y) { - Common::File file; - Common::String filename = Common::String::format("%s.avd", fn.c_str()); - - if (!file.open(filename)) - error("AVALANCHE: Scrolls: File not found: %s", filename.c_str()); - -#if 0 - uint16 st = (y - 1) * 80 + (40 - xl / 2) + ((1 - _vm->cp) * _vm->pagetop); - byte bit; - for (uint16 i = 1; i <= yl; i++) - for (bit = 0; bit <= 3; bit++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, mem[0xa000 * st + (i * 80)], xl); - } - bit = getpixel(0, 0); -#endif - - warning("STUB: Scrolls::drawSign()"); - - file.close(); -} - void Dialogs::drawScroll(DialogFunctionType modeFunc) { int16 lx = 0; int16 ly = (_maxLineNum + 1) * 6; @@ -438,11 +412,11 @@ void Dialogs::drawScroll(DialogFunctionType modeFunc) { iconIndent = 0; break; // No icon. case 34: - drawSign("about", 28, 76, 15); + _vm->_graphics->drawSign("about", 28, 76, 15); iconIndent = 0; break; case 35: - drawSign("gameover", 52, 59, 71); + _vm->_graphics->drawSign("gameover", 52, 59, 71); iconIndent = 0; break; } diff --git a/engines/avalanche/dialogs.h b/engines/avalanche/dialogs.h index fec842907d..19ee9e36a2 100644 --- a/engines/avalanche/dialogs.h +++ b/engines/avalanche/dialogs.h @@ -126,7 +126,6 @@ private: void resetScrollDriver(); void ringBell(); // Original: dingdongbell void getIcon(int16 x, int16 y, byte which); - void drawSign(Common::String name, int16 xl, int16 yl, int16 y); // This is for drawing a big "about" or "gameover" picture loaded from a file into an empty scroll. void loadFont(); // From Visa: diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 2d3d82ebd7..4435e5939b 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -560,6 +560,40 @@ void GraphicManager::drawReadyLight(Color color) { _surface.fillRect(Common::Rect(419, 195, 438, 197), color); } +void GraphicManager::drawSign(Common::String fn, int16 xl, int16 yl, int16 y) { + Common::File file; + Common::String filename = Common::String::format("%s.avd", fn.c_str()); + + if (!file.open(filename)) + error("AVALANCHE: Scrolls: File not found: %s", filename.c_str()); + + // I know it looks very similar to the loadPicture methods, but in truth it's the combination of the two. + + uint16 width = xl * 8; + uint16 height = yl; + + Graphics::Surface sign; // We make a Surface object for the picture itself. + sign.create(width, height, Graphics::PixelFormat::createFormatCLUT8()); + + // Produce the picture. We read it in row-by-row, and every row has 4 planes. + for (int y = 0; y < height; y++) { + for (int8 plane = 0; plane < 4; plane++) { // The planes are in the "right" order. + for (uint16 x = 0; x < width; x += 8) { + byte pixel = file.readByte(); + for (int bit = 0; bit < 8; bit++) { + byte pixelBit = (pixel >> bit) & 1; + if (pixelBit != 0) + *(byte *)sign.getBasePtr(x + 7 - bit, y) += (pixelBit << plane); + } + } + } + } + + drawPicture(_scrolls, sign, kScreenWidth / 2 - width / 2, y); + + file.close(); +} + void GraphicManager::prepareBubble(int xc, int xw, int my, Common::Point points[3]) { // Backup the screen before drawing the bubble. _scrolls.copyFrom(_surface); diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index c78ac56a9c..aa9c209c4f 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -104,6 +104,7 @@ public: void drawToolbar(); void drawCursor(byte pos); void drawReadyLight(Color color); + void drawSign(Common::String name, int16 xl, int16 yl, int16 y); // This is for drawing a big "about" or "gameover" picture loaded from a file into an empty scroll. void prepareBubble(int xc, int xw, int my, Common::Point points[3]); |