[Scummvm-cvs-logs] scummvm master -> d09b482bcb976ab36a5a4aa670b7258b1e12a65c

urukgit urukgit at users.noreply.github.com
Thu Mar 6 23:03:23 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:
d09b482bcb AVALANCHE: Implement MainMenu::wait().


Commit: d09b482bcb976ab36a5a4aa670b7258b1e12a65c
    https://github.com/scummvm/scummvm/commit/d09b482bcb976ab36a5a4aa670b7258b1e12a65c
Author: uruk (koppirnyo at gmail.com)
Date: 2014-03-06T14:02:07-08:00

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

Rework other pieces of the engine to fit to it's mechanism.

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



diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp
index fefbbed..ae96ac4 100644
--- a/engines/avalanche/avalot.cpp
+++ b/engines/avalanche/avalot.cpp
@@ -211,7 +211,9 @@ void AvalancheEngine::setup() {
 		loadGame(loadSlot);
 	} else {
 		_mainmenu->run();
-
+		if (_letMeOut)
+			return;
+		
 		newGame();
 
 		thinkAbout(kObjectMoney, kThing);
@@ -223,7 +225,7 @@ void AvalancheEngine::setup() {
 void AvalancheEngine::runAvalot() {
 	setup();
 
-	do {
+	while (!_letMeOut && !shouldQuit()) {
 		uint32 beginLoop = _system->getMillis();
 
 		updateEvents(); // The event handler.
@@ -241,7 +243,7 @@ void AvalancheEngine::runAvalot() {
 		uint32 delay = _system->getMillis() - beginLoop;
 		if (delay <= 55)
 			_system->delayMillis(55 - delay); // Replaces slowdown(); 55 comes from 18.2 Hz (B Flight).
-	} while (!_letMeOut && !shouldQuit());
+	};
 
 	warning("STUB: run()");
 
diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp
index 553556f..ae53f3e 100644
--- a/engines/avalanche/graphics.cpp
+++ b/engines/avalanche/graphics.cpp
@@ -801,8 +801,11 @@ void GraphicManager::menuInitialize() {
 	_menu.create(kScreenWidth, kMenuScreenHeight, Graphics::PixelFormat::createFormatCLUT8());
 }
 
-void GraphicManager::menuClear() {
+void GraphicManager::menuFree() {
 	_menu.free();
+}
+
+void GraphicManager::menuRestoreScreen() {
 	initGraphics(kScreenWidth, 2 * kScreenHeight, true);
 }
 
@@ -867,6 +870,13 @@ void GraphicManager::menuDrawBigText(FontType font, uint16 x, uint16 y, Common::
 	drawBigText(_menu, text, font, 14, x, y, color);
 }
 
+void GraphicManager::menuDrawIndicator(int x) { // TODO: Implement striped pattern for the indicator.
+	if (x > 0)
+		_menu.fillRect(Common::Rect(x - 1, 330, x, 337), kColorBlack);
+	_menu.fillRect(Common::Rect(x, 330, x + 1, 337), kColorWhite);
+	menuRefreshScreen();
+}
+
 /**
  * This function is for skipping the difference between a stored 'size' value associated with a picture
  * and the actual size of the pictures  when reading them from files for Ghostroom and Shoot em' up.
diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h
index 270e04d..7e0ed64 100644
--- a/engines/avalanche/graphics.h
+++ b/engines/avalanche/graphics.h
@@ -122,9 +122,11 @@ public:
 	// so it needs it's own graphic functions on that matter.
 	void menuRefreshScreen();
 	void menuInitialize();
-	void menuClear();
+	void menuFree();
+	void menuRestoreScreen();
 	void menuLoadPictures();
 	void menuDrawBigText(FontType font, uint16 x, uint16 y, Common::String text, Color color);
+	void menuDrawIndicator(int x);
 
 	void clearAlso();
 	void clearTextBar();
diff --git a/engines/avalanche/mainmenu.cpp b/engines/avalanche/mainmenu.cpp
index 0f64527..5436845 100644
--- a/engines/avalanche/mainmenu.cpp
+++ b/engines/avalanche/mainmenu.cpp
@@ -37,6 +37,7 @@ MainMenu::MainMenu(AvalancheEngine *vm) {
 }
 
 void MainMenu::run() {
+	CursorMan.showMouse(false);
 	_vm->_graphics->menuInitialize();
 	_vm->_graphics->menuLoadPictures();
 	loadRegiInfo();
@@ -54,7 +55,6 @@ void MainMenu::run() {
 	_vm->_graphics->menuRefreshScreen();
 
 	wait();
-	_vm->_graphics->menuClear();
 }
 
 void MainMenu::loadFont() {
@@ -81,7 +81,36 @@ void MainMenu::centre(int16 y, Common::String text) {
 }
 
 void MainMenu::wait() {
-	warning("STUB: MainMenu::wait()");
+	int x = 0;
+	while (!_vm->shouldQuit()) {
+		_vm->_graphics->menuDrawIndicator(x);
+		_vm->_system->delayMillis(40);
+		x++;
+		if (x == 641)
+			x = 0;
+		Common::Event event;
+		_vm->getEvent(event);
+		if (event.type == Common::EVENT_KEYDOWN) {
+			switch (event.kbd.keycode) {
+			case Common::KEYCODE_SPACE:
+			case Common::KEYCODE_RETURN:
+			case Common::KEYCODE_1: // Falltroughs are inteded.
+				// Play the game
+				_vm->_graphics->menuFree();
+				_vm->_graphics->menuRestoreScreen();
+				CursorMan.showMouse(true);
+				return;
+			case Common::KEYCODE_ESCAPE:
+			case Common::KEYCODE_6: // Falltroughs are inteded.
+				// Exit back to DOS
+				_vm->_letMeOut = true;
+				_vm->_graphics->menuFree();
+				return;
+			default:
+				break;
+			}
+		}
+	}
 }
 
 } // End of namespace Avalanche






More information about the Scummvm-git-logs mailing list