[Scummvm-cvs-logs] scummvm master -> 2196916b62777e9c2b3ad87d1e542ec11a8c3d4b

sev- sev at scummvm.org
Sun Sep 15 21:30:14 CEST 2013


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:
2196916b62 FULLPIPE: Implement FullpipeEngine::defHandleKeyDown()


Commit: 2196916b62777e9c2b3ad87d1e542ec11a8c3d4b
    https://github.com/scummvm/scummvm/commit/2196916b62777e9c2b3ad87d1e542ec11a8c3d4b
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2013-09-15T12:29:22-07:00

Commit Message:
FULLPIPE: Implement FullpipeEngine::defHandleKeyDown()

Changed paths:
    engines/fullpipe/constants.h
    engines/fullpipe/fullpipe.cpp
    engines/fullpipe/fullpipe.h
    engines/fullpipe/input.cpp
    engines/fullpipe/inventory.cpp
    engines/fullpipe/inventory.h



diff --git a/engines/fullpipe/constants.h b/engines/fullpipe/constants.h
index 4f389f8..796764d 100644
--- a/engines/fullpipe/constants.h
+++ b/engines/fullpipe/constants.h
@@ -30,6 +30,7 @@ namespace Fullpipe {
 #define ANI_INV_MAP 5321
 #define ANI_LIFTBUTTON 2751
 #define ANI_MAN 322
+#define MSG_CMN_WINARCADE 4778
 #define MSG_DISABLESAVES 5201
 #define MSG_ENABLESAVES 5202
 #define MSG_HMRKICK_METAL 4764
diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp
index 11808e9..6a4a587 100644
--- a/engines/fullpipe/fullpipe.cpp
+++ b/engines/fullpipe/fullpipe.cpp
@@ -71,6 +71,11 @@ FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc)
 	_inputController = 0;
 	_inputDisabled = false;
 
+	_normalSpeed = true;
+
+	_currentCheat = -1;
+	_currentCheatPos = 0;
+
 	_modalObject = 0;
 
 	_gameContinue = true;
@@ -201,7 +206,8 @@ Common::Error FullpipeEngine::run() {
 			_needRestart = false;
 		}
 
-		_system->delayMillis(10);
+		if (_normalSpeed)
+			_system->delayMillis(10);
 		_system->updateScreen();
 	}
 
diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h
index f688151..348ac2c 100644
--- a/engines/fullpipe/fullpipe.h
+++ b/engines/fullpipe/fullpipe.h
@@ -127,6 +127,9 @@ public:
 	CInputController *_inputController;
 	bool _inputDisabled;
 
+	int _currentCheat;
+	int _currentCheatPos;
+
 	void defHandleKeyDown(int key);
 
 	SoundList *_currSoundList1[11];
@@ -171,6 +174,7 @@ public:
 	bool _needRestart;
 	bool _flgPlayIntro;
 	int _musicAllowed;
+	bool _normalSpeed;
 
 	void enableSaves() { _isSaveAllowed = true; }
 	void disableSaves(ExCommand *ex);
@@ -222,6 +226,9 @@ public:
 	void openHelp();
 	void openMainMenu();
 
+	void winArcade();
+	void getAllInventory();
+
 	int lift_getButtonIdP(int objid);
 
 public:
diff --git a/engines/fullpipe/input.cpp b/engines/fullpipe/input.cpp
index 8cc7654..c4af54d 100644
--- a/engines/fullpipe/input.cpp
+++ b/engines/fullpipe/input.cpp
@@ -145,8 +145,72 @@ void FullpipeEngine::setCursor(int id) {
 		_inputController->setCursor(id);
 }
 
