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

sev- sev at scummvm.org
Tue Feb 16 11:34:06 CET 2016


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

Summary:
2ccbfd2ede WAGE: Fix random direction choosing logic
9b77e5c890 WAGE: Remove debug code
a6120d8b27 WAGE: Started post-gameover code implementation
bd7ef4143d WAGE: Enable required menu items to allow game restart


Commit: 2ccbfd2ede60d343d5481692b83da4aeb7723a16
    https://github.com/scummvm/scummvm/commit/2ccbfd2ede60d343d5481692b83da4aeb7723a16
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-02-16T11:32:47+01:00

Commit Message:
WAGE: Fix random direction choosing logic

Changed paths:
    engines/wage/combat.cpp



diff --git a/engines/wage/combat.cpp b/engines/wage/combat.cpp
index aa8ec53..4f2956d 100644
--- a/engines/wage/combat.cpp
+++ b/engines/wage/combat.cpp
@@ -402,20 +402,22 @@ void WageEngine::performMove(Chr *chr, int validMoves) {
 	// count how many valid moves we have
 	int numValidMoves = 0;
 
-	for (int dir = 0; dir < 4; dir++)
-		if ((validMoves & (1 << dir)) != 0)
+	for (int i = 0; i < 4; i++)
+		if ((validMoves & (1 << i)) != 0)
 			numValidMoves++;
 
 	// Now pick random dir
-	int dir = _rnd->getRandomNumber(numValidMoves);
+	int dirNum = _rnd->getRandomNumber(numValidMoves - 1);
+	int dir = 0;
 
 	// And get it
-	for (int i = 0; i < 4; i++, dir--)
+	for (int i = 0; i < 4; i++)
 		if ((validMoves & (1 << i)) != 0) {
-			if (dir == 1) {
+			if (dirNum == 0) {
 				dir = i;
 				break;
 			}
+			dirNum--;
 		}
 
 	char buf[256];


Commit: 9b77e5c8905e1731f69c18f0dc7b506a94030f07
    https://github.com/scummvm/scummvm/commit/9b77e5c8905e1731f69c18f0dc7b506a94030f07
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-02-16T11:32:47+01:00

Commit Message:
WAGE: Remove debug code

Changed paths:
    engines/wage/wage.cpp



diff --git a/engines/wage/wage.cpp b/engines/wage/wage.cpp
index ffdd8a2..5f79d98 100644
--- a/engines/wage/wage.cpp
+++ b/engines/wage/wage.cpp
@@ -124,14 +124,6 @@ Common::Error WageEngine::run() {
 		g_system->delayMillis(50);
 	}
 
-	//_world->_orderedScenes[1]->_design->paint(&screen, _world->_patterns, false);
-	//_world->_objs["frank.1"]->_design->setBounds(&r);
-	//_world->_objs["frank.1"]->_design->paint(&screen, _world->_patterns, false);
-	//_world->_scenes["temple of the holy mackeral"]->_design->setBounds(&r);
-	//_world->_scenes["temple of the holy mackeral"]->_design->paint(&screen, _world->_patterns, false);
-	//_world->_scenes["tower level 3"]->_design->setBounds(&r);
-	//_world->_scenes["tower level 3"]->_design->paint(&screen, _world->_patterns, false);
-
 	return Common::kNoError;
 }
 


Commit: a6120d8b27b67c86faab724f501327368a8d19f8
    https://github.com/scummvm/scummvm/commit/a6120d8b27b67c86faab724f501327368a8d19f8
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-02-16T11:32:47+01:00

Commit Message:
WAGE: Started post-gameover code implementation

Changed paths:
    engines/wage/gui-console.cpp
    engines/wage/gui.cpp
    engines/wage/gui.h
    engines/wage/menu.cpp
    engines/wage/menu.h
    engines/wage/wage.cpp



diff --git a/engines/wage/gui-console.cpp b/engines/wage/gui-console.cpp
index f1095de..18f6b25 100644
--- a/engines/wage/gui-console.cpp
+++ b/engines/wage/gui-console.cpp
@@ -395,4 +395,8 @@ void Gui::disableUndo() {
 	_menu->enableCommand(kMenuEdit, kMenuActionUndo, false);
 }
 
+void Gui::disableAllMenus() {
+	_menu->disableAllMenus();
+}
+
 } // End of namespace Wage
diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp
index a2931f9..afb30c7 100644
--- a/engines/wage/gui.cpp
+++ b/engines/wage/gui.cpp
@@ -218,14 +218,29 @@ const Graphics::Font *Gui::getTitleFont() {
 	return getFont("Chicago-12", Graphics::FontManager::kBigGUIFont);
 }
 
