diff options
author | Kamil Zbróg | 2013-12-09 19:03:42 +0000 |
---|---|---|
committer | Kamil Zbróg | 2013-12-09 19:03:42 +0000 |
commit | 7add223d859ae270834cafa5eaac2fb5d5a6bb50 (patch) | |
tree | ee6551d2d7de3c0e07ffb86d7453691f815b1757 /engines/fullpipe | |
parent | 8e772f936c43a68e4ae7c68b178bd9fa3a3e4f1f (diff) | |
parent | 8a936200037e6d97212a4d0ad6a710c87cc15b58 (diff) | |
download | scummvm-rg350-7add223d859ae270834cafa5eaac2fb5d5a6bb50.tar.gz scummvm-rg350-7add223d859ae270834cafa5eaac2fb5d5a6bb50.tar.bz2 scummvm-rg350-7add223d859ae270834cafa5eaac2fb5d5a6bb50.zip |
Merge remote-tracking branch 'sync/master' into prince-malik
Diffstat (limited to 'engines/fullpipe')
-rw-r--r-- | engines/fullpipe/console.cpp | 31 | ||||
-rw-r--r-- | engines/fullpipe/console.h | 40 | ||||
-rw-r--r-- | engines/fullpipe/constants.h | 15 | ||||
-rw-r--r-- | engines/fullpipe/fullpipe.cpp | 10 | ||||
-rw-r--r-- | engines/fullpipe/fullpipe.h | 7 | ||||
-rw-r--r-- | engines/fullpipe/gfx.cpp | 6 | ||||
-rw-r--r-- | engines/fullpipe/init.cpp | 4 | ||||
-rw-r--r-- | engines/fullpipe/module.mk | 1 | ||||
-rw-r--r-- | engines/fullpipe/motion.cpp | 126 | ||||
-rw-r--r-- | engines/fullpipe/motion.h | 44 | ||||
-rw-r--r-- | engines/fullpipe/objectnames.h | 2 | ||||
-rw-r--r-- | engines/fullpipe/scene.cpp | 75 | ||||
-rw-r--r-- | engines/fullpipe/scenes.cpp | 3 | ||||
-rw-r--r-- | engines/fullpipe/scenes.h | 18 | ||||
-rw-r--r-- | engines/fullpipe/scenes/scene04.cpp | 289 | ||||
-rw-r--r-- | engines/fullpipe/sound.cpp | 4 | ||||
-rw-r--r-- | engines/fullpipe/statics.cpp | 12 |
17 files changed, 628 insertions, 59 deletions
diff --git a/engines/fullpipe/console.cpp b/engines/fullpipe/console.cpp new file mode 100644 index 0000000000..587f3dc6e6 --- /dev/null +++ b/engines/fullpipe/console.cpp @@ -0,0 +1,31 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "fullpipe/fullpipe.h" + +namespace Fullpipe { + +Console::Console(FullpipeEngine *vm) : GUI::Debugger() { + _vm = vm; +} + +} // End of namespace Fullpipe diff --git a/engines/fullpipe/console.h b/engines/fullpipe/console.h new file mode 100644 index 0000000000..9c03081b2b --- /dev/null +++ b/engines/fullpipe/console.h @@ -0,0 +1,40 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef FULLPIPE_CONSOLE_H +#define FULLPIPE_CONSOLE_H + +namespace Fullpipe { + +class FullpipeEngine; + +class Console : public GUI::Debugger { +public: + Console(FullpipeEngine *vm); + +private: + FullpipeEngine *_vm; +}; + +} // End of namespace Fullpipe + +#endif /* FULLPIPE_CONSOLE_H */ diff --git a/engines/fullpipe/constants.h b/engines/fullpipe/constants.h index 76739b6632..b774c89ed0 100644 --- a/engines/fullpipe/constants.h +++ b/engines/fullpipe/constants.h @@ -96,7 +96,6 @@ namespace Fullpipe { #define MSG_SC4_KOZAWFALL 2858 #define MSG_SC4_MANFROMBOTTLE 2854 #define MSG_SC4_MANTOBOTTLE 2852 -#define PIC_SC4_LADDER 1438 #define MSG_GOTOLADDER 618 #define MSG_SHAKEBOTTLE 584 #define MSG_SHOOTKOZAW 557 @@ -110,6 +109,8 @@ namespace Fullpipe { #define MV_IN1MAN_SLEEP 5111 #define MV_KZW_JUMP 558 #define MV_KZW_JUMPROTATE 561 +#define MV_KZW_TOHOLERV 537 +#define MV_KZW_WALKPLANK 500 #define MV_BDG_OPEN 1379 #define MV_BTN_CLICK 599 #define MV_CLK_GO 589 @@ -118,6 +119,8 @@ namespace Fullpipe { #define MV_MAN_GOLADDER 451 #define MV_MAN_GOLADDER2 2844 #define MV_MAN_GOU 460 +#define MV_MAN_JUMPONPLANK 551 +#define MV_MAN_LOOKLADDER 520 #define MV_MAN_LOOKUP 4773 #define MV_MAN_STARTLADDER 452 #define MV_MAN_STARTLADDER2 2842 @@ -184,9 +187,14 @@ namespace Fullpipe { #define PIC_SC4_MASK 585 #define PIC_SC4_PLANK 5183 #define PIC_SCD_SEL 734 +#define QU_BALL_WALKL 4920 +#define QU_BALL_WALKR 4919 #define QU_EGTR_MD2_SHOW 4698 #define QU_EGTR_MD1_SHOW 4697 #define QU_EGTR_SLIMSHOW 4883 +#define QU_HND_TAKE0 1440 +#define QU_HND_TAKE1 1441 +#define QU_HND_TAKE2 1442 #define QU_HND_TAKEBOTTLE 1443 #define QU_IN2_DO 5144 #define QU_INTR_FINISH 5138 @@ -196,6 +204,7 @@ namespace Fullpipe { #define QU_PNK_CLICK 550 #define QU_SC3_ENTERLIFT 2779 #define QU_SC3_EXITLIFT 2808 +#define QU_SC4_GOCLOCK 595 #define QU_SC4_MANFROMBOTTLE 2851 #define SC_1 301 #define SC_10 653 @@ -284,8 +293,12 @@ namespace Fullpipe { #define ST_LBN_9N 2777 #define ST_LBN_9P 2778 #define ST_MAN_EMPTY 476 +#define ST_MAN_LADDERDOWN 521 +#define ST_MAN_ONPLANK 552 #define ST_MAN_RIGHT 325 #define ST_MAN_SIT 1164 +#define ST_MAN_STANDLADDER 453 +#define ST_PNK_WEIGHTLEFT 503 #define TrubaDown 697 #define TrubaLeft 474 #define TrubaRight 696 diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp index 7dedaf3109..a254ea642d 100644 --- a/engines/fullpipe/fullpipe.cpp +++ b/engines/fullpipe/fullpipe.cpp @@ -35,6 +35,7 @@ #include "fullpipe/input.h" #include "fullpipe/scenes.h" #include "fullpipe/floaters.h" +#include "fullpipe/console.h" namespace Fullpipe { @@ -51,6 +52,7 @@ FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc) _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume")); _rnd = new Common::RandomSource("fullpipe"); + _console = 0; _gameProjectVersion = 0; _pictureScale = 8; @@ -152,6 +154,7 @@ FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc) FullpipeEngine::~FullpipeEngine() { delete _rnd; + delete _console; delete _globalMessageQueueList; } @@ -174,6 +177,8 @@ Common::Error FullpipeEngine::run() { _backgroundSurface.create(800, 600, format); + _console = new Console(this); + initialize(); _isSaveAllowed = false; @@ -272,6 +277,11 @@ void FullpipeEngine::updateEvents() { return; break; default: + if (event.kbd.keycode == Common::KEYCODE_d && event.kbd.hasFlags(Common::KBD_CTRL)) { + // Start the debugger + getDebugger()->attach(); + getDebugger()->onFrame(); + } ex = new ExCommand(0, 17, 36, 0, 0, 0, 1, 0, 0, 0); ex->_keyCode = event.kbd.keycode; ex->_excFlags |= 3; diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h index 00d2863c94..ca025a48a2 100644 --- a/engines/fullpipe/fullpipe.h +++ b/engines/fullpipe/fullpipe.h @@ -36,6 +36,9 @@ #include "engines/engine.h" +#include "gui/debugger.h" +#include "fullpipe/console.h" + struct ADGameDescription; namespace Fullpipe { @@ -80,6 +83,9 @@ public: FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc); virtual ~FullpipeEngine(); + Console *_console; + GUI::Debugger *getDebugger() { return _console; } + void initialize(); void setMusicAllowed(int val) { _musicAllowed = val; } @@ -143,6 +149,7 @@ public: void playSound(int id, int flag); void startSceneTrack(); void stopSoundStream2(); + void stopAllSoundStreams(); int _sfxVolume; diff --git a/engines/fullpipe/gfx.cpp b/engines/fullpipe/gfx.cpp index fba7e402d2..a4dbc30669 100644 --- a/engines/fullpipe/gfx.cpp +++ b/engines/fullpipe/gfx.cpp @@ -596,7 +596,7 @@ void Picture::draw(int x, int y, int style, int angle) { int x1 = x; int y1 = y; - debug(0, "Picture::draw(%d, %d, %d, %d) (%s)", x, y, style, angle, _memfilename); + debug(7, "Picture::draw(%d, %d, %d, %d) (%s)", x, y, style, angle, _memfilename); if (x != -1) x1 = x; @@ -611,7 +611,7 @@ void Picture::draw(int x, int y, int style, int angle) { return; if ((_alpha & 0xff) < 0xff) { - debug(0, "Picture:draw: alpha = %0x", _alpha); + debug(7, "Picture:draw: alpha = %0x", _alpha); } byte *pal = _paletteData; @@ -783,7 +783,7 @@ bool Bitmap::isPixelAtHitPosRB(int x, int y) { } void Bitmap::putDib(int x, int y, int32 *palette) { - debug(0, "Bitmap::putDib(%d, %d)", x, y); + debug(7, "Bitmap::putDib(%d, %d)", x, y); _x = x - g_fullpipe->_sceneRect.left; _y = y - g_fullpipe->_sceneRect.top; diff --git a/engines/fullpipe/init.cpp b/engines/fullpipe/init.cpp index 49bf72ac91..eb109e11ec 100644 --- a/engines/fullpipe/init.cpp +++ b/engines/fullpipe/init.cpp @@ -65,7 +65,7 @@ void FullpipeEngine::initObjectStates() { setObjectState(sO_Guardian, getObjectEnumState(sO_Guardian, sO_OnRight)); setObjectState(sO_Grandma, getObjectEnumState(sO_Grandma, sO_In_14)); setObjectState(sO_Boot_15, getObjectEnumState(sO_Boot_15, sO_NotPresent)); - setObjectState(sO_LeftPipe_15, getObjectEnumState(sO_LeftPipe_15, sO_OpenedShe)); + setObjectState(sO_LeftPipe_15, getObjectEnumState(sO_LeftPipe_15, sO_IsOpened)); setObjectState(sO_Pedestal_16, getObjectEnumState(sO_Pedestal_16, sO_IsFree)); setObjectState(sO_Cup, getObjectEnumState(sO_Cup, sO_InSmokeRoom)); setObjectState(sO_Pedestal_17, getObjectEnumState(sO_Pedestal_17, sO_IsFree)); @@ -84,7 +84,7 @@ void FullpipeEngine::initObjectStates() { setObjectState(sO_Lever_23, getObjectEnumState(sO_Lever_23, sO_NotTaken)); setObjectState(sO_LeverHandle_23, getObjectEnumState(sO_LeverHandle_23, sO_WithoutStool)); setObjectState(sO_LowerPipe_21, getObjectEnumState(sO_LowerPipe_21, sO_IsClosed)); - setObjectState(sO_StarsDown_24, getObjectEnumState(sO_StarsDown_24, sO_OpenedShe)); + setObjectState(sO_StarsDown_24, getObjectEnumState(sO_StarsDown_24, sO_IsOpened)); setObjectState(sO_Hatch_26, getObjectEnumState(sO_Hatch_26, sO_Closed)); setObjectState(sO_Sock_26, getObjectEnumState(sO_Sock_26, sO_NotHanging)); setObjectState(sO_LeftPipe_26, getObjectEnumState(sO_LeftPipe_26, sO_IsClosed)); diff --git a/engines/fullpipe/module.mk b/engines/fullpipe/module.mk index 88e3ac5d02..bd948b7ab4 100644 --- a/engines/fullpipe/module.mk +++ b/engines/fullpipe/module.mk @@ -2,6 +2,7 @@ MODULE := engines/fullpipe MODULE_OBJS = \ behavior.o \ + console.o \ detection.o \ floaters.o \ fullpipe.o \ diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index f67011a50f..20b710d7df 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -28,9 +28,9 @@ #include "fullpipe/objects.h" #include "fullpipe/statics.h" +#include "fullpipe/gameloader.h" #include "fullpipe/motion.h" #include "fullpipe/messages.h" -#include "fullpipe/gameloader.h" namespace Fullpipe { @@ -185,6 +185,130 @@ MessageQueue *MctlCompound::doWalkTo(StaticANIObject *subj, int xpos, int ypos, return mq; } +MctlLadder::MctlLadder() { + _ladder_field_18 = 0; + _objId = 0; + _height = 0; + _ladderY = 0; + _ladder_field_14 = 0; + + _ladder_field_20 = 0; + _ladder_field_24 = 0; +} + +MctlLadder::~MctlLadder() { + freeItems(); +} + +int MctlLadder::collisionDetection(StaticANIObject *man) { + if (findObjectPos(man) < 0) + return 0; + + double delta; + + if ((double)(man->_oy - _ladderY) / (double)_height < 0.0) + delta = -0.5; + else + delta = 0.5; + + int res = (int)((double)(man->_oy - _ladderY) / (double)_height + delta); + + if (res < 0) + return 0; + + return res; +} + +void MctlLadder::addObject(StaticANIObject *obj) { + if (findObjectPos(obj) < 0) { + MctlLadderMovement *movement = new MctlLadderMovement; + + if (initMovement(obj, movement)) { + _mgm.addItem(obj->_id); + _movements.push_back(movement); + } else { + delete movement; + } + } +} + +int MctlLadder::findObjectPos(StaticANIObject *obj) { + int res = -1; + + for (Common::List<MctlLadderMovement *>::iterator it = _movements.begin(); it != _movements.end(); ++it, ++res) + if ((*it)->objId == obj->_id) + break; + + return res; +} + +bool MctlLadder::initMovement(StaticANIObject *ani, MctlLadderMovement *movement) { + GameVar *v = g_fullpipe->getGameLoaderGameVar()->getSubVarByName(ani->getName()); + + if (!v) + return false; + + v = v->getSubVarByName("Test_Ladder"); + + if (!v) + return false; + + movement->staticIdsSize = 6; + movement->movVars = new MctlLadderMovementVars; + movement->staticIds = new int[movement->staticIdsSize]; + + v = v->getSubVarByName("Up"); + + if (!v) + return false; + + movement->movVars->varUpStart = v->getSubVarAsInt("Start"); + movement->movVars->varUpGo = v->getSubVarAsInt("Go"); + movement->movVars->varUpStop = v->getSubVarAsInt("Stop"); + + movement->staticIds[0] = ani->getMovementById(movement->movVars->varUpStart)->_staticsObj1->_staticsId; + movement->staticIds[2] = ani->getMovementById(movement->movVars->varUpGo)->_staticsObj1->_staticsId; + + v = v->getSubVarByName("Down"); + + if (!v) + return false; + + movement->movVars->varDownStart = v->getSubVarAsInt("Start"); + movement->movVars->varDownGo = v->getSubVarAsInt("Go"); + movement->movVars->varDownStop = v->getSubVarAsInt("Stop"); + + movement->staticIds[1] = ani->getMovementById(movement->movVars->varDownStart)->_staticsObj1->_staticsId; + movement->staticIds[3] = ani->getMovementById(movement->movVars->varDownGo)->_staticsObj1->_staticsId; + + movement->objId = ani->_id; + + return true; +} + +void MctlLadder::freeItems() { + _mgm.clear(); + + for (Common::List<MctlLadderMovement *>::iterator it = _movements.begin(); it != _movements.end(); ++it) { + delete (*it)->movVars; + delete [] (*it)->staticIds; + } + + _movements.clear(); +} + +MessageQueue *MctlLadder::method34(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) { + warning("STUB: MctlLadder::method34()"); + + return 0; +} + +MessageQueue *MctlLadder::doWalkTo(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) { + warning("STUB: MctlLadder::doWalkTo()"); + + return 0; +} + MctlConnectionPoint *MctlCompound::findClosestConnectionPoint(int ox, int oy, int destIndex, int connectionX, int connectionY, int sourceIndex, int *minDistancePtr) { warning("STUB: MctlCompound::findClosestConnectionPoint()"); diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index bab0ffc8ca..5842b296da 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -161,6 +161,50 @@ public: MessageQueue *genMovement(MGMInfo *mgminfo); }; +struct MctlLadderMovementVars { + int varUpGo; + int varDownGo; + int varUpStop; + int varDownStop; + int varUpStart; + int varDownStart; +}; + +struct MctlLadderMovement { + int objId; + int staticIdsSize; + MctlLadderMovementVars *movVars; + int *staticIds; +}; + +class MctlLadder : public MotionController { +public: + int _objId; + int _ladderY; + int _ladder_field_14; + int _ladder_field_18; + int _height; + int _ladder_field_20; + int _ladder_field_24; + Common::List<MctlLadderMovement *> _movements; + MGM _mgm; + +public: + MctlLadder(); + virtual ~MctlLadder(); + int collisionDetection(StaticANIObject *man); + + virtual void addObject(StaticANIObject *obj); + virtual int removeObject(StaticANIObject *obj) { return 1; } + virtual void freeItems(); + virtual MessageQueue *method34(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId); + virtual MessageQueue *doWalkTo(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId); + +private: + int findObjectPos(StaticANIObject *obj); + bool initMovement(StaticANIObject *ani, MctlLadderMovement *movement); +}; + class MovGraphNode : public CObject { public: int _x; diff --git a/engines/fullpipe/objectnames.h b/engines/fullpipe/objectnames.h index 241e31b165..b8696ec672 100644 --- a/engines/fullpipe/objectnames.h +++ b/engines/fullpipe/objectnames.h @@ -148,7 +148,7 @@ namespace Fullpipe { #define sO_ClockAxis "\xce\xf1\xfc \xf7\xe0\xf1\xee\xe2" // "Ось часов" #define sO_Opened "\xce\xf2\xea\xf0\xfb\xf2" // "Открыт" #define sO_OpenedWithBoot "\xce\xf2\xea\xf0\xfb\xf2\xe0 \xf1 \xe1\xee\xf2\xe8\xed\xea\xee\xec" // "Открыта с ботинком" -#define sO_OpenedShe "\xce\xf2\xea\xf0\xfb\xf2\xe0" // "Открыта" +#define sO_IsOpened "\xce\xf2\xea\xf0\xfb\xf2\xe0" // "Открыта" #define sO_WeirdWacko "\xce\xf2\xec\xee\xf0\xee\xe6\xe5\xed\xed\xfb\xe9" // "Отмороженный" #define sO_NotPresent "\xce\xf2\xf1\xf3\xf2\xf1\xf2\xe2\xf3\xe5\xf2" // "Отсутствует" #define sO_Error "\xce\xf8\xe8\xe1\xea\xe0" // "Ошибка" diff --git a/engines/fullpipe/scene.cpp b/engines/fullpipe/scene.cpp index 3831831866..61ff3457a7 100644 --- a/engines/fullpipe/scene.cpp +++ b/engines/fullpipe/scene.cpp @@ -447,7 +447,7 @@ void Scene::objectList_sortByPriority(PtrList &list) { } void Scene::draw() { - debug(0, ">>>>> Scene::draw()"); + debug(6, ">>>>> Scene::draw()"); updateScrolling(); drawContent(60000, 0, true); @@ -470,11 +470,74 @@ void Scene::draw() { } void Scene::updateScrolling() { - debug(0, "STUB Scene::updateScrolling()"); + if (_messageQueueId && !_x && !_y) { + MessageQueue *mq = g_fullpipe->_globalMessageQueueList->getMessageQueueById(_messageQueueId); + + if (mq) + mq->update(); + + _messageQueueId = 0; + } + + if (_x || _y) { + int offsetX = 0; + int offsetY = 0; + + if (_x < 0) { + if (!g_fullpipe->_sceneRect.left && !(((PictureObject *)_picObjList[0])->_flags & 2)) + _x = 0; + + if (_x <= -g_fullpipe->_scrollSpeed) { + offsetX = -g_fullpipe->_scrollSpeed; + _x += g_fullpipe->_scrollSpeed; + } + } else if (_x >= g_fullpipe->_scrollSpeed) { + offsetX = g_fullpipe->_scrollSpeed; + _x -= g_fullpipe->_scrollSpeed; + } else { + _x = 0; + } + + if (_y > 0) { + offsetY = g_fullpipe->_scrollSpeed; + _y -= g_fullpipe->_scrollSpeed; + } + + if (_y < 0) { + offsetY -= g_fullpipe->_scrollSpeed; + _y += g_fullpipe->_scrollSpeed; + } + + g_fullpipe->_sceneRect.translate(offsetX, offsetY); + } + + updateScrolling2(); } void Scene::updateScrolling2() { - warning("STUB Scene::updateScrolling2()"); + if (_picObjList.size()) { + Common::Point point; + int offsetY = 0; + int offsetX = 0; + + ((PictureObject *)_picObjList[0])->getDimensions(&point); + + int flags = ((PictureObject *)_picObjList[0])->_flags; + + if (g_fullpipe->_sceneRect.left < 0 && !(flags & 2)) + offsetX = -g_fullpipe->_sceneRect.left; + + if (g_fullpipe->_sceneRect.top < 0 && !(flags & 0x20)) + offsetY = -g_fullpipe->_sceneRect.top; + + if (g_fullpipe->_sceneRect.right > point.x - 1 && g_fullpipe->_sceneRect.left > 0 && !(flags & 2)) + offsetX = point.x - g_fullpipe->_sceneRect.right - 1; + + if (g_fullpipe->_sceneRect.bottom > point.y - 1 && g_fullpipe->_sceneRect.top > 0 && !(flags & 0x20)) + offsetY = point.y - g_fullpipe->_sceneRect.bottom - 1; + + g_fullpipe->_sceneRect.translate(offsetX, offsetY); + } } StaticANIObject *Scene::getStaticANIObjectAtPos(int x, int y) { @@ -525,7 +588,7 @@ int Scene::getPictureObjectIdAtPos(int x, int y) { } void Scene::update(int counterdiff) { - debug(0, "Scene::update(%d)", counterdiff); + debug(6, "Scene::update(%d)", counterdiff); for (PtrList::iterator s = _staticANIObjectList2.begin(); s != _staticANIObjectList2.end(); ++s) ((StaticANIObject *)*s)->update(counterdiff); @@ -603,7 +666,7 @@ void Scene::drawContent(int minPri, int maxPri, bool drawBg) { } } _bigPictureArray[bgNumX][0]->getDimensions(&point); - int v32 = point.x + bgPosX; + int oldx = point.x + bgPosX; bgPosX += point.x; bgNumX++; @@ -612,7 +675,7 @@ void Scene::drawContent(int minPri, int maxPri, bool drawBg) { break; bgNumX = 0; } - if (v32 >= g_fullpipe->_sceneRect.right - 1) + if (oldx >= g_fullpipe->_sceneRect.right - 1) break; } } diff --git a/engines/fullpipe/scenes.cpp b/engines/fullpipe/scenes.cpp index 014459e847..9dc4c74b15 100644 --- a/engines/fullpipe/scenes.cpp +++ b/engines/fullpipe/scenes.cpp @@ -72,6 +72,7 @@ Vars::Vars() { scene04_coinPut = false; scene04_soundPlaying = false; scene04_dynamicPhaseIndex = 0; + scene04_needJumping = false; scene04_sceneClickX = 0; scene04_sceneClickY = 0; @@ -79,7 +80,6 @@ Vars::Vars() { scene04_dudePosX = 0; scene04_dudePosY = 0; - scene04_var01 = 0; scene04_var02 = 0; scene04_var04 = 0; scene04_walkingKozyawka = 0; @@ -100,6 +100,7 @@ Vars::Vars() { scene04_var20 = 0; scene04_var24 = 0; scene04_bottleY = 0; + scene04_ladderOffset = 0; selector = 0; } diff --git a/engines/fullpipe/scenes.h b/engines/fullpipe/scenes.h index 670b94a839..e7960fe010 100644 --- a/engines/fullpipe/scenes.h +++ b/engines/fullpipe/scenes.h @@ -26,6 +26,7 @@ namespace Fullpipe { class StaticANIObject; + class MctlLadder; int defaultUpdateCursor(); @@ -93,19 +94,27 @@ public: Common::List<GameObject *> scene04_bottleObjList; Common::List<StaticANIObject *> scene04_kozyawkiAni; - int scene04_ladder; + MctlLadder *scene04_ladder; + int scene04_ladderOffset; + bool scene04_coinPut; bool scene04_soundPlaying; + bool scene04_needJumping; + int scene04_dynamicPhaseIndex; int scene04_sceneClickX; int scene04_sceneClickY; int scene04_dudePosX; int scene04_dudePosY; + int scene04_bottleY; + + StaticANIObject *scene04_walkingKozyawka; + + int scene04_speakerVariant; + int scene04_speakerPhase; - int scene04_var01; int scene04_var02; int scene04_var04; - StaticANIObject *scene04_walkingKozyawka; int scene04_var06; int scene04_var07; int scene04_var08; @@ -116,13 +125,10 @@ public: int scene04_var13; int scene04_var14; int scene04_var15; - int scene04_speakerVariant; - int scene04_speakerPhase; int scene04_var18; int scene04_var19; int scene04_var20; StaticANIObject *scene04_var24; - int scene04_bottleY; PictureObject *selector; }; diff --git a/engines/fullpipe/scenes/scene04.cpp b/engines/fullpipe/scenes/scene04.cpp index d642ebfcd2..3c2c02298a 100644 --- a/engines/fullpipe/scenes/scene04.cpp +++ b/engines/fullpipe/scenes/scene04.cpp @@ -61,7 +61,7 @@ void scene04_speakerCallback(int *phase) { } void scene04_initScene(Scene *sc) { - g_vars->scene04_var01 = 0; + g_vars->scene04_needJumping = false; g_vars->scene04_bottle = sc->getPictureObjectById(PIC_SC4_BOTTLE, 0); g_vars->scene04_hand = sc->getStaticANIObject1ById(ANI_HAND, -1); g_vars->scene04_plank = sc->getStaticANIObject1ById(ANI_PLANK, -1); @@ -196,7 +196,19 @@ void scene04_initScene(Scene *sc) { } bool sceneHandler04_friesAreWalking() { - warning("STUB: sceneHandler04_friesAreWalking()"); + if (g_vars->scene04_needJumping && g_fullpipe->_aniMan->isIdle() && !(g_fullpipe->_aniMan->_flags & 0x100)) { + int col = g_vars->scene04_ladder->collisionDetection(g_fullpipe->_aniMan); + if (col >= 3 && col <= 6 ) { + Movement *koz; + + if (!g_vars->scene04_walkingKozyawka + || (koz = g_vars->scene04_walkingKozyawka->_movement) == 0 + || koz->_id != MV_KZW_WALKPLANK + || koz->_currDynamicPhaseIndex < 10 + || koz->_currDynamicPhaseIndex > 41) + return true; + } + } return false; } @@ -233,7 +245,7 @@ int scene04_updateCursor() { } void sceneHandlers_sub01(ExCommand *ex) { - warning("sceneHandlers_sub01()"); + warning("STUB: sceneHandlers_sub01()"); } void sceneHandler04_checkBigBallClick() { @@ -267,17 +279,52 @@ void sceneHandler04_clickButton() { } void sceneHandler04_clickLadder() { - warning("sceneHandler04_clickLadder()"); + warning("STUB: sceneHandler04_clickLadder()"); } -void sceneHandler04_sub13() { - warning("sceneHandler04_sub13()"); +void sceneHandler04_jumpOnLadder() { + if (g_fullpipe->_aniMan->_movement && g_fullpipe->_aniMan->_movement->_id != MV_MAN_LOOKLADDER) + return; + + if (g_fullpipe->_aniMan->_statics->_staticsId != ST_MAN_STANDLADDER && g_fullpipe->_aniMan->_statics->_staticsId != ST_MAN_LADDERDOWN) + return; + + g_fullpipe->_aniMan->changeStatics2(ST_MAN_LADDERDOWN); + + g_fullpipe->_aniMan->_flags |= 1; + + MGM mgm; + MGMInfo mgminfo; + + mgm.addItem(ANI_MAN); + + mgminfo.ani = g_fullpipe->_aniMan; + mgminfo.staticsId2 = ST_MAN_ONPLANK; + mgminfo.x1 = 938; + mgminfo.y1 = 442; + mgminfo.field_1C = 10; + mgminfo.field_10 = 1; + mgminfo.flags = 78; + mgminfo.movementId = MV_MAN_JUMPONPLANK; + + MessageQueue *mq = mgm.genMovement(&mgminfo); + + if (mq) { + mq->_flags |= 1; + + if (!mq->chain(g_fullpipe->_aniMan)) + delete mq; + + g_fullpipe->_aniMan->_priority = 10; + } + + g_vars->scene04_ladderOffset = g_vars->scene04_ladder->collisionDetection(g_fullpipe->_aniMan); } void sceneHandler04_clickPlank() { if (sceneHandler04_friesAreWalking()) - sceneHandler04_sub13(); - else if (g_vars->scene04_var01) + sceneHandler04_jumpOnLadder(); + else if (g_vars->scene04_needJumping) g_fullpipe->playSound(SND_4_033, 0); else if (!g_vars->scene04_soundPlaying) chainQueue(QU_PNK_CLICK, 0); @@ -311,7 +358,7 @@ void sceneHandler04_dropBottle() { } void sceneHandler04_gotoLadder(int par) { - warning("sceneHandler04_gotoLadder()"); + warning("STUB: sceneHandler04_gotoLadder()"); } void sceneHandler04_lowerPlank() { @@ -319,7 +366,20 @@ void sceneHandler04_lowerPlank() { } void sceneHandler04_manFromBottle() { - warning("sceneHandler04_manFromBottle()"); + for (Common::List<GameObject *>::iterator it = g_vars->scene04_bottleObjList.begin(); it != g_vars->scene04_bottleObjList.end(); ++it) + if (*it == g_fullpipe->_aniMan) { + g_vars->scene04_bottleObjList.erase(it); + g_vars->scene04_var06 -= 9; + break; + } + + if (g_vars->scene04_ladder) + delete g_vars->scene04_ladder; + + g_vars->scene04_ladder = 0; + + getSc2MctlCompoundBySceneId(g_fullpipe->_currentScene->_sceneId)->setEnabled(); + getGameLoaderInteractionController()->enableFlag24(); } void sceneHandler04_manToBottle() { @@ -335,7 +395,7 @@ void sceneHandler04_raisePlank() { } void sceneHandler04_shootKozyawka() { - warning("sceneHandler04_shootKozyawka()"); + warning("STUB: sceneHandler04_shootKozyawka()"); } void sceneHandler04_showCoin() { @@ -349,7 +409,7 @@ void sceneHandler04_showCoin() { } void sceneHandler04_stopSound() { - warning("sceneHandler04_stopSound()"); + warning("STUB: sceneHandler04_stopSound()"); } void sceneHandler04_sub1(ExCommand *ex) { @@ -382,11 +442,78 @@ void sceneHandler04_walkKozyawka() { } void sceneHandler04_sub4() { - warning("sceneHandler04_sub4()"); +#if 0 + int var20 = g_vars->scene04_var20; + int oldDynIndex = g_vars->scene04_dynamicPhaseIndex; + v2 = g_vars->scene04_var20 + g_vars->scene04_dynamicPhaseIndex; + g_vars->scene04_dynamicPhaseIndex += g_vars->scene04_var20; + + if (g_vars->scene04_var20 + g_vars->scene04_dynamicPhaseIndex < 0) { + v2 = 0; + var20 = 0; + g_vars->scene04_dynamicPhaseIndex = 0; + g_vars->scene04_var20 = 0; + } + + if (v2 > 14) { + v2 = 14; + var20 = 0; + g_vars->scene04_dynamicPhaseIndex = 14; + g_vars->scene04_var20 = 0; + } + + v4 = __OFSUB__(g_vars->scene04_var06, v2); + v3 = g_vars->scene04_var06 - v2 < 0; + + if (g_vars->scene04_var06 > v2) { + ++var20; + v4 = __OFSUB__(g_vars->scene04_var06, v2); + v3 = g_vars->scene04_var06 - v2 < 0; + g_vars->scene04_var20 = var20; + } + + if (v3 ^ v4) { + --var20; + g_vars->scene04_var20 = var20; + } + + if (oldDynIndex <= g_vars->scene04_var06) + if (v2 <= g_vars->scene04_var06) + goto LABEL_16; + } else if (v2 > g_vars->scene04_var06) { + goto LABEL_16; + } + + g_vars->scene04_var25++; + + if (var20 && g_vars->scene04_var25 > 1) { + g_vars->scene04_var25 = 0; + g_vars->scene04_var20--; + } + LABEL_16: + + Common::Point point; + + int curdelta = g_vars->scene04_spring->getCurrDimensions(&point)->y - g_vars->scene04_dynamicPhaseIndex; + + if (g_vars->scene04_dynamicPhaseIndex) { + if (!g_vars->scene04_spring->_movement) + g_vars->scene04_spring->startAnim(MV_SPR_LOWER, 0, -1); + + g_vars->scene04_spring->_movement->setDynamicPhaseIndex(g_vars->scene04_dynamicPhaseIndex); + } else { + g_vars->scene04_spring->changeStatics2(ST_SPR_UP); + } + + if (g_vars->scene04_dynamicPhaseIndex != oldDynIndex) + sceneHandler04_bottleUpdateObjects(curdelta - (g_vars->scene04_spring->getCurrDimensions(&point)->y - g_vars->scene04_dynamicPhaseIndex)); +#endif + + warning("STUB: sceneHandler04_sub4()"); } void sceneHandler04_sub5() { - warning("sceneHandler04_sub5()"); + warning("STUB: sceneHandler04_sub5()"); } void sceneHandler04_bottleUpdateObjects(int off) { @@ -421,36 +548,138 @@ void sceneHandler04_liftBottle() { } } -void sceneHandler04_sub7() { - warning("sceneHandler04_sub7()"); +void sceneHandler04_startSounds(const char *snd1, const char *snd2, const char *snd3) { + warning("STUB: sceneHandler04_startSounds()"); +} + +void sceneHandler04_goClock() { + sceneHandler04_walkKozyawka(); + chainQueue(QU_SC4_GOCLOCK, 0); + g_vars->scene04_soundPlaying = 1; + g_vars->scene04_coinPut = 0; + + g_fullpipe->stopAllSoundStreams(); + + sceneHandler04_startSounds("sc4_start.ogg", "sc4_loop.ogg", "sc4_stop2.ogg"); + + g_vars->scene04_var14 = 0; } void sceneHandler04_sub8(ExCommand *ex) { - warning("sceneHandler04_sub8()"); + warning("STUB: sceneHandler04_sub8()"); } -void sceneHandler04_sub9(StaticANIObject *ani) { - warning("sceneHandler04_sub9()"); +void sceneHandler04_sub12() { + StaticANIObject *ball = g_fullpipe->_currentScene->getStaticANIObject1ById(ANI_BIGBALL, -1); + + if (ball && ball->_flags & 4) + for (uint i = 0; i < ball->_movements.size(); i++) + ((Movement *)ball->_movements[i])->_counterMax = 0; + + g_vars->scene04_var13 = 0; +} + +void sceneHandler04_handTake() { + g_vars->scene04_clock->changeStatics2(ST_CLK_CLOSED); + + if (g_vars->scene04_kozyawkiAni.size()) { + if (g_vars->scene04_kozyawkiAni.size() == 1) { + chainQueue(QU_HND_TAKE1, 0); + g_vars->scene04_var19 = 0; + } else { + chainQueue((g_vars->scene04_kozyawkiAni.size() != 2) ? QU_HND_TAKEBOTTLE : QU_HND_TAKE2, 0); + g_vars->scene04_var19 = 0; + } + } else { + chainQueue(QU_HND_TAKE0, 0); + g_vars->scene04_var19 = 0; + } } -void sceneHandler04_sub15() { - warning("sceneHandler04_sub15()"); +void sceneHandler04_sub9(StaticANIObject *ani) { + g_vars->scene04_bottleObjList.push_back(ani); + g_vars->scene04_kozyawkiAni.push_back(ani); + + g_vars->scene04_var06 += 2; + g_vars->scene04_walkingKozyawka = 0; + g_vars->scene04_var24 = 0; + + if (g_vars->scene04_kozyawkiAni.size() > 1 ) + g_vars->scene04_var19 = 0; + + if (g_vars->scene04_kozyawkiAni.size() <= 2 || g_vars->scene04_hand->_movement) { + sceneHandler04_walkKozyawka(); + } else { + sceneHandler04_handTake(); + sceneHandler04_stopSound(); + } } void sceneHandler04_sub17() { - warning("sceneHandler04_sub17()"); + StaticANIObject *ball = g_fullpipe->_currentScene->getStaticANIObject1ById(ANI_BIGBALL, -1); + + if (g_vars->scene04_needJumping + && (!ball || !(ball->_flags & 4)) + && g_vars->scene04_ladder->collisionDetection(g_fullpipe->_aniMan) > 3) { + + if (!g_fullpipe->_rnd->getRandomNumber(49)) { + if (g_vars->scene04_var15) + chainQueue(QU_BALL_WALKR, 0); + else + chainQueue(QU_BALL_WALKL, 0); + + g_vars->scene04_var15 = !g_vars->scene04_var15; + + sceneHandler04_checkBigBallClick(); + + g_vars->scene04_var14 = 0; + } + } } void sceneHandler04_takeBottle() { - warning("sceneHandler04_takeBottle()"); + g_vars->scene04_var02 = 1; + g_vars->scene04_hand->_priority = 5; + + g_fullpipe->setObjectState(sO_LowerPipe, g_fullpipe->getObjectEnumState(sO_LowerPipe, sO_IsOpened)); } void sceneHandler04_takeKozyawka() { - warning("sceneHandler04_takeKozyawka()"); + if (g_vars->scene04_kozyawkiAni.size() > 0) { + if (g_vars->scene04_kozyawkiAni.size() == 1) + g_vars->scene04_var19 = 1; + + StaticANIObject *koz = g_vars->scene04_kozyawkiAni.front(); + g_vars->scene04_kozyawkiAni.pop_front(); + + if (koz) { + koz->queueMessageQueue(0); + koz->hide(); + + g_vars->scene04_kozyawkiObjList.push_back(koz); + + for (Common::List<GameObject *>::iterator it = g_vars->scene04_bottleObjList.begin(); it != g_vars->scene04_bottleObjList.end(); ++it) + if (*it == koz) { + g_vars->scene04_bottleObjList.erase(it); + break; + } + + g_vars->scene04_var06 -= 2; + } + } } void sceneHandler04_testPlank(ExCommand *ex) { - warning("sceneHandler04_testPlank()"); + MessageQueue *mq = g_fullpipe->_globalMessageQueueList->getMessageQueueById(ex->_parId); + + if (!mq) + return; + + if (g_vars->scene04_plank->_movement || !g_vars->scene04_plank->_statics || g_vars->scene04_plank->_statics->_staticsId != ST_PNK_WEIGHTLEFT) { + mq->getExCommandByIndex(0)->_messageNum = MV_KZW_TOHOLERV; + } else { + mq->getExCommandByIndex(0)->_messageNum = MV_KZW_WALKPLANK; + } } void sceneHandler04_updateBottle() { @@ -526,7 +755,7 @@ int sceneHandler04(ExCommand *ex) { if (g_vars->scene04_var10) sceneHandler04_sub1(0); - sceneHandler04_sub15(); + sceneHandler04_handTake(); sceneHandler04_stopSound(); break; @@ -614,9 +843,9 @@ int sceneHandler04(ExCommand *ex) { sceneHandler04_sub1(0); if (g_vars->scene04_coinPut && g_vars->scene04_var18 && !g_vars->scene04_var09 && !g_vars->scene04_soundPlaying) - sceneHandler04_sub7(); + sceneHandler04_goClock(); - if (g_vars->scene04_var01) { + if (g_vars->scene04_needJumping) { if (!g_vars->scene04_soundPlaying) { g_fullpipe->startSceneTrack(); @@ -676,7 +905,7 @@ int sceneHandler04(ExCommand *ex) { sceneHandler04_clickPlank(); ex->_messageKind = 0; - } else if (g_vars->scene04_var01) { + } else if (g_vars->scene04_needJumping) { sceneHandler04_sub8(ex); } else if (!ani || !canInteractAny(g_fullpipe->_aniMan, ani, ex->_keyCode)) { PictureObject *pic = g_fullpipe->_currentScene->getPictureObjectById(picid, 0); @@ -719,7 +948,7 @@ int sceneHandler04(ExCommand *ex) { if (g_vars->scene04_var10) sceneHandler04_sub1(0); - sceneHandler04_sub15(); + sceneHandler04_handTake(); } break; diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp index b4a864d164..147d6218c6 100644 --- a/engines/fullpipe/sound.cpp +++ b/engines/fullpipe/sound.cpp @@ -139,5 +139,9 @@ void FullpipeEngine::stopSoundStream2() { warning("STUB: FullpipeEngine::stopSoundStream2()"); } +void FullpipeEngine::stopAllSoundStreams() { + warning("STUB: FullpipeEngine::stopAllSoundStreams()"); +} + } // End of namespace Fullpipe diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp index b82875f638..8324e0f322 100644 --- a/engines/fullpipe/statics.cpp +++ b/engines/fullpipe/statics.cpp @@ -496,7 +496,7 @@ void StaticANIObject::draw() { Common::Point point; Common::Rect rect; - debug(0, "StaticANIObject::draw() (%s) [%d] [%d, %d]", transCyrillic((byte *)_objectName), _id, _ox, _oy); + debug(6, "StaticANIObject::draw() (%s) [%d] [%d, %d]", transCyrillic((byte *)_objectName), _id, _ox, _oy); if (_shadowsOn && g_fullpipe->_currentScene && g_fullpipe->_currentScene->_shadows && (getCurrDimensions(point)->x != 1 || getCurrDimensions(point)->y != 1)) { @@ -556,7 +556,7 @@ void StaticANIObject::draw() { } void StaticANIObject::draw2() { - debug(0, "StatciANIObject::draw2(): id: (%s) %d [%d, %d]", transCyrillic((byte *)_objectName), _id, _ox, _oy); + debug(6, "StatciANIObject::draw2(): id: (%s) %d [%d, %d]", transCyrillic((byte *)_objectName), _id, _ox, _oy); if ((_flags & 4) && (_flags & 0x10)) { if (_movement) { @@ -891,7 +891,7 @@ void StaticANIObject::hide() { } void StaticANIObject::show1(int x, int y, int movId, int mqId) { - debug(0, "StaticANIObject::show1(%d, %d, %d, %d)", x, y, movId, mqId); + debug(6, "StaticANIObject::show1(%d, %d, %d, %d)", x, y, movId, mqId); if (_messageQueueId) return; @@ -998,20 +998,17 @@ bool StaticANIObject::startAnim(int movementId, int messageQueueId, int dynPhase int newy = _oy; Common::Point point; - debug(0, "0 %d %d", newx, newy); if (_movement) { _movement->getCurrDynamicPhaseXY(point); newx -= point.x; newy -= point.y; - debug(0, "1 %d %d", newx, newy); } else if (_statics) { _statics->getSomeXY(point); newx -= point.x; newy -= point.y; - debug(0, "2 %d %d - %d %d assa", newx, newy, point.x, point.y); } _movement = mov; @@ -1029,7 +1026,6 @@ bool StaticANIObject::startAnim(int movementId, int messageQueueId, int dynPhase newx += point.x + _movement->_mx; newy += point.y + _movement->_my; - debug(0, "3 %d %d", newx, newy); _stepArray.gotoNextPoint(); ExCommand *ex = _movement->_currDynamicPhase->getExCommand(); @@ -1794,7 +1790,7 @@ DynamicPhase::DynamicPhase(DynamicPhase *src, bool reverse) { _field_7E = 0; _rect = new Common::Rect(); - debug(0, "DynamicPhase::DynamicPhase(src, %d)", reverse); + debug(1, "DynamicPhase::DynamicPhase(src, %d)", reverse); if (reverse) { if (!src->_bitmap) |