From b930b4a74f8d2c8ae87a49e4e5c0e3cfd234762c Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 11 Dec 2016 18:35:43 +0100 Subject: FULLPIPE: Implement Russian demo differences --- engines/fullpipe/init.cpp | 5 +- engines/fullpipe/messagehandlers.cpp | 4 ++ engines/fullpipe/modal.cpp | 124 +++++++++++++++++++++++++++++++++-- engines/fullpipe/modal.h | 2 + engines/fullpipe/objectnames.h | 1 + engines/fullpipe/stateloader.cpp | 9 ++- 6 files changed, 137 insertions(+), 8 deletions(-) diff --git a/engines/fullpipe/init.cpp b/engines/fullpipe/init.cpp index 9602803010..db95cd88b8 100644 --- a/engines/fullpipe/init.cpp +++ b/engines/fullpipe/init.cpp @@ -57,7 +57,10 @@ void FullpipeEngine::initObjectStates() { setObjectState(sO_FriesPit, getObjectEnumState(sO_FriesPit, sO_WithApple)); setObjectState(sO_Jug, getObjectEnumState(sO_Jug, sO_Blocked)); setObjectState(sO_RightStairs_9, getObjectEnumState(sO_RightStairs_9, sO_IsClosed)); - setObjectState(sO_Pipe_9, getObjectEnumState(sO_Pipe_9, sO_WithJug)); + if (isDemo() && getLanguage() == Common::RU_RUS) + setObjectState(sO_Pipe_9, getObjectEnumState(sO_Pipe_9, sO_WithoutJug)); + else + setObjectState(sO_Pipe_9, getObjectEnumState(sO_Pipe_9, sO_WithJug)); setObjectState(sO_Inflater, getObjectEnumState(sO_Inflater, sO_WithGum)); setObjectState(sO_Swingie, getObjectEnumState(sO_Swingie, sO_IsSwinging)); setObjectState(sO_DudeHasJumped, getObjectEnumState(sO_DudeHasJumped, sO_No)); diff --git a/engines/fullpipe/messagehandlers.cpp b/engines/fullpipe/messagehandlers.cpp index d69e8a94e3..f53a705ea9 100644 --- a/engines/fullpipe/messagehandlers.cpp +++ b/engines/fullpipe/messagehandlers.cpp @@ -188,6 +188,10 @@ int global_messageHandler1(ExCommand *cmd) { } break; case '\t': + // Demo has no map + if (g_fp->isDemo() && g_fp->getLanguage() == Common::RU_RUS) + break; + if (g_fp->_flgCanOpenMap) g_fp->openMap(); cmd->_messageKind = 0; diff --git a/engines/fullpipe/modal.cpp b/engines/fullpipe/modal.cpp index acb834d919..a20d6fcb1b 100644 --- a/engines/fullpipe/modal.cpp +++ b/engines/fullpipe/modal.cpp @@ -1803,6 +1803,28 @@ ModalQuery::~ModalQuery() { } bool ModalQuery::create(Scene *sc, Scene *bgScene, int id) { + if (g_fp->isDemo() && g_fp->getLanguage() == Common::RU_RUS) { + _bg = sc->getPictureObjectById(386, 0); + + if (!_bg) + return false; + + _okBtn = sc->getPictureObjectById(392, 0); + + if (!_okBtn) + return false; + + _cancelBtn = sc->getPictureObjectById(396, 0); + + if (!_cancelBtn) + return 0; + + _queryResult = -1; + _bgScene = bgScene; + + return true; + } + if (id == PIC_MEX_BGR) { _bg = sc->getPictureObjectById(PIC_MEX_BGR, 0); @@ -1817,7 +1839,7 @@ bool ModalQuery::create(Scene *sc, Scene *bgScene, int id) { _cancelBtn = sc->getPictureObjectById(PIC_MEX_CANCEL, 0); if (!_cancelBtn) - return 0; + return false; } else { if (id != PIC_MOV_BGR) return false; @@ -1892,6 +1914,18 @@ bool ModalQuery::init(int counterdiff) { if (_queryResult == -1) { return true; } else { + if (g_fp->isDemo() && g_fp->getLanguage() == Common::RU_RUS) { + if (!_queryResult) + return false; + + ModalDemo *demo = new ModalDemo; + demo->launch(); + + g_fp->_modalObject = demo; + + return true; + } + if (_bg->_id == PIC_MEX_BGR) { _cancelBtn->_flags &= 0xFFFB; _okBtn->_flags &= 0xFFFB; @@ -2268,12 +2302,21 @@ ModalDemo::ModalDemo() { _bg = 0; _button = 0; _text = 0; - _clickedQuit = -1; - _countdown = 1000; + + if (g_fp->getLanguage() == Common::RU_RUS) { + _clickedQuit = 0; + _countdown = -10; + } else { + _clickedQuit = -1; + _countdown = 1000; + } + _scene = 0; } ModalDemo::~ModalDemo() { - _bg->_flags &= 0xFFFB; + if (_bg) + _bg->_flags &= 0xFFFB; + _button->_flags &= 0xFFFB; _text->_flags &= 0xFFFB; } @@ -2281,6 +2324,24 @@ ModalDemo::~ModalDemo() { bool ModalDemo::launch() { Scene *sc = g_fp->accessScene(SC_MAINMENU); + if (g_fp->getLanguage() == Common::RU_RUS) { + _scene = sc; + + for (uint i = 1; i < sc->_picObjList.size(); i++) { + if (((PictureObject *)sc->_picObjList[i])->_id == 399) + sc->_picObjList[i]->_flags |= 4; + else + sc->_picObjList[i]->_flags &= 0xFFFB; + } + + _button = sc->getPictureObjectById(443, 0); + _text = sc->getPictureObjectById(402, 0); + + _countdown = -10; + + return true; + } + _bg = sc->getPictureObjectById(PIC_POST_BGR, 0); if (!_bg) @@ -2304,6 +2365,9 @@ bool ModalDemo::launch() { } bool ModalDemo::init(int counterDiff) { + if (g_fp->getLanguage() == Common::RU_RUS) + return init2(counterDiff); + g_fp->_cursorId = PIC_CSR_DEFAULT; if (_button->isPointInside(g_fp->_mouseScreenPos.x, g_fp->_mouseScreenPos.y)) { @@ -2335,7 +2399,46 @@ bool ModalDemo::init(int counterDiff) { return false; } +bool ModalDemo::init2(int counterDiff) { + if (_clickedQuit) { + // open URL + // http://pipestudio.ru/fullpipe/ + + g_fp->_gameContinue = false; + + return false; + } + + if (_countdown > 0) { + _countdown--; + } else { + _text->_flags ^= 4; + _countdown = 24; + } + + if (_button->isPointInside(g_fp->_mouseScreenPos.x, g_fp->_mouseScreenPos.y)) { + _button->_flags |= 4; + + g_fp->_cursorId = PIC_CSR_ITN; + } else { + _button->_flags &= 0xFFFB; + + g_fp->_cursorId = PIC_CSR_DEFAULT; + } + + return true; +} + void ModalDemo::update() { + if (g_fp->getLanguage() == Common::RU_RUS) { + if (_countdown == -10) + g_fp->sceneFade(_scene, true); + + _scene->draw(); + + return; + } + _bg->draw(); if (_button->_flags & 4) @@ -2352,7 +2455,7 @@ bool ModalDemo::handleMessage(ExCommand *cmd) { if (cmd->_messageNum == 29) { if (_button->isPointInside(g_fp->_mouseScreenPos.x, g_fp->_mouseScreenPos.y)) _clickedQuit = 1; - } else if (cmd->_messageNum == 36 && cmd->_param == 27) { + } else if (cmd->_messageNum == 36 && (cmd->_param == 27 || g_fp->getLanguage() == Common::RU_RUS)) { _clickedQuit = 1; } @@ -2370,6 +2473,17 @@ void FullpipeEngine::openHelp() { } void FullpipeEngine::openMainMenu() { + if (isDemo() && getLanguage() == Common::RU_RUS) { + ModalQuery *q = new ModalQuery; + + Scene *sc = accessScene(SC_MAINMENU); + + q->create(sc, 0, 0); + + g_fp->_modalObject = q; + + return; + } ModalMainMenu *menu = new ModalMainMenu; menu->_parentObj = g_fp->_modalObject; diff --git a/engines/fullpipe/modal.h b/engines/fullpipe/modal.h index 68ebef258c..ba8880827d 100644 --- a/engines/fullpipe/modal.h +++ b/engines/fullpipe/modal.h @@ -326,6 +326,7 @@ class ModalDemo : public BaseModalObject { PictureObject *_text; int _clickedQuit; int _countdown; + Scene *_scene; public: ModalDemo(); @@ -336,6 +337,7 @@ class ModalDemo : public BaseModalObject { virtual bool pollEvent() { return true; } virtual bool handleMessage(ExCommand *message); virtual bool init(int counterdiff); + bool init2(int counterdiff); virtual void update(); virtual void saveload() {} }; diff --git a/engines/fullpipe/objectnames.h b/engines/fullpipe/objectnames.h index 0baf83b175..7af82ff62c 100644 --- a/engines/fullpipe/objectnames.h +++ b/engines/fullpipe/objectnames.h @@ -32,6 +32,7 @@ namespace Fullpipe { #define sO_Pool "\xc1\xe0\xf1\xf1\xe5\xe9\xed" // "Бассейн" #define sO_TummyTrampie "\xc1\xe0\xf2\xf3\xf2\xe0" // "Батута" #define sO_WithoutBoot "\xc1\xe5\xe7 \xe1\xee\xf2\xe8\xed\xea\xe0" // "Без ботинка" +#define sO_WithoutJug "\xc1\xe5\xe7 \xe3\xee\xf0\xf8\xea\xe0" // "Без горшка" #define sO_WithoutJugs "\xc1\xe5\xe7 \xe3\xee\xf0\xf8\xea\xee\xe2" // "Без горшков" #define sO_WithoutCarpet "\xc1\xe5\xe7 \xea\xee\xe2\xf0\xe8\xea\xe0" // "Без коврика" #define sO_WithoutCoin "\xc1\xe5\xe7 \xec\xee\xed\xe5\xf2\xfb" // "Без монеты" diff --git a/engines/fullpipe/stateloader.cpp b/engines/fullpipe/stateloader.cpp index b53291b985..adc4fe3731 100644 --- a/engines/fullpipe/stateloader.cpp +++ b/engines/fullpipe/stateloader.cpp @@ -288,8 +288,13 @@ bool FullpipeEngine::loadGam(const char *fname, int scene) { addMessageHandlerByIndex(global_messageHandler1, 0, 4); _inventory = getGameLoaderInventory(); - _inventory->setItemFlags(ANI_INV_MAP, 0x10003); - _inventory->addItem(ANI_INV_MAP, 1); + + if (isDemo() && getLanguage() == Common::RU_RUS) { + _inventory->addItem(ANI_INV_HAMMER, 1); + } else { + _inventory->setItemFlags(ANI_INV_MAP, 0x10003); + _inventory->addItem(ANI_INV_MAP, 1); + } _inventory->rebuildItemRects(); -- cgit v1.2.3