diff options
Diffstat (limited to 'engines/fullpipe')
-rw-r--r-- | engines/fullpipe/fullpipe.cpp | 103 | ||||
-rw-r--r-- | engines/fullpipe/fullpipe.h | 5 | ||||
-rw-r--r-- | engines/fullpipe/inventory.h | 1 | ||||
-rw-r--r-- | engines/fullpipe/messages.cpp | 14 | ||||
-rw-r--r-- | engines/fullpipe/messages.h | 1 |
5 files changed, 120 insertions, 4 deletions
diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp index b71021bc66..57691de861 100644 --- a/engines/fullpipe/fullpipe.cpp +++ b/engines/fullpipe/fullpipe.cpp @@ -58,6 +58,8 @@ FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc) _globalPalette = 0; _updateTicks = 0; + _lastInputTicks = 0; + _lastButtonUpTicks = 0; _currArchive = 0; @@ -74,6 +76,10 @@ FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc) _gameContinue = true; _needRestart = false; _flgPlayIntro = false; + _gamePaused = false; + _inputArFlag = false; + _recordEvents = false; + _flgSavegameMenuRequested = false; _isProcessingMessages = false; @@ -180,26 +186,117 @@ Common::Error FullpipeEngine::run() { void FullpipeEngine::updateEvents() { Common::Event event; Common::EventManager *eventMan = _system->getEventManager(); + ExCommand *ex; while (eventMan->pollEvent(event)) { switch (event.type) { case Common::EVENT_KEYDOWN: _keyState = event.kbd.keycode; - break; + + switch (event.kbd.keycode) { + case Common::KEYCODE_SPACE: + if (_gamePaused) { + if (_modalObject) { + if (_modalObject->init(42)) { + _modalObject->update(); + } else { + _modalObject->saveload(); + CBaseModalObject *obj = _modalObject->_parentObj; + if (obj) + delete _modalObject; + _modalObject = obj; + } + } else { + _gameLoader->updateSystems(42); + } + return; + } + + ex = new ExCommand(0, 17, 36, 0, 0, 0, 1, 0, 0, 0); + ex->_keyCode = 32; + ex->_excFlags |= 3; + ex->handle(); + break; + case Common::KEYCODE_s: + if (_gamePaused) { + _gamePaused = 0; + _flgSavegameMenuRequested = true; + return; + } + + ex = new ExCommand(0, 17, 36, 0, 0, 0, 1, 0, 0, 0); + ex->_keyCode = 83; + ex->_excFlags |= 3; + ex->handle(); + break; + case Common::KEYCODE_q: + return; + break; + default: + ex = new ExCommand(0, 17, 36, 0, 0, 0, 1, 0, 0, 0); + ex->_keyCode = event.kbd.keycode; + ex->_excFlags |= 3; + ex->handle(); + break; + } case Common::EVENT_KEYUP: + if (!_inputArFlag) { + ex = new ExCommand(0, 17, 37, 0, 0, 0, 1, 0, 0, 0); + ex->_excFlags |= 3; + ex->handle(); + } _keyState = Common::KEYCODE_INVALID; break; case Common::EVENT_MOUSEMOVE: - _mouseX = event.mouse.x; - _mouseY = event.mouse.y; + if (_recordEvents) { + ex = new ExCommand(0, 17, 31, event.mouse.x, event.mouse.x, 0, 1, 0, 0, 0); + ex->_excFlags |= 3; + ex->handle(); + } break; case Common::EVENT_QUIT: _gameContinue = false; break; + case Common::EVENT_RBUTTONDOWN: + if (!_inputArFlag && (_updateTicks - _lastInputTicks) >= 2) { + ex = new ExCommand(0, 17, 107, event.mouse.x, event.mouse.x, 0, 1, 0, 0, 0); + ex->_excFlags |= 3; + _lastInputTicks = _updateTicks; + ex->handle(); + } + break; + case Common::EVENT_LBUTTONDOWN: + if (!_inputArFlag && (_updateTicks - _lastInputTicks) >= 2) { + ex = new ExCommand(0, 17, 29, event.mouse.x, event.mouse.x, 0, 1, 0, 0, 0); + + ex->_sceneClickX = _sceneRect.left + ex->_x; + ex->_sceneClickY = _sceneRect.top + ex->_y; + ex->_keyCode = getGameLoaderInventory()->getSelectedItemId(); + ex->_excFlags |= 3; + _lastInputTicks = _updateTicks; + ex->handle(); + } + break; + case Common::EVENT_LBUTTONUP: + if (!_inputArFlag && (_updateTicks - _lastButtonUpTicks) >= 2) { + ex = new ExCommand(0, 17, 30, 0, 0, 0, 1, 0, 0, 0); + ex->_excFlags |= 3; + _lastButtonUpTicks = _updateTicks; + ex->handle(); + } + break; default: break; } } + + +#if 0 + warning("STUB: FullpipeEngine::updateEvents() <mainWindowProc>"); + if (Msg == MSG_SC11_SHOWSWING && _modalObject) { + _modalObject->method14(); + } +#endif } void FullpipeEngine::freeGameLoader() { diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h index 257a45841a..4123f62855 100644 --- a/engines/fullpipe/fullpipe.h +++ b/engines/fullpipe/fullpipe.h @@ -109,7 +109,10 @@ public: bool _savesEnabled; bool _updateFlag; bool _flgCanOpenMap; + bool _gamePaused; bool _flgSavegameMenuRequested; + bool _inputArFlag; + bool _recordEvents; Common::Rect _sceneRect; int _sceneWidth; @@ -178,6 +181,8 @@ public: CInventory2 *_inventory; int32 _updateTicks; + int32 _lastInputTicks; + int32 _lastButtonUpTicks; CBaseModalObject *_modalObject; diff --git a/engines/fullpipe/inventory.h b/engines/fullpipe/inventory.h index a61df385a5..c449dfc718 100644 --- a/engines/fullpipe/inventory.h +++ b/engines/fullpipe/inventory.h @@ -100,6 +100,7 @@ class CInventory2 : public CInventory { void rebuildItemRects(); Scene *getScene() { return _scene; } + int getSelectedItemId() { return _selectedId < 0 ? 0 : _selectedId; } void draw(); }; diff --git a/engines/fullpipe/messages.cpp b/engines/fullpipe/messages.cpp index 0b1fec9bc6..c8befd5fd9 100644 --- a/engines/fullpipe/messages.cpp +++ b/engines/fullpipe/messages.cpp @@ -24,6 +24,7 @@ #include "fullpipe/objects.h" #include "fullpipe/messages.h" +#include "fullpipe/modal.h" namespace Fullpipe { @@ -104,9 +105,20 @@ void ExCommand::sendMessage() { processMessages(); } +void ExCommand::handle() { + if (g_fullpipe->_modalObject) { + g_fullpipe->_modalObject->handleMessage(this); + + delete this; + } else { + postMessage(this); + } +} + Message::Message() { _messageKind = 0; - _parentId = 0; + _parentId = 0; + _x = 0; _y = 0; _field_14 = 0; diff --git a/engines/fullpipe/messages.h b/engines/fullpipe/messages.h index b59b5947ee..25cdfc19ea 100644 --- a/engines/fullpipe/messages.h +++ b/engines/fullpipe/messages.h @@ -70,6 +70,7 @@ class ExCommand : public Message { bool handleMessage(); void sendMessage(); + void handle(); }; class CObjstateCommand : public CObject { |