diff options
author | Eugene Sandulenko | 2013-08-11 17:18:42 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2013-09-06 14:51:13 +0300 |
commit | c12ea8bd2b495c2d433ffc740bb44d0f32dbc47a (patch) | |
tree | 196b44eb985216973cadb8d51a776f80b5bd2f4a /engines | |
parent | cee12678dca97e52f57c926f646530cb3e23b176 (diff) | |
download | scummvm-rg350-c12ea8bd2b495c2d433ffc740bb44d0f32dbc47a.tar.gz scummvm-rg350-c12ea8bd2b495c2d433ffc740bb44d0f32dbc47a.tar.bz2 scummvm-rg350-c12ea8bd2b495c2d433ffc740bb44d0f32dbc47a.zip |
FULLPIPE: Implement global_messageHandler1()
Diffstat (limited to 'engines')
-rw-r--r-- | engines/fullpipe/constants.h | 19 | ||||
-rw-r--r-- | engines/fullpipe/fullpipe.cpp | 16 | ||||
-rw-r--r-- | engines/fullpipe/fullpipe.h | 19 | ||||
-rw-r--r-- | engines/fullpipe/gameloader.cpp | 2 | ||||
-rw-r--r-- | engines/fullpipe/input.cpp | 13 | ||||
-rw-r--r-- | engines/fullpipe/input.h | 1 | ||||
-rw-r--r-- | engines/fullpipe/inventory.cpp | 30 | ||||
-rw-r--r-- | engines/fullpipe/inventory.h | 13 | ||||
-rw-r--r-- | engines/fullpipe/messages.cpp | 10 | ||||
-rw-r--r-- | engines/fullpipe/messages.h | 2 | ||||
-rw-r--r-- | engines/fullpipe/modal.cpp | 12 | ||||
-rw-r--r-- | engines/fullpipe/scenes.cpp | 171 | ||||
-rw-r--r-- | engines/fullpipe/sound.cpp | 18 | ||||
-rw-r--r-- | engines/fullpipe/sound.h | 2 | ||||
-rw-r--r-- | engines/fullpipe/statics.h | 8 |
15 files changed, 307 insertions, 29 deletions
diff --git a/engines/fullpipe/constants.h b/engines/fullpipe/constants.h index b1a7565fea..43f90edf3d 100644 --- a/engines/fullpipe/constants.h +++ b/engines/fullpipe/constants.h @@ -29,9 +29,24 @@ namespace Fullpipe { #define ANI_IN1MAN 5110 #define ANI_INV_MAP 5321 #define ANI_MAN 322 +#define MSG_DISABLESAVES 5201 +#define MSG_ENABLESAVES 5202 +#define MSG_HMRKICK_METAL 4764 +#define MSG_HMRKICK_STUCCO 4765 +#define MSG_MANSHADOWSOFF 5196 +#define MSG_MANSHADOWSON 5197 #define MSG_SC1_SHOWOSK 1019 #define MSG_SC1_SHOWOSK2 468 #define MSG_SC1_UTRUBACLICK 1100 +#define MV_MAN_GOLADDER 451 +#define MV_MAN_GOLADDER2 2844 +#define MV_MAN_LOOKUP 4773 +#define MV_MAN_STARTLADDER 452 +#define MV_MAN_STARTLADDER2 2842 +#define MV_MAN_STOPLADDER 454 +#define MV_MAN_STOPLADDER2 2845 +#define MV_MAN_TOLADDER 448 +#define MV_MAN_TOLADDER2 2841 #define MV_MAN_TURN_LU 486 #define PIC_CMN_EVAL 3468 #define PIC_CSR_ARCADE1 4901 @@ -120,12 +135,16 @@ namespace Fullpipe { #define SC_MAP 5222 #define SC_TEST 903 #define SC_TITLES 5166 +#define SND_CMN_031 3516 +#define SND_CMN_070 5199 #define ST_LBN_2N 2756 #define ST_MAN_EMPTY 476 +#define ST_MAN_RIGHT 325 #define TrubaDown 697 #define TrubaLeft 474 #define TrubaRight 696 #define TrubaUp 680 +#define rMV_MAN_LOOKUP 4775 } // End of namespace Fullpipe diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp index e73a81aef0..bca025770b 100644 --- a/engines/fullpipe/fullpipe.cpp +++ b/engines/fullpipe/fullpipe.cpp @@ -105,6 +105,8 @@ FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc) _mouseVirtX = 0; _mouseVirtY = 0; + _currSelectedInventoryItemId = 0; + _behaviorManager = 0; _cursorId = 0; @@ -254,8 +256,7 @@ void FullpipeEngine::updateEvents() { ex->handle(); } - _mouseX = event.mouse.x; - _mouseY = event.mouse.y; + _mouseScreenPos = event.mouse; break; case Common::EVENT_QUIT: _gameContinue = false; @@ -311,8 +312,8 @@ void FullpipeEngine::cleanup() { } void FullpipeEngine::updateScreen() { - _mouseVirtX = _mouseX + _sceneRect.left; - _mouseVirtY = _mouseY + _sceneRect.top; + _mouseVirtX = _mouseScreenPos.x + _sceneRect.left; + _mouseVirtY = _mouseScreenPos.y + _sceneRect.top; //if (inputArFlag) // updateGame_inputArFlag(); @@ -348,7 +349,7 @@ void FullpipeEngine::updateScreen() { } else { //vrtRectangle(*(_DWORD *)g_vrtHandle, 0, 0, 0, 800, 600); } - _inputController->drawCursor(_mouseX, _mouseY); + _inputController->drawCursor(_mouseScreenPos.x, _mouseScreenPos.y); ++_updateTicks; } @@ -404,4 +405,9 @@ void FullpipeEngine::updateMapPiece(int mapId, int update) { } } +void FullpipeEngine::disableSaves(ExCommand *ex) { + warning("STUB: FullpipeEngine::disableSaves()"); +} + + } // End of namespace Fullpipe diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h index 4123f62855..7598ff40ed 100644 --- a/engines/fullpipe/fullpipe.h +++ b/engines/fullpipe/fullpipe.h @@ -88,7 +88,6 @@ public: Common::RandomSource *_rnd; - int _mouseX, _mouseY; Common::KeyCode _keyState; uint16 _buttonState; @@ -106,7 +105,6 @@ public: int _gameProjectVersion; int _pictureScale; int _scrollSpeed; - bool _savesEnabled; bool _updateFlag; bool _flgCanOpenMap; bool _gamePaused; @@ -126,11 +124,18 @@ public: CInputController *_inputController; bool _inputDisabled; + void defHandleKeyDown(int key); + SoundList *_currSoundList1[11]; int _currSoundListCount; bool _soundEnabled; bool _flgSoundList; + void stopAllSounds(); + void toggleMute(); + void playSound(int id, int flag); + void startSceneTrack(); + int _sfxVolume; GlobalMessageQueueList *_globalMessageQueueList; @@ -146,6 +151,7 @@ public: int _mouseVirtX; int _mouseVirtY; + Common::Point _mouseScreenPos; BehaviorManager *_behaviorManager; @@ -163,6 +169,9 @@ public: bool _flgPlayIntro; int _musicAllowed; + void enableSaves() { _isSaveAllowed = true; } + void disableSaves(ExCommand *ex); + void initObjectStates(); void setLevelStates(); void setSwallowedEggsState(); @@ -179,6 +188,7 @@ public: Scene *_inventoryScene; CInventory2 *_inventory; + int _currSelectedInventoryItemId; int32 _updateTicks; int32 _lastInputTicks; @@ -190,6 +200,7 @@ public: int (*_updateCursorCallback)(); int _cursorId; + void setCursor(int id); int getObjectState(const char *objname); void setObjectState(const char *name, int state); @@ -201,6 +212,10 @@ public: NGIArchive *_currArchive; + void openMap(); + void openHelp(); + void openMainMenu(); + public: bool _isSaveAllowed; diff --git a/engines/fullpipe/gameloader.cpp b/engines/fullpipe/gameloader.cpp index 0b431975e1..adb81092f9 100644 --- a/engines/fullpipe/gameloader.cpp +++ b/engines/fullpipe/gameloader.cpp @@ -311,7 +311,7 @@ void CGameLoader::updateSystems(int counterdiff) { _updateCounter++; _exCommand._messageNum = 33; _exCommand._excFlags = 0; - postMessage(&_exCommand); + _exCommand.postMessage(); } processMessages(); diff --git a/engines/fullpipe/input.cpp b/engines/fullpipe/input.cpp index 78c6e50a49..b649c013f8 100644 --- a/engines/fullpipe/input.cpp +++ b/engines/fullpipe/input.cpp @@ -82,6 +82,10 @@ void CInputController::drawCursor(int x, int y) { warning("STUB: CInputController::drawCursor(%d, %d)", x, y); } +void CInputController::setCursor(int id) { + warning("STUB: CInputController::setCursor(%d)", id); +} + CursorInfo::CursorInfo() { pictureId = 0; picture = 0; @@ -104,4 +108,13 @@ CursorInfo::CursorInfo(CursorInfo *src) { height = src->height; } +void FullpipeEngine::setCursor(int id) { + if (_inputController) + _inputController->setCursor(id); +} + +void FullpipeEngine::defHandleKeyDown(int key) { + warning("STUB: FullpipeEngine::defHandleKeyDown(%d)", key); +} + } // End of namespace Fullpipe diff --git a/engines/fullpipe/input.h b/engines/fullpipe/input.h index 06013ab0c1..e527770dc9 100644 --- a/engines/fullpipe/input.h +++ b/engines/fullpipe/input.h @@ -65,6 +65,7 @@ class CInputController { void setCursorMode(bool mode); void drawCursor(int x, int y); + void setCursor(int id); }; } // End of namespace Fullpipe diff --git a/engines/fullpipe/inventory.cpp b/engines/fullpipe/inventory.cpp index c88d6f9cdc..c45c66dc7e 100644 --- a/engines/fullpipe/inventory.cpp +++ b/engines/fullpipe/inventory.cpp @@ -110,4 +110,34 @@ void CInventory2::draw() { warning("STUB: CInventory2::draw()"); } +void CInventory2::slideOut() { + _isInventoryOut = true; + + ExCommand *ex = new ExCommand(0, 17, 65, 0, 0, 0, 1, 0, 0, 0); + + ex->_field_2C = 10; + ex->_field_14 = _isInventoryOut; + ex->_field_20 = !_isInventoryOut; + ex->_excFlags |= 3; + ex->postMessage(); +} + +int CInventory2::handleLeftClick(ExCommand *cmd) { + warning("STUB: CInventory2::handleLeftClick()"); + + return 0; +} + +int CInventory2::unselectItem(bool flag) { + warning("STUB: CInventory2::unselectItem()"); + + return 0; +} + +int CInventory2::getHoveredItem(Common::Point *point) { + warning("STUB: CInventory2::getHoveredItem()"); + + return 0; +} + } // End of namespace Fullpipe diff --git a/engines/fullpipe/inventory.h b/engines/fullpipe/inventory.h index c449dfc718..accfb08afa 100644 --- a/engines/fullpipe/inventory.h +++ b/engines/fullpipe/inventory.h @@ -87,8 +87,8 @@ class CInventory2 : public CInventory { InventoryIcons _inventoryIcons; int _selectedId; int _field_48; - int _isInventoryOut; - int _isLocked; + bool _isInventoryOut; + bool _isLocked; int _topOffset; Scene *_scene; BigPicture *_picture; @@ -100,7 +100,16 @@ class CInventory2 : public CInventory { void rebuildItemRects(); Scene *getScene() { return _scene; } + bool getIsLocked() { return _isLocked; } + void setIsLocked(bool val) { _isLocked = val; } + bool getIsInventoryOut() { return _isInventoryOut; } + int getSelectedItemId() { return _selectedId < 0 ? 0 : _selectedId; } + int getHoveredItem(Common::Point *point); + void slideOut(); + + int handleLeftClick(ExCommand *cmd); + int unselectItem(bool flag); void draw(); }; diff --git a/engines/fullpipe/messages.cpp b/engines/fullpipe/messages.cpp index fe9ca51811..c93cd42172 100644 --- a/engines/fullpipe/messages.cpp +++ b/engines/fullpipe/messages.cpp @@ -106,13 +106,17 @@ void ExCommand::sendMessage() { processMessages(); } +void ExCommand::postMessage() { + g_fullpipe->_exCommandList.push_back(this); +} + void ExCommand::handle() { if (g_fullpipe->_modalObject) { g_fullpipe->_modalObject->handleMessage(this); delete this; } else { - postMessage(this); + postMessage(); } } @@ -624,10 +628,6 @@ void clearMessageHandlers() { } } -void postMessage(ExCommand *ex) { - g_fullpipe->_exCommandList.push_back(ex); -} - void processMessages() { if (!g_fullpipe->_isProcessingMessages) { g_fullpipe->_isProcessingMessages = true; diff --git a/engines/fullpipe/messages.h b/engines/fullpipe/messages.h index 746765f462..650a237381 100644 --- a/engines/fullpipe/messages.h +++ b/engines/fullpipe/messages.h @@ -72,6 +72,7 @@ class ExCommand : public Message { bool handleMessage(); void sendMessage(); + void postMessage(); void handle(); }; @@ -153,7 +154,6 @@ int getMessageHandlersCount(); bool addMessageHandlerByIndex(int (*callback)(ExCommand *), int index, int16 id); bool insertMessageHandler(int (*callback)(ExCommand *), int index, int16 id); void clearMessageHandlers(); -void postMessage(ExCommand *ex); void processMessages(); void updateGlobalMessageQueue(int id, int objid); diff --git a/engines/fullpipe/modal.cpp b/engines/fullpipe/modal.cpp index 4728fb25f9..f7bc633ca6 100644 --- a/engines/fullpipe/modal.cpp +++ b/engines/fullpipe/modal.cpp @@ -91,4 +91,16 @@ bool CModalIntro::handleMessage(ExCommand *message) { return true; } +void FullpipeEngine::openMap() { + warning("STUB: FullpipeEngine::openMap()"); +} + +void FullpipeEngine::openHelp() { + warning("STUB: FullpipeEngine::openHelp()"); +} + +void FullpipeEngine::openMainMenu() { + warning("STUB: FullpipeEngine::openMainMenu()"); +} + } // End of namespace Fullpipe diff --git a/engines/fullpipe/scenes.cpp b/engines/fullpipe/scenes.cpp index 5663fc2446..0f1202abd0 100644 --- a/engines/fullpipe/scenes.cpp +++ b/engines/fullpipe/scenes.cpp @@ -91,7 +91,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { _scrollSpeed = 8; - _savesEnabled = true; + _isSaveAllowed = true; _updateFlag = true; _flgCanOpenMap = true; @@ -651,8 +651,173 @@ void setElevatorButton(const char *name, int state) { var->setSubVarAsInt(name, state); } +void global_messageHandler_KickStucco() { + warning("STUB: global_messageHandler_KickStucco()"); +} + +void global_messageHandler_KickMetal() { + warning("STUB: global_messageHandler_KickMetal()"); +} + int global_messageHandler1(ExCommand *cmd) { - warning("STUB: global_messageHandler1()"); + if (cmd->_excFlags & 0x10000) { + if (cmd->_messageNum == MV_MAN_TOLADDER) + cmd->_messageNum = MV_MAN_TOLADDER2; + if (cmd->_messageNum == MV_MAN_STARTLADDER) + cmd->_messageNum = MV_MAN_STARTLADDER2; + if (cmd->_messageNum == MV_MAN_GOLADDER) + cmd->_messageNum = MV_MAN_GOLADDER2; + if (cmd->_messageNum == MV_MAN_STOPLADDER) + cmd->_messageNum = MV_MAN_STOPLADDER2; + } + + if (g_fullpipe->_inputDisabled) { + if (cmd->_messageKind == 17) { + switch (cmd->_messageNum) { + case 29: + case 30: + case 36: + case 106: + cmd->_messageKind = 0; + break; + default: + break; + } + } + } else if (cmd->_messageKind == 17) { + switch (cmd->_messageNum) { + case MSG_MANSHADOWSON: + g_fullpipe->_aniMan->_shadowsOn = 1; + break; + case MSG_HMRKICK_STUCCO: + global_messageHandler_KickStucco(); + break; + case MSG_MANSHADOWSOFF: + g_fullpipe->_aniMan->_shadowsOn = 0; + break; + case MSG_DISABLESAVES: + g_fullpipe->disableSaves(cmd); + break; + case MSG_ENABLESAVES: + g_fullpipe->enableSaves(); + break; + case MSG_HMRKICK_METAL: + global_messageHandler_KickMetal(); + break; + case 29: // left mouse + if (g_fullpipe->_inventoryScene) { + if (getGameLoaderInventory()->handleLeftClick(cmd)) + cmd->_messageKind = 0; + } + break; + case 107: // right mouse + if (getGameLoaderInventory()->getSelectedItemId()) { + getGameLoaderInventory()->unselectItem(0); + cmd->_messageKind = 0; + } + break; + case 36: // keydown + switch (cmd->_keyCode) { + case '\x1B': // ESC + if (g_fullpipe->_currentScene) { + getGameLoaderInventory()->unselectItem(0); + g_fullpipe->openMainMenu(); + cmd->_messageKind = 0; + } + break; + case 't': + g_fullpipe->stopAllSounds(); + cmd->_messageKind = 0; + break; + case 'u': + g_fullpipe->toggleMute(); + cmd->_messageKind = 0; + break; + case ' ': + if (getGameLoaderInventory()->getIsLocked()) { + if (getGameLoaderInventory()->getIsInventoryOut()) { + getGameLoaderInventory()->setIsLocked(0); + } + } else { + getGameLoaderInventory()->slideOut(); + getGameLoaderInventory()->setIsLocked(1); + } + break; + case '\t': + if (g_fullpipe->_flgCanOpenMap) + g_fullpipe->openMap(); + cmd->_messageKind = 0; + break; + case 'p': + if (g_fullpipe->_flgCanOpenMap) + g_fullpipe->openHelp(); + cmd->_messageKind = 0; + break; + default: + g_fullpipe->defHandleKeyDown(cmd->_keyCode); + break; + } + break; + case 33: + if (!g_fullpipe->_inventoryScene) + break; + + int invItem; + + if (g_fullpipe->_updateFlag && (invItem = g_fullpipe->_inventory->getHoveredItem(&g_fullpipe->_mouseScreenPos))) { + g_fullpipe->_cursorId = PIC_CSR_ITN; + if (!g_fullpipe->_currSelectedInventoryItemId && !g_fullpipe->_aniMan->_movement && + !(g_fullpipe->_aniMan->_flags & 0x100) && g_fullpipe->_aniMan->isIdle()) { + int st = g_fullpipe->_aniMan->_statics->_staticsId; + ExCommand *newex; + + if (st == ST_MAN_RIGHT) { + newex = new ExCommand(g_fullpipe->_aniMan->_id, 1, rMV_MAN_LOOKUP, 0, 0, 0, 1, 0, 0, 0); + } else if (st == (0x4000 | ST_MAN_RIGHT)) { + newex = new ExCommand(g_fullpipe->_aniMan->_id, 1, MV_MAN_LOOKUP, 0, 0, 0, 1, 0, 0, 0); + } + newex->_keyCode = g_fullpipe->_aniMan->_field_4; + newex->_excFlags |= 3; + newex->postMessage(); + } + + if (g_fullpipe->_currSelectedInventoryItemId != invItem) + g_fullpipe->playSound(SND_CMN_070, 0); + + g_fullpipe->_currSelectedInventoryItemId = invItem; + g_fullpipe->setCursor(g_fullpipe->_cursorId); + break; + } + if (g_fullpipe->_updateCursorCallback) + g_fullpipe->_updateCursorCallback(); + + g_fullpipe->_currSelectedInventoryItemId = 0; + g_fullpipe->setCursor(g_fullpipe->_cursorId); + break; + case 65: // open map + if (cmd->_field_2C == 11 && cmd->_field_14 == ANI_INV_MAP && g_fullpipe->_flgCanOpenMap) + g_fullpipe->openMap(); + break; + default: + break; + } + } + + if (cmd->_messageKind == 56) { + getGameLoaderInventory()->rebuildItemRects(); + + ExCommand *newex = new ExCommand(0, 35, SND_CMN_031, 0, 0, 0, 1, 0, 0, 0); + + newex->_field_14 = 1; + newex->_excFlags |= 3; + newex->postMessage(); + + return 1; + } else if (cmd->_messageKind == 57) { + getGameLoaderInventory()->rebuildItemRects(); + + return 1; + } return 0; } @@ -784,7 +949,7 @@ int sceneHandler01(ExCommand *cmd) { } g_fullpipe->_behaviorManager->updateBehaviors(); - startSceneTrack(); + g_fullpipe->startSceneTrack(); return res; } diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp index 996bf5b1a4..7c64dd088b 100644 --- a/engines/fullpipe/sound.cpp +++ b/engines/fullpipe/sound.cpp @@ -110,8 +110,22 @@ void FullpipeEngine::setSceneMusicParameters(CGameVar *var) { warning("STUB: FullpipeEngine::setSceneMusicParameters()"); } -void startSceneTrack() { - warning("STUB: startSceneTrack()"); +void FullpipeEngine::startSceneTrack() { + warning("STUB: FullpipeEngine::startSceneTrack()"); } +void FullpipeEngine::stopAllSounds() { + warning("STUB: FullpipeEngine::stopAllSounds()"); +} + +void FullpipeEngine::toggleMute() { + warning("STUB: FullpipeEngine::toggleMute()"); +} + +void FullpipeEngine::playSound(int id, int flag) { + warning("STUB: FullpipeEngine::playSounds(%d, %d)", id, flag); +} + + + } // End of namespace Fullpipe diff --git a/engines/fullpipe/sound.h b/engines/fullpipe/sound.h index 775086774c..93e994a720 100644 --- a/engines/fullpipe/sound.h +++ b/engines/fullpipe/sound.h @@ -25,8 +25,6 @@ namespace Fullpipe { -void startSceneTrack(); - class Sound : public MemoryObject { int _id; char *_description; diff --git a/engines/fullpipe/statics.h b/engines/fullpipe/statics.h index e81a83d364..ee99861a00 100644 --- a/engines/fullpipe/statics.h +++ b/engines/fullpipe/statics.h @@ -81,9 +81,7 @@ class DynamicPhase : public StaticPhase { }; class Statics : public DynamicPhase { - friend class StaticANIObject; - friend class Movement; - + public: int16 _staticsId; int16 _field_86; char *_staticsName; @@ -158,9 +156,7 @@ class Movement : public GameObject { }; class StaticANIObject : public GameObject { - friend class FullpipeEngine; - - protected: + public: Movement *_movement; Statics *_statics; int _shadowsOn; |