+void Gui::drawDesktop() {
+	// Draw desktop
+	Common::Rect r(0, 0, _screen.w - 1, _screen.h - 1);
+	Design::drawFilledRoundRect(&_screen, r, kDesktopArc, kColorBlack, _patterns, kPatternCheckers);
+	g_system->copyRectToScreen(_screen.getPixels(), _screen.pitch, 0, 0, _screen.w, _screen.h);
+}
+
 void Gui::draw() {
+	if (_engine->_isGameOver) {
+		if (_menuDirty) {
+			drawDesktop();
+			_menu->render();
+		}
+
+		_menuDirty = false;
+
+		return;
+	}
+
 	if (_scene != _engine->_world->_player->_currentScene || _sceneDirty) {
 		_scene = _engine->_world->_player->_currentScene;
 
-		// Draw desktop
-		Common::Rect r(0, 0, _screen.w - 1, _screen.h - 1);
-		Design::drawFilledRoundRect(&_screen, r, kDesktopArc, kColorBlack, _patterns, kPatternCheckers);
-		g_system->copyRectToScreen(_screen.getPixels(), _screen.pitch, 0, 0, _screen.w, _screen.h);
+		drawDesktop();
 
 		_sceneDirty = true;
 		_consoleDirty = true;
diff --git a/engines/wage/gui.h b/engines/wage/gui.h
index 8cdc827..d611579 100644
--- a/engines/wage/gui.h
+++ b/engines/wage/gui.h
@@ -110,9 +110,11 @@ public:
 	void actionClear();
 	void actionCut();
 	void disableUndo();
+	void disableAllMenus();
 
 private:
 	void undrawCursor();
+	void drawDesktop();
 	void paintBorder(Graphics::Surface *g, Common::Rect &r, WindowType windowType);
 	void renderConsole(Graphics::Surface *g, Common::Rect &r);
 	void drawBox(Graphics::Surface *g, int x, int y, int w, int h);
@@ -131,7 +133,6 @@ public:
 	int _cursorX, _cursorY;
 	bool _cursorState;
 	Common::Rect _consoleTextArea;
-	bool _cursorOff;
 
 	bool _builtInFonts;
 	WageEngine *_engine;
@@ -140,6 +141,9 @@ public:
 
 	bool _cursorDirty;
 	Common::Rect _cursorRect;
+	bool _cursorOff;
+
+	bool _menuDirty;
 
 private:
 	Graphics::Surface _console;
@@ -148,7 +152,6 @@ private:
 	bool _sceneDirty;
 	bool _consoleDirty;
 	bool _bordersDirty;
-	bool _menuDirty;
 
 	Common::StringArray _out;
 	Common::StringArray _lines;
diff --git a/engines/wage/menu.cpp b/engines/wage/menu.cpp
index b859867..dfb042d 100644
--- a/engines/wage/menu.cpp
+++ b/engines/wage/menu.cpp
@@ -560,4 +560,10 @@ void Menu::enableCommand(int menunum, int action, bool state) {
 			_items[menunum]->subitems[i]->enabled = state;
 }
 
+void Menu::disableAllMenus() {
+	for (uint i = 1; i < _items.size(); i++) // Leave About menu on
+		for (uint j = 0; j < _items[i]->subitems.size(); j++)
+			_items[i]->subitems[j]->enabled = false;
+}
+
 } // End of namespace Wage
diff --git a/engines/wage/menu.h b/engines/wage/menu.h
index cee7611..3550356 100644
--- a/engines/wage/menu.h
+++ b/engines/wage/menu.h
@@ -104,6 +104,7 @@ public:
 	void regenWeaponsMenu();
 	void processMenuShortCut(byte flags, uint16 ascii);
 	void enableCommand(int menunum, int action, bool state);
+	void disableAllMenus();
 
 	bool _menuActivated;
 	Common::Rect _bbox;
diff --git a/engines/wage/wage.cpp b/engines/wage/wage.cpp
index 5f79d98..8dd578e 100644
--- a/engines/wage/wage.cpp
+++ b/engines/wage/wage.cpp
@@ -215,6 +215,9 @@ void WageEngine::gameOver() {
 	gameOverDialog.run();
 
 	doClose();
+
+	_gui->disableAllMenus();
+	_gui->_menuDirty = true;
 }
 
 bool WageEngine::saveDialog() {


Commit: bd7ef4143df7fb85b70ee98b4dc338618d1602a4
    https://github.com/scummvm/scummvm/commit/bd7ef4143df7fb85b70ee98b4dc338618d1602a4
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-02-16T11:32:48+01:00

Commit Message:
WAGE: Enable required menu items to allow game restart

Changed paths:
    engines/wage/gui-console.cpp
    engines/wage/gui.h
    engines/wage/wage.cpp



diff --git a/engines/wage/gui-console.cpp b/engines/wage/gui-console.cpp
index 18f6b25..ad1bf58 100644
--- a/engines/wage/gui-console.cpp
+++ b/engines/wage/gui-console.cpp
@@ -399,4 +399,10 @@ void Gui::disableAllMenus() {
 	_menu->disableAllMenus();
 }
 
+void Gui::enableNewGameMenus() {
+	_menu->enableCommand(kMenuFile, kMenuActionNew, true);
+	_menu->enableCommand(kMenuFile, kMenuActionOpen, true);
+	_menu->enableCommand(kMenuFile, kMenuActionQuit, true);
+}
+
 } // End of namespace Wage
diff --git a/engines/wage/gui.h b/engines/wage/gui.h
index d611579..61f8c31 100644
--- a/engines/wage/gui.h
+++ b/engines/wage/gui.h
@@ -111,6 +111,7 @@ public:
 	void actionCut();
 	void disableUndo();
 	void disableAllMenus();
+	void enableNewGameMenus();
 
 private:
 	void undrawCursor();
diff --git a/engines/wage/wage.cpp b/engines/wage/wage.cpp
index 8dd578e..90aad2f 100644
--- a/engines/wage/wage.cpp
+++ b/engines/wage/wage.cpp
@@ -217,6 +217,7 @@ void WageEngine::gameOver() {
 	doClose();
 
 	_gui->disableAllMenus();
+	_gui->enableNewGameMenus();
 	_gui->_menuDirty = true;
 }
 






More information about the Scummvm-git-logs mailing list