Skip to content

Commit

Permalink
FULLPIPE: Implement Russian demo differences
Browse files Browse the repository at this point in the history
  • Loading branch information
sev- committed Dec 11, 2016
1 parent b6bc2e0 commit b930b4a
Show file tree
Hide file tree
Showing 6 changed files with 137 additions and 8 deletions.
5 changes: 4 additions & 1 deletion engines/fullpipe/init.cpp
Expand Up @@ -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));
Expand Down
4 changes: 4 additions & 0 deletions engines/fullpipe/messagehandlers.cpp
Expand Up @@ -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;
Expand Down
124 changes: 119 additions & 5 deletions engines/fullpipe/modal.cpp
Expand Up @@ -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);

Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -2268,19 +2302,46 @@ 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;
}

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)
Expand All @@ -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)) {
Expand Down Expand Up @@ -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)
Expand All @@ -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;
}

Expand All @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions engines/fullpipe/modal.h
Expand Up @@ -326,6 +326,7 @@ class ModalDemo : public BaseModalObject {
PictureObject *_text;
int _clickedQuit;
int _countdown;
Scene *_scene;

public:
ModalDemo();
Expand All @@ -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() {}
};
Expand Down
1 change: 1 addition & 0 deletions engines/fullpipe/objectnames.h
Expand Up @@ -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" // "Без монеты"
Expand Down
9 changes: 7 additions & 2 deletions engines/fullpipe/stateloader.cpp
Expand Up @@ -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();

Expand Down

0 comments on commit b930b4a

Please sign in to comment.