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

m-kiewitz m_kiewitz at users.sourceforge.net
Tue Feb 2 23:03:12 CET 2016


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:
5f41a09701 AGI: Remove inputMode, not needed anyore


Commit: 5f41a09701d25619fc51e077781e4204080b7d62
    https://github.com/scummvm/scummvm/commit/5f41a09701d25619fc51e077781e4204080b7d62
Author: Martin Kiewitz (m_kiewitz at users.sourceforge.net)
Date: 2016-02-02T23:02:50+01:00

Commit Message:
AGI: Remove inputMode, not needed anyore

Changed paths:
    engines/agi/agi.cpp
    engines/agi/agi.h
    engines/agi/cycle.cpp
    engines/agi/keyboard.cpp
    engines/agi/op_cmd.cpp
    engines/agi/saveload.cpp



diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp
index a313eb1..ba8a2ba 100644
--- a/engines/agi/agi.cpp
+++ b/engines/agi/agi.cpp
@@ -387,8 +387,6 @@ AgiEngine::AgiEngine(OSystem *syst, const AGIGameDescription *gameDesc) : AgiBas
 
 	_restartGame = false;
 
-	_oldMode = INPUTMODE_NONE;
-
 	_firstSlot = 0;
 
 	resetControllers();
diff --git a/engines/agi/agi.h b/engines/agi/agi.h
index 3ee9d71..801d807 100644
--- a/engines/agi/agi.h
+++ b/engines/agi/agi.h
@@ -383,11 +383,6 @@ struct ScriptPos {
 	int curIP;
 };
 
