[Scummvm-cvs-logs] scummvm master -> 80e01378d34217e572825bd6aa1e196247cc5b40

urukgit urukgit at users.noreply.github.com
Tue Mar 4 20:27:31 CET 2014


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
80e01378d3 AVALANCHE: Implement MainMenu::option().


Commit: 80e01378d34217e572825bd6aa1e196247cc5b40
    https://github.com/scummvm/scummvm/commit/80e01378d34217e572825bd6aa1e196247cc5b40
Author: uruk (koppirnyo at gmail.com)
Date: 2014-03-04T11:27:00-08:00

Commit Message:
AVALANCHE: Implement MainMenu::option().

Rework and implement a lot of connected functions.

Changed paths:
    engines/avalanche/graphics.cpp
    engines/avalanche/graphics.h
    engines/avalanche/help.cpp
    engines/avalanche/mainmenu.cpp
    engines/avalanche/mainmenu.h



diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp
index 0ba9a8c..e1dd8e9 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 36952c7..3e8224b 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 b24f6c4..2388aae 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 6c3b606..058e1cf 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 7b1e386..e973e0c 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);






More information about the Scummvm-git-logs mailing list