aboutsummaryrefslogtreecommitdiff
path: root/engines/avalanche
diff options
context:
space:
mode:
authoruruk2014-03-04 20:27:00 +0100
committeruruk2014-03-04 20:27:00 +0100
commit80e01378d34217e572825bd6aa1e196247cc5b40 (patch)
treed4566e769128d4f6535cca2fa73f4e3eebb23257 /engines/avalanche
parent8b16fdcede688a156b4787601d284224d915d49f (diff)
downloadscummvm-rg350-80e01378d34217e572825bd6aa1e196247cc5b40.tar.gz
scummvm-rg350-80e01378d34217e572825bd6aa1e196247cc5b40.tar.bz2
scummvm-rg350-80e01378d34217e572825bd6aa1e196247cc5b40.zip
AVALANCHE: Implement MainMenu::option().
Rework and implement a lot of connected functions.
Diffstat (limited to 'engines/avalanche')
-rw-r--r--engines/avalanche/graphics.cpp14
-rw-r--r--engines/avalanche/graphics.h4
-rw-r--r--engines/avalanche/help.cpp8
-rw-r--r--engines/avalanche/mainmenu.cpp19
-rw-r--r--engines/avalanche/mainmenu.h4
5 files changed, 36 insertions, 13 deletions
diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp
index 0ba9a8c118..e1dd8e91cd 100644
--- a/engines/avalanche/graphics.cpp
+++ b/engines/avalanche/graphics.cpp
@@ -353,9 +353,9 @@ void GraphicManager::drawNormalText(const Common::String text, FontType font, by
}
/**
- * Used in Help. Draws text double the size of the normal.
+ * Draws text double the size of the normal.
*/
-void GraphicManager::drawBigText(const Common::String text, FontType font, byte fontHeight, int16 x, int16 y, Color color) {
+void GraphicManager::drawBigText(Graphics::Surface &surface, const Common::String text, FontType font, byte fontHeight, int16 x, int16 y, Color color) {
for (uint i = 0; i < text.size(); i++) {
for (int j = 0; j < fontHeight; j++) {
byte pixel = font[(byte)text[i]][j];
@@ -365,7 +365,7 @@ void GraphicManager::drawBigText(const Common::String text, FontType font, byte
pixelBit = (pixel >> (bit / 2)) & 1;
for (int k = 0; k < 2; k++)
if (pixelBit)
- *(byte *)_surface.getBasePtr(x + i * 16 + 16 - bit, y + j * 2 + k) = color;
+ *(byte *)surface.getBasePtr(x + i * 16 + 16 - bit, y + j * 2 + k) = color;
}
}
}
@@ -694,6 +694,10 @@ void GraphicManager::helpDrawHighlight(byte which, Color color) {
drawRectangle(Common::Rect(466, 38 + which * 27, 556, 63 + which * 27), color);
}
+void GraphicManager::helpDrawBigText(const Common::String text, int16 x, int16 y, Color color) {
+ drawBigText(_surface, text, _vm->_font, 8, x, y, color);
+}
+
/**
* @remarks Originally called 'titles'
*/
@@ -857,8 +861,10 @@ void GraphicManager::menuLoadPictures() {
title.free();
file.close();
+}
- menuRefreshScreen();
+void GraphicManager::menuDrawBigText(FontType font, uint16 x, uint16 y, Common::String text, bool notted) {
+ drawBigText(_menu, text, font, 14, x, y, kColorBlack);
}
/**
diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h
index 36952c7415..3e8224bb22 100644
--- a/engines/avalanche/graphics.h
+++ b/engines/avalanche/graphics.h
@@ -68,7 +68,6 @@ public:
void drawPieSlice(int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color);
void drawTriangle(Common::Point *p, Color color);
void drawNormalText(const Common::String text, FontType font, byte fontHeight, int16 x, int16 y, Color color);
- void drawBigText(const Common::String text, FontType font, byte fontHeight, int16 x, int16 y, Color color); // Very similar to drawText. TODO: Try to unify the two.
void drawScrollText(const Common::String text, FontType font, byte fontHeight, int16 x, int16 y, Color color);
void drawDigit(int index, int x, int y);
void drawDirection(int index, int x, int y);
@@ -107,6 +106,7 @@ public:
// Help's function:
void helpDrawButton(int y, byte which);
void helpDrawHighlight(byte which, Color color);
+ void helpDrawBigText(const Common::String text, int16 x, int16 y, Color color); // Very similar to drawText. TODO: Try to unify the two.
// Shoot em' up's functions:
void seuDrawTitle();
@@ -124,6 +124,7 @@ public:
void menuInitialize();
void menuClear();
void menuLoadPictures();
+ void menuDrawBigText(FontType font, uint16 x, uint16 y, Common::String text, bool notted);
void clearAlso();
void clearTextBar();
@@ -196,6 +197,7 @@ private:
Graphics::Surface loadPictureSign(Common::File &file, uint16 width, uint16 height); // 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 drawBigText(Graphics::Surface &surface, const Common::String text, FontType font, byte fontHeight, int16 x, int16 y, Color color); // Very similar to drawText. TODO: Try to unify the two.
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.
diff --git a/engines/avalanche/help.cpp b/engines/avalanche/help.cpp
index b24f6c40d8..2388aae095 100644
--- a/engines/avalanche/help.cpp
+++ b/engines/avalanche/help.cpp
@@ -76,8 +76,8 @@ void Help::switchPage(byte which) {
_vm->_graphics->drawNormalText(title, _vm->_font, 8, 629 - 8 * title.size(), 26, kColorBlack);
_vm->_graphics->drawNormalText(title, _vm->_font, 8, 630 - 8 * title.size(), 25, kColorCyan);
- _vm->_graphics->drawBigText("help!", _vm->_font, 8, 549, 1, kColorBlack);
- _vm->_graphics->drawBigText("help!", _vm->_font, 8, 550, 0, kColorCyan);
+ _vm->_graphics->helpDrawBigText("help!", 549, 1, kColorBlack);
+ _vm->_graphics->helpDrawBigText("help!", 550, 0, kColorCyan);
byte y = 0;
do {
@@ -141,8 +141,8 @@ void Help::switchPage(byte which) {
break;
}
- _vm->_graphics->drawBigText(text, _vm->_font, 8, 589 - (text.size() * 8), 18 + (y + 1) * 27, kColorBlack);
- _vm->_graphics->drawBigText(text, _vm->_font, 8, 590 - (text.size() * 8), 17 + (y + 1) * 27, kColorCyan);
+ _vm->_graphics->helpDrawBigText(text, 589 - (text.size() * 8), 18 + (y + 1) * 27, kColorBlack);
+ _vm->_graphics->helpDrawBigText(text, 590 - (text.size() * 8), 17 + (y + 1) * 27, kColorCyan);
y++;
_buttonNum++;
diff --git a/engines/avalanche/mainmenu.cpp b/engines/avalanche/mainmenu.cpp
index 6c3b606854..058e1cf347 100644
--- a/engines/avalanche/mainmenu.cpp
+++ b/engines/avalanche/mainmenu.cpp
@@ -33,13 +33,14 @@ namespace Avalanche {
MainMenu::MainMenu(AvalancheEngine *vm) {
_vm = vm;
- registrant = Common::String("");
+ _registrant = Common::String("");
}
void MainMenu::run() {
_vm->_graphics->menuInitialize();
_vm->_graphics->menuLoadPictures();
loadRegiInfo();
+ loadFont();
option(1, "Play the game.");
option(2, "Read the background.");
@@ -47,19 +48,31 @@ void MainMenu::run() {
option(4, "View the documentation.");
option(5, "Registration info.");
option(6, "Exit back to DOS.");
- centre(275, registrant);
+ centre(275, _registrant);
centre(303, "Make your choice, or wait for the demo.");
+ _vm->_graphics->menuRefreshScreen();
+
wait();
_vm->_graphics->menuClear();
}
+void MainMenu::loadFont() {
+ Common::File file;
+ if (!file.open("avalot.fnt"))
+ error("AVALANCHE: Scrolls: File not found: avalot.fnt");
+ for (int16 i = 0; i < 256; i++)
+ file.read(_font[i], 16);
+ file.close();
+}
+
void MainMenu::loadRegiInfo() {
warning("STUB: MainMenu::loadRegiInfo()");
}
void MainMenu::option(byte which, Common::String what) {
- warning("STUB: MainMenu::option()");
+ _vm->_graphics->menuDrawBigText(_font, 127, 39 + which * 33, Common::String(which + 48) + ')', true);
+ _vm->_graphics->menuDrawBigText(_font, 191, 39 + which * 33, what, true);
}
void MainMenu::centre(int16 y, Common::String text) {
diff --git a/engines/avalanche/mainmenu.h b/engines/avalanche/mainmenu.h
index 7b1e38612f..e973e0ccf3 100644
--- a/engines/avalanche/mainmenu.h
+++ b/engines/avalanche/mainmenu.h
@@ -40,8 +40,10 @@ public:
private:
AvalancheEngine *_vm;
- Common::String registrant;
+ Common::String _registrant;
+ FontType _font;
+ void loadFont();
void loadRegiInfo();
void option(byte which, Common::String what);
void centre(int16 y, Common::String text);