[Scummvm-cvs-logs] scummvm master -> 5c8129a1ddcb682695e25f83e3da2286d85e15aa

urukgit urukgit at users.noreply.github.com
Sun Sep 7 11:02:28 CEST 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:
5c8129a1dd CGE2: Refactor _startupMode.


Commit: 5c8129a1ddcb682695e25f83e3da2286d85e15aa
    https://github.com/scummvm/scummvm/commit/5c8129a1ddcb682695e25f83e3da2286d85e15aa
Author: unknown (koppirnyo at gmail.com)
Date: 2014-09-07T11:01:23+02:00

Commit Message:
CGE2: Refactor _startupMode.

Changed paths:
    engines/cge2/cge2.cpp
    engines/cge2/cge2.h
    engines/cge2/cge2_main.cpp
    engines/cge2/saveload.cpp
    engines/cge2/toolbar.cpp



diff --git a/engines/cge2/cge2.cpp b/engines/cge2/cge2.cpp
index 8b51dda..852b7af 100644
--- a/engines/cge2/cge2.cpp
+++ b/engines/cge2/cge2.cpp
@@ -78,7 +78,7 @@ CGE2Engine::CGE2Engine(OSystem *syst, const ADGameDescription *gameDescription)
 	_map = nullptr;
 	_quitFlag = false;
 	_bitmapPalette = nullptr;
-	_startupMode = 1;
+	_gamePhase = kPhaseIntro;
 	_now = 1;
 	_sex = 1;
 	_mouseTop = kWorldHeight / 3;
diff --git a/engines/cge2/cge2.h b/engines/cge2/cge2.h
index 8e94683..1f1cb17 100644
--- a/engines/cge2/cge2.h
+++ b/engines/cge2/cge2.h
@@ -124,6 +124,8 @@ struct SavegameHeader {
 
 enum ColorBank { kCBRel, kCBStd, kCBSay, kCBInf, kCBMnu, kCBWar };
 
+enum GamePhase { kPhaseInGame, kPhaseIntro, kPhaseOver };
+
 // our engine debug channels
 enum {
 	kCGE2DebugOpcode = 1 << 0
@@ -282,7 +284,7 @@ public:
 
 	bool _quitFlag;
 	Dac *_bitmapPalette;
-	int _startupMode;
+	GamePhase _gamePhase; // Original name: startupmode
 	int _now;
 	int _sex;
 	int _mouseTop;
diff --git a/engines/cge2/cge2_main.cpp b/engines/cge2/cge2_main.cpp
index c52a354..1057b00 100644
--- a/engines/cge2/cge2_main.cpp
+++ b/engines/cge2/cge2_main.cpp
@@ -49,13 +49,13 @@ void System::touch(uint16 mask, V2D pos, Common::KeyCode keyCode) {
 			// The original was calling keyClick()
 			// The sound is uselessly annoying and noisy, so it has been removed
 			_vm->killText();
-			if (_vm->_startupMode == 1) {
+			if (_vm->_gamePhase == kPhaseIntro) {
 				_vm->_commandHandler->addCommand(kCmdClear, -1, 0, nullptr);
 				return;
 			}
 		}
 	} else {
-		if (_vm->_startupMode)
+		if (_vm->_gamePhase != kPhaseInGame)
 			return;
 		_vm->_infoLine->setText(nullptr);
 		
@@ -450,7 +450,7 @@ void CGE2Engine::sceneUp(int cav) {
 
 	_dark = false;
 
-	if (!_startupMode)
+	if (_gamePhase == kPhaseInGame)
 		_mouse->on();
 
 	feedSnail(_vga->_showQ->locate(bakRef + 255), kNear, _heroTab[_sex]->_ptr);
@@ -522,7 +522,7 @@ void CGE2Engine::showBak(int ref) {
 }
 
 void CGE2Engine::mainLoop() {
-	if (_startupMode == 0)
+	if (_gamePhase == kPhaseInGame)
 		checkSounds();
 
 	_vga->show();
@@ -751,7 +751,7 @@ void CGE2Engine::cge2_main() {
 
 		if (_text->getText(255) != nullptr) {
 			runGame();
-			_startupMode = 2;
+			_gamePhase = kPhaseOver;
 		}
 		
 		_vga->sunset();
@@ -850,7 +850,7 @@ void Sprite::touch(uint16 mask, V2D pos, Common::KeyCode keyCode) {
 	if ((mask & kEventAttn) != 0)
 		return;
 
-	if (!_vm->_startupMode)
+	if (_vm->_gamePhase == kPhaseInGame)
 		_vm->_infoLine->setText(name());
 
 	if (_ref < 0)
diff --git a/engines/cge2/saveload.cpp b/engines/cge2/saveload.cpp
index c9cedff..fd60422 100644
--- a/engines/cge2/saveload.cpp
+++ b/engines/cge2/saveload.cpp
@@ -45,7 +45,7 @@ namespace CGE2 {
 #define kBadSVG           99
 
 bool CGE2Engine::canSaveGameStateCurrently() {
-	return (_startupMode == 0) && _mouse->_active &&
+	return (_gamePhase == kPhaseInGame) && _mouse->_active &&
 		_commandHandler->idle() && (_soundStat._wait == nullptr);
 }
 
@@ -77,7 +77,7 @@ void CGE2Engine::saveGame(int slotNumber, const Common::String &desc) {
 }
 
 bool CGE2Engine::canLoadGameStateCurrently() {
-	return (_startupMode == 0) && _mouse->_active;
+	return (_gamePhase == kPhaseInGame) && _mouse->_active;
 }
 
 Common::Error CGE2Engine::loadGameState(int slot) {
diff --git a/engines/cge2/toolbar.cpp b/engines/cge2/toolbar.cpp
index dbbed34..6af64b1 100644
--- a/engines/cge2/toolbar.cpp
+++ b/engines/cge2/toolbar.cpp
@@ -182,7 +182,7 @@ void CGE2Engine::initToolbar() {
 	_infoLine->setText(nullptr);
 	_vga->_showQ->insert(_infoLine);
 
-	_startupMode = 0;
+	_gamePhase = kPhaseInGame;
 	_mouse->center();
 	_mouse->off();
 	_mouse->on();






More information about the Scummvm-git-logs mailing list