+const char *input_cheats[] = {
+	"HELP",
+	"STUFF",
+	"FASTER",
+	"OHWAIT",
+	"MUSOFF",
+	""
+};
+
 void FullpipeEngine::defHandleKeyDown(int key) {
-	warning("STUB: FullpipeEngine::defHandleKeyDown(%d)", key);
+	if (_currentCheat == -1) {
+		for (int i = 0; input_cheats[i][0]; i++)
+			if (toupper(key) == input_cheats[i][0]) {
+				_currentCheat = i;
+				_currentCheatPos = 1;
+			}
+
+		return;
+	}
+
+	warning("%d %d", _currentCheat, _currentCheatPos);
+	if (toupper(key) != input_cheats[_currentCheat][_currentCheatPos]) {
+		_currentCheat = -1;
+
+		return;
+	}
+
+	_currentCheatPos++;
+	warning("%d %d", _currentCheat, _currentCheatPos);
+
+	if (!input_cheats[_currentCheat][_currentCheatPos]) {
+		switch (_currentCheat) {
+		case 0:                               // HELP
+			winArcade();
+			break;
+		case 1:                               // STUFF
+			getAllInventory();
+			break;
+		case 2:                               // FASTER
+			_normalSpeed = !_normalSpeed;
+			break;
+		case 3:                               // OHWAIT
+			_gamePaused = 1;
+			_flgGameIsRunning = 0;
+			break;
+		case 4:                               // MUSOFF
+			if (_musicAllowed & 2)
+				setMusicAllowed(_musicAllowed & 0xFFFFFFFD);
+			else
+				setMusicAllowed(_musicAllowed | 2);
+			break;
+		default:
+			break;
+		}
+
+		_currentCheatPos = 0;
+		_currentCheat = -1;
+	}
+}
+
+void FullpipeEngine::winArcade() {
+	ExCommand *ex = new ExCommand(0, 17, MSG_CMN_WINARCADE, 0, 0, 0, 1, 0, 0, 0);
+	ex->_excFlags |= 3;
+
+	ex->postMessage();
+
 }
 
 void FullpipeEngine::updateCursorsCommon() {
diff --git a/engines/fullpipe/inventory.cpp b/engines/fullpipe/inventory.cpp
index 1e229f3..ccedb57 100644
--- a/engines/fullpipe/inventory.cpp
+++ b/engines/fullpipe/inventory.cpp
@@ -138,6 +138,10 @@ int CInventory2::getInventoryItemIndexById(int itemId) {
 	return -1;
 }
 
+int CInventory2::getInventoryPoolItemIdAtIndex(int itemId) {
+	return _itemsPool[itemId]->id;
+}
+
 int CInventory2::getInventoryPoolItemFieldCById(int itemId) {
 	for (uint i = 0; i < _itemsPool.size(); i++) {
 		if (_itemsPool[i]->id == itemId)
@@ -417,4 +421,17 @@ int CInventory2::getHoveredItem(Common::Point *point) {
 	return 0;
 }
 
+void FullpipeEngine::getAllInventory() {
+	CInventory2 *inv = getGameLoaderInventory();
+
+	for (uint i = 0; i < inv->getItemsPoolCount(); ++i ) {
+		int id = inv->getInventoryPoolItemIdAtIndex(i);
+
+		if (inv->getCountItemsWithId(id) < 1)
+			inv->addItem(id, 1);
+	}
+
+	inv->rebuildItemRects();
+}
+
 } // End of namespace Fullpipe
diff --git a/engines/fullpipe/inventory.h b/engines/fullpipe/inventory.h
index f84d27d..5f10303 100644
--- a/engines/fullpipe/inventory.h
+++ b/engines/fullpipe/inventory.h
@@ -52,6 +52,7 @@ class CInventory : public CObject {
 	virtual bool load(MfcArchive &file);
 
 	int getInventoryPoolItemIndexById(int itemId);
+	uint getItemsPoolCount() { return _itemsPool.size(); }
 	bool setItemFlags(int itemId, int flags);
 };
 
@@ -102,6 +103,7 @@ class CInventory2 : public CInventory {
 	void removeItem2(Scene *sceneObj, int itemId, int x, int y, int priority);
 
 	int getInventoryItemIndexById(int itemId);
+	int getInventoryPoolItemIdAtIndex(int itemId);
 	int getInventoryPoolItemFieldCById(int itemId);
 	int getCountItemsWithId(int itemId);
 	int getItemFlags(int itemId);






More information about the Scummvm-git-logs mailing list