-enum InputMode {
-	INPUTMODE_NONE      = 0x04,
-	INPUTMODE_NORMAL    = 0x01 // prompt active
-};
-
 enum CycleInnerLoopType {
 	CYCLE_INNERLOOP_GETSTRING                    = 0,
 	CYCLE_INNERLOOP_GETNUMBER                    = 1,
@@ -437,8 +432,6 @@ struct AgiGame {
 	bool  cycleInnerLoopActive;
 	int16 cycleInnerLoopType;
 
-	InputMode inputMode;            /**< keyboard input mode */
-
 	int16 curLogicNr;               /**< current logic number */
 	Common::Array<ScriptPos> execStack;
 
@@ -778,7 +771,6 @@ public:
 	int scummVMSaveLoadDialog(bool isSave);
 
 	uint8 *_intobj;
-	InputMode _oldMode;
 	bool _restartGame;
 
 	SpritesMgr *_sprites;
@@ -815,9 +807,6 @@ public:
 	virtual bool isKeypress();
 	virtual void clearKeyQueue();
 
-	void newInputMode(InputMode mode);
-	void oldInputMode();
-
 	byte getVar(int16 varNr);
 	void setVar(int16 varNr, byte newValue);
 
diff --git a/engines/agi/cycle.cpp b/engines/agi/cycle.cpp
index 2591713..e2b6e0a 100644
--- a/engines/agi/cycle.cpp
+++ b/engines/agi/cycle.cpp
@@ -173,18 +173,6 @@ void AgiEngine::interpretCycle() {
 	//_gfx->doUpdate();
 }
 
-void AgiEngine::newInputMode(InputMode mode) {
-	//if (mode == INPUTMODE_MENU && !getflag(VM_FLAG_MENUS_WORK) && !(getFeatures() & GF_MENUS))
-	//	return;
-
-	_oldMode = _game.inputMode;
-	_game.inputMode = mode;
-}
-
-void AgiEngine::oldInputMode() {
-	_game.inputMode = _oldMode;
-}
-
 // If main_cycle returns false, don't process more events!
 int AgiEngine::mainCycle(bool onlyCheckForEvents) {
 	uint16 key;
@@ -206,9 +194,7 @@ int AgiEngine::mainCycle(bool onlyCheckForEvents) {
 		setVar(VM_VAR_MOUSE_Y, _mouse.pos.y);
 	//}
 
-	switch (_game.inputMode) {
-	case INPUTMODE_NORMAL:
-	case INPUTMODE_NONE:
+	if (!cycleInnerLoopIsActive()) {
 		// Click-to-walk mouse interface
 		if (_game.playerControl && (screenObjEgo->flags & fAdjEgoXY)) {
 			int toX = screenObjEgo->move_x;
@@ -231,9 +217,6 @@ int AgiEngine::mainCycle(bool onlyCheckForEvents) {
 			if (screenObjEgo->direction == 0)
 				inDestination(screenObjEgo);
 		}
-		break;
-	default:
-		break;
 	}
 
 	keyAscii = key & 0xFF;
@@ -245,26 +228,12 @@ int AgiEngine::mainCycle(bool onlyCheckForEvents) {
 
 	if (!cycleInnerLoopIsActive()) {
 		// no inner loop active at the moment, regular processing
-		switch (_game.inputMode) {
-		case INPUTMODE_NORMAL:
-			if (key) {
-				if (!handleController(key)) {
-					if ((key) && (_text->promptIsEnabled())) {
-						_text->promptCharPress(key);
-					}
-				}
-			}
-			break;
-		case INPUTMODE_NONE:
-			if (key) {
-				handleController(key);
-				if (key) {
-					_game.keypress = key;
+		if (key) {
+			if (!handleController(key)) {
+				if ((key) && (_text->promptIsEnabled())) {
+					_text->promptCharPress(key);
 				}
 			}
-			break;
-		default:
-			break;
 		}
 
 	} else {
@@ -486,7 +455,6 @@ int AgiEngine::runGame() {
 
 		setVar(VM_VAR_FREE_PAGES, 180); // Set amount of free memory to realistic value
 		setVar(VM_VAR_MAX_INPUT_CHARACTERS, 38);
-		_game.inputMode = INPUTMODE_NONE;
 		_text->promptDisable();
 
 		_game.state = STATE_RUNNING;
diff --git a/engines/agi/keyboard.cpp b/engines/agi/keyboard.cpp
index d93038b..a22f733 100644
--- a/engines/agi/keyboard.cpp
+++ b/engines/agi/keyboard.cpp
@@ -402,8 +402,8 @@ bool AgiEngine::handleController(uint16 key) {
 	//		return false;
 
 	if ((getGameID() == GID_MH1 || getGameID() == GID_MH2) && (key == AGI_KEY_ENTER) &&
-	        (_game.inputMode == INPUTMODE_NONE)) {
-		key = 0x20; // Set Enter key to Space in Manhunter when there's no text input
+	        (!_text->promptIsEnabled())) {
+		key = 0x20; // Set Enter key to Space in Manhunter when prompt is disabled
 	}
 
 	debugC(3, kDebugLevelInput, "key = %04x", key);
diff --git a/engines/agi/op_cmd.cpp b/engines/agi/op_cmd.cpp
index 563c566..46a27d3 100644
--- a/engines/agi/op_cmd.cpp
+++ b/engines/agi/op_cmd.cpp
@@ -1884,8 +1884,6 @@ void cmdAcceptInput(AgiGame *state, AgiEngine *vm, uint8 *parameter) {
 
 	debugC(4, kDebugLevelScripts | kDebugLevelInput, "input normal");
 
-	state->_vm->newInputMode(INPUTMODE_NORMAL);
-
 	textMgr->promptEnable();
 	textMgr->promptRedraw();
 }
@@ -1895,8 +1893,6 @@ void cmdPreventInput(AgiGame *state, AgiEngine *vm, uint8 *parameter) {
 
 	debugC(4, kDebugLevelScripts | kDebugLevelInput, "no input");
 
-	state->_vm->newInputMode(INPUTMODE_NONE);
-
 	textMgr->promptDisable();
 
 	textMgr->inputEditOn();
diff --git a/engines/agi/saveload.cpp b/engines/agi/saveload.cpp
index 474755a..e04b042 100644
--- a/engines/agi/saveload.cpp
+++ b/engines/agi/saveload.cpp
@@ -147,7 +147,7 @@ int AgiEngine::saveGame(const Common::String &fileName, const Common::String &de
 	out->writeSint16BE((int16)_text->promptRow_Get());
 	out->writeSint16BE((int16)_text->getWindowRowMin());
 
-	out->writeSint16BE((int16)_game.inputMode);
+	out->writeSint16BE(1); // was _game.inputMode, we set it to 1, which was INPUTMODE_NORMAL
 	out->writeSint16BE((int16)_game.curLogicNr);
 
 	out->writeSint16BE((int16)_game.playerControl);
@@ -467,11 +467,7 @@ int AgiEngine::loadGame(const Common::String &fileName, bool checkId) {
 
 	_game.keypress = 0;
 
-	_game.inputMode = (InputMode)in->readSint16BE();
-	if ((_game.inputMode != INPUTMODE_NORMAL) && (_game.inputMode != INPUTMODE_NONE)) {
-		// other input modes were removed
-		_game.inputMode = INPUTMODE_NORMAL;
-	}
+	in->readSint16BE(); // was _game.inputMode, not needed anymore
 
 	_game.curLogicNr = in->readSint16BE();
 






More information about the Scummvm-git-logs mailing list