diff options
Diffstat (limited to 'engines/avalanche')
-rw-r--r-- | engines/avalanche/graphics.cpp | 26 | ||||
-rw-r--r-- | engines/avalanche/graphics.h | 22 | ||||
-rw-r--r-- | engines/avalanche/nim.cpp | 21 | ||||
-rw-r--r-- | engines/avalanche/nim.h | 1 |
4 files changed, 56 insertions, 14 deletions
diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 4fdb21db7b..a512e3a7c3 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -59,7 +59,11 @@ GraphicManager::~GraphicManager() { _screen.free(); _scrolls.free(); _backup.free(); + _nimStone.free(); + for (int i = 0; i < 3; i++) + _nimInitials[i].free(); + _nimLogo.free(); for (int i = 0; i < 10; i++) _digits[i].free(); @@ -452,11 +456,15 @@ void GraphicManager::drawDebugLines() { } } -void GraphicManager::blackOutScreen() { - _surface.fillRect(Common::Rect(0, 0, _surface.w, _surface.h), Color::kColorBlack); +void GraphicManager::drawFilledRectangle(Common::Rect rect, Color color) { + _surface.fillRect(rect, color); +} + +void GraphicManager::drawRectangle(Common::Rect rect, Color color) { + _surface.frameRect(rect, color); } -void GraphicManager::loadNimStone() { +void GraphicManager::loadNim() { Common::File file; Common::String filename = "nim.avd"; @@ -466,6 +474,9 @@ void GraphicManager::loadNimStone() { file.seek(41); _nimStone = loadPictureSign(file, 7, 23); + for (int i = 0; i < 3; i++) + _nimInitials[i] = loadPictureSign(file, 7, 23); + _nimLogo = loadPictureSign(file, 30, 37); file.close(); } @@ -474,6 +485,15 @@ void GraphicManager::drawNimStone(int x, int y) { drawPicture(_surface, _nimStone, x, y); } +void GraphicManager::drawNimInitials() { + for (int i = 0; i < 3; i++) + drawPicture(_surface, _nimInitials[i], 0, 75 + i * 35); +} + +void GraphicManager::drawNimLogo() { + drawPicture(_surface, _nimLogo, 392, 5); +} + /** * This function mimics Pascal's getimage(). */ diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index 0df91de67f..d54160229a 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -78,9 +78,12 @@ public: void drawDebugLines(); // For the mini-game "Nim". - void blackOutScreen(); - void loadNimStone(); + void drawFilledRectangle(Common::Rect rect, Color color); + void drawRectangle(Common::Rect rect, Color color); + void loadNim(); void drawNimStone(int x, int y); + void drawNimInitials(); + void drawNimLogo(); void clearAlso(); void clearTextBar(); @@ -88,12 +91,10 @@ public: byte getAlsoColor(int x1, int y1, int x2, int y2); byte getScreenColor(Common::Point pos); - // The caller has to .free() the returned Surfaces!!! - // Further information about these two: http://www.shikadi.net/moddingwiki/Raw_EGA_data + // Further information about this: http://www.shikadi.net/moddingwiki/Raw_EGA_data Graphics::Surface loadPictureRaw(Common::File &file, uint16 width, uint16 height); void drawSprite(AnimationType *sprite, byte picnum, int16 x, int16 y); - void drawPicture(Graphics::Surface &target, const Graphics::Surface picture, uint16 destX, uint16 destY); void drawThinkPic(Common::String filename, int id); void drawToolbar(); void drawCursor(byte pos); @@ -130,14 +131,23 @@ private: Graphics::Surface _screen; // Only used in refreshScreen() to make it more optimized. (No recreation of it at every call of the function.) Graphics::Surface _scrolls; Graphics::Surface _surface; - Graphics::Surface _nimStone; // For the mini-game "Nim". + + // For the mini-game "Nim". + Graphics::Surface _nimStone; + Graphics::Surface _nimInitials[3]; + Graphics::Surface _nimLogo; + byte _egaPalette[64][3]; AvalancheEngine *_vm; + // Further information about these two: http://www.shikadi.net/moddingwiki/Raw_EGA_data Graphics::Surface loadPictureGraphic(Common::File &file); // Reads Graphic-planar EGA data. Graphics::Surface loadPictureSign(Common::File &file, int xl, int yl); // Reads a tricky type of picture used for the "game over"/"about" scrolls and in the mini-game Nim. + void drawText(Graphics::Surface &surface, const Common::String text, FontType font, byte fontHeight, int16 x, int16 y, Color color); + void drawPicture(Graphics::Surface &target, const Graphics::Surface picture, uint16 destX, uint16 destY); + // Taken from Free Pascal's Procedure InternalEllipseDefault. Used to replace Pascal's procedure arc. // Returns the end point of the arc. (Needed in Clock.) // TODO: Make it more accurate later. diff --git a/engines/avalanche/nim.cpp b/engines/avalanche/nim.cpp index 15146eaf63..0f83e9b91c 100644 --- a/engines/avalanche/nim.cpp +++ b/engines/avalanche/nim.cpp @@ -54,8 +54,6 @@ void Nim::resetVariables() { _old[i] = 0; _stones[i] = 0; } - - memset(_stonePic, 0, 4 * 23 * 7); } void Nim::synchronize(Common::Serializer &sz) { @@ -78,9 +76,9 @@ void Nim::playNim() { _vm->_dialogs->displayScrollChain('Q', 3); _playedNim++; - _vm->fadeOut(); - + _vm->_graphics->saveScreen(); + _vm->fadeOut(); CursorMan.showMouse(false); setup(); @@ -138,6 +136,21 @@ void Nim::chalk(int x,int y, Common::String z) { } void Nim::setup() { + _vm->fadeIn(); + _vm->_graphics->loadNim(); + _vm->_graphics->drawFilledRectangle(Common::Rect(0, 0, 640, 200), kColorBlack); + // Upper left rectangle. + _vm->_graphics->drawRectangle(Common::Rect(10, 5, 381, 71), kColorRed); + _vm->_graphics->drawFilledRectangle(Common::Rect(11, 6, 380, 70), kColorBrown); + // Bottom right rectangle. + _vm->_graphics->drawRectangle(Common::Rect(394, 50, 635, 198), kColorRed); + _vm->_graphics->drawFilledRectangle(Common::Rect(395, 51, 634, 197), kColorBrown); + + _vm->_graphics->drawNimLogo(); + _vm->_graphics->drawNimInitials(); + + _vm->_graphics->refreshScreen(); + warning("STUB: Nim::setup()"); } diff --git a/engines/avalanche/nim.h b/engines/avalanche/nim.h index a76afcfe22..e3b4584645 100644 --- a/engines/avalanche/nim.h +++ b/engines/avalanche/nim.h @@ -44,7 +44,6 @@ private: byte _old[3]; byte _stones[3]; - byte _stonePic[4][23][7]; // Picture of Nimstone. byte _turns; bool _dogfoodsTurn; byte _stonesLeft; |