diff options
author | Kamil Zbróg | 2014-01-12 18:44:51 +0000 |
---|---|---|
committer | Kamil Zbróg | 2014-01-12 18:44:51 +0000 |
commit | 444934a0accec982f55db92c17ef65270fe18e66 (patch) | |
tree | f62210b1ff15696accd87d97b68b03688a153156 /engines | |
parent | e94fabc37407a7d300af04493b0f5cbced42a092 (diff) | |
parent | 1a4f951f8bff52f6185304722f2ab9cf9bcd58f4 (diff) | |
download | scummvm-rg350-444934a0accec982f55db92c17ef65270fe18e66.tar.gz scummvm-rg350-444934a0accec982f55db92c17ef65270fe18e66.tar.bz2 scummvm-rg350-444934a0accec982f55db92c17ef65270fe18e66.zip |
Merge remote-tracking branch 'sync/master' into prince-malik
Diffstat (limited to 'engines')
63 files changed, 2379 insertions, 578 deletions
diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 811e71ee1d..7ba482f049 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -1040,6 +1040,8 @@ bool Parser::isHolding() { // Also object if ((51 <= _thing) && (_thing <= 99)) return true; + if (_thing == 0) + return false; bool holdingResult = false; diff --git a/engines/cge/fileio.cpp b/engines/cge/fileio.cpp index c08cb43a47..8ee726c46d 100644 --- a/engines/cge/fileio.cpp +++ b/engines/cge/fileio.cpp @@ -93,8 +93,8 @@ ResourceManager::~ResourceManager() { delete _buff[i]._page; } -uint16 ResourceManager::XCrypt(void *buf, uint16 length) { - byte *b = static_cast<byte *>(buf); +uint16 ResourceManager::XCrypt(byte *buf, uint16 length) { + byte *b = buf; for (uint16 i = 0; i < length; i++) *b++ ^= kCryptSeed; @@ -106,7 +106,7 @@ bool ResourceManager::seek(int32 offs, int whence) { return _datFile->seek(offs, whence); } -uint16 ResourceManager::read(void *buf, uint16 length) { +uint16 ResourceManager::read(byte *buf, uint16 length) { if (!_datFile->isOpen()) return 0; @@ -178,7 +178,7 @@ bool ResourceManager::exist(const char *name) { return scumm_stricmp(find(name)->_key, name) == 0; } -uint16 ResourceManager::catRead(void *buf, uint16 length) { +uint16 ResourceManager::catRead(byte *buf, uint16 length) { if (!_catFile->isOpen()) return 0; @@ -225,7 +225,7 @@ EncryptedStream::EncryptedStream(CGEEngine *vm, const char *name) : _vm(vm) { _readStream = new Common::MemoryReadStream(dataBuffer, bufSize, DisposeAfterUse::YES); } -uint32 EncryptedStream::read(void *dataPtr, uint32 dataSize) { +uint32 EncryptedStream::read(byte *dataPtr, uint32 dataSize) { return _readStream->read(dataPtr, dataSize); } diff --git a/engines/cge/fileio.h b/engines/cge/fileio.h index cee1fa79ef..653aabae8f 100644 --- a/engines/cge/fileio.h +++ b/engines/cge/fileio.h @@ -83,15 +83,15 @@ class ResourceManager { } _buff[kBtLevel]; BtPage *getPage(int level, uint16 pageId); - uint16 catRead(void *buf, uint16 length); + uint16 catRead(byte *buf, uint16 length); Common::File *_catFile; Common::File *_datFile; - uint16 XCrypt(void *buf, uint16 length); + uint16 XCrypt(byte *buf, uint16 length); public: ResourceManager(); ~ResourceManager(); - uint16 read(void *buf, uint16 length); + uint16 read(byte *buf, uint16 length); bool seek(int32 offs, int whence = 0); BtKeypack *find(const char *key); @@ -111,7 +111,7 @@ public: bool seek(int32 offset); int32 pos(); int32 size(); - uint32 read(void *dataPtr, uint32 dataSize); + uint32 read(byte *dataPtr, uint32 dataSize); Common::String readLine(); }; diff --git a/engines/fullpipe/constants.h b/engines/fullpipe/constants.h index 5edeeb1ec8..cdb5dc6945 100644 --- a/engines/fullpipe/constants.h +++ b/engines/fullpipe/constants.h @@ -30,6 +30,7 @@ namespace Fullpipe { #define ANI_INV_MAP 5321 #define ANI_LIFTBUTTON 2751 #define ANI_MAN 322 +#define ANI_PBAR 896 #define MSG_CMN_WINARCADE 4778 #define MSG_DISABLESAVES 5201 #define MSG_ENABLESAVES 5202 @@ -49,6 +50,7 @@ namespace Fullpipe { #define MV_MAN_STOPLADDER 454 #define MV_MAN_STOPLADDER2 2845 #define MV_MAN_TURN_LU 486 +#define MV_PBAR_RUN 897 #define PIC_CSR_DEFAULT 4891 #define PIC_CSR_DEFAULT_INV 4892 #define PIC_CSR_ITN 4893 @@ -127,6 +129,7 @@ namespace Fullpipe { #define SC_38 2072 #define SC_COMMON 321 #define SC_DBGMENU 726 +#define SC_LDR 635 #define SC_FINAL1 4999 #define SC_FINAL2 5000 #define SC_FINAL3 5001 @@ -139,6 +142,7 @@ namespace Fullpipe { #define SND_CMN_061 4922 #define SND_CMN_070 5199 #define SND_INTR_019 5220 +#define ST_EGTR_SLIMSORROW 340 #define ST_FLY_FLY 4918 #define ST_LBN_0N 2832 #define ST_LBN_0P 2833 @@ -161,6 +165,7 @@ namespace Fullpipe { #define ST_LBN_9N 2777 #define ST_LBN_9P 2778 #define ST_MAN_EMPTY 476 +#define ST_MAN_GOU 459 #define ST_MAN_RIGHT 325 #define TrubaDown 697 #define TrubaLeft 474 @@ -980,6 +985,8 @@ namespace Fullpipe { // Scene 28 #define ANI_LIFT 982 #define ANI_LIFT_28 4238 +#define ANI_MAN_28 4247 +#define ANI_TIOTIA 4286 #define MSG_SC28_CLICKLIFT 4258 #define MSG_SC28_ENDCABIN 3456 #define MSG_SC28_ENDLIFT1 4259 @@ -1003,6 +1010,11 @@ namespace Fullpipe { #define MSG_SC28_TURNON_3 4274 #define MSG_SC28_TURNON_4 4281 #define MSG_SC28_TURNON_6 4272 +#define MV_WMN28_IN_1 3443 +#define MV_WMN28_IN_2 3445 +#define MV_WMN28_IN_3 3446 +#define MV_WMN28_IN_4 3447 +#define MV_WMN28_IN_5 3448 #define PIC_SC28_DARK0 4675 #define PIC_SC28_DARK1 4266 #define PIC_SC28_DARK2 4267 @@ -1010,13 +1022,21 @@ namespace Fullpipe { #define PIC_SC28_DARK4 4269 #define PIC_SC28_DARK5 4270 #define PIC_SC28_DARK6 4271 +#define QU_BRD28_GOL 4960 +#define QU_BRD28_GOR 4959 +#define QU_GLV28_GOL 4958 +#define QU_GLV28_GOR 4957 #define QU_SC28_LIFT0_START 4676 #define QU_SC28_LIFT1_START 4254 +#define QU_SC28_LIFT1_WORK 4256 #define QU_SC28_LIFT2_START 4246 #define QU_SC28_LIFT3_START 4245 #define QU_SC28_LIFT5_START 4674 #define QU_SC28_LIFT6_END 3563 #define QU_SC28_LIFT6_START 4243 +#define QU_SC28_LIFT6_START2 4295 +#define QU_SC28_WMN_START 3452 +#define ST_MAN28_RIGHT 4249 // Scene 30 #define ANI_LEG 2322 @@ -1039,6 +1059,94 @@ namespace Fullpipe { #define SND_31_001 4377 #define ST_CTS31_GROWN2 2472 +// Scene 32 +#define ANI_BUTTON_32 5347 +#define ANI_CACTUS 2267 +#define ANI_FLAG 2257 +#define ANI_KADKA 2670 +#define ANI_TESTO_BLUE 2659 +#define ANI_TESTO_GREEN 2662 +#define ANI_TESTO_ORANGE 2656 +#define MSG_SC32_ONLADDER 2270 +#define MSG_SC32_SPIN 2405 +#define MSG_SC32_STARTCACTUS 2414 +#define MSG_SC32_STARTFLAGLEFT 2310 +#define MSG_SC32_STARTFLAGRIGHT 2309 +#define MSG_SC32_STOPFLAG 2311 +#define MSG_SC32_TRUBATOBACK 5181 +#define MSG_SC32_TRUBATOFRONT 5180 +#define MSG_SC32_TRYSIT 2294 +#define MV_CTS_DEFAULT 4299 +#define MV_FLG_CYCLEL 2262 +#define MV_FLG_CYCLER 2266 +#define MV_FLG_STARTL 2258 +#define MV_FLG_STARTR 2263 +#define MV_FLG_STOPL 2261 +#define MV_FLG_STOPR 2265 +#define MV_MAN32_SITDOWN 2276 +#define MV_MAN32_STANDUP 2313 +#define MV_TSTG_FLOW 2663 +#define MV_TSTO_FLOW 2657 +#define PIC_SC32_LADDER 4296 +#define PIC_SC32_RTRUBA 2292 +#define QU_CTS_BACK 2415 +#define QU_CTS_GROW 2416 +#define QU_CTS_GROWMAN 2417 +#define QU_KBK32_GO 4977 +#define QU_KBK32_START 4982 +#define QU_KDK_DRIZZLE 4301 +#define QU_SC32_ENTERLIFT 2827 +#define QU_SC32_EXITLIFT 2828 +#define QU_SC32_FALLHANDLE 5351 +#define QU_SC32_FROMLADDER 4300 +#define QU_SC32_SHOWHANDLE 2399 +#define ST_BTN32_OFF 5349 +#define ST_BTN32_ON 5350 +#define ST_CTS_EMPTY 2269 +#define ST_CTS_GROWUP 2467 +#define ST_FLG_LEFT 2260 +#define ST_FLG_NORM 2259 +#define ST_FLG_RIGHT 2264 +#define ST_HDL_LAID 3039 +#define ST_MAN32_SIT 2277 + +// Scene 33 +#define ANI_KUBIK 4963 +#define ANI_JETTIE_FLOW 2627 +#define ANI_MUG_33 2623 +#define ANI_VENT_33 2637 +#define MSG_SC33_HANDLEDOWN 2643 +#define MSG_SC33_POUR 2645 +#define MSG_SC33_TESTMUG 5185 +#define MSG_SC33_TRYKUBIK 4980 +#define MSG_SC33_UPDATEKUBIK 5346 +#define MV_JTI33_FLOW 2628 +#define MV_JTI33_POUR 2630 +#define MV_JTI33_POURFULL 4455 +#define MV_VNT33_TURND 2638 +#define MV_VNT33_TURNR 2641 +#define PIC_SC33_LTRUBA 2618 +#define PIC_SC33_ZONES 5298 +#define QU_KBK33_GO 4978 +#define QU_KBK33_START 4983 +#define QU_SC33_STARTWATER 2644 +#define ST_MUG33_EMPTY 2625 +#define ST_MUG33_FULL 2626 +#define ST_VNT33_DOWN 2640 +#define ST_VNT33_RIGHT 2639 + +// Scene 34 +#define ANI_BOOT_34 4560 +#define ANI_CACTUS_34 2381 +#define ANI_LUK_34 2541 +#define ANI_VENT_34 2473 +#define QU_SC34_ENTERLIFT 2819 +#define QU_SC34_EXITLIFT 2820 +#define ST_CTS34_EMPTY 2383 +#define QU_CTS34_FALLEFT 4316 +#define QU_CTS34_FALLRIGHT 4317 +#define ST_CTS34_GROWNEMPTY2 2475 + // Scene 36 #define ANI_SCISSORS_36 2647 #define ANI_ROTOHRUST 2360 diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp index 674dada0b9..4cfa330a09 100644 --- a/engines/fullpipe/fullpipe.cpp +++ b/engines/fullpipe/fullpipe.cpp @@ -99,7 +99,9 @@ FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc) _aniMan = 0; _aniMan2 = 0; _currentScene = 0; + _loaderScene = 0; _scene2 = 0; + _scene3 = 0; _movTable = 0; _floaters = 0; _mgm = 0; diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h index 7c7ac0525e..ecf3c12982 100644 --- a/engines/fullpipe/fullpipe.h +++ b/engines/fullpipe/fullpipe.h @@ -64,6 +64,7 @@ struct MovTable; class MGM; class NGIArchive; class PictureObject; +struct PreloadItem; class Scene; class SoundList; class StaticANIObject; @@ -128,7 +129,9 @@ public: int _sceneWidth; int _sceneHeight; Scene *_currentScene; + Scene *_loaderScene; Scene *_scene2; + Scene *_scene3; StaticANIObject *_aniMan; StaticANIObject *_aniMan2; byte *_globalPalette; @@ -182,6 +185,7 @@ public: Common::Array<Common::Point *> _arcadeKeys; void initMap(); + void updateMap(PreloadItem *pre); void updateMapPiece(int mapId, int update); void updateScreen(); @@ -272,6 +276,7 @@ public: void lift_sub1(StaticANIObject *ani); void lift_startExitQueue(); void lift_sub05(ExCommand *ex); + bool lift_checkButton(const char *varname); GameVar *_musicGameVar; Audio::SoundHandle _sceneTrackHandle; diff --git a/engines/fullpipe/gameloader.cpp b/engines/fullpipe/gameloader.cpp index 64e6b93fb2..845655dded 100644 --- a/engines/fullpipe/gameloader.cpp +++ b/engines/fullpipe/gameloader.cpp @@ -28,6 +28,9 @@ #include "fullpipe/statics.h" #include "fullpipe/interaction.h" #include "fullpipe/motion.h" +#include "fullpipe/constants.h" +#include "fullpipe/scenes.h" +#include "fullpipe/floaters.h" namespace Fullpipe { @@ -79,6 +82,8 @@ GameLoader::~GameLoader() { delete _gameProject; delete _interactionController; delete _inputController; + + warning("STUB: GameLoader::~GameLoader()"); } bool GameLoader::load(MfcArchive &file) { @@ -228,8 +233,100 @@ bool GameLoader::gotoScene(int sceneId, int entranceId) { return true; } -bool preloadCallback(const PreloadItem &pre, int flag) { - warning("STUB: preloadCallback"); +bool preloadCallback(PreloadItem &pre, int flag) { + if (flag) { + if (flag == 50) + g_fp->_aniMan->preloadMovements(g_fp->_movTable); + + StaticANIObject *pbar = g_fp->_loaderScene->getStaticANIObject1ById(ANI_PBAR, -1); + + if (pbar) { + int sz; + + if (pbar->_movement->_currMovement) + sz = pbar->_movement->_currMovement->_dynamicPhases.size(); + else + sz = pbar->_movement->_dynamicPhases.size(); + + pbar->_movement->setDynamicPhaseIndex(flag * (sz - 1) / 100); + } + + g_fp->updateMap(&pre); + + g_fp->_currentScene = g_fp->_loaderScene; + + g_fp->_loaderScene->draw(); + + g_fp->_system->updateScreen(); + } else { + if (g_fp->_scene2) { + g_fp->_aniMan = g_fp->_scene2->getAniMan(); + g_fp->_scene2 = 0; + setInputDisabled(1); + } + + g_fp->_floaters->stopAll(); + + if (g_fp->_soundEnabled) { + g_fp->_currSoundListCount = 1; + g_fp->_currSoundList1[0] = g_fp->accessScene(SC_COMMON)->_soundList; + } + + g_vars->scene18_var01 = 0; + + if ((pre.preloadId1 != SC_18 || pre.sceneId != SC_19) && (pre.preloadId1 != SC_19 || (pre.sceneId != SC_18 && pre.sceneId != SC_19))) { + if (g_fp->_scene3) { + if (pre.preloadId1 != SC_18) + g_fp->_gameLoader->unloadScene(SC_18); + + g_fp->_scene3 = 0; + } + } else { + scene19_preload(g_fp->accessScene(pre.preloadId1), pre.keyCode); + + g_vars->scene18_var01 = 1; + + if (pre.preloadId1 == SC_18) { + g_fp->_gameLoader->saveScenePicAniInfos(SC_18); + + scene18_preload(); + } + } + + if (((pre.sceneId == SC_19 && pre.keyCode == TrubaRight) || (pre.sceneId == SC_18 && pre.keyCode == TrubaRight)) && !pre.preloadId2) { + pre.sceneId = SC_18; + pre.keyCode = TrubaLeft; + } + + if (!g_fp->_loaderScene) { + g_fp->_gameLoader->loadScene(SC_LDR); + g_fp->_loaderScene = g_fp->accessScene(SC_LDR);; + } + + StaticANIObject *pbar = g_fp->_loaderScene->getStaticANIObject1ById(ANI_PBAR, -1); + + if (pbar) { + pbar->show1(ST_EGTR_SLIMSORROW, ST_MAN_GOU, MV_PBAR_RUN, 0); + pbar->startAnim(MV_PBAR_RUN, 0, -1); + } + + g_fp->_inventoryScene = 0; + g_fp->_updateCursorCallback = 0; + + g_fp->_sceneRect.translate(-g_fp->_sceneRect.left, -g_fp->_sceneRect.top); + + g_fp->_system->delayMillis(10); + + Scene *oldsc = g_fp->_currentScene; + + g_fp->_currentScene = g_fp->_loaderScene; + + g_fp->_loaderScene->draw(); + + g_fp->_system->updateScreen(); + + g_fp->_currentScene = oldsc; + } return true; } diff --git a/engines/fullpipe/gameloader.h b/engines/fullpipe/gameloader.h index 4cfb803d8e..85bd6ab0fb 100644 --- a/engines/fullpipe/gameloader.h +++ b/engines/fullpipe/gameloader.h @@ -65,7 +65,7 @@ struct PreloadItem { int keyCode; }; -bool preloadCallback(const PreloadItem &pre, int flag); +bool preloadCallback(PreloadItem &pre, int flag); class PreloadItems : public Common::Array<PreloadItem *>, public CObject { public: @@ -95,7 +95,7 @@ class GameLoader : public CObject { Inventory2 _inventory; Sc2Array _sc2array; void *_sceneSwitcher; - bool (*_preloadCallback)(const PreloadItem &pre, int flag); + bool (*_preloadCallback)(PreloadItem &pre, int flag); void *_readSavegameCallback; int16 _field_F8; int16 _field_FA; diff --git a/engines/fullpipe/gfx.cpp b/engines/fullpipe/gfx.cpp index 435a06d63b..a67a4d7b19 100644 --- a/engines/fullpipe/gfx.cpp +++ b/engines/fullpipe/gfx.cpp @@ -58,6 +58,8 @@ Bitmap::Bitmap(Bitmap *src) { Bitmap::~Bitmap() { if (_pixels) free(_pixels); + + _pixels = 0; } void Bitmap::load(Common::ReadStream *s) { @@ -87,6 +89,10 @@ Background::Background() { _palette = 0; } +Background::~Background() { + warning("STUB: Background::~Background()"); +} + bool Background::load(MfcArchive &file) { debug(5, "Background::load()"); _bgname = file.readPascalString(); @@ -152,6 +158,10 @@ PictureObject::PictureObject() { _objtype = kObjTypePictureObject; } +PictureObject::~PictureObject() { + warning("STUB: PictureObject::~PictureObject()"); +} + PictureObject::PictureObject(PictureObject *src) : GameObject(src) { _picture = src->_picture; _ox2 = _ox; @@ -222,7 +232,7 @@ void PictureObject::drawAt(int x, int y) { bool PictureObject::setPicAniInfo(PicAniInfo *picAniInfo) { if (!(picAniInfo->type & 2) || (picAniInfo->type & 1)) { - error("Picture::setPicAniInfo(): Wrong type: %d", picAniInfo->type); + error("PictureObject::setPicAniInfo(): Wrong type: %d", picAniInfo->type); return false; } @@ -269,6 +279,11 @@ bool PictureObject::isPixelHitAtPos(int x, int y) { return res; } +void PictureObject::setOXY2() { + _ox2 = _ox; + _oy2 = _oy; +} + GameObject::GameObject() { _okeyCode = 0; _flags = 0; @@ -469,7 +484,7 @@ void Picture::freePicture() { if (_bitmap) { if (testFlags() && !_field_54) { freeData(); - delete _bitmap; + free(_bitmap); _bitmap = 0; } } @@ -486,6 +501,11 @@ void Picture::freePicture() { } } +void Picture::freePixelData() { + freePicture(); + freeData(); +} + bool Picture::load(MfcArchive &file) { debug(5, "Picture::load()"); MemoryObject::load(file); diff --git a/engines/fullpipe/gfx.h b/engines/fullpipe/gfx.h index 72495bfe0b..d640decc80 100644 --- a/engines/fullpipe/gfx.h +++ b/engines/fullpipe/gfx.h @@ -88,6 +88,7 @@ class Picture : public MemoryObject { virtual ~Picture(); void freePicture(); + void freePixelData(); virtual bool load(MfcArchive &file); void setAOIDs(); @@ -115,6 +116,8 @@ class Picture : public MemoryObject { class BigPicture : public Picture { public: BigPicture() {} + virtual ~BigPicture() {} + virtual bool load(MfcArchive &file); virtual void draw(int x, int y, int style, int angle); }; @@ -156,7 +159,9 @@ class PictureObject : public GameObject { public: PictureObject(); + PictureObject(PictureObject *src); + virtual ~PictureObject(); virtual bool load(MfcArchive &file, bool bigPicture); virtual bool load(MfcArchive &file) { assert(0); return false; } // Disable base class @@ -168,6 +173,7 @@ class PictureObject : public GameObject { bool setPicAniInfo(PicAniInfo *picAniInfo); bool isPointInside(int x, int y); bool isPixelHitAtPos(int x, int y); + void setOXY2(); }; class Background : public CObject { @@ -185,6 +191,8 @@ class Background : public CObject { public: Background(); + virtual ~Background(); + virtual bool load(MfcArchive &file); void addPictureObject(PictureObject *pct); diff --git a/engines/fullpipe/interaction.cpp b/engines/fullpipe/interaction.cpp index 9d92638328..59b01a1777 100644 --- a/engines/fullpipe/interaction.cpp +++ b/engines/fullpipe/interaction.cpp @@ -55,6 +55,10 @@ bool canInteractAny(GameObject *obj1, GameObject *obj2, int invId) { return false; } +InteractionController::~InteractionController() { + warning("STUB: InteractionController::~InteractionController()"); +} + bool InteractionController::load(MfcArchive &file) { debug(5, "InteractionController::load()"); @@ -422,6 +426,10 @@ Interaction::Interaction() { _actionName = 0; } +Interaction::~Interaction() { + warning("STUB: Interaction::~Interaction()"); +} + bool Interaction::load(MfcArchive &file) { debug(5, "Interaction::load()"); diff --git a/engines/fullpipe/interaction.h b/engines/fullpipe/interaction.h index 456b35458b..7d9ee0bd51 100644 --- a/engines/fullpipe/interaction.h +++ b/engines/fullpipe/interaction.h @@ -54,6 +54,8 @@ class Interaction : public CObject { public: Interaction(); + virtual ~Interaction(); + virtual bool load(MfcArchive &file); bool canInteract(GameObject *obj1, GameObject *obj2, int invId); bool isOverlapping(StaticANIObject *subj, GameObject *obj); @@ -70,6 +72,7 @@ class InteractionController : public CObject { public: InteractionController() : _field_20(0), _flag24(true) {} + virtual ~InteractionController(); virtual bool load(MfcArchive &file); diff --git a/engines/fullpipe/inventory.cpp b/engines/fullpipe/inventory.cpp index 3e22f8526d..f5af0611cb 100644 --- a/engines/fullpipe/inventory.cpp +++ b/engines/fullpipe/inventory.cpp @@ -30,6 +30,10 @@ namespace Fullpipe { +Inventory::~Inventory() { + warning("STUB: Inventory::~Inventory()"); +} + bool Inventory::load(MfcArchive &file) { debug(5, "Inventory::load()"); @@ -85,6 +89,10 @@ Inventory2::Inventory2() { _topOffset = -65; } +Inventory2::~Inventory2() { + warning("STUB: Inventory2::~Inventory2()"); +} + bool Inventory2::loadPartial(MfcArchive &file) { // Inventory2_SerializePartially int numInvs = file.readUint32LE(); diff --git a/engines/fullpipe/inventory.h b/engines/fullpipe/inventory.h index 6d07f069bd..bc5847312b 100644 --- a/engines/fullpipe/inventory.h +++ b/engines/fullpipe/inventory.h @@ -49,6 +49,8 @@ class Inventory : public CObject { public: Inventory() { _sceneId = 0; } + virtual ~Inventory(); + virtual bool load(MfcArchive &file); int getInventoryPoolItemIndexById(int itemId); @@ -96,6 +98,8 @@ class Inventory2 : public Inventory { public: Inventory2(); + virtual ~Inventory2(); + bool loadPartial(MfcArchive &file); void addItem(int itemId, int count); void addItem2(StaticANIObject *obj); diff --git a/engines/fullpipe/lift.cpp b/engines/fullpipe/lift.cpp index ca23d8223a..cb811d610c 100644 --- a/engines/fullpipe/lift.cpp +++ b/engines/fullpipe/lift.cpp @@ -105,4 +105,10 @@ void FullpipeEngine::lift_sub05(ExCommand *ex) { warning("STUB: FullpipeEngine::lift_sub05()"); } +bool FullpipeEngine::lift_checkButton(const char *varname) { + warning("STUB: FullpipeEngine::lift_checkButton(%s)", varname); + + return false; +} + } // End of namespace Fullpipe diff --git a/engines/fullpipe/messages.cpp b/engines/fullpipe/messages.cpp index 4665712ca0..7dfdd06fc8 100644 --- a/engines/fullpipe/messages.cpp +++ b/engines/fullpipe/messages.cpp @@ -234,12 +234,23 @@ ObjstateCommand::ObjstateCommand() { _objCommandName = 0; } +ObjstateCommand::ObjstateCommand(ObjstateCommand *src) : ExCommand(src) { + _value = src->_value; + _objCommandName = (char *)calloc(strlen(src->_objCommandName) + 1, 1); + + strncpy(_objCommandName, src->_objCommandName, strlen(src->_objCommandName)); +} + +ObjstateCommand::~ObjstateCommand() { + free(_objCommandName); +} + bool ObjstateCommand::load(MfcArchive &file) { debug(5, "ObjStateCommand::load()"); _objtype = kObjTypeObjstateCommand; - _cmd.load(file); + ExCommand::load(file); _value = file.readUint32LE(); @@ -248,6 +259,10 @@ bool ObjstateCommand::load(MfcArchive &file) { return true; } +ObjstateCommand *ObjstateCommand::createClone() { + return new ObjstateCommand(this); +} + MessageQueue::MessageQueue() { _field_14 = 0; _parId = 0; @@ -392,7 +407,12 @@ void MessageQueue::addExCommandToEnd(ExCommand *ex) { } void MessageQueue::insertExCommandAt(int pos, ExCommand *ex) { - warning("STUB: MessageQueue::insertExCommandAt()"); + Common::List<ExCommand *>::iterator it = _exCommands.begin(); + + for (int i = pos; i > 0; i--) + ++it; + + _exCommands.insert(it, ex); } ExCommand *MessageQueue::getExCommandByIndex(uint idx) { @@ -663,7 +683,20 @@ void GlobalMessageQueueList::addMessageQueue(MessageQueue *msg) { } void clearGlobalMessageQueueList1() { - warning("STUB: clearGlobalMessageQueueList1()"); + clearMessages(); + + g_fp->_globalMessageQueueList->clear(); +} + +void clearMessages() { + while (g_fp->_exCommandList.size()) { + ExCommand *ex = g_fp->_exCommandList.front(); + + g_fp->_exCommandList.pop_front(); + + if (ex->_excFlags & 2) + delete ex; + } } bool removeMessageHandler(int16 id, int pos) { diff --git a/engines/fullpipe/messages.h b/engines/fullpipe/messages.h index 7f708383e3..33bb827888 100644 --- a/engines/fullpipe/messages.h +++ b/engines/fullpipe/messages.h @@ -92,15 +92,19 @@ class ExCommand2 : public ExCommand { virtual ExCommand2 *createClone(); }; -class ObjstateCommand : public CObject { +class ObjstateCommand : public ExCommand { public: - ExCommand _cmd; char *_objCommandName; int _value; public: ObjstateCommand(); + ObjstateCommand(ObjstateCommand *src); + virtual ~ObjstateCommand(); + virtual bool load(MfcArchive &file); + + virtual ObjstateCommand *createClone(); }; class MessageQueue : public CObject { @@ -186,6 +190,7 @@ bool insertMessageHandler(int (*callback)(ExCommand *), int index, int16 id); void clearMessageHandlers(); void processMessages(); void updateGlobalMessageQueue(int id, int objid); +void clearMessages(); void clearGlobalMessageQueueList1(); bool chainQueue(int queueId, int flags); diff --git a/engines/fullpipe/modal.cpp b/engines/fullpipe/modal.cpp index 6db916ae4f..729b4035f0 100644 --- a/engines/fullpipe/modal.cpp +++ b/engines/fullpipe/modal.cpp @@ -256,7 +256,10 @@ void ModalVideoPlayer::play(const char *filename) { Common::Event event; while (g_fp->_system->getEventManager()->pollEvent(event)) { - if ((event.type == Common::EVENT_KEYDOWN && event.kbd.keycode == Common::KEYCODE_ESCAPE) || event.type == Common::EVENT_LBUTTONUP) + if ((event.type == Common::EVENT_KEYDOWN && (event.kbd.keycode == Common::KEYCODE_ESCAPE || + event.kbd.keycode == Common::KEYCODE_RETURN || + event.kbd.keycode == Common::KEYCODE_SPACE)) + || event.type == Common::EVENT_LBUTTONUP) skipVideo = true; } diff --git a/engines/fullpipe/module.mk b/engines/fullpipe/module.mk index 55be5a7a34..ae259d907c 100644 --- a/engines/fullpipe/module.mk +++ b/engines/fullpipe/module.mk @@ -41,6 +41,7 @@ MODULE_OBJS = \ scenes/scene15.o \ scenes/scene16.o \ scenes/scene17.o \ + scenes/scene18and19.o \ scenes/scene20.o \ scenes/scene21.o \ scenes/scene22.o \ @@ -51,6 +52,9 @@ MODULE_OBJS = \ scenes/scene28.o \ scenes/scene30.o \ scenes/scene31.o \ + scenes/scene32.o \ + scenes/scene33.o \ + scenes/scene34.o \ scenes/scene36.o \ scenes/sceneDbg.o diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 42dd60a3aa..f0318581f1 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -463,6 +463,10 @@ MovGraph::MovGraph() { _objtype = kObjTypeMovGraph; } +MovGraph::~MovGraph() { + warning("STUB: MovGraph::~MovGraph()"); +} + bool MovGraph::load(MfcArchive &file) { debug(5, "MovGraph::load()"); @@ -1882,6 +1886,9 @@ Common::Point *MGM::getPoint(Common::Point *point, int objectId, int staticsId1, } int MGM::getStaticsIndexById(int idx, int16 id) { + if (!_items[idx]->statics.size()) + return -1; + for (uint i = 0; i < _items[idx]->statics.size(); i++) { if (_items[idx]->statics[i]->_staticsId == id) return i; @@ -1890,6 +1897,18 @@ int MGM::getStaticsIndexById(int idx, int16 id) { return 0; } +int MGM::getStaticsIndex(int idx, Statics *st) { + if (!_items[idx]->statics.size()) + return -1; + + for (uint i = 0; i < _items[idx]->statics.size(); i++) { + if (_items[idx]->statics[i] == st) + return i; + } + + return 0; +} + void MGM::clearMovements2(int idx) { _items[idx]->movements2.clear(); } @@ -1900,10 +1919,86 @@ int MGM::recalcOffsets(int idx, int st1idx, int st2idx, bool flip, bool flop) { return 0; } -Common::Point *MGM::calcLength(Common::Point *point, Movement *mov, int x, int y, int *x1, int *y1, int flag) { - warning("STUB: MGM::calcLength()"); +Common::Point *MGM::calcLength(Common::Point *pRes, Movement *mov, int x, int y, int *x1, int *y1, int flag) { + Common::Point point; - return point; + mov->calcSomeXY(point, 0); + int p1x = point.x; + int p1y = point.y; + + int newx1 = 0; + int oldy1 = *y1; + + if (abs(p1y) > abs(p1x)) { + if (mov->calcSomeXY(point, 0)->y) + newx1 = (int)((double)y / point.y); + } else if (mov->calcSomeXY(point, 0)->x) { + newx1 = (int)((double)x / point.y); + } + + if (newx1 < 0) + newx1 = 0; + + *x1 = newx1; + + int phase = 1; + int sz; + + if (flag) { + if (abs(p1y) > abs(p1x)) { + while (abs(p1y * newx1 + mov->calcSomeXY(point, 0)->y) < abs(y)) { + sz = mov->_currMovement ? mov->_currMovement->_dynamicPhases.size() : mov->_dynamicPhases.size(); + + if (phase >= sz) { + phase--; + + break; + } + + phase++; + } + } else { + while (abs(p1x * newx1 + mov->calcSomeXY(point, 0)->x) < abs(x)) { + sz = mov->_currMovement ? mov->_currMovement->_dynamicPhases.size() : mov->_dynamicPhases.size(); + + if (phase >= sz) { + phase--; + + break; + } + + phase++; + } + } + + *y1 = phase - 1; + } else { + *y1 = -1; + } + + int p2x = 0; + int p2y = 0; + + if (!oldy1) + oldy1 = -1; + + if (oldy1 > 0) { + ++*x1; + + mov->calcSomeXY(point, 0); + p2x = point.x; + p2y = point.y; + + if (abs(p1y) > abs(p1x)) + p2x = p1x; + else + p2y = p1y; + } + + pRes->x = p2x + p1x * newx1; + pRes->y = p2y + p1y * newx1; + + return pRes; } ExCommand2 *MGM::buildExCommand2(Movement *mov, int objId, int x1, int y1, Common::Point *x2, Common::Point *y2, int len) { @@ -1938,7 +2033,7 @@ ExCommand2 *MGM::buildExCommand2(Movement *mov, int objId, int x1, int y1, Commo y2->y -= x2->y; - if ( !y2->y ) + if (!y2->y) x2->y = 0; } } @@ -1972,6 +2067,11 @@ MovGraphLink::MovGraphLink() { _objtype = kObjTypeMovGraphLink; } +MovGraphLink::~MovGraphLink() { + warning("STUB: MovGraphLink::~MovGraphLink()"); +} + + bool MovGraphLink::load(MfcArchive &file) { debug(5, "MovGraphLink::load()"); diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index cecde70775..6ad46e719a 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -173,6 +173,7 @@ public: void updateAnimStatics(StaticANIObject *ani, int staticsId); Common::Point *getPoint(Common::Point *point, int aniId, int staticsId1, int staticsId2); int getStaticsIndexById(int idx, int16 id); + int getStaticsIndex(int idx, Statics *st); void clearMovements2(int idx); int recalcOffsets(int idx, int st1idx, int st2idx, bool flip, bool flop); Common::Point *calcLength(Common::Point *point, Movement *mov, int x, int y, int *x1, int *y1, int flag); @@ -288,6 +289,8 @@ class MovGraphLink : public CObject { public: MovGraphLink(); + virtual ~MovGraphLink(); + virtual bool load(MfcArchive &file); void calcNodeDistanceAndAngle(); @@ -325,6 +328,8 @@ public: public: MovGraph(); + virtual ~MovGraph(); + virtual bool load(MfcArchive &file); virtual void addObject(StaticANIObject *obj); diff --git a/engines/fullpipe/objectnames.h b/engines/fullpipe/objectnames.h index c33750ff6b..8939f44975 100644 --- a/engines/fullpipe/objectnames.h +++ b/engines/fullpipe/objectnames.h @@ -54,8 +54,9 @@ namespace Fullpipe { #define sO_In_15_2 "\xc2_15_2" // "В_15_2" #define sO_In_15_3 "\xc2_15_3" // "В_15_3" #define sO_In_16 "\xc2_16" // "В_16" +#define sO_In_32 "\xc2_32" // "В_32" #define sO_In_32_Lies "\xc2_32 \xeb\xe5\xe6\xe8\xf2" // "В_32 лежит" -#define sO_In_32_Stands "\xc2_32 \xf2\xee\xf0\xf7\xe8\xf2" // "В_32 торчит" +#define sO_In_32_Sticks "\xc2_32 \xf2\xee\xf0\xf7\xe8\xf2" // "В_32 торчит" #define sO_In_33 "\xc2_33" // "В_33" #define sO_In_7 "\xc2_7" // "В_7" #define sO_Together "\xc2\xe4\xe2\xee\xe5\xec" // "Вдвоем" diff --git a/engines/fullpipe/objects.h b/engines/fullpipe/objects.h index a12851e63b..d13559429a 100644 --- a/engines/fullpipe/objects.h +++ b/engines/fullpipe/objects.h @@ -82,6 +82,8 @@ class GameVar : public CObject { public: GameVar(); + virtual ~GameVar(); + virtual bool load(MfcArchive &file); GameVar *getSubVarByName(const char *name); bool setSubVarAsInt(const char *name, int value); diff --git a/engines/fullpipe/scene.cpp b/engines/fullpipe/scene.cpp index 928bd5cf2e..997d92ae1c 100644 --- a/engines/fullpipe/scene.cpp +++ b/engines/fullpipe/scene.cpp @@ -92,6 +92,9 @@ bool SceneTag::load(MfcArchive &file) { SceneTag::~SceneTag() { free(_tag); + + delete _scene; + delete _field_4; } void SceneTag::loadScene() { @@ -129,6 +132,10 @@ Scene::Scene() { _sceneName = 0; } +Scene::~Scene() { + warning("STUB: Scene::~Scene()"); +} + bool Scene::load(MfcArchive &file) { debug(5, "Scene::load()"); diff --git a/engines/fullpipe/scene.h b/engines/fullpipe/scene.h index b8defe2d06..fc04a877f5 100644 --- a/engines/fullpipe/scene.h +++ b/engines/fullpipe/scene.h @@ -44,6 +44,7 @@ class Scene : public Background { public: Scene(); + virtual ~Scene(); virtual bool load(MfcArchive &file); @@ -84,7 +85,7 @@ class Scene : public Background { class SceneTag : public CObject { public: - int _field_4; + CObject *_field_4; char *_tag; Scene *_scene; int16 _sceneId; diff --git a/engines/fullpipe/scenes.cpp b/engines/fullpipe/scenes.cpp index 4482225c2a..11f8e19865 100644 --- a/engines/fullpipe/scenes.cpp +++ b/engines/fullpipe/scenes.cpp @@ -247,6 +247,8 @@ Vars::Vars() { scene17_handPhase = false; scene17_sceneEdgeX = 0; + scene18_var01 = 0; + scene20_fliesCountdown = 0; scene20_grandma = 0; @@ -298,17 +300,13 @@ Vars::Vars() { scene26_sock = 0; scene26_activeVent = 0; - scene28_var01 = 0; - scene28_var02 = 0; - scene28_var03 = 0; - scene28_var04 = 0; - scene28_var05 = 1; - scene28_var06 = 1; - scene28_var07 = 0; - scene28_var08 = 0; - scene28_var09 = 0; - scene28_var10 = 0; - scene28_var11 = 0; + scene28_fliesArePresent = true; + scene28_beardedDirection = true; + scene28_darkeningObject = 0; + scene28_lighteningObject = 0; + scene28_headDirection = false; + scene28_headBeardedFlipper = false; + scene28_lift6inside = false; scene30_leg = 0; scene30_liftFlag = 1; @@ -317,6 +315,43 @@ Vars::Vars() { scene31_cactus = 0; scene31_plusMinus = 0; + scene32_flagIsWaving = false; + scene32_flagNeedsStopping = false; + scene32_dudeIsSitting = false; + scene32_cactusCounter = -1; + scene32_dudeOnLadder = false; + scene32_cactusIsGrowing = false; + scene32_flag = 0; + scene32_cactus = 0; + scene32_massOrange = 0; + scene32_massBlue = 0; + scene32_massGreen = 0; + scene32_button = 0; + + scene33_mug = 0; + scene33_jettie = 0; + scene33_cube = 0; + scene33_cubeX = -1; + scene33_handleIsDown = false; + + for (int i = 0; i < 9; i++) { + scene33_ventsX[i] = 0; + scene33_ventsState[i] = 0; + } + + scene34_var01 = 0; + scene34_var02 = 0; + scene34_var03 = 0; + scene34_var04 = 0; + scene34_cactus = 0; + scene34_vent = 0; + scene34_hatch = 0; + scene34_boot = 0; + scene34_var05 = 0; + scene34_var06 = 0; + scene34_var07 = 0; + scene34_var08 = 0; + scene36_rotohrust = 0; scene36_scissors = 0; @@ -840,7 +875,6 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { _updateCursorCallback = defaultUpdateCursor; break; -#if 0 case SC_32: sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_32"); scene->preloadMovements(sceneVar); @@ -849,7 +883,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { scene->initObjectCursors("SC_32"); setSceneMusicParameters(sceneVar); insertMessageHandler(sceneHandler32, 2, 2); - scene32_sub_42C5C0(); + scene32_setupMusic(); _updateCursorCallback = scene32_updateCursor; break; @@ -861,10 +895,11 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { scene->initObjectCursors("SC_33"); setSceneMusicParameters(sceneVar); insertMessageHandler(sceneHandler33, 2, 2); - scene33_sub_42CEF0(); + scene33_setupMusic(); _updateCursorCallback = scene33_updateCursor; break; +#if 0 case SC_34: sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_34"); scene->preloadMovements(sceneVar); diff --git a/engines/fullpipe/scenes.h b/engines/fullpipe/scenes.h index ab5e18654f..1348740036 100644 --- a/engines/fullpipe/scenes.h +++ b/engines/fullpipe/scenes.h @@ -101,6 +101,9 @@ void scene17_restoreState(); int sceneHandler17(ExCommand *cmd); int scene17_updateCursor(); +void scene18_preload(); +void scene19_preload(Scene *sc, int key); + void scene20_initScene(Scene *sc); int sceneHandler20(ExCommand *ex); @@ -143,6 +146,16 @@ int sceneHandler30(ExCommand *cmd); void scene31_initScene(Scene *sc); int sceneHandler31(ExCommand *ex); +void scene32_initScene(Scene *sc); +void scene32_setupMusic(); +int sceneHandler32(ExCommand *cmd); +int scene32_updateCursor(); + +void scene33_initScene(Scene *sc); +void scene33_setupMusic(); +int sceneHandler33(ExCommand *cmd); +int scene33_updateCursor(); + int scene36_updateCursor(); void scene36_initScene(Scene *sc); int sceneHandler36(ExCommand *cmd); @@ -375,6 +388,8 @@ public: bool scene17_handPhase; int scene17_sceneEdgeX; + int scene18_var01; + int scene20_fliesCountdown; StaticANIObject *scene20_grandma; @@ -426,17 +441,13 @@ public: StaticANIObject *scene26_sock; StaticANIObject *scene26_activeVent; - int scene28_var01; - int scene28_var02; - int scene28_var03; - int scene28_var04; - int scene28_var05; - int scene28_var06; - PictureObject *scene28_var07; - PictureObject *scene28_var08; - int scene28_var09; - int scene28_var10; - int scene28_var11; + bool scene28_fliesArePresent; + bool scene28_beardedDirection; + PictureObject *scene28_darkeningObject; + PictureObject *scene28_lighteningObject; + bool scene28_headDirection; + bool scene28_headBeardedFlipper; + bool scene28_lift6inside; StaticANIObject *scene30_leg; int scene30_liftFlag; @@ -445,6 +456,40 @@ public: StaticANIObject *scene31_cactus; StaticANIObject *scene31_plusMinus; + bool scene32_flagIsWaving; + bool scene32_flagNeedsStopping; + bool scene32_dudeIsSitting; + int scene32_cactusCounter; + bool scene32_dudeOnLadder; + bool scene32_cactusIsGrowing; + StaticANIObject *scene32_flag; + StaticANIObject *scene32_cactus; + StaticANIObject *scene32_massOrange; + StaticANIObject *scene32_massBlue; + StaticANIObject *scene32_massGreen; + StaticANIObject *scene32_button; + + StaticANIObject *scene33_mug; + StaticANIObject *scene33_jettie; + StaticANIObject *scene33_cube; + int scene33_cubeX; + bool scene33_handleIsDown; + int scene33_ventsX[9]; + int scene33_ventsState[9]; + + int scene34_var01; + int scene34_var02; + int scene34_var03; + int scene34_var04; + StaticANIObject *scene34_cactus; + StaticANIObject *scene34_vent; + StaticANIObject *scene34_hatch; + StaticANIObject *scene34_boot; + int scene34_var05; + int scene34_var06; + int scene34_var07; + int scene34_var08; + StaticANIObject *scene36_rotohrust; StaticANIObject *scene36_scissors; diff --git a/engines/fullpipe/scenes/scene18and19.cpp b/engines/fullpipe/scenes/scene18and19.cpp new file mode 100644 index 0000000000..a965cfb98e --- /dev/null +++ b/engines/fullpipe/scenes/scene18and19.cpp @@ -0,0 +1,49 @@ +/* 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" + +#include "fullpipe/objectnames.h" +#include "fullpipe/constants.h" + +#include "fullpipe/gameloader.h" +#include "fullpipe/motion.h" +#include "fullpipe/scenes.h" +#include "fullpipe/statics.h" + +#include "fullpipe/interaction.h" +#include "fullpipe/behavior.h" + + +namespace Fullpipe { + +void scene18_preload() { + warning("WARNING: scene18_preload()"); +} + +void scene19_preload(Scene *sc, int key) { + warning("WARNING: scene19_preload()"); +} + + + +} // End of namespace Fullpipe diff --git a/engines/fullpipe/scenes/scene28.cpp b/engines/fullpipe/scenes/scene28.cpp index 9fad0f74f5..62afd128c2 100644 --- a/engines/fullpipe/scenes/scene28.cpp +++ b/engines/fullpipe/scenes/scene28.cpp @@ -37,17 +37,13 @@ namespace Fullpipe { void scene28_initScene(Scene *sc) { - g_vars->scene28_var01 = 200; - g_vars->scene28_var02 = 200; - g_vars->scene28_var03 = 300; - g_vars->scene28_var04 = 300; - g_vars->scene28_var05 = 1; - g_vars->scene28_var06 = 1; - g_vars->scene28_var07 = 0; - g_vars->scene28_var08 = 0; - g_vars->scene28_var09 = 0; - g_vars->scene28_var10 = 0; - g_vars->scene28_var11 = 0; + g_vars->scene28_fliesArePresent = true; + g_vars->scene28_beardedDirection = true; + g_vars->scene28_darkeningObject = 0; + g_vars->scene28_lighteningObject = 0; + g_vars->scene28_headDirection = false; + g_vars->scene28_headBeardedFlipper = false; + g_vars->scene28_lift6inside = false; g_fp->_floaters->init(g_fp->getGameLoaderGameVar()->getSubVarByName("SC_28")); @@ -64,27 +60,141 @@ int scene28_updateCursor() { } void sceneHandler28_lift1ShowAfter() { - warning("STUB: sceneHandler28_lift1ShowAfter()"); + StaticANIObject *ani = g_fp->_currentScene->getStaticANIObject1ById(ANI_MAN_28, -1); + + g_fp->_aniMan->_statics = g_fp->_aniMan->getStaticsById(ST_MAN_SIT|0x4000); + g_fp->_aniMan->setOXY(ani->_ox + 7, ani->_oy); + g_fp->_aniMan->_priority = ani->_priority; + g_fp->_aniMan->show1(-1, -1, -1, 0); } void sceneHandler28_makeFaces(ExCommand *cmd) { - warning("STUB: sceneHandler28_makeFaces()"); + g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK4, 0)->_flags &= 0xFFFB; + + g_vars->scene28_lighteningObject = 0; + + MessageQueue *mq = g_fp->_globalMessageQueueList->getMessageQueueById(cmd->_parId); + if (mq) { + int frames[5]; + + frames[0] = MV_WMN28_IN_1; + frames[1] = MV_WMN28_IN_2; + frames[2] = MV_WMN28_IN_3; + frames[3] = MV_WMN28_IN_4; + frames[4] = MV_WMN28_IN_5; + + for (int i = 0; i < 5; i++) { + int pos; + + while (frames[pos = g_fp->_rnd->getRandomNumber(4)] == 0) + ; + + mq->getExCommandByIndex(i)->_messageNum = frames[pos]; + + frames[pos] = 0; + } + } } void sceneHandler28_trySecondaryPers() { - warning("STUB: sceneHandler28_trySecondaryPers()"); + MessageQueue *mq; + int x; + + if (g_vars->scene28_headBeardedFlipper) { + if (g_vars->scene28_beardedDirection) { + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_BRD28_GOR), 0, 1); + + mq->getExCommandByIndex(0)->_x = g_fp->_sceneRect.left - 20; + mq->getExCommandByIndex(0)->_keyCode = 1; + mq->replaceKeyCode(-1, 1); + mq->chain(0); + + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_BRD28_GOR), 0, 1); + + mq->getExCommandByIndex(0)->_x = g_fp->_sceneRect.left - 40; + mq->getExCommandByIndex(0)->_y += 20; + mq->getExCommandByIndex(0)->_keyCode = 2; + mq->replaceKeyCode(-1, 2); + mq->chain(0); + + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_BRD28_GOR), 0, 1); + + x = g_fp->_sceneRect.left - 60; + } else { + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_BRD28_GOL), 0, 1); + + mq->getExCommandByIndex(0)->_x = g_fp->_sceneRect.right + 20; + mq->getExCommandByIndex(0)->_keyCode = 1; + mq->replaceKeyCode(-1, 1); + mq->chain(0); + + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_BRD28_GOL), 0, 1); + + mq->getExCommandByIndex(0)->_x = g_fp->_sceneRect.right + 40; + mq->getExCommandByIndex(0)->_y += 20; + mq->getExCommandByIndex(0)->_keyCode = 2; + mq->replaceKeyCode(-1, 2); + mq->chain(0); + + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_BRD28_GOL), 0, 1); + + x = g_fp->_sceneRect.right + 60; + } + + mq->getExCommandByIndex(0)->_x = x; + mq->getExCommandByIndex(0)->_y += 40; + mq->getExCommandByIndex(0)->_keyCode = 3; + mq->replaceKeyCode(-1, 3); + mq->chain( 0); + + g_vars->scene28_beardedDirection = !g_vars->scene28_beardedDirection; + } else { + if (g_vars->scene28_headDirection) { + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_GLV28_GOR), 0, 1); + + x = g_fp->_sceneRect.left - 40; + } else { + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_GLV28_GOL), 0, 1); + + x = g_fp->_sceneRect.right + 40; + } + + mq->getExCommandByIndex(0)->_x = x; + mq->chain(0); + + g_vars->scene28_headDirection = !g_vars->scene28_headDirection; + } + + g_vars->scene28_headBeardedFlipper = !g_vars->scene28_headBeardedFlipper; } void sceneHandler28_turnOn2() { - warning("STUB: sceneHandler28_turnOn2()"); + if (g_vars->scene28_fliesArePresent) { + g_fp->_floaters->genFlies(g_fp->_currentScene, 1013, 329, 60, 4); + + g_fp->_floaters->_array2[g_fp->_floaters->_array2.size() - 1]->val15 = 30; + g_fp->_floaters->_array2[g_fp->_floaters->_array2.size() - 1]->countdown = g_fp->_rnd->getRandomNumber(12) + 12; + + g_fp->_floaters->genFlies(g_fp->_currentScene, 1074, 311, 60, 4); + + g_fp->_floaters->_array2[g_fp->_floaters->_array2.size() - 1]->val15 = 30; + g_fp->_floaters->_array2[g_fp->_floaters->_array2.size() - 1]->countdown = g_fp->_rnd->getRandomNumber(12) + 12; + } + + g_vars->scene28_fliesArePresent = false; } void sceneHandler28_startWork1() { - warning("STUB: sceneHandler28_startWork1()"); -} + g_fp->_aniMan->hide(); + + StaticANIObject *man = g_fp->_currentScene->getStaticANIObject1ById(ANI_MAN_28, -1); + + man->_statics = man->getStaticsById(ST_MAN28_RIGHT); + man->setOXY(g_fp->_aniMan->_ox, g_fp->_aniMan->_oy); + man->_priority = g_fp->_aniMan->_priority; + man->show1(-1, -1, -1, 0); -void sceneHandler28_clickLift(int keyCode) { - warning("STUB: sceneHandler28_clickLift()"); + chainQueue(QU_SC28_LIFT1_WORK, 1); } void sceneHandler28_lift0Start() { @@ -92,7 +202,11 @@ void sceneHandler28_lift0Start() { } void sceneHandler28_lift1Start() { - warning("STUB: sceneHandler28_lift1Start()"); + g_fp->_aniMan->_flags |= 1; + + g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 0); + + chainQueue(QU_SC28_LIFT1_START, 1); } void sceneHandler28_lift2Start() { @@ -104,7 +218,11 @@ void sceneHandler28_lift3Start() { } void sceneHandler28_lift4Start() { - warning("STUB: sceneHandler28_lift4Start()"); + g_fp->_aniMan->_flags |= 1; + + g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 0); + + chainQueue(QU_SC28_WMN_START, 1); } void sceneHandler28_lift5Start() { @@ -112,9 +230,71 @@ void sceneHandler28_lift5Start() { } void sceneHandler28_lift6Start() { - warning("STUB: sceneHandler28_lift6Start()"); + g_fp->_aniMan->_flags |= 1; + + g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 0); + + StaticANIObject *woman = g_fp->_currentScene->getStaticANIObject1ById(ANI_TIOTIA, -1); + + if (woman && (woman->_flags & 4)) + chainQueue(QU_SC28_LIFT6_START2, 1); + else + chainQueue(QU_SC28_LIFT6_START, 1); } +void sceneHandler28_clickLift(int keycode) { + int x = 0; + + switch (keycode) { + case 0: x = 600; break; + case 1: x = 824; break; + case 2: x = 1055; break; + case 3: x = 1286; break; + case 4: x = 1517; break; + case 5: x = 1748; break; + case 6: x = 1979; break; + } + + if (abs(x - g_fp->_aniMan->_ox) > 1 || abs(472 - g_fp->_aniMan->_oy) > 1 + || g_fp->_aniMan->_movement + || g_fp->_aniMan->_statics->_staticsId != ST_MAN_UP) { + MessageQueue *mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, x, 472, 1, ST_MAN_UP); + if (mq) { + ExCommand *ex = new ExCommand(0, 17, MSG_SC28_CLICKLIFT, 0, 0, 0, 1, 0, 0, 0); + ex->_excFlags |= 3; + + mq->addExCommandToEnd(ex); + + postExCommand(g_fp->_aniMan->_id, 2, x, 472, 0, -1); + } + } else { + switch (keycode) { + case 0: + sceneHandler28_lift0Start(); + break; + case 1: + sceneHandler28_lift1Start(); + break; + case 2: + sceneHandler28_lift2Start(); + break; + case 3: + sceneHandler28_lift3Start(); + break; + case 4: + sceneHandler28_lift4Start(); + break; + case 5: + sceneHandler28_lift5Start(); + break; + case 6: + sceneHandler28_lift6Start(); + break; + default: + return; + } + } +} int sceneHandler28(ExCommand *cmd) { if (cmd->_messageKind != 17) @@ -126,7 +306,7 @@ int sceneHandler28(ExCommand *cmd) { break; case MSG_SC28_LIFT6INSIDE: - g_vars->scene28_var11 = 1; + g_vars->scene28_lift6inside = true; break; case MSG_SC28_LIFT1_SHOWAFTER: @@ -142,58 +322,58 @@ int sceneHandler28(ExCommand *cmd) { break; case MSG_SC28_TURNOFF_0: - g_vars->scene28_var08 = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK0, 0); - g_vars->scene28_var08->_flags |= 4; + g_vars->scene28_lighteningObject = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK0, 0); + g_vars->scene28_lighteningObject->_flags |= 4; break; case MSG_SC28_TURNON_0: - g_vars->scene28_var07 = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK0, 0); + g_vars->scene28_darkeningObject = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK0, 0); break; case MSG_SC28_TURNON_1: - g_vars->scene28_var07 = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK1, 0); + g_vars->scene28_darkeningObject = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK1, 0); break; case MSG_SC28_TURNOFF_1: - g_vars->scene28_var08 = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK1, 0); - g_vars->scene28_var08->_flags |= 4; + g_vars->scene28_lighteningObject = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK1, 0); + g_vars->scene28_lighteningObject->_flags |= 4; break; case MSG_SC28_TURNON_2: - g_vars->scene28_var07 = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK2, 0); + g_vars->scene28_darkeningObject = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK2, 0); sceneHandler28_turnOn2(); break; case MSG_SC28_TURNOFF_2: - g_vars->scene28_var08 = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK2, 0); - g_vars->scene28_var08->_flags |= 4; + g_vars->scene28_lighteningObject = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK2, 0); + g_vars->scene28_lighteningObject->_flags |= 4; break; case MSG_SC28_TURNON_3: - g_vars->scene28_var07 = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK3, 0); + g_vars->scene28_darkeningObject = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK3, 0); break; case MSG_SC28_TURNOFF_3: - g_vars->scene28_var08 = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK3, 0); - g_vars->scene28_var08->_flags |= 4; + g_vars->scene28_lighteningObject = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK3, 0); + g_vars->scene28_lighteningObject->_flags |= 4; break; case MSG_SC28_TURNON_4: - g_vars->scene28_var07 = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK4, 0); + g_vars->scene28_darkeningObject = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK4, 0); break; case MSG_SC28_TURNOFF_4: - g_vars->scene28_var08 = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK4, 0); - g_vars->scene28_var08->_flags |= 4; + g_vars->scene28_lighteningObject = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK4, 0); + g_vars->scene28_lighteningObject->_flags |= 4; break; case MSG_SC28_TURNON_6: - g_vars->scene28_var07 = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK6, 0); + g_vars->scene28_darkeningObject = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK6, 0); break; case MSG_SC28_TURNOFF_6: - g_vars->scene28_var08 = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK6, 0); - g_vars->scene28_var08->_flags |= 4; + g_vars->scene28_lighteningObject = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK6, 0); + g_vars->scene28_lighteningObject->_flags |= 4; break; case MSG_SC28_STARTWORK1: @@ -213,12 +393,12 @@ int sceneHandler28(ExCommand *cmd) { case 29: { - if (g_vars->scene28_var11) { + if (g_vars->scene28_lift6inside) { chainObjQueue(g_fp->_aniMan, QU_SC28_LIFT6_END, 1); g_fp->playTrack(g_fp->getGameLoaderGameVar()->getSubVarByName("SC_28"), "MUSIC", 1); - g_vars->scene28_var11 = 0; + g_vars->scene28_lift6inside = false; } StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(cmd->_sceneClickX, cmd->_sceneClickY); @@ -248,30 +428,30 @@ int sceneHandler28(ExCommand *cmd) { if (g_fp->_aniMan2) { int x = g_fp->_aniMan2->_ox; - if (x < g_fp->_sceneRect.left + g_vars->scene28_var01) - g_fp->_currentScene->_x = x - g_vars->scene28_var03 - g_fp->_sceneRect.left; + if (x < g_fp->_sceneRect.left + 200) + g_fp->_currentScene->_x = x - 300 - g_fp->_sceneRect.left; - if (x > g_fp->_sceneRect.right - g_vars->scene28_var01) - g_fp->_currentScene->_x = x + g_vars->scene28_var03 - g_fp->_sceneRect.right; + if (x > g_fp->_sceneRect.right - 200) + g_fp->_currentScene->_x = x + 300 - g_fp->_sceneRect.right; } - if (g_vars->scene28_var07) { - if (g_vars->scene28_var07->_picture->getAlpha() > 10) { - g_vars->scene28_var07->_picture->setAlpha(g_vars->scene28_var07->_picture->getAlpha() - 10); + if (g_vars->scene28_darkeningObject) { + if (g_vars->scene28_darkeningObject->_picture->getAlpha() > 10) { + g_vars->scene28_darkeningObject->_picture->setAlpha(g_vars->scene28_darkeningObject->_picture->getAlpha() - 10); } else { - g_vars->scene28_var07->_flags &= 0xFFFB; + g_vars->scene28_darkeningObject->_flags &= 0xFFFB; - g_vars->scene28_var07 = 0; + g_vars->scene28_darkeningObject = 0; } } - if (g_vars->scene28_var08) { - if (g_vars->scene28_var08->_picture->getAlpha() < 0xF9u ) { - g_vars->scene28_var08->_picture->setAlpha(g_vars->scene28_var08->_picture->getAlpha() + 6); + if (g_vars->scene28_lighteningObject) { + if (g_vars->scene28_lighteningObject->_picture->getAlpha() < 0xF9u) { + g_vars->scene28_lighteningObject->_picture->setAlpha(g_vars->scene28_lighteningObject->_picture->getAlpha() + 6); } else { - g_vars->scene28_var08->_picture->setAlpha(0xff); + g_vars->scene28_lighteningObject->_picture->setAlpha(0xff); - g_vars->scene28_var08 = 0; + g_vars->scene28_lighteningObject = 0; } } diff --git a/engines/fullpipe/scenes/scene32.cpp b/engines/fullpipe/scenes/scene32.cpp new file mode 100644 index 0000000000..c93e888e51 --- /dev/null +++ b/engines/fullpipe/scenes/scene32.cpp @@ -0,0 +1,431 @@ +/* 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" + +#include "fullpipe/objectnames.h" +#include "fullpipe/constants.h" + +#include "fullpipe/gameloader.h" +#include "fullpipe/motion.h" +#include "fullpipe/scenes.h" +#include "fullpipe/statics.h" + +#include "fullpipe/interaction.h" +#include "fullpipe/behavior.h" + + +namespace Fullpipe { + +void scene32_initScene(Scene *sc) { + g_vars->scene32_flagIsWaving = false; + g_vars->scene32_flagNeedsStopping = false; + g_vars->scene32_dudeIsSitting = false; + g_vars->scene32_cactusCounter = -1; + g_vars->scene32_dudeOnLadder = false; + g_vars->scene32_cactusIsGrowing = false; + g_vars->scene32_flag = sc->getStaticANIObject1ById(ANI_FLAG, -1); + g_vars->scene32_cactus = sc->getStaticANIObject1ById(ANI_CACTUS, -1); + g_vars->scene32_massOrange = sc->getStaticANIObject1ById(ANI_TESTO_ORANGE, -1); + g_vars->scene32_massBlue = sc->getStaticANIObject1ById(ANI_TESTO_BLUE, -1); + g_vars->scene32_massGreen = sc->getStaticANIObject1ById(ANI_TESTO_GREEN, -1); + g_vars->scene32_button = sc->getStaticANIObject1ById(ANI_BUTTON_32, -1); + + g_vars->scene32_massOrange->startAnim(MV_TSTO_FLOW, 0, -1); + g_vars->scene32_massOrange->_movement->setDynamicPhaseIndex(15); + + g_vars->scene32_massGreen->startAnim(MV_TSTG_FLOW, 0, -1); + g_vars->scene32_massGreen->_movement->setDynamicPhaseIndex(26); + + Scene *oldsc = g_fp->_currentScene; + StaticANIObject *ani; + + if (g_fp->getObjectState(sO_ClockHandle) == g_fp->getObjectEnumState(sO_ClockHandle, sO_In_32_Lies)) { + ani = sc->getStaticANIObject1ById(ANI_INV_HANDLE, -1); + if (ani) { + g_fp->_currentScene = sc; + + ani->changeStatics2(ST_HDL_LAID); + } + } else { + if (g_fp->getObjectState(sO_ClockHandle) == g_fp->getObjectEnumState(sO_ClockHandle, sO_In_32_Sticks)) { + ani = sc->getStaticANIObject1ById(ANI_INV_HANDLE, -1); + + g_fp->_currentScene = sc; + + if (ani) + ani->changeStatics2(ST_HDL_PLUGGED); + + g_vars->scene32_button->changeStatics2(ST_BTN32_ON); + } + } + + g_fp->_currentScene = oldsc; + + if (g_fp->getObjectState(sO_Cube) == g_fp->getObjectEnumState(sO_Cube, sO_In_32)) { + MessageQueue *mq = new MessageQueue(sc->getMessageQueueById(QU_KBK32_START), 0, 0); + + mq->sendNextCommand(); + } + + g_fp->lift_setButton(sO_Level9, ST_LBN_9N); + g_fp->lift_sub5(sc, QU_SC32_ENTERLIFT, QU_SC32_EXITLIFT); + + g_fp->initArcadeKeys("SC_32"); +} + +void scene32_setupMusic() { + if (g_fp->lift_checkButton(sO_Level6)) + g_fp->playTrack(g_fp->getGameLoaderGameVar()->getSubVarByName("SC_32"), "MUSIC2", 1); +} + +int scene32_updateCursor() { + g_fp->updateCursorCommon(); + + if (g_fp->_objectIdAtCursor == PIC_SC32_LADDER && g_fp->_cursorId == PIC_CSR_ITN) + g_fp->_cursorId = g_vars->scene32_dudeOnLadder ? PIC_CSR_GOD : PIC_CSR_GOU; // TODO FIXME doublecheck + + return g_fp->_cursorId; +} + +void sceneHandler32_tryCube() { + if (g_fp->getObjectState(sO_Cube) == g_fp->getObjectEnumState(sO_Cube, sO_In_33)) + chainQueue(QU_KBK32_GO, 0); +} + +void sceneHandler32_startCactus() { + g_vars->scene32_cactusCounter = 48; + g_vars->scene32_cactusIsGrowing = false; +} + +void sceneHandler32_spin(ExCommand *cmd) { + MessageQueue *mq = g_fp->_globalMessageQueueList->getMessageQueueById(cmd->_parId); + + if (!mq || mq->getCount() == 0) + return; + + ExCommand *ex = mq->getExCommandByIndex(0); + ExCommand *newex; + + if ((g_vars->scene32_cactus->_movement && g_vars->scene32_cactus->_movement->_id == MV_CTS_DEFAULT) + || g_vars->scene32_cactus->_statics->_staticsId == ST_CTS_GROWUP) { + for (int i = 0; i < 12; i++) { + newex = ex->createClone(); + newex->_excFlags |= 2; + mq->insertExCommandAt(1, newex); + } + + g_vars->scene32_cactus->changeStatics2(ST_CTS_GROWUP); + + chainQueue(QU_CTS_BACK, 1); + + g_vars->scene32_cactusIsGrowing = false; + + return; + } + + if (g_vars->scene32_cactus->_statics->_staticsId == ST_CTS_EMPTY && g_vars->scene32_cactusCounter < 0) { + for (int i = 0; i < 2; i++) { + newex = ex->createClone(); + newex->_excFlags |= 2; + mq->insertExCommandAt(1, newex); + } + + chainQueue(QU_KDK_DRIZZLE, 0); + } +} + +void sceneHandler32_startFlagLeft() { + g_vars->scene32_flag->changeStatics2(ST_FLG_NORM); + g_vars->scene32_flag->startAnim(MV_FLG_STARTL, 0, -1); + + g_vars->scene32_flagIsWaving = true; +} + +void sceneHandler32_startFlagRight() { + g_vars->scene32_flag->changeStatics2(ST_FLG_NORM); + g_vars->scene32_flag->startAnim(MV_FLG_STARTR, 0, -1); + + g_vars->scene32_flagIsWaving = true; +} + +void sceneHandler32_trySit(ExCommand *cmd) { + MessageQueue *mq = g_fp->_globalMessageQueueList->getMessageQueueById(cmd->_parId); + + if (!mq || mq->getCount() == 0) + return; + + ExCommand *ex = mq->getExCommandByIndex(0); + + if (g_vars->scene32_cactusIsGrowing || g_vars->scene32_cactus->_movement + || g_vars->scene32_cactus->_statics->_staticsId != ST_CTS_EMPTY + || (g_vars->scene32_cactusCounter >= 0 && g_vars->scene32_cactusCounter <= 20)) { + ex->_messageKind = 0; + ex->_excFlags |= 1; + } else { + ex->_parentId = ANI_MAN; + ex->_messageKind = 1; + ex->_messageNum = MV_MAN32_SITDOWN; + ex->_keyCode = g_fp->_aniMan->_okeyCode; + + g_vars->scene32_dudeIsSitting = true; + + getCurrSceneSc2MotionController()->clearEnabled(); + getGameLoaderInteractionController()->disableFlag24(); + } +} + +void sceneHandler32_buttonPush() { + if (g_fp->getObjectState(sO_ClockHandle) == g_fp->getObjectEnumState(sO_ClockHandle, sO_In_32_Sticks)) { + StaticANIObject *ani = g_fp->_currentScene->getStaticANIObject1ById(ANI_INV_HANDLE, -1); + if (ani) + ani->changeStatics2(ST_HDL_PLUGGED); + + chainQueue(QU_SC32_FALLHANDLE, 1); + + g_vars->scene32_button->changeStatics2(ST_BTN32_OFF); + } +} + +void sceneHandler32_installHandle() { + chainQueue(QU_SC32_SHOWHANDLE, 0); + + g_vars->scene32_button->changeStatics2(ST_BTN32_ON); +} + +void sceneHandler32_animateCactus() { + if (g_fp->_aniMan->_statics->_staticsId != ST_MAN32_SIT) + chainQueue(QU_CTS_GROW, 1); + else + chainQueue(QU_CTS_GROWMAN, 1); + + g_vars->scene32_cactusCounter = -1; + g_vars->scene32_cactusIsGrowing = true; +} + +void sceneHandler32_ladderLogic(ExCommand *cmd) { + MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC32_FROMLADDER), 0, 0); + + if (g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY) != PIC_SC32_LADDER) + mq->addExCommandToEnd(cmd->createClone()); + + mq->setFlags(mq->getFlags() | 1); + + g_fp->_aniMan->changeStatics2(ST_MAN_STANDLADDER); + if (!mq->chain(g_fp->_aniMan)) + delete mq; + + g_vars->scene32_dudeOnLadder = false; + + getCurrSceneSc2MotionController()->setEnabled(); + getGameLoaderInteractionController()->enableFlag24(); +} + +void sceneHandler32_potLogic(ExCommand *cmd) { + if (g_vars->scene32_cactusCounter < 0 || g_vars->scene32_cactusCounter > 20) { + MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact()); + + ExCommand *ex = new ExCommand(ANI_MAN, 1, MV_MAN32_STANDUP, 0, 0, 0, 1, 0, 0, 0); + + ex->_excFlags |= 2; + + mq->addExCommandToEnd(ex); + + StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(cmd->_sceneClickX, cmd->_sceneClickY); + + if (!ani || ani->_id != ANI_KADKA) + mq->addExCommandToEnd(cmd->createClone()); + + mq->setFlags(mq->getFlags() | 1); + mq->chain(0); + + getCurrSceneSc2MotionController()->setEnabled(); + getGameLoaderInteractionController()->enableFlag24(); + + g_vars->scene32_dudeIsSitting = false; + } +} + +int sceneHandler32(ExCommand *cmd) { + if (cmd->_messageKind != 17) + return 0; + + switch (cmd->_messageNum) { + case MSG_LIFT_CLOSEDOOR: + g_fp->lift_closedoorSeq(); + break; + + case MSG_LIFT_EXITLIFT: + g_fp->lift_exitSeq(cmd); + break; + + case MSG_LIFT_STARTEXITQUEUE: + g_fp->lift_startExitQueue(); + break; + + case MSG_SC32_TRUBATOBACK: + g_fp->_currentScene->getPictureObjectById(PIC_SC32_RTRUBA, 0)->_priority = 20; + break; + + case MSG_SC32_TRUBATOFRONT: + g_fp->_currentScene->getPictureObjectById(PIC_SC32_RTRUBA, 0)->_priority = 0; + break; + + case MSG_LIFT_CLICKBUTTON: + g_fp->lift_animation3(); + break; + + case MSG_SC33_TRYKUBIK: + sceneHandler32_tryCube(); + break; + + case MSG_SC32_STARTCACTUS: + sceneHandler32_startCactus(); + break; + + case MSG_SC32_STOPFLAG: + g_vars->scene32_flagIsWaving = false; + g_vars->scene32_flagNeedsStopping = true; + break; + + case MSG_SC32_SPIN: + sceneHandler32_spin(cmd); + break; + + case MSG_SC32_STARTFLAGLEFT : + sceneHandler32_startFlagLeft(); + break; + + case MSG_SC32_STARTFLAGRIGHT: + sceneHandler32_startFlagRight(); + break; + + case MSG_SC32_TRYSIT: + sceneHandler32_trySit(cmd); + break; + + case MSG_LIFT_GO: + g_fp->lift_goAnimation(); + break; + + case MSG_SC32_ONLADDER: + g_vars->scene32_dudeOnLadder = true; + + getCurrSceneSc2MotionController()->clearEnabled(); + getGameLoaderInteractionController()->disableFlag24(); + break; + + case MSG_SC6_BTNPUSH: + sceneHandler32_buttonPush(); + break; + + case 64: + g_fp->lift_sub05(cmd); + break; + + case MSG_SC6_INSTHANDLE: + sceneHandler32_installHandle(); + break; + + case 33: + if (g_fp->_aniMan2) { + int x = g_fp->_aniMan2->_ox; + + if (x < g_fp->_sceneRect.left + 200) + g_fp->_currentScene->_x = x - 300 - g_fp->_sceneRect.left; + + if (x > g_fp->_sceneRect.right - 200) + g_fp->_currentScene->_x = x + 300 - g_fp->_sceneRect.right; + } + + if (!g_vars->scene32_flag->_movement) { + if (g_vars->scene32_flagIsWaving) { + if (g_vars->scene32_flag->_statics->_staticsId == ST_FLG_RIGHT) + g_vars->scene32_flag->startAnim(MV_FLG_CYCLER, 0, -1); + else if (g_vars->scene32_flag->_statics->_staticsId == ST_FLG_LEFT) + g_vars->scene32_flag->startAnim(MV_FLG_CYCLEL, 0, -1); + } + + if (g_vars->scene32_flagNeedsStopping && !g_vars->scene32_flagIsWaving) { + if (g_vars->scene32_flag->_statics->_staticsId == ST_FLG_RIGHT) + g_vars->scene32_flag->startAnim(MV_FLG_STOPR, 0, -1); + else if (g_vars->scene32_flag->_statics->_staticsId == ST_FLG_LEFT) + g_vars->scene32_flag->startAnim(MV_FLG_STOPL, 0, -1); + + g_vars->scene32_flagNeedsStopping = false; + } + } + + if (g_vars->scene32_cactusCounter) { + if (g_vars->scene32_cactusCounter > 0) + --g_vars->scene32_cactusCounter; + + g_fp->_behaviorManager->updateBehaviors(); + + g_fp->startSceneTrack(); + } else { + sceneHandler32_animateCactus(); + + g_fp->_behaviorManager->updateBehaviors(); + + g_fp->startSceneTrack(); + + } + break; + + case 29: + if (g_vars->scene32_dudeOnLadder) { + sceneHandler32_ladderLogic(cmd); + cmd->_messageKind = 0; + break; + } + + if (!g_vars->scene32_dudeIsSitting || g_fp->_aniMan->_movement) { + StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(cmd->_sceneClickX, cmd->_sceneClickY); + + if (ani && ani->_id == ANI_LIFTBUTTON) { + g_fp->lift_sub1(ani); + + cmd->_messageKind = 0; + break; + } + + if (g_fp->_cursorId == PIC_CSR_GOFAR_R || g_fp->_cursorId == PIC_CSR_GOFAR_L) { + if ((g_fp->_sceneRect.right - cmd->_sceneClickX < 47 && g_fp->_sceneRect.right < g_fp->_sceneWidth - 1) + || (cmd->_sceneClickX - g_fp->_sceneRect.left < 47 && g_fp->_sceneRect.left > 0)) + g_fp->processArcade(cmd); + } + break; + } + + if (!g_vars->scene32_cactusIsGrowing) + sceneHandler32_potLogic(cmd); + + cmd->_messageKind = 0; + + break; + } + + return 0; +} + +} // End of namespace Fullpipe diff --git a/engines/fullpipe/scenes/scene33.cpp b/engines/fullpipe/scenes/scene33.cpp new file mode 100644 index 0000000000..209198c0f3 --- /dev/null +++ b/engines/fullpipe/scenes/scene33.cpp @@ -0,0 +1,314 @@ +/* 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" + +#include "fullpipe/objectnames.h" +#include "fullpipe/constants.h" + +#include "fullpipe/gameloader.h" +#include "fullpipe/motion.h" +#include "fullpipe/scenes.h" +#include "fullpipe/statics.h" + +#include "fullpipe/interaction.h" +#include "fullpipe/behavior.h" + + +namespace Fullpipe { + +const int ventsInit[9] = { 0, 0, 1, 0, 0, 1, 0, 0, 1 }; + +void scene33_initScene(Scene *sc) { + g_vars->scene33_mug = sc->getStaticANIObject1ById(ANI_MUG_33, -1); + g_vars->scene33_jettie = sc->getStaticANIObject1ById(ANI_JETTIE_FLOW, -1); + g_vars->scene33_cube = 0; + g_vars->scene33_cubeX = -1; + g_vars->scene33_handleIsDown = false; + + if (g_fp->getObjectState(sO_Cube) == g_fp->getObjectEnumState(sO_Cube, sO_In_33)) { + MessageQueue *mq = new MessageQueue(sc->getMessageQueueById(QU_KBK33_START), 0, 0); + + mq->sendNextCommand(); + } + + + for (int i = 0; i < 9; i++) { + g_vars->scene33_ventsX[i] = sc->getStaticANIObject1ById(ANI_VENT_33, i)->_ox; + + g_vars->scene33_ventsState[i] = ventsInit[i]; + } + + g_fp->initArcadeKeys("SC_33"); +} + +void scene33_setupMusic() { + if (g_fp->lift_checkButton(sO_Level6)) + g_fp->playTrack(g_fp->getGameLoaderGameVar()->getSubVarByName("SC_33"), "MUSIC2", 1); +} + +int scene33_updateCursor() { + g_fp->updateCursorCommon(); + + if (g_fp->_objectIdAtCursor == PIC_SC33_ZONES && g_fp->_cursorId == PIC_CSR_DEFAULT) + g_fp->_cursorId = PIC_CSR_ITN; + + return g_fp->_cursorId; +} + +void sceneHandler33_processJettie(ExCommand *cmd) { + MessageQueue *mq = g_fp->_globalMessageQueueList->getMessageQueueById(cmd->_parId); + + if (mq && g_vars->scene33_jettie->_movement) { + ExCommand *ex = mq->getExCommandByIndex(0); + + if (ex) { + ex->_messageKind = 0; + ex->_excFlags |= 1; + } + + ex = mq->getExCommandByIndex(1); + + if (ex) { + ex->_messageKind = 0; + ex->_excFlags |= 1; + } + } +} + +void sceneHandler33_switchVent(StaticANIObject *ani) { + int mv = 0; + + if (ani->_statics->_staticsId == ST_VNT33_DOWN) + mv = MV_VNT33_TURNR; + + if (ani->_statics->_staticsId == ST_VNT33_RIGHT) + mv = MV_VNT33_TURND; + + if (mv) + ani->startAnim(mv, 0, -1); + + g_vars->scene33_ventsState[ani->_okeyCode] = !g_vars->scene33_ventsState[ani->_okeyCode]; +} + +void sceneHandler33_processVents() { + for (int i = 0; i < 9; i++) + if (((g_vars->scene33_cubeX < g_vars->scene33_ventsX[i]) != (g_vars->scene33_cube->_ox < g_vars->scene33_ventsX[i])) + && g_vars->scene33_ventsState[i] != ventsInit[i]) + sceneHandler33_switchVent(g_fp->_currentScene->getStaticANIObject1ById(ANI_VENT_33, i)); + + g_vars->scene33_cubeX = g_vars->scene33_cube->_ox; +} + +void sceneHandler33_tryCube() { + if (g_fp->getObjectState(sO_Cube) == g_fp->getObjectEnumState(sO_Cube, sO_In_32)) + chainQueue(QU_KBK33_GO, 0); +} + +void sceneHandler33_pour() { + bool solved = true; + + for (int i = 0; i < 9; i++) + if (g_vars->scene33_ventsState[i] != ventsInit[i]) + solved = false; + + if (solved) { + if ((g_vars->scene33_mug->_flags & 4) && g_vars->scene33_mug->_statics->_staticsId == ST_MUG33_EMPTY) { + g_vars->scene33_jettie->startAnim(MV_JTI33_POUR, 0, -1); + + g_vars->scene33_handleIsDown = false; + + return; + } + + if ((g_vars->scene33_mug->_flags & 4) && g_vars->scene33_mug->_statics->_staticsId == ST_MUG33_FULL) { + g_vars->scene33_jettie->startAnim(MV_JTI33_POURFULL, 0, -1); + + g_vars->scene33_handleIsDown = false; + + return; + } + + g_vars->scene33_jettie->startAnim(MV_JTI33_FLOW, 0, -1); + } + + g_vars->scene33_handleIsDown = false; +} + +void sceneHandler33_handleDown() { + if (!g_vars->scene33_handleIsDown && !g_vars->scene33_jettie->_movement && !g_vars->scene33_jettie->getMessageQueue() ) { + chainQueue(QU_SC33_STARTWATER, 0); + + g_vars->scene33_handleIsDown = true; + } +} + +void sceneHandler33_zoneClickProcess(StaticANIObject *ani) { + if (!ani->_movement) { + sceneHandler33_switchVent(ani); + + StaticANIObject *vent1 = 0; + StaticANIObject *vent2 = 0; + + switch (ani->_okeyCode) { + case 0: + vent1 = g_fp->_currentScene->getStaticANIObject1ById(ANI_VENT_33, 2); + vent2 = g_fp->_currentScene->getStaticANIObject1ById(ANI_VENT_33, 3); + break; + + case 1: + vent1 = g_fp->_currentScene->getStaticANIObject1ById(ANI_VENT_33, 3); + vent2 = g_fp->_currentScene->getStaticANIObject1ById(ANI_VENT_33, 4); + break; + + case 2: + vent1 = g_fp->_currentScene->getStaticANIObject1ById(ANI_VENT_33, 4); + vent2 = g_fp->_currentScene->getStaticANIObject1ById(ANI_VENT_33, 0); + break; + + case 3: + vent1 = g_fp->_currentScene->getStaticANIObject1ById(ANI_VENT_33, 0); + vent2 = g_fp->_currentScene->getStaticANIObject1ById(ANI_VENT_33, 1); + break; + + case 4: + vent1 = g_fp->_currentScene->getStaticANIObject1ById(ANI_VENT_33, 1); + vent2 = g_fp->_currentScene->getStaticANIObject1ById(ANI_VENT_33, 2); + break; + + default: + return; + } + + if (vent1) { + sceneHandler33_switchVent(vent1); + sceneHandler33_switchVent(vent2); + } + } +} + +void sceneHandler33_clickZones(ExCommand *cmd) { + StaticANIObject *closest = 0; + double mindist = 1e10; + + for (uint i = 0; i < g_fp->_currentScene->_staticANIObjectList1.size(); i++) { + StaticANIObject *ani = (StaticANIObject *)g_fp->_currentScene->_staticANIObjectList1[i]; + + if (ani->_id == ANI_VENT_33) { + int dx = ani->_ox - cmd->_sceneClickX; + int dy = ani->_oy - cmd->_sceneClickY; + double dist = sqrt((double)(dx * dx + dy * dy)); + + if (dist < mindist) { + mindist = dist; + closest = ani; + } + } + } + + if (closest) + sceneHandler33_zoneClickProcess(closest); +} + +int sceneHandler33(ExCommand *cmd) { + if (cmd->_messageKind != 17) + return 0; + + switch (cmd->_messageNum) { + case MSG_SC32_TRUBATOFRONT: + g_fp->_currentScene->getPictureObjectById(PIC_SC33_LTRUBA, 0)->_priority = 0; + break; + + case MSG_SC32_TRUBATOBACK: + g_fp->_currentScene->getPictureObjectById(PIC_SC33_LTRUBA, 0)->_priority = 20; + break; + + case MSG_SC33_TESTMUG: + sceneHandler33_processJettie(cmd); + break; + + case MSG_SC33_UPDATEKUBIK: + g_vars->scene33_cube = g_fp->_currentScene->getStaticANIObject1ById(ANI_KUBIK, -1); + + if (g_vars->scene33_cube) + g_vars->scene33_cubeX = g_vars->scene33_cube->_ox; + + break; + + case MSG_SC33_TRYKUBIK: + sceneHandler33_tryCube(); + break; + + case MSG_SC33_POUR: + sceneHandler33_pour(); + break; + + case MSG_SC33_HANDLEDOWN: + sceneHandler33_handleDown(); + break; + + case 29: + { + StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(g_fp->_sceneRect.left + cmd->_x, g_fp->_sceneRect.top + cmd->_y); + + if (!ani || !canInteractAny(g_fp->_aniMan, ani, cmd->_keyCode)) { + int picId = g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY); + PictureObject *pic = g_fp->_currentScene->getPictureObjectById(picId, 0); + + if (pic && pic->_id == PIC_SC33_ZONES) { + sceneHandler33_clickZones(cmd); + break; + } + + if (!pic || !canInteractAny(g_fp->_aniMan, pic, cmd->_keyCode)) { + if ((g_fp->_sceneRect.right - cmd->_sceneClickX < 47 && g_fp->_sceneRect.right < g_fp->_sceneWidth - 1) || (cmd->_sceneClickX - g_fp->_sceneRect.left < 47 && g_fp->_sceneRect.left > 0)) + g_fp->processArcade(cmd); + } + } + break; + } + + case 33: + if (g_fp->_aniMan2) { + int x = g_fp->_aniMan2->_ox; + + if (x < g_fp->_sceneRect.left + 200) + g_fp->_currentScene->_x = x - 300 - g_fp->_sceneRect.left; + + if (x > g_fp->_sceneRect.right - 200) + g_fp->_currentScene->_x = x + 300 - g_fp->_sceneRect.right; + } + + if (g_vars->scene33_cube) + sceneHandler33_processVents(); + + g_fp->_behaviorManager->updateBehaviors(); + + g_fp->startSceneTrack(); + + break; + } + + return 0; +} + +} // End of namespace Fullpipe diff --git a/engines/fullpipe/scenes/scene34.cpp b/engines/fullpipe/scenes/scene34.cpp new file mode 100644 index 0000000000..0882c0f9e8 --- /dev/null +++ b/engines/fullpipe/scenes/scene34.cpp @@ -0,0 +1,105 @@ +/* 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" + +#include "fullpipe/objectnames.h" +#include "fullpipe/constants.h" + +#include "fullpipe/gameloader.h" +#include "fullpipe/motion.h" +#include "fullpipe/scenes.h" +#include "fullpipe/statics.h" + +#include "fullpipe/interaction.h" +#include "fullpipe/behavior.h" +#include "fullpipe/floaters.h" + +namespace Fullpipe { + +void sceneHandler34_setExits() { + warning("STUB: sceneHandler34_setExits()"); +} + +void scene34_initScene(Scene *sc) { + g_vars->scene34_var01 = 200; + g_vars->scene34_var02 = 200; + g_vars->scene34_var03 = 300; + g_vars->scene34_var04 = 300; + g_vars->scene34_cactus = sc->getStaticANIObject1ById(ANI_CACTUS_34, -1); + g_vars->scene34_vent = sc->getStaticANIObject1ById(ANI_VENT_34, -1); + g_vars->scene34_hatch = sc->getStaticANIObject1ById(ANI_LUK_34, -1); + g_vars->scene34_boot = sc->getStaticANIObject1ById(ANI_BOOT_34, -1); + + if (g_fp->getObjectState(sO_Cactus) == g_fp->getObjectEnumState(sO_Cactus, sO_HasGrown)) { + Scene *oldsc = g_fp->_currentScene; + + g_fp->_currentScene = sc; + + g_vars->scene34_cactus->changeStatics2(ST_CTS34_EMPTY); + g_vars->scene34_cactus->setOXY(506, 674); + g_vars->scene34_cactus->_priority = 30; + + g_vars->scene34_cactus->changeStatics2(ST_CTS34_GROWNEMPTY2); + g_vars->scene34_cactus->_flags |= 4; + + g_fp->_currentScene = oldsc; + } + + if (g_fp->getObjectState(sO_Grandma) == g_fp->getObjectEnumState(sO_Grandma, sO_Strolling)) + g_fp->setObjectState(sO_Grandma, g_fp->getObjectEnumState(sO_Grandma, sO_OnStool)); + + sceneHandler34_setExits(); + + g_vars->scene34_var05 = 0; + g_vars->scene34_var06 = 0; + g_vars->scene34_var07 = 0; + g_vars->scene34_var08 = g_fp->_rnd->getRandomNumber(500) + 500; + + g_fp->_floaters->init(g_fp->getGameLoaderGameVar()->getSubVarByName("SC_34")); + + g_fp->lift_setButton(sO_Level7, ST_LBN_7N); + g_fp->lift_sub5(sc, QU_SC34_ENTERLIFT, QU_SC34_EXITLIFT); + + g_fp->initArcadeKeys("SC_34"); +} + +void scene34_initBeh() { + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene34_cactus, ST_CTS34_GROWNEMPTY2, QU_CTS34_FALLEFT, 0); + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene34_cactus, ST_CTS34_GROWNEMPTY2, QU_CTS34_FALLRIGHT, 0); +} + +int scene34_updateCursor() { +#if 0 + g_fp->updateCursorCommon(); + + if ((g_fp->_objectIdAtCursor != ANI_STOOL_34 || g_fp->getGameLoaderInventory()->getSelectedItemId() != ANI_INV_BOX) + && (g_fp->_objectIdAtCursor != ANI_BOX_34 || g_fp->getGameLoaderInventory()->getSelectedItemId() != ANI_INV_STOOL)) + ; // emtpy + else + g_fp->_cursorId = PIC_CSR_ITN_INV; + +#endif + return g_fp->_cursorId; +} + +} // End of namespace Fullpipe diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp index da9e7e3984..cf66cb40a1 100644 --- a/engines/fullpipe/sound.cpp +++ b/engines/fullpipe/sound.cpp @@ -82,6 +82,9 @@ Sound::Sound() { _description = 0; } +Sound::~Sound() { + warning("STUB: Sound::~Sound()"); +} bool Sound::load(MfcArchive &file, NGIArchive *archive) { debug(5, "Sound::load()"); diff --git a/engines/fullpipe/sound.h b/engines/fullpipe/sound.h index 07830e9617..ca64832c04 100644 --- a/engines/fullpipe/sound.h +++ b/engines/fullpipe/sound.h @@ -34,8 +34,10 @@ class Sound : public MemoryObject { byte *_soundData; Audio::SoundHandle _handle; - public: +public: Sound(); + virtual ~Sound(); + virtual bool load(MfcArchive &file, NGIArchive *archive); virtual bool load(MfcArchive &file) { assert(0); return false; } // Disable base class void updateVolume(); diff --git a/engines/fullpipe/stateloader.cpp b/engines/fullpipe/stateloader.cpp index 9c54947b35..fdf38ada1f 100644 --- a/engines/fullpipe/stateloader.cpp +++ b/engines/fullpipe/stateloader.cpp @@ -31,6 +31,7 @@ #include "fullpipe/scene.h" #include "fullpipe/statics.h" #include "fullpipe/interaction.h" +#include "fullpipe/gameloader.h" #include "fullpipe/constants.h" @@ -146,6 +147,8 @@ bool GameProject::load(MfcArchive &file) { GameProject::~GameProject() { free(_headerFilename); + + delete _sceneTagList; } GameVar::GameVar() { @@ -159,6 +162,10 @@ GameVar::GameVar() { _varName = 0; } +GameVar::~GameVar() { + warning("STUB: GameVar::~GameVar()"); +} + bool GameVar::load(MfcArchive &file) { _varName = file.readPascalString(); _varType = file.readUint32LE(); @@ -321,4 +328,8 @@ bool PicAniInfo::load(MfcArchive &file) { return true; } +void FullpipeEngine::updateMap(PreloadItem *pre) { + warning("STUB: FullpipeEngine::updateMap()"); +} + } // End of namespace Fullpipe diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp index c6edce9621..10d9b4dfdf 100644 --- a/engines/fullpipe/statics.cpp +++ b/engines/fullpipe/statics.cpp @@ -127,6 +127,10 @@ StaticANIObject::StaticANIObject() { _objtype = kObjTypeStaticANIObject; } +StaticANIObject::~StaticANIObject() { + warning("STUB: StaticANIObject::~StaticANIObject()"); +} + StaticANIObject::StaticANIObject(StaticANIObject *src) : GameObject(src) { _shadowsOn = src->_shadowsOn; _field_30 = src->_field_30; @@ -659,6 +663,19 @@ void StaticANIObject::initMovements() { ((Movement *)_movements[i])->removeFirstPhase(); } +void StaticANIObject::preloadMovements(MovTable *mt) { + if ( mt ) { + for (uint i = 0; i < _movements.size(); i++) { + Movement *mov = (Movement *)_movements[i]; + + if (mt->movs[i] == 1) + mov->loadPixelData(); + else if (mt->movs[i] == 2) + mov->freePixelData(); + } + } +} + Common::Point *StaticANIObject::getCurrDimensions(Common::Point &p) { Picture *pic; @@ -830,6 +847,44 @@ void StaticANIObject::updateStepPos() { setOXY(ox + x, oy + y); } +Common::Point *StaticANIObject::calcNextStep(Common::Point *pRes) { + if (!_movement) { + pRes->x = 0; + pRes->y = 0; + + return pRes; + } + + Common::Point point; + + _movement->calcSomeXY(point, 1); + + int resX = point.x; + int resY = point.y; + + int pointN, offset; + + if (_someDynamicPhaseIndex <= 0) { + pointN = _stepArray.getCurrPointIndex(); + offset = _stepArray.getPointsCount() - _stepArray.getCurrPointIndex(); + } else { + pointN = _stepArray.getCurrPointIndex(); + offset = 1 - _movement->_currDynamicPhaseIndex + _someDynamicPhaseIndex; + } + + if (pointN >= 0) { + _stepArray.getPoint(&point, pointN, offset); + + resX += point.x; + resY += point.y; + } + + pRes->x = resX; + pRes->y = resY; + + return pRes; +} + void StaticANIObject::stopAnim_maybe() { debug(6, "StaticANIObject::stopAnim_maybe()"); @@ -898,7 +953,24 @@ void StaticANIObject::stopAnim_maybe() { } void StaticANIObject::adjustSomeXY() { - warning("STUB: StaticANIObject::adjustSomeXY()"); + if (_movement) { + Common::Point point; + + _movement->calcSomeXY(point, 0); + + int diff = abs(point.y) - abs(point.x); + + _movement->calcSomeXY(point, 1); + + if (diff > 0) + _ox += point.x; + else + _oy += point.y; + + _statics = _movement->_staticsObj2; + _movement = 0; + _someDynamicPhaseIndex = -1; + } } MessageQueue *StaticANIObject::changeStatics1(int msgNum) { @@ -1210,6 +1282,10 @@ Movement::Movement() { _somePoint.y = 0; } +Movement::~Movement() { + warning("STUB: Movement::~Movement()"); +} + Movement::Movement(Movement *src, StaticANIObject *ani) { _lastFrameSpecialFlag = 0; _flipFlag = src->_flipFlag; @@ -1613,6 +1689,15 @@ void Movement::loadPixelData() { mov->_staticsObj1->getPixelData(); } +void Movement::freePixelData() { + if (!_currMovement) + for (uint i = 0; i < _dynamicPhases.size(); i++) + ((DynamicPhase *)_dynamicPhases[i])->freePixelData(); + + if (_staticsObj1) + _staticsObj1->freePixelData(); +} + void Movement::removeFirstPhase() { if (_updateFlag1) { if (!_currDynamicPhaseIndex) diff --git a/engines/fullpipe/statics.h b/engines/fullpipe/statics.h index 258752edd1..a620daa528 100644 --- a/engines/fullpipe/statics.h +++ b/engines/fullpipe/statics.h @@ -132,6 +132,8 @@ class Movement : public GameObject { public: Movement(); + virtual ~Movement(); + Movement(Movement *src, StaticANIObject *ani); Movement(Movement *src, int *flag1, int flag2, StaticANIObject *ani); @@ -162,6 +164,7 @@ class Movement : public GameObject { void gotoLastFrame(); void loadPixelData(); + void freePixelData(); void draw(bool flipFlag, int angle); }; @@ -187,11 +190,12 @@ class StaticANIObject : public GameObject { int _counter; int _someDynamicPhaseIndex; - public: +public: int16 _sceneId; - public: +public: StaticANIObject(); + virtual ~StaticANIObject(); StaticANIObject(StaticANIObject *src); virtual bool load(MfcArchive &file); @@ -220,6 +224,7 @@ class StaticANIObject : public GameObject { void initMovements(); void loadMovementsPixelData(); + void preloadMovements(MovTable *mt); void setSomeDynamicPhaseIndex(int val) { _someDynamicPhaseIndex = val; } void adjustSomeXY(); @@ -243,6 +248,7 @@ class StaticANIObject : public GameObject { void updateStepPos(); void stopAnim_maybe(); + Common::Point *calcNextStep(Common::Point *point); MessageQueue *changeStatics1(int msgNum); void changeStatics2(int objId); @@ -253,6 +259,9 @@ class StaticANIObject : public GameObject { struct MovTable { int count; int16 *movs; + + MovTable() { count = 0; movs = 0; } + ~MovTable() { free(movs); } }; } // End of namespace Fullpipe diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index b68dd48b0f..6f57019cf2 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -40,7 +40,7 @@ namespace Mortevielle { * @remarks Originally called 'taller' */ void MortevielleEngine::fctMove() { - int oldMenu = (_menu._moveMenu[6]._menuId << 8) | _menu._moveMenu[6]._actionId; + int oldMenu = (_menu->_moveMenu[6]._menuId << 8) | _menu->_moveMenu[6]._actionId; if ((_coreVar._currPlace == ROOM26) && (_currAction == oldMenu)) { _coreVar._currPlace = LANDING; _caff = _coreVar._currPlace; @@ -65,10 +65,10 @@ void MortevielleEngine::fctMove() { if (_num == 1) { _coreVar._currPlace = OWN_ROOM; - _menu.setDestinationText(OWN_ROOM); + _menu->setDestinationText(OWN_ROOM); } else if (_num == 7) { _coreVar._currPlace = ATTIC; - _menu.setDestinationText(ATTIC); + _menu->setDestinationText(ATTIC); } else if (_num != 6) _coreVar._currPlace = ROOM26; @@ -85,10 +85,10 @@ void MortevielleEngine::fctMove() { } exitRoom(); int menuChoice = 1; - oldMenu = (_menu._moveMenu[menuChoice]._menuId << 8) | _menu._moveMenu[menuChoice]._actionId; + oldMenu = (_menu->_moveMenu[menuChoice]._menuId << 8) | _menu->_moveMenu[menuChoice]._actionId; while (oldMenu != _currAction) { ++menuChoice; - oldMenu = (_menu._moveMenu[menuChoice]._menuId << 8) | _menu._moveMenu[menuChoice]._actionId; + oldMenu = (_menu->_moveMenu[menuChoice]._menuId << 8) | _menu->_moveMenu[menuChoice]._actionId; } switch (_coreVar._currPlace) { @@ -97,14 +97,14 @@ void MortevielleEngine::fctMove() { gotoManorFront(); else if (menuChoice == 2) checkManorDistance(); - _menu.setDestinationText(_coreVar._currPlace); + _menu->setDestinationText(_coreVar._currPlace); return; case INSIDE_WELL: if (menuChoice == 1) floodedInWell(); else if (menuChoice == 2) gotoManorBack(); - _menu.setDestinationText(_coreVar._currPlace); + _menu->setDestinationText(_coreVar._currPlace); return; case BUREAU: if (menuChoice == 1) @@ -193,7 +193,7 @@ void MortevielleEngine::fctMove() { if ((menuChoice < 5) || (menuChoice == 13) || (menuChoice == 14)) prepareDisplayText(); resetRoomVariables(_coreVar._currPlace); - _menu.setDestinationText(_coreVar._currPlace); + _menu->setDestinationText(_coreVar._currPlace); } /** @@ -224,7 +224,7 @@ void MortevielleEngine::fctTake() { _coreVar._secretPassageObjectId = 0; if (_coreVar._currPlace == WELL) _coreVar._wellObjectId = 0; - _menu.unsetSearchMenu(); + _menu->unsetSearchMenu(); _obpart = false; prepareDisplayText(); } else { @@ -325,7 +325,7 @@ void MortevielleEngine::fctInventoryTake() { int oldMenu = 0; do { ++inventIndex; - oldMenu = (_menu._inventoryMenu[inventIndex]._menuId << 8) | _menu._inventoryMenu[inventIndex]._actionId; + oldMenu = (_menu->_inventoryMenu[inventIndex]._menuId << 8) | _menu->_inventoryMenu[inventIndex]._actionId; } while (oldMenu != _currAction); int cz = 0; int cy = 0; @@ -336,7 +336,7 @@ void MortevielleEngine::fctInventoryTake() { } while (cz != inventIndex); cz = _coreVar._inventory[cy]; _coreVar._inventory[cy] = 0; - _menu.setInventoryText(); + _menu->setInventoryText(); putInHand(cz); _crep = 998; clearDescriptionBar(); @@ -536,7 +536,7 @@ void MortevielleEngine::fctSearch() { if (_curSearchObjId != 0) { _searchCount = 0; _heroSearching = true; - _menu.setSearchMenu(); + _menu->setSearchMenu(); prepareNextObject(); } else _crep = 997; @@ -607,7 +607,7 @@ void MortevielleEngine::fctOpen() { if (_caff == ROOM26) { if (_roomDoorId != OWN_ROOM) { - _currAction = _menu._opcodeEnter; + _currAction = _menu->_opcodeEnter; _syn = true; } else _crep = 997; @@ -663,11 +663,11 @@ void MortevielleEngine::fctOpen() { || (_coreVar._currPlace == PURPLE_ROOM) || (_coreVar._currPlace == BLUE_ROOM)) { if (getRandomNumber(1, 4) == 3) - _soundManager.startSpeech(7, 9, 1); + _soundManager->startSpeech(7, 9, 1); } _openObjects[i] = _num; displayAnimFrame(1, _num); - _soundManager.waitSpeech(); + _soundManager->waitSpeech(); } int tmpPlace = _coreVar._currPlace; if (_coreVar._currPlace == CRYPT) @@ -731,21 +731,21 @@ void MortevielleEngine::fctPlace() { displayAnimFrame(1, 1); handleDescriptionText(2, 165); displayEmptyHand(); - _soundManager.startSpeech(6, -9, 1); + _soundManager->startSpeech(6, -9, 1); // Do you want to enter the hidden passage? - int answer = _dialogManager.show(getEngineString(S_YES_NO)); + int answer = _dialogManager->show(getEngineString(S_YES_NO)); if (answer == 1) { Common::String alertTxt = getString(582); - _dialogManager.show(alertTxt); + _dialogManager->show(alertTxt); - bool enterPassageFl = _dialogManager.showKnowledgeCheck(); - _mouse.hideMouse(); + bool enterPassageFl = _dialogManager->showKnowledgeCheck(); + _mouse->hideMouse(); clearScreen(); drawRightFrame(); clearDescriptionBar(); clearVerbBar(); - _mouse.showMouse(); + _mouse->showMouse(); prepareRoom(); drawClock(); if (_currBitIndex != 0) @@ -753,18 +753,18 @@ void MortevielleEngine::fctPlace() { else displayAloneText(); - _menu.displayMenu(); + _menu->displayMenu(); if (enterPassageFl) { _coreVar._currPlace = SECRET_PASSAGE; - _menu.setDestinationText(SECRET_PASSAGE); + _menu->setDestinationText(SECRET_PASSAGE); } else { - _menu.setDestinationText(_coreVar._currPlace); + _menu->setDestinationText(_coreVar._currPlace); setPal(14); drawPicture(); displayAnimFrame(1, 2); displayAnimFrame(1, 1); alertTxt = getString(577); - _dialogManager.show(alertTxt); + _dialogManager->show(alertTxt); displayAnimFrame(2, 1); _crep = 166; } @@ -832,8 +832,8 @@ void MortevielleEngine::fctTurn() { _crep = 997; if ((_coreVar._currPlace == ATTIC) && (_coreVar._atticRodHoleObjectId == 159) && (_coreVar._atticBallHoleObjectId == 141)) { handleDescriptionText(2, 167); - _soundManager.startSpeech(7, 9, 1); - int answer = _dialogManager.show(getEngineString(S_YES_NO)); + _soundManager->startSpeech(7, 9, 1); + int answer = _dialogManager->show(getEngineString(S_YES_NO)); if (answer == 1) _endGame = true; else @@ -842,8 +842,8 @@ void MortevielleEngine::fctTurn() { if ((_coreVar._currPlace == SECRET_PASSAGE) && (_coreVar._secretPassageObjectId == 143)) { handleDescriptionText(2, 175); clearVerbBar(); - _soundManager.startSpeech(6, -9, 1); - int answer = _dialogManager.show(getEngineString(S_YES_NO)); + _soundManager->startSpeech(6, -9, 1); + int answer = _dialogManager->show(getEngineString(S_YES_NO)); if (answer == 1) { _coreVar._currPlace = CRYPT; prepareDisplayText(); @@ -949,7 +949,7 @@ void MortevielleEngine::fctKnock() { displayTextInVerbBar(getEngineString(S_HIT)); if (_coreVar._currPlace == LANDING) { - _dialogManager.show(getEngineString(S_BEFORE_USE_DEP_MENU)); + _dialogManager->show(getEngineString(S_BEFORE_USE_DEP_MENU)); return; } @@ -967,7 +967,7 @@ void MortevielleEngine::fctKnock() { if (_coreVar._currPlace == ROOM26) { int rand = (getRandomNumber(0, 8)) - 4; - _soundManager.startSpeech(11, rand, 1); + _soundManager->startSpeech(11, rand, 1); int pres = getPresenceStats(rand, _coreVar._faithScore, _roomDoorId); if (_roomDoorId != OWN_ROOM) { if (pres != -500) { @@ -1132,7 +1132,7 @@ void MortevielleEngine::fctEat() { _coreVar._currPlace = DINING_ROOM; _caff = DINING_ROOM; resetRoomVariables(_coreVar._currPlace); - _menu.setDestinationText(_coreVar._currPlace); + _menu->setDestinationText(_coreVar._currPlace); int day, hour, minute; updateHour(day, hour, minute); @@ -1168,7 +1168,7 @@ void MortevielleEngine::fctEat() { void MortevielleEngine::fctEnter() { if ((_coreVar._currPlace == MANOR_FRONT) || (_coreVar._currPlace == MANOR_BACK)) { gotoDiningRoom(); - _menu.setDestinationText(_coreVar._currPlace); + _menu->setDestinationText(_coreVar._currPlace); } else if (_coreVar._currPlace == LANDING) showMoveMenuAlert(); else if (_roomDoorId == OWN_ROOM) @@ -1185,15 +1185,15 @@ void MortevielleEngine::fctEnter() { _crep = 179; else { int randVal = (getRandomNumber(0, 10)) - 5; - _soundManager.startSpeech(7, randVal, 1); + _soundManager->startSpeech(7, randVal, 1); displayAnimFrame(1, 1); - _soundManager.waitSpeech(); + _soundManager->waitSpeech(); int charIndex = convertBitIndexToCharacterIndex(pres); ++_coreVar._faithScore; _coreVar._currPlace = LANDING; _currMenu = MENU_DISCUSS; - _currAction = (_menu._discussMenu[charIndex]._menuId << 8) | _menu._discussMenu[charIndex]._actionId; + _currAction = (_menu->_discussMenu[charIndex]._menuId << 8) | _menu->_discussMenu[charIndex]._actionId; _syn = true; if (_roomDoorId == JULIA_ROOM) { _col = true; @@ -1207,14 +1207,14 @@ void MortevielleEngine::fctEnter() { } } else { int randVal = (getRandomNumber(0, 10)) - 5; - _soundManager.startSpeech(7, randVal, 1); + _soundManager->startSpeech(7, randVal, 1); displayAnimFrame(1, 1); - _soundManager.waitSpeech(); + _soundManager->waitSpeech(); _coreVar._currPlace = _roomDoorId; prepareDisplayText(); resetRoomVariables(_coreVar._currPlace); - _menu.setDestinationText(_coreVar._currPlace); + _menu->setDestinationText(_coreVar._currPlace); _roomDoorId = OWN_ROOM; _savedBitIndex = 0; _currBitIndex = 0; @@ -1237,7 +1237,7 @@ void MortevielleEngine::fctSleep() { prepareDisplayText(); drawPictureWithText(); resetRoomVariables(_coreVar._currPlace); - _menu.setDestinationText(_coreVar._currPlace); + _menu->setDestinationText(_coreVar._currPlace); } clearVerbBar(); clearDescriptionBar(); @@ -1261,7 +1261,7 @@ void MortevielleEngine::fctSleep() { if (hour > 23) hour = 0; prepareRoom(); - answer = _dialogManager.show(getEngineString(S_YES_NO)); + answer = _dialogManager->show(getEngineString(S_YES_NO)); _anyone = false; } while (answer != 1); _crep = 998; @@ -1321,7 +1321,7 @@ void MortevielleEngine::fctLeave() { if (_crep == 0) _crep = nextPlace; resetRoomVariables(nextPlace); - _menu.setDestinationText(nextPlace); + _menu->setDestinationText(nextPlace); } } @@ -1351,7 +1351,7 @@ void MortevielleEngine::fctWait() { return; } handleDescriptionText(2, 102); - answer = _dialogManager.show(getEngineString(S_YES_NO)); + answer = _dialogManager->show(getEngineString(S_YES_NO)); } while (answer != 2); _crep = 998; if (!_anyone) @@ -1394,7 +1394,7 @@ void MortevielleEngine::fctDiscuss() { int oldMenu; do { ++cx; - oldMenu = (_menu._discussMenu[cx]._menuId << 8) | _menu._discussMenu[cx]._actionId; + oldMenu = (_menu->_discussMenu[cx]._menuId << 8) | _menu->_discussMenu[cx]._actionId; } while (oldMenu != _currAction); _caff = 69 + cx; drawPictureWithText(); @@ -1403,7 +1403,7 @@ void MortevielleEngine::fctDiscuss() { } testKey(false); menuUp(); - _mouse.hideMouse(); + _mouse->hideMouse(); clearScreen(); drawDiscussionBox(); startDialog(displId); @@ -1417,13 +1417,13 @@ void MortevielleEngine::fctDiscuss() { } lib[46] = lib[45]; lib[45] = ' '; - _mouse.showMouse(); + _mouse->showMouse(); do { choice = 0; int posX = 0; int posY = 0; for (int icm = 1; icm < 43; icm++) { - _screenSurface.putxy(posX, posY); + _screenSurface->putxy(posX, posY); if (_coreVar._availableQuestion[icm] == '*') { // If question already asked, write it in reverse video if (questionAsked[icm]) @@ -1438,17 +1438,17 @@ void MortevielleEngine::fctDiscuss() { } else posY += 8; } - _screenSurface.putxy(320, 176); + _screenSurface->putxy(320, 176); displayQuestionText(lib[46], 0); char retKey = '\0'; bool click; do { bool dummyFl; - _mouse.moveMouse(dummyFl, retKey); + _mouse->moveMouse(dummyFl, retKey); if (shouldQuit()) return; - _mouse.getMousePosition(x, y, click); + _mouse->getMousePosition(x, y, click); x *= (3 - kResolutionScaler); if (x > 319) cx = 41; @@ -1462,7 +1462,7 @@ void MortevielleEngine::fctDiscuss() { posX = 320; else posX = 0; - _screenSurface.putxy(posX, posY); + _screenSurface->putxy(posX, posY); if (questionAsked[choice]) displayQuestionText(lib[choice], 0); else @@ -1481,7 +1481,7 @@ void MortevielleEngine::fctDiscuss() { posX = 320; else posX = 0; - _screenSurface.putxy(posX, posY); + _screenSurface->putxy(posX, posY); if (questionAsked[choice]) displayQuestionText(lib[choice], 0); else @@ -1494,7 +1494,7 @@ void MortevielleEngine::fctDiscuss() { posX = 320; else posX = 0; - _screenSurface.putxy(posX, posY); + _screenSurface->putxy(posX, posY); if (questionAsked[ix]) displayQuestionText(lib[ix], 0); else @@ -1533,11 +1533,11 @@ void MortevielleEngine::fctDiscuss() { _coreVar._faithScore += 3; displId = 139; } - _mouse.hideMouse(); + _mouse->hideMouse(); clearScreen(); drawDiscussionBox(); startDialog(displId); - _mouse.showMouse(); + _mouse->showMouse(); if ((displId == 84) || (displId == 86)) { _coreVar._pctHintFound[5] = '*'; _coreVar._availableQuestion[7] = '*'; @@ -1551,32 +1551,32 @@ void MortevielleEngine::fctDiscuss() { _coreVar._pctHintFound[8] = '*'; _coreVar._availableQuestion[32] = '*'; } - _mouse.hideMouse(); + _mouse->hideMouse(); clearScreen(); - _mouse.showMouse(); + _mouse->showMouse(); } } while ((choice != 46) && (displId != 138)); if (_col) { _coreVar._faithScore += (3 * (_coreVar._faithScore / 10)); - _mouse.hideMouse(); + _mouse->hideMouse(); clearScreen(); drawDiscussionBox(); startDialog(138); - _mouse.showMouse(); + _mouse->showMouse(); _col = false; _coreVar._currPlace = LANDING; } _controlMenu = 0; - _mouse.hideMouse(); + _mouse->hideMouse(); clearScreen(); drawRightFrame(); - _mouse.showMouse(); + _mouse->showMouse(); showPeoplePresent(_currBitIndex); prepareRoom(); drawClock(); prepareDisplayText(); /* chech;*/ - _menu.setDestinationText(_coreVar._currPlace); + _menu->setDestinationText(_coreVar._currPlace); clearVerbBar(); } @@ -1625,13 +1625,13 @@ void MortevielleEngine::endGame() { clearVerbBar(); handleDescriptionText(9, 1509); testKey(false); - _mouse.hideMouse(); + _mouse->hideMouse(); _caff = 70; - _text.taffich(); + _text->taffich(); clearScreen(); drawDiscussionBox(); startDialog(141); - _mouse.showMouse(); + _mouse->showMouse(); clearUpperLeftPart(); handleDescriptionText(9, 1509); handleDescriptionText(2, 142); @@ -1667,7 +1667,7 @@ void MortevielleEngine::askRestart() { _day = 0; handleDescriptionText(2, 180); - int answer = _dialogManager.show(getEngineString(S_YES_NO)); + int answer = _dialogManager->show(getEngineString(S_YES_NO)); _quitGame = (answer != 1); } diff --git a/engines/mortevielle/debugger.cpp b/engines/mortevielle/debugger.cpp index 4ef5151c81..4b39462cde 100644 --- a/engines/mortevielle/debugger.cpp +++ b/engines/mortevielle/debugger.cpp @@ -25,7 +25,8 @@ namespace Mortevielle { -Debugger::Debugger() : GUI::Debugger() { +Debugger::Debugger(MortevielleEngine *vm) : GUI::Debugger() { + _vm = vm; DCmd_Register("continue", WRAP_METHOD(Debugger, Cmd_Exit)); DCmd_Register("show_questions", WRAP_METHOD(Debugger, Cmd_showAllQuestions)); DCmd_Register("reset_parano", WRAP_METHOD(Debugger, Cmd_resetParano)); @@ -52,8 +53,4 @@ bool Debugger::Cmd_resetParano(int argc, const char **argv) { return true; } -void Debugger::setParent(MortevielleEngine *vm) { - _vm = vm; -} - } // End of namespace Mortevielle diff --git a/engines/mortevielle/debugger.h b/engines/mortevielle/debugger.h index 9041d90110..6e1006681c 100644 --- a/engines/mortevielle/debugger.h +++ b/engines/mortevielle/debugger.h @@ -39,9 +39,8 @@ protected: bool Cmd_resetParano(int argc, const char **argv); public: - Debugger(); + Debugger(MortevielleEngine *vm); virtual ~Debugger() {} - void setParent(MortevielleEngine *vm); }; } // End of namespace Mortevielle diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index 9a2ade60ab..09a4227cc0 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -35,15 +35,19 @@ namespace Mortevielle { +DialogManager::DialogManager(MortevielleEngine *vm) { + _vm = vm; +} + /** * Alert function - Show * @remarks Originally called 'do_alert' */ int DialogManager::show(const Common::String &msg) { // Make a copy of the current screen surface for later restore - _vm->_backgroundSurface.copyFrom(_vm->_screenSurface); + _vm->_backgroundSurface.copyFrom(*_vm->_screenSurface); - _vm->_mouse.hideMouse(); + _vm->_mouse->hideMouse(); while (_vm->keyPressed()) _vm->getChar(); @@ -63,7 +67,7 @@ int DialogManager::show(const Common::String &msg) { } else { drawAlertBox(8, 7, colNumb); int i = 0; - _vm->_screenSurface._textPos.y = 70; + _vm->_screenSurface->_textPos.y = 70; do { curPos.x = 320; Common::String displayStr = ""; @@ -72,9 +76,9 @@ int DialogManager::show(const Common::String &msg) { displayStr += alertStr[i]; curPos.x -= 3; } - _vm->_screenSurface.putxy(curPos.x, _vm->_screenSurface._textPos.y); - _vm->_screenSurface._textPos.y += 6; - _vm->_screenSurface.drawString(displayStr, 4); + _vm->_screenSurface->putxy(curPos.x, _vm->_screenSurface->_textPos.y); + _vm->_screenSurface->_textPos.y += 6; + _vm->_screenSurface->drawString(displayStr, 4); ++i; } while (alertStr[i] != ']'); } @@ -99,17 +103,17 @@ int DialogManager::show(const Common::String &msg) { limit[2][1] = ((uint)(320 + ((uint)esp >> 1)) / 2) * kResolutionScaler; limit[2][2] = (limit[2][1]) + 40; } - _vm->_mouse.showMouse(); + _vm->_mouse->showMouse(); int id = 0; bool dummyFl = false; bool test3; do { char dummyKey = '\377'; - _vm->_mouse.moveMouse(dummyFl, dummyKey); + _vm->_mouse->moveMouse(dummyFl, dummyKey); if (_vm->shouldQuit()) return 0; - curPos = _vm->_mouse._pos; + curPos = _vm->_mouse->_pos; bool newaff = false; if ((curPos.y > 95) && (curPos.y < 105)) { bool test1 = (curPos.x > limit[1][1]) && (curPos.x < limit[1][2]); @@ -125,56 +129,56 @@ int DialogManager::show(const Common::String &msg) { else ix = 2; if (ix != id) { - _vm->_mouse.hideMouse(); + _vm->_mouse->hideMouse(); if (id != 0) { setPosition(id, coldep, esp); Common::String tmpStr(" "); tmpStr += buttonStr[id]; tmpStr += " "; - _vm->_screenSurface.drawString(tmpStr, 0); + _vm->_screenSurface->drawString(tmpStr, 0); } setPosition(ix, coldep, esp); Common::String tmp2 = " "; tmp2 += buttonStr[ix]; tmp2 += " "; - _vm->_screenSurface.drawString(tmp2, 1); + _vm->_screenSurface->drawString(tmp2, 1); id = ix; - _vm->_mouse.showMouse(); + _vm->_mouse->showMouse(); } } } if ((id != 0) && !newaff) { - _vm->_mouse.hideMouse(); + _vm->_mouse->hideMouse(); setPosition(id, coldep, esp); Common::String tmp3(" "); tmp3 += buttonStr[id]; tmp3 += " "; - _vm->_screenSurface.drawString(tmp3, 0); + _vm->_screenSurface->drawString(tmp3, 0); id = 0; - _vm->_mouse.showMouse(); + _vm->_mouse->showMouse(); } test3 = (curPos.y > 95) && (curPos.y < 105) && (((curPos.x > limit[1][1]) && (curPos.x < limit[1][2])) || ((curPos.x > limit[2][1]) && (curPos.x < limit[2][2]))); } while (!_vm->getMouseClick()); _vm->setMouseClick(false); - _vm->_mouse.hideMouse(); + _vm->_mouse->hideMouse(); if (!test3) { id = 1; setPosition(1, coldep, esp); Common::String tmp4(" "); tmp4 += buttonStr[1]; tmp4 += " "; - _vm->_screenSurface.drawString(tmp4, 1); + _vm->_screenSurface->drawString(tmp4, 1); } - _vm->_mouse.showMouse(); + _vm->_mouse->showMouse(); /* Restore the background area */ - _vm->_screenSurface.copyFrom(_vm->_backgroundSurface, 0, 0); + _vm->_screenSurface->copyFrom(_vm->_backgroundSurface, 0, 0); return id; } @@ -221,7 +225,7 @@ void DialogManager::decodeAlertDetails(Common::String inputStr, int &choiceNumb, } void DialogManager::setPosition(int ji, int coldep, int esp) { - _vm->_screenSurface.putxy(coldep + (40 + esp) * (ji - 1), 98); + _vm->_screenSurface->putxy(coldep + (40 + esp) * (ji - 1), 98); } /** @@ -235,9 +239,9 @@ void DialogManager::drawAlertBox(int firstLine, int lineNum, int width) { int y = (firstLine - 1) * 8; int xx = x + width; int yy = y + (lineNum * 8); - _vm->_screenSurface.fillRect(15, Common::Rect(x, y, xx, yy)); - _vm->_screenSurface.fillRect(0, Common::Rect(x, y + 2, xx, y + 4)); - _vm->_screenSurface.fillRect(0, Common::Rect(x, yy - 4, xx, yy - 2)); + _vm->_screenSurface->fillRect(15, Common::Rect(x, y, xx, yy)); + _vm->_screenSurface->fillRect(0, Common::Rect(x, y + 2, xx, y + 4)); + _vm->_screenSurface->fillRect(0, Common::Rect(x, yy - 4, xx, yy - 2)); } /** @@ -259,13 +263,13 @@ void DialogManager::setButtonText(Common::String c, int coldep, int nbcase, Comm while (str[l].size() < 3) str[l] += ' '; - _vm->_screenSurface.putxy(x, 98); + _vm->_screenSurface->putxy(x, 98); Common::String tmp(" "); tmp += str[l]; tmp += " "; - _vm->_screenSurface.drawString(tmp, 0); + _vm->_screenSurface->drawString(tmp, 0); x += esp + 40; } } @@ -292,13 +296,13 @@ bool DialogManager::showKnowledgeCheck() { int correctCount = 0; for (int indx = 0; indx < 10; ++indx) { - _vm->_mouse.hideMouse(); + _vm->_mouse->hideMouse(); _vm->clearScreen(); - _vm->_mouse.showMouse(); + _vm->_mouse->showMouse(); int dialogHeight = 23; - _vm->_screenSurface.fillRect(15, Common::Rect(0, 14, 630, dialogHeight)); + _vm->_screenSurface->fillRect(15, Common::Rect(0, 14, 630, dialogHeight)); Common::String tmpStr = _vm->getString(textIndexArr[indx]); - _vm->_text.displayStr(tmpStr, 20, 15, 100, 2, 0); + _vm->_text->displayStr(tmpStr, 20, 15, 100, 2, 0); int firstOption; int lastOption; @@ -318,7 +322,7 @@ bool DialogManager::showKnowledgeCheck() { tmpStr = _vm->getString(j); if ((int) tmpStr.size() > maxLength) maxLength = tmpStr.size(); - _vm->_text.displayStr(tmpStr, 100, optionPosY, 100, 1, 0); + _vm->_text->displayStr(tmpStr, 100, optionPosY, 100, 1, 0); choiceArray[prevChoice] = tmpStr; optionPosY += 8; } @@ -333,7 +337,7 @@ bool DialogManager::showKnowledgeCheck() { } coor[lastOption - firstOption + 2]._enabled = false; int rep = 6; - _vm->_screenSurface.drawBox(80, 33, 40 + (maxLength * rep), (lastOption - firstOption) * 8 + 16, 15); + _vm->_screenSurface->drawBox(80, 33, 40 + (maxLength * rep), (lastOption - firstOption) * 8 + 16, 15); rep = 0; prevChoice = 0; @@ -342,26 +346,26 @@ bool DialogManager::showKnowledgeCheck() { _vm->setMouseClick(false); bool flag; char key; - _vm->_mouse.moveMouse(flag, key); + _vm->_mouse->moveMouse(flag, key); if (_vm->shouldQuit()) return false; currChoice = 1; - while (coor[currChoice]._enabled && !_vm->_mouse.isMouseIn(coor[currChoice]._rect)) + while (coor[currChoice]._enabled && !_vm->_mouse->isMouseIn(coor[currChoice]._rect)) ++currChoice; if (coor[currChoice]._enabled) { if ((prevChoice != 0) && (prevChoice != currChoice)) { tmpStr = choiceArray[prevChoice] + '$'; - _vm->_text.displayStr(tmpStr, 100, 27 + (prevChoice * 8), 100, 1, 0); + _vm->_text->displayStr(tmpStr, 100, 27 + (prevChoice * 8), 100, 1, 0); } if (prevChoice != currChoice) { tmpStr = choiceArray[currChoice] + '$'; - _vm->_text.displayStr(tmpStr, 100, 27 + (currChoice * 8), 100, 1, 1); + _vm->_text->displayStr(tmpStr, 100, 27 + (currChoice * 8), 100, 1, 1); prevChoice = currChoice; } } else if (prevChoice != 0) { tmpStr = choiceArray[prevChoice] + '$'; - _vm->_text.displayStr(tmpStr, 100, 27 + (prevChoice * 8), 100, 1, 0); + _vm->_text->displayStr(tmpStr, 100, 27 + (prevChoice * 8), 100, 1, 0); prevChoice = 0; } } while (!((prevChoice != 0) && _vm->getMouseClick())); @@ -391,17 +395,17 @@ void DialogManager::drawF3F8() { Common::String f8 = _vm->getEngineString(S_F8); // Write the F3 and F8 text strings - _vm->_screenSurface.putxy(3, 44); - _vm->_screenSurface.drawString(f3, 5); - _vm->_screenSurface._textPos.y = 51; - _vm->_screenSurface.drawString(f8, 5); + _vm->_screenSurface->putxy(3, 44); + _vm->_screenSurface->drawString(f3, 5); + _vm->_screenSurface->_textPos.y = 51; + _vm->_screenSurface->drawString(f8, 5); // Get the width of the written text strings - int f3Width = _vm->_screenSurface.getStringWidth(f3); - int f8Width = _vm->_screenSurface.getStringWidth(f8); + int f3Width = _vm->_screenSurface->getStringWidth(f3); + int f8Width = _vm->_screenSurface->getStringWidth(f8); // Write out the bounding box - _vm->_screenSurface.drawBox(0, 42, MAX(f3Width, f8Width) + 6, 18, 7); + _vm->_screenSurface->drawBox(0, 42, MAX(f3Width, f8Width) + 6, 18, 7); } /** @@ -412,7 +416,7 @@ void DialogManager::drawF3F8() { void DialogManager::checkForF8(int SpeechNum, bool drawFrame2Fl) { _vm->testKeyboard(); do { - _vm->_soundManager.startSpeech(SpeechNum, 0, 0); + _vm->_soundManager->startSpeech(SpeechNum, 0, 0); _vm->_key = waitForF3F8(); if (_vm->shouldQuit()) return; @@ -442,7 +446,7 @@ int DialogManager::waitForF3F8() { void DialogManager::displayIntroScreen(bool drawFrame2Fl) { _vm->_caff = 50; _vm->_maff = 0; - _vm->_text.taffich(); + _vm->_text->taffich(); _vm->draw(63, 12); if (drawFrame2Fl) displayIntroFrame2(); @@ -466,7 +470,4 @@ void DialogManager::displayIntroFrame2() { _vm->handleDescriptionText(2, kDialogStringIndex + 143); } -void DialogManager::setParent(MortevielleEngine *vm) { - _vm = vm; -} } // End of namespace Mortevielle diff --git a/engines/mortevielle/dialogs.h b/engines/mortevielle/dialogs.h index 3f30851960..03dfc78023 100644 --- a/engines/mortevielle/dialogs.h +++ b/engines/mortevielle/dialogs.h @@ -51,7 +51,8 @@ private: void drawAlertBox(int firstLine, int lineNum, int width); void setButtonText(Common::String c, int coldep, int nbcase, Common::String *str, int esp); public: - void setParent(MortevielleEngine *vm); + DialogManager(MortevielleEngine *vm); + int show(const Common::String &msg); void drawF3F8(); void checkForF8(int SpeechNum, bool drawFrame2Fl); diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index daf7926438..18b0e7f1c1 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -881,6 +881,10 @@ GfxSurface::~GfxSurface() { * Screen surface *-------------------------------------------------------------------------*/ +ScreenSurface::ScreenSurface(MortevielleEngine *vm) { + _vm = vm; +} + /** * Called to populate the font data from the passed file */ @@ -1070,7 +1074,7 @@ void ScreenSurface::drawString(const Common::String &l, int command) { if (l == "") return; - _vm->_mouse.hideMouse(); + _vm->_mouse->hideMouse(); Common::Point pt = _textPos; int charWidth = 6; @@ -1082,11 +1086,11 @@ void ScreenSurface::drawString(const Common::String &l, int command) { case 0: case 2: color = 15; - _vm->_screenSurface.fillRect(0, Common::Rect(pt.x, pt.y, x, pt.y + 7)); + _vm->_screenSurface->fillRect(0, Common::Rect(pt.x, pt.y, x, pt.y + 7)); break; case 1: case 3: - _vm->_screenSurface.fillRect(15, Common::Rect(pt.x, pt.y, x, pt.y + 7)); + _vm->_screenSurface->fillRect(15, Common::Rect(pt.x, pt.y, x, pt.y + 7)); break; case 5: color = 15; @@ -1099,10 +1103,10 @@ void ScreenSurface::drawString(const Common::String &l, int command) { pt.x += 1; pt.y += 1; for (x = 1; (x <= (int)l.size()) && (l[x - 1] != 0); ++x) { - _vm->_screenSurface.writeCharacter(Common::Point(pt.x, pt.y), l[x - 1], color); + _vm->_screenSurface->writeCharacter(Common::Point(pt.x, pt.y), l[x - 1], color); pt.x += charWidth; } - _vm->_mouse.showMouse(); + _vm->_mouse->showMouse(); } /** @@ -1133,7 +1137,7 @@ void ScreenSurface::drawLine(int x, int y, int xx, int yy, int coul) { else step = 1; do { - _vm->_screenSurface.setPixel(Common::Point(abs((int)(a * i + b)), i), coul); + _vm->_screenSurface->setPixel(Common::Point(abs((int)(a * i + b)), i), coul); i += step; } while (i != yy); } else { @@ -1145,7 +1149,7 @@ void ScreenSurface::drawLine(int x, int y, int xx, int yy, int coul) { else step = 1; do { - _vm->_screenSurface.setPixel(Common::Point(i, abs((int)(a * i + b))), coul); + _vm->_screenSurface->setPixel(Common::Point(i, abs((int)(a * i + b))), coul); i = i + step; } while (i != xx); } @@ -1156,12 +1160,7 @@ void ScreenSurface::drawLine(int x, int y, int xx, int yy, int coul) { * @remarks Originally called 'paint_rect' */ void ScreenSurface::drawRectangle(int x, int y, int dx, int dy) { - _vm->_screenSurface.fillRect(11, Common::Rect(x, y, x + dx, y + dy)); + _vm->_screenSurface->fillRect(11, Common::Rect(x, y, x + dx, y + dy)); } -void ScreenSurface::setParent(MortevielleEngine *vm) { - _vm = vm; -} - - } // End of namespace Mortevielle diff --git a/engines/mortevielle/graphics.h b/engines/mortevielle/graphics.h index e31f5da29a..7f0d4823cb 100644 --- a/engines/mortevielle/graphics.h +++ b/engines/mortevielle/graphics.h @@ -91,6 +91,8 @@ private: byte _fontData[FONT_NUM_CHARS * FONT_HEIGHT]; public: + ScreenSurface(MortevielleEngine *vm); + Common::Point _textPos; // Original called xwhere/ywhere void readFontData(Common::File &f, int dataSize); Graphics::Surface lockArea(const Common::Rect &bounds); @@ -106,7 +108,6 @@ public: int getStringWidth(const Common::String &s); void drawLine(int x, int y, int xx, int yy, int coul); void drawRectangle(int x, int y, int dx, int dy); - void setParent(MortevielleEngine *vm); // TODO: Refactor code to remove this method, for increased performance void setPixel(const Common::Point &pt, int palIndex); diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 641a527c98..14fc8d4084 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -48,7 +48,8 @@ const byte menuConstants[8][4] = { {62, 46, 13, 10} }; -Menu::Menu() { +Menu::Menu(MortevielleEngine *vm) { + _vm = vm; _opcodeAttach = _opcodeWait = _opcodeForce = _opcodeSleep = OPCODE_NONE; _opcodeListen = _opcodeEnter = _opcodeClose = _opcodeSearch = OPCODE_NONE; _opcodeKnock = _opcodeScratch = _opcodeRead = _opcodeEat = OPCODE_NONE; @@ -295,8 +296,8 @@ void Menu::enableMenuItem(MenuItem item) { } void Menu::displayMenu() { - _vm->_mouse.hideMouse(); - _vm->_screenSurface.fillRect(7, Common::Rect(0, 0, 639, 10)); + _vm->_mouse->hideMouse(); + _vm->_screenSurface->fillRect(7, Common::Rect(0, 0, 639, 10)); int col = 28 * kResolutionScaler; for (int charNum = 0; charNum < 6; charNum++) { @@ -310,9 +311,9 @@ void Menu::displayMenu() { uint msk = 0x80; for (int pt = 0; pt <= 7; ++pt) { if ((_charArr[charNum][idx] & msk) != 0) { - _vm->_screenSurface.setPixel(Common::Point(x + 1, y + 1), 0); - _vm->_screenSurface.setPixel(Common::Point(x, y + 1), 0); - _vm->_screenSurface.setPixel(Common::Point(x, y), 9); + _vm->_screenSurface->setPixel(Common::Point(x + 1, y + 1), 0); + _vm->_screenSurface->setPixel(Common::Point(x, y + 1), 0); + _vm->_screenSurface->setPixel(Common::Point(x, y), 9); } msk >>= 1; ++x; @@ -322,7 +323,7 @@ void Menu::displayMenu() { } col += 48 * kResolutionScaler; } - _vm->_mouse.showMouse(); + _vm->_mouse->showMouse(); } /** @@ -348,7 +349,7 @@ void Menu::invert(int indx) { int menuIndex = _msg4 & 0xFF; - _vm->_screenSurface.putxy(menuConstants[_msg3 - 1][0] << 3, (menuIndex + 1) << 3); + _vm->_screenSurface->putxy(menuConstants[_msg3 - 1][0] << 3, (menuIndex + 1) << 3); Common::String str; switch (_msg3) { @@ -388,7 +389,7 @@ void Menu::invert(int indx) { break; } if ((str[0] != '*') && (str[0] != '<')) - _vm->_screenSurface.drawString(str, indx); + _vm->_screenSurface->drawString(str, indx); else _msg4 = OPCODE_NONE; } @@ -419,71 +420,71 @@ void Menu::util(Common::Point pos) { */ void Menu::menuDown(int ii) { // Make a copy of the current screen surface for later restore - _vm->_backgroundSurface.copyFrom(_vm->_screenSurface); + _vm->_backgroundSurface.copyFrom(*_vm->_screenSurface); // Draw the menu int minX = menuConstants[ii - 1][0] << 3; int lineNum = menuConstants[ii - 1][3]; - _vm->_mouse.hideMouse(); + _vm->_mouse->hideMouse(); int deltaX = 6; int maxX = minX + (menuConstants[ii - 1][2] * deltaX) + 6; if ((ii == 4) && (_vm->getLanguage() == Common::EN_ANY)) // Extra width needed for Self menu in English version maxX = 435; - _vm->_screenSurface.fillRect(15, Common::Rect(minX, 12, maxX, 10 + (menuConstants[ii - 1][1] << 1))); - _vm->_screenSurface.fillRect(0, Common::Rect(maxX, 12, maxX + 4, 10 + (menuConstants[ii - 1][1] << 1))); - _vm->_screenSurface.fillRect(0, Common::Rect(minX, 8 + (menuConstants[ii - 1][1] << 1), maxX + 4, 12 + (menuConstants[ii - 1][1] << 1))); - _vm->_screenSurface.putxy(minX, 16); + _vm->_screenSurface->fillRect(15, Common::Rect(minX, 12, maxX, 10 + (menuConstants[ii - 1][1] << 1))); + _vm->_screenSurface->fillRect(0, Common::Rect(maxX, 12, maxX + 4, 10 + (menuConstants[ii - 1][1] << 1))); + _vm->_screenSurface->fillRect(0, Common::Rect(minX, 8 + (menuConstants[ii - 1][1] << 1), maxX + 4, 12 + (menuConstants[ii - 1][1] << 1))); + _vm->_screenSurface->putxy(minX, 16); for (int i = 1; i <= lineNum; i++) { switch (ii) { case 1: if (_inventoryStringArray[i][0] != '*') - _vm->_screenSurface.drawString(_inventoryStringArray[i], 4); + _vm->_screenSurface->drawString(_inventoryStringArray[i], 4); break; case 2: if (_moveStringArray[i][0] != '*') - _vm->_screenSurface.drawString(_moveStringArray[i], 4); + _vm->_screenSurface->drawString(_moveStringArray[i], 4); break; case 3: if (_actionStringArray[i][0] != '*') - _vm->_screenSurface.drawString(_actionStringArray[i], 4); + _vm->_screenSurface->drawString(_actionStringArray[i], 4); break; case 4: if (_selfStringArray[i][0] != '*') - _vm->_screenSurface.drawString(_selfStringArray[i], 4); + _vm->_screenSurface->drawString(_selfStringArray[i], 4); break; case 5: if (_discussStringArray[i][0] != '*') - _vm->_screenSurface.drawString(_discussStringArray[i], 4); + _vm->_screenSurface->drawString(_discussStringArray[i], 4); break; case 6: - _vm->_screenSurface.drawString(_vm->getEngineString(S_SAVE_LOAD + i), 4); + _vm->_screenSurface->drawString(_vm->getEngineString(S_SAVE_LOAD + i), 4); break; case 7: { Common::String s = _vm->getEngineString(S_SAVE_LOAD + 1); s += ' '; s += (char)(48 + i); - _vm->_screenSurface.drawString(s, 4); + _vm->_screenSurface->drawString(s, 4); } break; case 8: if (i == 1) - _vm->_screenSurface.drawString(_vm->getEngineString(S_RESTART), 4); + _vm->_screenSurface->drawString(_vm->getEngineString(S_RESTART), 4); else { Common::String s = _vm->getEngineString(S_SAVE_LOAD + 2); s += ' '; s += (char)(47 + i); - _vm->_screenSurface.drawString(s, 4); + _vm->_screenSurface->drawString(s, 4); } break; default: break; } - _vm->_screenSurface.putxy(minX, _vm->_screenSurface._textPos.y + 8); + _vm->_screenSurface->putxy(minX, _vm->_screenSurface->_textPos.y + 8); } _multiTitle = true; - _vm->_mouse.showMouse(); + _vm->_mouse->showMouse(); } /** @@ -492,11 +493,11 @@ void Menu::menuDown(int ii) { void Menu::menuUp(int msgId) { if (_multiTitle) { /* Restore the background area */ - assert(_vm->_screenSurface.pitch == _vm->_backgroundSurface.pitch); + assert(_vm->_screenSurface->pitch == _vm->_backgroundSurface.pitch); // Get a pointer to the source and destination of the area to restore const byte *pSrc = (const byte *)_vm->_backgroundSurface.getBasePtr(0, 10); - Graphics::Surface destArea = _vm->_screenSurface.lockArea(Common::Rect(0, 10, SCREEN_WIDTH, SCREEN_HEIGHT)); + Graphics::Surface destArea = _vm->_screenSurface->lockArea(Common::Rect(0, 10, SCREEN_WIDTH, SCREEN_HEIGHT)); byte *pDest = (byte *)destArea.getPixels(); // Copy the data @@ -523,7 +524,7 @@ void Menu::updateMenu() { if (!_menuActive) return; - Common::Point curPos = _vm->_mouse._pos; + Common::Point curPos = _vm->_mouse->_pos; if (!_vm->getMouseClick()) { if (curPos == _vm->_prevPos) return; @@ -590,10 +591,6 @@ void Menu::updateMenu() { } } -void Menu::setParent(MortevielleEngine *vm) { - _vm = vm; -} - void Menu::initMenu() { Common::File f; diff --git a/engines/mortevielle/menu.h b/engines/mortevielle/menu.h index debf5b09b6..d8a3b4d0d6 100644 --- a/engines/mortevielle/menu.h +++ b/engines/mortevielle/menu.h @@ -60,7 +60,7 @@ private: void menuDown(int ii); public: - Menu(); + Menu(MortevielleEngine *vm); bool _menuActive; bool _menuSelected; @@ -103,7 +103,6 @@ public: int _opcodeSLook; MenuItem _actionMenu[12]; - void setParent(MortevielleEngine *vm); void readVerbNums(Common::File &f, int dataSize); void setText(MenuItem item, Common::String name); void setDestinationText(int roomId); diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index d434150977..34372ba32a 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -47,17 +47,16 @@ namespace Mortevielle { MortevielleEngine *g_vm; MortevielleEngine::MortevielleEngine(OSystem *system, const MortevielleGameDescription *gameDesc): - Engine(system), _gameDescription(gameDesc), _randomSource("mortevielle"), - _soundManager(_mixer) { + Engine(system), _gameDescription(gameDesc), _randomSource("mortevielle") { g_vm = this; - _debugger.setParent(this); - _dialogManager.setParent(this); - _screenSurface.setParent(this); - _mouse.setParent(this); - _text.setParent(this); - _soundManager.setParent(this); - _savegameManager.setParent(this); - _menu.setParent(this); + _debugger = new Debugger(this); + _dialogManager = new DialogManager(this); + _screenSurface = new ScreenSurface(this); + _mouse = new MouseHandler(this); + _text = new TextHandler(this); + _soundManager = new SoundManager(this, _mixer); + _savegameManager = new SavegameManager(this); + _menu = new Menu(this); _lastGameFrame = 0; _mouseClick = false; @@ -105,6 +104,15 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const MortevielleGameDescr } MortevielleEngine::~MortevielleEngine() { + delete _menu; + delete _savegameManager; + delete _soundManager; + delete _text; + delete _mouse; + delete _screenSurface; + delete _dialogManager; + delete _debugger; + free(_curPict); free(_curAnim); free(_rightFramePict); @@ -140,7 +148,7 @@ bool MortevielleEngine::canSaveGameStateCurrently() { * Load in a savegame at the specified slot number */ Common::Error MortevielleEngine::loadGameState(int slot) { - return _savegameManager.loadGame(slot); + return _savegameManager->loadGame(slot); } /** @@ -150,7 +158,7 @@ Common::Error MortevielleEngine::saveGameState(int slot, const Common::String &d if (slot == 0) return Common::kWritingFailed; - return _savegameManager.saveGame(slot, desc); + return _savegameManager->saveGame(slot, desc); } /** @@ -196,7 +204,7 @@ Common::ErrorCode MortevielleEngine::initialize() { DebugMan.addDebugChannel(kMortevielleGraphics, "graphics", "Graphics debugging"); // Set up an intermediate screen surface - _screenSurface.create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()); + _screenSurface->create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()); _txxFileFl = false; // Load texts from TXX files @@ -205,7 +213,7 @@ Common::ErrorCode MortevielleEngine::initialize() { // Load the mort.dat resource Common::ErrorCode result = loadMortDat(); if (result != Common::kNoError) { - _screenSurface.free(); + _screenSurface->free(); return result; } @@ -235,8 +243,8 @@ Common::ErrorCode MortevielleEngine::initialize() { testKeyboard(); clearScreen(); - _soundManager.loadNoise(); - _soundManager.loadAmbiantSounds(); + _soundManager->loadNoise(); + _soundManager->loadAmbiantSounds(); return Common::kNoError; } @@ -278,13 +286,13 @@ Common::ErrorCode MortevielleEngine::loadMortDat() { if (!strncmp(dataType, "FONT", 4)) { // Font resource - _screenSurface.readFontData(f, dataSize); + _screenSurface->readFontData(f, dataSize); } else if (!strncmp(dataType, "SSTR", 4)) { readStaticStrings(f, dataSize, kStaticStrings); } else if ((!strncmp(dataType, "GSTR", 4)) && (!_txxFileFl)) { readStaticStrings(f, dataSize, kGameStrings); } else if (!strncmp(dataType, "VERB", 4)) { - _menu.readVerbNums(f, dataSize); + _menu->readVerbNums(f, dataSize); } else { // Unknown section f.skip(dataSize); @@ -369,21 +377,21 @@ Common::Error MortevielleEngine::run() { showIntroduction(); else { _caff = 51; - _text.taffich(); + _text->taffich(); } // Either load the initial game state savegame, or the specified savegame number adzon(); resetVariables(); if (loadSlot != 0) - _savegameManager.loadSavegame(generateSaveFilename(loadSlot)); + _savegameManager->loadSavegame(generateSaveFilename(loadSlot)); // Run the main game loop mainGame(); // Cleanup (allocated in initialize()) - _screenSurface.free(); - free(_soundManager._cfiphBuffer); + _screenSurface->free(); + free(_soundManager->_cfiphBuffer); free(_cfiecBuffer); return Common::kNoError; @@ -393,13 +401,13 @@ Common::Error MortevielleEngine::run() { * Show the game introduction */ void MortevielleEngine::showIntroduction() { - _dialogManager.displayIntroScreen(false); - _dialogManager.checkForF8(142, false); + _dialogManager->displayIntroScreen(false); + _dialogManager->checkForF8(142, false); if (shouldQuit()) return; - _dialogManager.displayIntroFrame2(); - _dialogManager.checkForF8(143, true); + _dialogManager->displayIntroFrame2(); + _dialogManager->checkForF8(143, true); if (shouldQuit()) return; @@ -419,13 +427,13 @@ void MortevielleEngine::mainGame() { for (_crep = 1; _crep <= _x26KeyCount; ++_crep) decodeNumber(&_cfiecBuffer[161 * 16], (_cfiecBufferSize - (161 * 16)) / 64); - _menu.initMenu(); + _menu->initMenu(); charToHour(); initGame(); clearScreen(); drawRightFrame(); - _mouse.showMouse(); + _mouse->showMouse(); // Loop to play the game do { diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 5ae94987a0..579e495b65 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -427,17 +427,18 @@ public: byte *_curAnim; byte *_rightFramePict; - Debugger _debugger; - ScreenSurface _screenSurface; PaletteManager _paletteManager; GfxSurface _backgroundSurface; Common::RandomSource _randomSource; - SoundManager _soundManager; - SavegameManager _savegameManager; - Menu _menu; - MouseHandler _mouse; - TextHandler _text; - DialogManager _dialogManager; + + Debugger *_debugger; + ScreenSurface *_screenSurface; + SoundManager *_soundManager; + SavegameManager *_savegameManager; + Menu *_menu; + MouseHandler *_mouse; + TextHandler *_text; + DialogManager *_dialogManager; MortevielleEngine(OSystem *system, const MortevielleGameDescription *gameDesc); ~MortevielleEngine(); @@ -448,7 +449,7 @@ public: virtual Common::Error saveGameState(int slot, const Common::String &desc); virtual Common::Error run(); virtual void pauseEngineIntern(bool pause); - virtual GUI::Debugger *getDebugger() {return &_debugger;} + virtual GUI::Debugger *getDebugger() {return _debugger;} uint32 getGameFlags() const; Common::Language getLanguage() const; Common::Language getOriginalLanguage() const; diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index 480b4381ef..2077a4cdc5 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -33,6 +33,10 @@ namespace Mortevielle { +MouseHandler::MouseHandler(MortevielleEngine *vm) { + _vm = vm; +} + /** * Initialize the mouse * @remarks Originally called 'init_mouse' @@ -264,8 +268,4 @@ bool MouseHandler::isMouseIn(Common::Rect r) { return false; } -void MouseHandler::setParent(MortevielleEngine *vm) { - _vm = vm; -} - } // End of namespace Mortevielle diff --git a/engines/mortevielle/mouse.h b/engines/mortevielle/mouse.h index 90d1ef310e..81c02dc8bd 100644 --- a/engines/mortevielle/mouse.h +++ b/engines/mortevielle/mouse.h @@ -38,8 +38,8 @@ private: MortevielleEngine *_vm; public: Common::Point _pos; + MouseHandler(MortevielleEngine *vm); - void setParent(MortevielleEngine *vm); void initMouse(); void hideMouse(); void showMouse(); diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index d50f4005de..2518b317d5 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -35,6 +35,10 @@ namespace Mortevielle { +TextHandler::TextHandler(MortevielleEngine *vm) { + _vm = vm; +} + /** * Next word * @remarks Originally called 'l_motsuiv' @@ -59,7 +63,7 @@ void TextHandler::displayStr(Common::String inputStr, int x, int y, int dx, int // Safeguard: add $ just in case inputStr += '$'; - _vm->_screenSurface.putxy(x, y); + _vm->_screenSurface->putxy(x, y); int tab = 6; dx *= 6; dy *= 6; @@ -73,19 +77,19 @@ void TextHandler::displayStr(Common::String inputStr, int x, int y, int dx, int while (!stringParsed) { switch (inputStr[p]) { case '@': - _vm->_screenSurface.drawString(s, typ); + _vm->_screenSurface->drawString(s, typ); s = ""; ++p; xc = x; yc += 6; - _vm->_screenSurface.putxy(xc, yc); + _vm->_screenSurface->putxy(xc, yc); break; case ' ': s += ' '; xc += tab; ++p; if (nextWord(p, inputStr.c_str(), tab) + xc > xf) { - _vm->_screenSurface.drawString(s, typ); + _vm->_screenSurface->drawString(s, typ); s = ""; xc = x; yc += 6; @@ -96,20 +100,20 @@ void TextHandler::displayStr(Common::String inputStr, int x, int y, int dx, int do { j = x; do { - _vm->_screenSurface.putxy(j, i); - _vm->_screenSurface.drawString(" ", 0); + _vm->_screenSurface->putxy(j, i); + _vm->_screenSurface->drawString(" ", 0); j += 6; } while (j <= xf); i += 6; } while (i <= yf); yc = y; } - _vm->_screenSurface.putxy(xc, yc); + _vm->_screenSurface->putxy(xc, yc); } break; case '$': stringParsed = true; - _vm->_screenSurface.drawString(s, typ); + _vm->_screenSurface->drawString(s, typ); break; default: s += inputStr[p]; @@ -218,7 +222,7 @@ void TextHandler::taffich() { } _vm->_destinationOk = true; - _vm->_mouse.hideMouse(); + _vm->_mouse->hideMouse(); drawingStartPos = 0; Common::String filename, altFilename; @@ -291,8 +295,8 @@ void TextHandler::taffich() { } loadAniFile(filename, drawingStartPos, drawingSize); } - _vm->_mouse.showMouse(); - if ((a < COAT_ARMS) && ((_vm->_maff < COAT_ARMS) || (_vm->_coreVar._currPlace == LANDING)) && (_vm->_currAction != _vm->_menu._opcodeEnter)) { + _vm->_mouse->showMouse(); + if ((a < COAT_ARMS) && ((_vm->_maff < COAT_ARMS) || (_vm->_coreVar._currPlace == LANDING)) && (_vm->_currAction != _vm->_menu->_opcodeEnter)) { if ((a == ATTIC) || (a == CELLAR)) _vm->displayAloneText(); else if (!_vm->_blo) @@ -301,8 +305,4 @@ void TextHandler::taffich() { } } -void TextHandler::setParent(MortevielleEngine *vm) { - _vm = vm; -} - } // End of namespace Mortevielle diff --git a/engines/mortevielle/outtext.h b/engines/mortevielle/outtext.h index 44868036d5..397ca850dd 100644 --- a/engines/mortevielle/outtext.h +++ b/engines/mortevielle/outtext.h @@ -38,7 +38,8 @@ private: MortevielleEngine *_vm; int nextWord(int p, const char *ch, int &tab); public: - void setParent(MortevielleEngine *vm); + TextHandler (MortevielleEngine *vm); + void displayStr(Common::String inputStr, int x, int y, int dx, int dy, int typ); void loadPictureFile(Common::String filename, Common::String altFilename, int32 skipSize, int length); void loadAniFile(Common::String filename, int32 skipSize, int length); diff --git a/engines/mortevielle/saveload.cpp b/engines/mortevielle/saveload.cpp index c14a03cd60..77a9a6371e 100644 --- a/engines/mortevielle/saveload.cpp +++ b/engines/mortevielle/saveload.cpp @@ -37,7 +37,7 @@ namespace Mortevielle { static const char SAVEGAME_ID[4] = { 'M', 'O', 'R', 'T' }; -void SavegameManager::setParent(MortevielleEngine *vm) { +SavegameManager::SavegameManager(MortevielleEngine *vm) { _vm = vm; } @@ -116,14 +116,14 @@ bool SavegameManager::loadSavegame(const Common::String &filename) { * Load a saved game */ Common::Error SavegameManager::loadGame(const Common::String &filename) { - g_vm->_mouse.hideMouse(); + g_vm->_mouse->hideMouse(); g_vm->displayEmptyHand(); if (loadSavegame(filename)) { /* Initialization */ g_vm->charToHour(); g_vm->initGame(); g_vm->gameLoaded(); - g_vm->_mouse.showMouse(); + g_vm->_mouse->showMouse(); return Common::kNoError; } else return Common::kUnknownError; @@ -136,7 +136,7 @@ Common::Error SavegameManager::saveGame(int n, const Common::String &saveName) { Common::OutSaveFile *f; int i; - g_vm->_mouse.hideMouse(); + g_vm->_mouse->hideMouse(); g_vm->hourToChar(); for (i = 0; i <= 389; ++i) @@ -165,7 +165,7 @@ Common::Error SavegameManager::saveGame(int n, const Common::String &saveName) { // Skipped: dialog asking to swap floppy - g_vm->_mouse.showMouse(); + g_vm->_mouse->showMouse(); return Common::kNoError; } @@ -191,7 +191,7 @@ void SavegameManager::writeSavegameHeader(Common::OutSaveFile *out, const Common // Create a thumbnail and save it Graphics::Surface *thumb = new Graphics::Surface(); - Graphics::Surface s = g_vm->_screenSurface.lockArea(Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)); + Graphics::Surface s = g_vm->_screenSurface->lockArea(Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)); ::createThumbnail(thumb, (const byte *)s.getPixels(), SCREEN_WIDTH, SCREEN_HEIGHT, thumbPalette); Graphics::saveThumbnail(*out, *thumb); diff --git a/engines/mortevielle/saveload.h b/engines/mortevielle/saveload.h index 79747e6889..9c21b0c294 100644 --- a/engines/mortevielle/saveload.h +++ b/engines/mortevielle/saveload.h @@ -56,7 +56,8 @@ private: void sync_save(Common::Serializer &sz); public: - void setParent(MortevielleEngine *vm); + SavegameManager(MortevielleEngine *vm); + bool loadSavegame(const Common::String &filename); Common::Error loadGame(const Common::String &filename); Common::Error saveGame(int n, const Common::String &saveName); diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp index b670246726..c39c8e7024 100644 --- a/engines/mortevielle/sound.cpp +++ b/engines/mortevielle/sound.cpp @@ -55,7 +55,8 @@ namespace Mortevielle { const byte _tabdph[16] = {0, 10, 2, 0, 2, 10, 3, 0, 3, 7, 5, 0, 6, 7, 7, 10}; const byte _tabdbc[18] = {7, 23, 7, 14, 13, 9, 14, 9, 5, 12, 6, 12, 13, 4, 0, 4, 5, 9}; -SoundManager::SoundManager(Audio::Mixer *mixer) { +SoundManager::SoundManager(MortevielleEngine *vm, Audio::Mixer *mixer) { + _vm = vm; _mixer = mixer; _audioStream = nullptr; _ambiantNoiseBuf = nullptr; @@ -281,10 +282,6 @@ void SoundManager::playSong(const byte* buf, uint size, uint loops) { _mixer->stopHandle(songHandle); } -void SoundManager::setParent(MortevielleEngine *vm) { - _vm = vm; -} - void SoundManager::spfrac(int wor) { _queue[2]._rep = (uint)wor >> 12; if ((_soundType == 0) && (_queue[2]._code != 9)) { diff --git a/engines/mortevielle/sound.h b/engines/mortevielle/sound.h index cc0567fd98..5321c8946c 100644 --- a/engines/mortevielle/sound.h +++ b/engines/mortevielle/sound.h @@ -84,15 +84,13 @@ private: void litph(tablint &t, int typ, int tempo); public: - SoundManager(Audio::Mixer *mixer); + SoundManager(MortevielleEngine *vm, Audio::Mixer *mixer); ~SoundManager(); Audio::Mixer *_mixer; Audio::SoundHandle _soundHandle; uint16 *_cfiphBuffer; - void setParent(MortevielleEngine *vm); - int decodeMusic(const byte *PSrc, byte *PDest, int size); void playSong(const byte *buf, uint usize, uint loops); void loadAmbiantSounds(); diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index c4f2d5714b..6e0f266f9b 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -50,9 +50,9 @@ bool MortevielleEngine::keyPressed() { if (g_system->getMillis() > (_lastGameFrame + GAME_FRAME_DELAY)) { _lastGameFrame = g_system->getMillis(); - _screenSurface.updateScreen(); + _screenSurface->updateScreen(); - _debugger.onFrame(); + _debugger->onFrame(); } // Delay briefly to keep CPU usage down @@ -92,8 +92,8 @@ bool MortevielleEngine::handleEvents() { case Common::EVENT_LBUTTONUP: case Common::EVENT_MOUSEMOVE: _mousePos = Common::Point(event.mouse.x, event.mouse.y / 2); - _mouse._pos.x = event.mouse.x; - _mouse._pos.y = event.mouse.y / 2; + _mouse->_pos.x = event.mouse.x; + _mouse->_pos.y = event.mouse.y / 2; if (event.type == Common::EVENT_LBUTTONDOWN) _mouseClick = true; @@ -121,8 +121,8 @@ void MortevielleEngine::addKeypress(Common::Event &evt) { // Check for debugger if ((evt.kbd.keycode == Common::KEYCODE_d) && (evt.kbd.flags & Common::KBD_CTRL)) { // Attach to the debugger - _debugger.attach(); - _debugger.onFrame(); + _debugger->attach(); + _debugger->onFrame(); } else if ((evt.kbd.keycode >= Common::KEYCODE_a) && (evt.kbd.keycode <= Common::KEYCODE_z)) { // Handle alphabetic keys if (evt.kbd.hasFlags(Common::KBD_CTRL)) @@ -208,7 +208,7 @@ void MortevielleEngine::initMouse() { CursorMan.replaceCursor(CURSOR_ARROW_DATA, 16, 16, 0, 0, 0xff); CursorMan.showMouse(true); - _mouse.initMouse(); + _mouse->initMouse(); } /** @@ -237,9 +237,9 @@ void MortevielleEngine::delay(int amount) { while (g_system->getMillis() < endTime) { if (g_system->getMillis() > (_lastGameFrame + GAME_FRAME_DELAY)) { _lastGameFrame = g_system->getMillis(); - _screenSurface.updateScreen(); + _screenSurface->updateScreen(); - _debugger.onFrame(); + _debugger->onFrame(); } g_system->delayMillis(10); @@ -261,8 +261,8 @@ void MortevielleEngine::handleAction() { bool handledOpcodeFl = false; _controlMenu = 0; if (!_keyPressedEsc) { - _menu.drawMenu(); - _menu._menuDisplayed = true; + _menu->drawMenu(); + _menu->_menuDisplayed = true; temps = 0; _key = 0; funct = false; @@ -270,28 +270,28 @@ void MortevielleEngine::handleAction() { _inMainGameLoop = true; do { - _menu.updateMenu(); + _menu->updateMenu(); prepareRoom(); - _mouse.moveMouse(funct, inkey); + _mouse->moveMouse(funct, inkey); if (shouldQuit()) return; ++temps; if (keyPressed() || _mouseClick) { - _soundManager._mixer->stopHandle(_soundManager._soundHandle); + _soundManager->_mixer->stopHandle(_soundManager->_soundHandle); } - } while (!((_menu._menuSelected) || (temps > lim) || (funct) || (_anyone))); + } while (!((_menu->_menuSelected) || (temps > lim) || (funct) || (_anyone))); _inMainGameLoop = false; - _menu.eraseMenu(); - _menu._menuDisplayed = false; - if (_menu._menuSelected && (_currMenu == MENU_SAVE)) { + _menu->eraseMenu(); + _menu->_menuDisplayed = false; + if (_menu->_menuSelected && (_currMenu == MENU_SAVE)) { Common::String saveName = Common::String::format("Savegame #%d", _currAction & 15); - _savegameManager.saveGame(_currAction & 15, saveName); + _savegameManager->saveGame(_currAction & 15, saveName); } - if (_menu._menuSelected && (_currMenu == MENU_LOAD)) - _savegameManager.loadGame((_currAction & 15) - 1); + if (_menu->_menuSelected && (_currMenu == MENU_LOAD)) + _savegameManager->loadGame((_currAction & 15) - 1); if (inkey == '\103') { /* F9 */ - temps = _dialogManager.show(_hintPctMessage); + temps = _dialogManager->show(_hintPctMessage); return; } else if (inkey == '\77') { if ((_menuOpcode != OPCODE_NONE) && ((_currMenu == MENU_ACTION) || (_currMenu == MENU_SELF))) { @@ -321,12 +321,12 @@ void MortevielleEngine::handleAction() { _menuOpcode = _currAction; if (!_anyone) { if ((_heroSearching) || (_obpart)) { - if (_mouse._pos.y < 12) + if (_mouse->_pos.y < 12) return; - if ((_currAction == _menu._opcodeSound) || (_currAction == _menu._opcodeLift)) { + if ((_currAction == _menu->_opcodeSound) || (_currAction == _menu->_opcodeLift)) { handledOpcodeFl = true; - if ((_currAction == _menu._opcodeLift) || (_obpart)) { + if ((_currAction == _menu->_opcodeLift) || (_obpart)) { endSearch(); _caff = _coreVar._currPlace; _crep = 998; @@ -341,7 +341,7 @@ void MortevielleEngine::handleAction() { handleOpcode(); if ((_controlMenu == 0) && (! _loseGame) && (! _endGame)) { - _text.taffich(); + _text->taffich(); if (_destinationOk) { _destinationOk = false; drawPicture(); @@ -389,7 +389,7 @@ void MortevielleEngine::setTextColor(int col) { */ void MortevielleEngine::prepareScreenType1() { // Large drawing - _screenSurface.drawBox(0, 11, 512, 164, 15); + _screenSurface->drawBox(0, 11, 512, 164, 15); } /** @@ -500,51 +500,51 @@ void MortevielleEngine::resetPresenceInRooms(int roomId) { * @remarks Originally called 'affper' */ void MortevielleEngine::showPeoplePresent(int bitIndex) { - int xp = 580 - (_screenSurface.getStringWidth("LEO") / 2); + int xp = 580 - (_screenSurface->getStringWidth("LEO") / 2); for (int i = 1; i <= 8; ++i) - _menu.disableMenuItem(_menu._discussMenu[i]); + _menu->disableMenuItem(_menu->_discussMenu[i]); clearUpperRightPart(); if ((bitIndex & 128) == 128) { - _screenSurface.putxy(xp, 24); - _screenSurface.drawString("LEO", 4); - _menu.enableMenuItem(_menu._discussMenu[1]); + _screenSurface->putxy(xp, 24); + _screenSurface->drawString("LEO", 4); + _menu->enableMenuItem(_menu->_discussMenu[1]); } if ((bitIndex & 64) == 64) { - _screenSurface.putxy(xp, 32); - _screenSurface.drawString("PAT", 4); - _menu.enableMenuItem(_menu._discussMenu[2]); + _screenSurface->putxy(xp, 32); + _screenSurface->drawString("PAT", 4); + _menu->enableMenuItem(_menu->_discussMenu[2]); } if ((bitIndex & 32) == 32) { - _screenSurface.putxy(xp, 40); - _screenSurface.drawString("GUY", 4); - _menu.enableMenuItem(_menu._discussMenu[3]); + _screenSurface->putxy(xp, 40); + _screenSurface->drawString("GUY", 4); + _menu->enableMenuItem(_menu->_discussMenu[3]); } if ((bitIndex & 16) == 16) { - _screenSurface.putxy(xp, 48); - _screenSurface.drawString("EVA", 4); - _menu.enableMenuItem(_menu._discussMenu[4]); + _screenSurface->putxy(xp, 48); + _screenSurface->drawString("EVA", 4); + _menu->enableMenuItem(_menu->_discussMenu[4]); } if ((bitIndex & 8) == 8) { - _screenSurface.putxy(xp, 56); - _screenSurface.drawString("BOB", 4); - _menu.enableMenuItem(_menu._discussMenu[5]); + _screenSurface->putxy(xp, 56); + _screenSurface->drawString("BOB", 4); + _menu->enableMenuItem(_menu->_discussMenu[5]); } if ((bitIndex & 4) == 4) { - _screenSurface.putxy(xp, 64); - _screenSurface.drawString("LUC", 4); - _menu.enableMenuItem(_menu._discussMenu[6]); + _screenSurface->putxy(xp, 64); + _screenSurface->drawString("LUC", 4); + _menu->enableMenuItem(_menu->_discussMenu[6]); } if ((bitIndex & 2) == 2) { - _screenSurface.putxy(xp, 72); - _screenSurface.drawString("IDA", 4); - _menu.enableMenuItem(_menu._discussMenu[7]); + _screenSurface->putxy(xp, 72); + _screenSurface->drawString("IDA", 4); + _menu->enableMenuItem(_menu->_discussMenu[7]); } if ((bitIndex & 1) == 1) { - _screenSurface.putxy(xp, 80); - _screenSurface.drawString("MAX", 4); - _menu.enableMenuItem(_menu._discussMenu[8]); + _screenSurface->putxy(xp, 80); + _screenSurface->drawString("MAX", 4); + _menu->enableMenuItem(_menu->_discussMenu[8]); } _currBitIndex = bitIndex; } @@ -605,7 +605,7 @@ int MortevielleEngine::getPresenceStatsGreenRoom() { else if ((hour >= 0) && (hour < 8)) retVal = 70; - _menu.updateMenu(); + _menu->updateMenu(); return retVal; } @@ -698,19 +698,19 @@ int MortevielleEngine::getPresenceStatsRedRoom() { */ void MortevielleEngine::displayAloneText() { for (int i = 1; i <= 8; ++i) - _menu.disableMenuItem(_menu._discussMenu[i]); + _menu->disableMenuItem(_menu->_discussMenu[i]); Common::String sYou = getEngineString(S_YOU); Common::String sAre = getEngineString(S_ARE); Common::String sAlone = getEngineString(S_ALONE); clearUpperRightPart(); - _screenSurface.putxy(580 - (_screenSurface.getStringWidth(sYou) / 2), 30); - _screenSurface.drawString(sYou, 4); - _screenSurface.putxy(580 - (_screenSurface.getStringWidth(sAre) / 2), 50); - _screenSurface.drawString(sAre, 4); - _screenSurface.putxy(580 - (_screenSurface.getStringWidth(sAlone) / 2), 70); - _screenSurface.drawString(sAlone, 4); + _screenSurface->putxy(580 - (_screenSurface->getStringWidth(sYou) / 2), 30); + _screenSurface->drawString(sYou, 4); + _screenSurface->putxy(580 - (_screenSurface->getStringWidth(sAre) / 2), 50); + _screenSurface->drawString(sAre, 4); + _screenSurface->putxy(580 - (_screenSurface->getStringWidth(sAlone) / 2), 70); + _screenSurface->drawString(sAlone, 4); _currBitIndex = 0; } @@ -1255,24 +1255,24 @@ void MortevielleEngine::startMusicOrSpeech(int so) { ; } else if ((!_introSpeechPlayed) && (!_coreVar._alreadyEnteredManor)) { // Type 1: Speech - _soundManager.startSpeech(10, 1, 1); + _soundManager->startSpeech(10, 1, 1); _introSpeechPlayed = true; } else { if (((_coreVar._currPlace == MOUNTAIN) || (_coreVar._currPlace == MANOR_FRONT) || (_coreVar._currPlace == MANOR_BACK)) && (getRandomNumber(1, 3) == 2)) // Type 1: Speech - _soundManager.startSpeech(9, getRandomNumber(2, 4), 1); + _soundManager->startSpeech(9, getRandomNumber(2, 4), 1); else if ((_coreVar._currPlace == CHAPEL) && (getRandomNumber(1, 2) == 1)) // Type 1: Speech - _soundManager.startSpeech(8, 1, 1); + _soundManager->startSpeech(8, 1, 1); else if ((_coreVar._currPlace == WELL) && (getRandomNumber(1, 2) == 2)) // Type 1: Speech - _soundManager.startSpeech(12, 1, 1); + _soundManager->startSpeech(12, 1, 1); else if (_coreVar._currPlace == INSIDE_WELL) // Type 1: Speech - _soundManager.startSpeech(13, 1, 1); + _soundManager->startSpeech(13, 1, 1); else // Type 2 : music - _soundManager.startSpeech(getRandomNumber(1, 17), 1, 2); + _soundManager->startSpeech(getRandomNumber(1, 17), 1, 2); } } @@ -1284,13 +1284,13 @@ void MortevielleEngine::loseGame() { resetOpenObjects(); _roomDoorId = OWN_ROOM; _curSearchObjId = 0; - _menu.unsetSearchMenu(); + _menu->unsetSearchMenu(); if (!_blo) getPresence(MANOR_FRONT); _loseGame = true; clearUpperLeftPart(); - _screenSurface.drawBox(60, 35, 400, 50, 15); + _screenSurface->drawBox(60, 35, 400, 50, 15); handleDescriptionText(9, _crep); clearDescriptionBar(); clearVerbBar(); @@ -1333,20 +1333,20 @@ void MortevielleEngine::startDialog(int16 rep) { assert(rep >= 0); - _mouse.hideMouse(); + _mouse->hideMouse(); Common::String dialogStr = getString(rep + kDialogStringIndex); - _text.displayStr(dialogStr, 230, 4, 65, 26, 5); - _dialogManager.drawF3F8(); + _text->displayStr(dialogStr, 230, 4, 65, 26, 5); + _dialogManager->drawF3F8(); key = 0; do { - _soundManager.startSpeech(rep, haut[_caff - 69], 0); - key = _dialogManager.waitForF3F8(); + _soundManager->startSpeech(rep, haut[_caff - 69], 0); + key = _dialogManager->waitForF3F8(); if (shouldQuit()) return; } while (key != 66); clearScreen(); - _mouse.showMouse(); + _mouse->showMouse(); } /** @@ -1357,7 +1357,7 @@ void MortevielleEngine::endSearch() { _heroSearching = false; _obpart = false; _searchCount = 0; - _menu.unsetSearchMenu(); + _menu->unsetSearchMenu(); } /** @@ -1379,17 +1379,17 @@ void MortevielleEngine::gotoDiningRoom() { showPeoplePresent(_currBitIndex); _caff = 77; drawPictureWithText(); - _screenSurface.drawBox(223, 47, 155, 92, 15); + _screenSurface->drawBox(223, 47, 155, 92, 15); handleDescriptionText(2, 33); testKey(false); menuUp(); - _mouse.hideMouse(); + _mouse->hideMouse(); clearScreen(); drawDiscussionBox(); startDialog(140); drawRightFrame(); drawClock(); - _mouse.showMouse(); + _mouse->showMouse(); _coreVar._currPlace = OWN_ROOM; prepareDisplayText(); resetPresenceInRooms(DINING_ROOM); @@ -1451,8 +1451,8 @@ void MortevielleEngine::floodedInWell() { * @remarks Originally called 'antegame' */ void MortevielleEngine::gameLoaded() { - _mouse.hideMouse(); - _menu._menuDisplayed = false; + _mouse->hideMouse(); + _menu->_menuDisplayed = false; _loseGame = true; _anyone = false; _destinationOk = true; @@ -1490,11 +1490,11 @@ void MortevielleEngine::gameLoaded() { handleDescriptionText(2, _crep); clearVerbBar(); _endGame = false; - _menu.setDestinationText(_coreVar._currPlace); - _menu.setInventoryText(); + _menu->setDestinationText(_coreVar._currPlace); + _menu->setInventoryText(); if (_coreVar._selectedObjectId != 0) displayItemInHand(_coreVar._selectedObjectId + 400); - _mouse.showMouse(); + _mouse->showMouse(); } /** @@ -1508,7 +1508,7 @@ void MortevielleEngine::handleOpcode() { _keyPressedEsc = false; if (!_anyone) { if (_uptodatePresence) { - if ((_currMenu == MENU_MOVE) || (_currAction == _menu._opcodeLeave) || (_currAction == _menu._opcodeSleep) || (_currAction == _menu._opcodeEat)) { + if ((_currMenu == MENU_MOVE) || (_currAction == _menu->_opcodeLeave) || (_currAction == _menu->_opcodeSleep) || (_currAction == _menu->_opcodeEat)) { _controlMenu = 4; menuUp(); return; @@ -1521,60 +1521,60 @@ void MortevielleEngine::handleOpcode() { fctDiscuss(); else if (_currMenu == MENU_INVENTORY) fctInventoryTake(); - else if (_currAction == _menu._opcodeAttach) + else if (_currAction == _menu->_opcodeAttach) fctAttach(); - else if (_currAction == _menu._opcodeWait) + else if (_currAction == _menu->_opcodeWait) fctWait(); - else if (_currAction == _menu._opcodeForce) + else if (_currAction == _menu->_opcodeForce) fctForce(); - else if (_currAction == _menu._opcodeSleep) + else if (_currAction == _menu->_opcodeSleep) fctSleep(); - else if (_currAction == _menu._opcodeListen) + else if (_currAction == _menu->_opcodeListen) fctListen(); - else if (_currAction == _menu._opcodeEnter) + else if (_currAction == _menu->_opcodeEnter) fctEnter(); - else if (_currAction == _menu._opcodeClose) + else if (_currAction == _menu->_opcodeClose) fctClose(); - else if (_currAction == _menu._opcodeSearch) + else if (_currAction == _menu->_opcodeSearch) fctSearch(); - else if (_currAction == _menu._opcodeKnock) + else if (_currAction == _menu->_opcodeKnock) fctKnock(); - else if (_currAction == _menu._opcodeScratch) + else if (_currAction == _menu->_opcodeScratch) fctScratch(); - else if (_currAction == _menu._opcodeRead) + else if (_currAction == _menu->_opcodeRead) fctRead(); - else if (_currAction == _menu._opcodeEat) + else if (_currAction == _menu->_opcodeEat) fctEat(); - else if (_currAction == _menu._opcodePlace) + else if (_currAction == _menu->_opcodePlace) fctPlace(); - else if (_currAction == _menu._opcodeOpen) + else if (_currAction == _menu->_opcodeOpen) fctOpen(); - else if (_currAction == _menu._opcodeTake) + else if (_currAction == _menu->_opcodeTake) fctTake(); - else if (_currAction == _menu._opcodeLook) + else if (_currAction == _menu->_opcodeLook) fctLook(); - else if (_currAction == _menu._opcodeSmell) + else if (_currAction == _menu->_opcodeSmell) fctSmell(); - else if (_currAction == _menu._opcodeSound) + else if (_currAction == _menu->_opcodeSound) fctSound(); - else if (_currAction == _menu._opcodeLeave) + else if (_currAction == _menu->_opcodeLeave) fctLeave(); - else if (_currAction == _menu._opcodeLift) + else if (_currAction == _menu->_opcodeLift) fctLift(); - else if (_currAction == _menu._opcodeTurn) + else if (_currAction == _menu->_opcodeTurn) fctTurn(); - else if (_currAction == _menu._opcodeSSearch) + else if (_currAction == _menu->_opcodeSSearch) fctSelfSearch(); - else if (_currAction == _menu._opcodeSRead) + else if (_currAction == _menu->_opcodeSRead) fctSelfRead(); - else if (_currAction == _menu._opcodeSPut) + else if (_currAction == _menu->_opcodeSPut) fctSelfPut(); - else if (_currAction == _menu._opcodeSLook) + else if (_currAction == _menu->_opcodeSLook) fctSelftLook(); _hiddenHero = false; - if (_currAction == _menu._opcodeSHide) + if (_currAction == _menu->_opcodeSHide) fctSelfHide(); } else if (_anyone) { interactNPC(); @@ -1640,9 +1640,9 @@ void MortevielleEngine::charToHour() { * @remarks Originally called 'clsf1' */ void MortevielleEngine::clearUpperLeftPart() { - _mouse.hideMouse(); - _screenSurface.fillRect(0, Common::Rect(0, 11, 514, 175)); - _mouse.showMouse(); + _mouse->hideMouse(); + _screenSurface->fillRect(0, Common::Rect(0, 11, 514, 175)); + _mouse->showMouse(); } /** @@ -1650,16 +1650,16 @@ void MortevielleEngine::clearUpperLeftPart() { * @remarks Originally called 'clsf2' */ void MortevielleEngine::clearDescriptionBar() { - _mouse.hideMouse(); + _mouse->hideMouse(); if (_largestClearScreen) { - _screenSurface.fillRect(0, Common::Rect(1, 176, 633, 199)); - _screenSurface.drawBox(0, 176, 634, 23, 15); + _screenSurface->fillRect(0, Common::Rect(1, 176, 633, 199)); + _screenSurface->drawBox(0, 176, 634, 23, 15); _largestClearScreen = false; } else { - _screenSurface.fillRect(0, Common::Rect(1, 176, 633, 190)); - _screenSurface.drawBox(0, 176, 634, 14, 15); + _screenSurface->fillRect(0, Common::Rect(1, 176, 633, 190)); + _screenSurface->drawBox(0, 176, 634, 14, 15); } - _mouse.showMouse(); + _mouse->showMouse(); } /** @@ -1667,10 +1667,10 @@ void MortevielleEngine::clearDescriptionBar() { * @remarks Originally called 'clsf3' */ void MortevielleEngine::clearVerbBar() { - _mouse.hideMouse(); - _screenSurface.fillRect(0, Common::Rect(1, 192, 633, 199)); - _screenSurface.drawBox(0, 191, 634, 8, 15); - _mouse.showMouse(); + _mouse->hideMouse(); + _screenSurface->fillRect(0, Common::Rect(1, 192, 633, 199)); + _screenSurface->drawBox(0, 191, 634, 8, 15); + _mouse->showMouse(); } /** @@ -1680,10 +1680,10 @@ void MortevielleEngine::clearVerbBar() { void MortevielleEngine::clearUpperRightPart() { Common::String st; - _mouse.hideMouse(); + _mouse->hideMouse(); // Clear ambiance description - _screenSurface.fillRect(15, Common::Rect(544, 93, 600, 98)); + _screenSurface->fillRect(15, Common::Rect(544, 93, 600, 98)); if (_coreVar._faithScore < 33) st = getEngineString(S_COOL); else if (_coreVar._faithScore < 66) @@ -1691,13 +1691,13 @@ void MortevielleEngine::clearUpperRightPart() { else if (_coreVar._faithScore > 65) st = getEngineString(S_MALSAINE); - int x1 = 580 - (_screenSurface.getStringWidth(st) / 2); - _screenSurface.putxy(x1, 92); - _screenSurface.drawString(st, 4); + int x1 = 580 - (_screenSurface->getStringWidth(st) / 2); + _screenSurface->putxy(x1, 92); + _screenSurface->drawString(st, 4); // Clear person list - _screenSurface.fillRect(15, Common::Rect(560, 24, 610, 86)); - _mouse.showMouse(); + _screenSurface->fillRect(15, Common::Rect(560, 24, 610, 86)); + _mouse->showMouse(); } /** @@ -1713,7 +1713,7 @@ int MortevielleEngine::getRandomNumber(int minval, int maxval) { * @remarks Originally called 'aldepl' */ void MortevielleEngine::showMoveMenuAlert() { - _dialogManager.show(getEngineString(S_USE_DEP_MENU)); + _dialogManager->show(getEngineString(S_USE_DEP_MENU)); } /** @@ -2074,10 +2074,10 @@ void MortevielleEngine::loadCFIPH() { error("Missing file - *cfiph.mor"); } - _soundManager._cfiphBuffer = (uint16 *)malloc(sizeof(uint16) * (f.size() / 2)); + _soundManager->_cfiphBuffer = (uint16 *)malloc(sizeof(uint16) * (f.size() / 2)); for (int i = 0; i < (f.size() / 2); ++i) - _soundManager._cfiphBuffer[i] = f.readUint16BE(); + _soundManager->_cfiphBuffer[i] = f.readUint16BE(); f.close(); } @@ -2102,10 +2102,10 @@ void MortevielleEngine::music() { f.read(compMusicBuf, size); f.close(); - int musicSize = _soundManager.decodeMusic(compMusicBuf, musicBuf, size); + int musicSize = _soundManager->decodeMusic(compMusicBuf, musicBuf, size); free(compMusicBuf); - _soundManager.playSong(musicBuf, musicSize, 5); + _soundManager->playSong(musicBuf, musicSize, 5); while (keyPressed()) getChar(); @@ -2120,14 +2120,14 @@ void MortevielleEngine::showTitleScreen() { clearScreen(); handleDescriptionText(7, 2035); _caff = 51; - _text.taffich(); + _text->taffich(); testKeyboard(); clearScreen(); draw(0, 0); Common::String cpr = "COPYRIGHT 1989 : LANKHOR"; - _screenSurface.putxy(104 + 72 * kResolutionScaler, 185); - _screenSurface.drawString(cpr, 0); + _screenSurface->putxy(104 + 72 * kResolutionScaler, 185); + _screenSurface->drawString(cpr, 0); } /** @@ -2135,10 +2135,10 @@ void MortevielleEngine::showTitleScreen() { * @remarks Originally called 'dessine' */ void MortevielleEngine::draw(int x, int y) { - _mouse.hideMouse(); + _mouse->hideMouse(); setPal(_numpal); displayPicture(_curPict, x, y); - _mouse.showMouse(); + _mouse->showMouse(); } /** @@ -2147,9 +2147,9 @@ void MortevielleEngine::draw(int x, int y) { */ void MortevielleEngine::drawRightFrame() { setPal(89); - _mouse.hideMouse(); + _mouse->hideMouse(); displayPicture(_rightFramePict, 0, 0); - _mouse.showMouse(); + _mouse->showMouse(); } /** @@ -2205,7 +2205,7 @@ void MortevielleEngine::prepareRoom() { _minute = 30; drawClock(); } - if (_mouse._pos.y < 12) + if (_mouse->_pos.y < 12) return; if (!_blo) { @@ -2221,8 +2221,8 @@ void MortevielleEngine::prepareRoom() { int newTime = readclock(); if ((newTime - _currentTime) > _inGameHourDuration) { - bool activeMenu = _menu._menuActive; - _menu.eraseMenu(); + bool activeMenu = _menu->_menuActive; + _menu->eraseMenu(); _currentHourCount += ((newTime - _currentTime) / _inGameHourDuration); _currentTime = newTime; switch (_place) { @@ -2280,8 +2280,8 @@ void MortevielleEngine::prepareRoom() { prepareScreenType2(); displayTextInVerbBar(getEngineString(S_HEAR_NOISE)); int rand = (getRandomNumber(0, 4)) - 2; - _soundManager.startSpeech(1, rand, 1); - _soundManager.waitSpeech(); + _soundManager->startSpeech(1, rand, 1); + _soundManager->waitSpeech(); clearVerbBar(); } } @@ -2289,7 +2289,7 @@ void MortevielleEngine::prepareRoom() { } if (activeMenu) - _menu.drawMenu(); + _menu->drawMenu(); } } _endTime = readclock(); @@ -2315,15 +2315,15 @@ void MortevielleEngine::drawClock() { const int y = 123; const int rg = 9; - _mouse.hideMouse(); + _mouse->hideMouse(); - _screenSurface.drawRectangle(570, 118, 20, 10); - _screenSurface.drawRectangle(578, 114, 6, 18); + _screenSurface->drawRectangle(570, 118, 20, 10); + _screenSurface->drawRectangle(578, 114, 6, 18); if (_minute == 0) - _screenSurface.drawLine(((uint)x >> 1) * kResolutionScaler, y, ((uint)x >> 1) * kResolutionScaler, (y - rg), 1); + _screenSurface->drawLine(((uint)x >> 1) * kResolutionScaler, y, ((uint)x >> 1) * kResolutionScaler, (y - rg), 1); else - _screenSurface.drawLine(((uint)x >> 1) * kResolutionScaler, y, ((uint)x >> 1) * kResolutionScaler, (y + rg), 1); + _screenSurface->drawLine(((uint)x >> 1) * kResolutionScaler, y, ((uint)x >> 1) * kResolutionScaler, (y + rg), 1); int hour12 = _hour; if (hour12 > 12) @@ -2331,20 +2331,20 @@ void MortevielleEngine::drawClock() { if (hour12 == 0) hour12 = 12; - _screenSurface.drawLine(((uint)x >> 1) * kResolutionScaler, y, ((uint)(x + cv[0][hour12 - 1]) >> 1) * kResolutionScaler, y + cv[1][hour12 - 1], 1); - _mouse.showMouse(); - _screenSurface.putxy(568, 154); + _screenSurface->drawLine(((uint)x >> 1) * kResolutionScaler, y, ((uint)(x + cv[0][hour12 - 1]) >> 1) * kResolutionScaler, y + cv[1][hour12 - 1], 1); + _mouse->showMouse(); + _screenSurface->putxy(568, 154); if (_hour > 11) - _screenSurface.drawString("PM ", 1); + _screenSurface->drawString("PM ", 1); else - _screenSurface.drawString("AM ", 1); + _screenSurface->drawString("AM ", 1); - _screenSurface.putxy(550, 160); + _screenSurface->putxy(550, 160); if ((_day >= 0) && (_day <= 8)) { Common::String tmp = getEngineString(S_DAY); tmp.insertChar((char)(_day + 49), 0); - _screenSurface.drawString(tmp, 1); + _screenSurface->drawString(tmp, 1); } } @@ -2376,7 +2376,7 @@ Common::String MortevielleEngine::copy(const Common::String &s, int idx, size_t * @remarks Originally called 'hirs' */ void MortevielleEngine::clearScreen() { - _screenSurface.clearScreen(); + _screenSurface->clearScreen(); } /** @@ -2391,8 +2391,8 @@ void MortevielleEngine::initCaveOrCellar() { prepareScreenType2(); displayTextInVerbBar(getEngineString(S_SOMEONE_ENTERS)); int rand = (getRandomNumber(0, 4)) - 2; - _soundManager.startSpeech(2, rand, 1); - _soundManager.waitSpeech(); + _soundManager->startSpeech(2, rand, 1); + _soundManager->waitSpeech(); // The original was doing here a useless loop. // It has been removed @@ -2416,7 +2416,7 @@ void MortevielleEngine::displayControlMenu() { void MortevielleEngine::displayPicture(const byte *pic, int x, int y) { GfxSurface surface; surface.decode(pic); - _screenSurface.drawPicture(surface, x, y); + _screenSurface->drawPicture(surface, x, y); } void MortevielleEngine::adzon() { @@ -2465,7 +2465,7 @@ void MortevielleEngine::displayTextInDescriptionBar(int x, int y, int nb, int me Common::String tmpStr = getString(mesgId); if ((y == 182) && ((int) tmpStr.size() > nb)) y = 176; - _text.displayStr(tmpStr, x, y, nb, 20, _textColor); + _text->displayStr(tmpStr, x, y, nb, 20, _textColor); } /** @@ -2482,7 +2482,7 @@ void MortevielleEngine::handleDescriptionText(int f, int mesgId) { _largestClearScreen = false; clearDescriptionBar(); - _text.displayStr(tmpStr, 8, 176, 85, 3, 5); + _text->displayStr(tmpStr, 8, 176, 85, 3, 5); } else { mapMessageId(mesgId); switch (f) { @@ -2511,7 +2511,7 @@ void MortevielleEngine::handleDescriptionText(int f, int mesgId) { i = 5; Common::String tmpStr = getString(mesgId); - _text.displayStr(tmpStr, 80, 40, 60, 25, i); + _text->displayStr(tmpStr, 80, 40, 60, 25, i); if (mesgId == 180) _coreVar._pctHintFound[6] = '*'; @@ -2584,32 +2584,32 @@ void MortevielleEngine::resetOpenObjects() { */ void MortevielleEngine::displayTextBlock(Common::String text) { // Some dead code was present in the original: removed - _screenSurface.putxy(8, 177); + _screenSurface->putxy(8, 177); int tlig = 59 + (kResolutionScaler - 1) * 36; if ((int)text.size() < tlig) - _screenSurface.drawString(text, 5); + _screenSurface->drawString(text, 5); else if ((int)text.size() < (tlig << 1)) { - _screenSurface.putxy(8, 176); - _screenSurface.drawString(copy(text, 1, (tlig - 1)), 5); - _screenSurface.putxy(8, 182); - _screenSurface.drawString(copy(text, tlig, tlig << 1), 5); + _screenSurface->putxy(8, 176); + _screenSurface->drawString(copy(text, 1, (tlig - 1)), 5); + _screenSurface->putxy(8, 182); + _screenSurface->drawString(copy(text, tlig, tlig << 1), 5); } else { _largestClearScreen = true; clearDescriptionBar(); - _screenSurface.putxy(8, 176); - _screenSurface.drawString(copy(text, 1, (tlig - 1)), 5); - _screenSurface.putxy(8, 182); - _screenSurface.drawString(copy(text, tlig, ((tlig << 1) - 1)), 5); - _screenSurface.putxy(8, 190); - _screenSurface.drawString(copy(text, tlig << 1, tlig * 3), 5); + _screenSurface->putxy(8, 176); + _screenSurface->drawString(copy(text, 1, (tlig - 1)), 5); + _screenSurface->putxy(8, 182); + _screenSurface->drawString(copy(text, tlig, ((tlig << 1) - 1)), 5); + _screenSurface->putxy(8, 190); + _screenSurface->drawString(copy(text, tlig << 1, tlig * 3), 5); } } void MortevielleEngine::displayTextInVerbBar(Common::String text) { clearVerbBar(); - _screenSurface.putxy(8, 192); - _screenSurface.drawString(text, 5); + _screenSurface->putxy(8, 192); + _screenSurface->drawString(text, 5); } /** @@ -2622,8 +2622,8 @@ void MortevielleEngine::displayItemInHand(int objId) { if (objId != 500) strp = getString(objId - 501 + kInventoryStringIndex); - _menu.setText(_menu._inventoryMenu[8], strp); - _menu.disableMenuItem(_menu._inventoryMenu[8]); + _menu->setText(_menu->_inventoryMenu[8], strp); + _menu->disableMenuItem(_menu->_inventoryMenu[8]); } /** @@ -2831,7 +2831,7 @@ int MortevielleEngine::getPresence(int roomId) { * @remarks Originally called 'writetp' */ void MortevielleEngine::displayQuestionText(Common::String s, int cmd) { - _screenSurface.drawString(s, cmd); + _screenSurface->drawString(s, cmd); } /** @@ -2855,7 +2855,7 @@ void MortevielleEngine::displayAnimFrame(int frameNum, int animId) { GfxSurface surface; surface.decode(&_curAnim[offset]); - _screenSurface.drawPicture(surface, 0, 12); + _screenSurface->drawPicture(surface, 0, 12); prepareScreenType1(); } @@ -2868,10 +2868,10 @@ void MortevielleEngine::drawPicture() { clearUpperLeftPart(); if (_caff > 99) { draw(60, 33); - _screenSurface.drawBox(118, 32, 291, 122, 15); // Medium box + _screenSurface->drawBox(118, 32, 291, 122, 15); // Medium box } else if (_caff > 69) { draw(112, 48); // Heads - _screenSurface.drawBox(222, 47, 155, 92, 15); + _screenSurface->drawBox(222, 47, 155, 92, 15); } else { draw(0, 12); prepareScreenType1(); @@ -2910,7 +2910,7 @@ void MortevielleEngine::drawPicture() { } void MortevielleEngine::drawPictureWithText() { - _text.taffich(); + _text->taffich(); drawPicture(); _destinationOk = false; } @@ -2924,7 +2924,7 @@ void MortevielleEngine::testKey(bool d) { int x, y; bool click; - _mouse.hideMouse(); + _mouse->hideMouse(); displayStatusInDescriptionBar('K'); // Wait for release from any key or mouse button @@ -2932,7 +2932,7 @@ void MortevielleEngine::testKey(bool d) { _key = gettKeyPressed(); do { - _mouse.getMousePosition(x, y, click); + _mouse->getMousePosition(x, y, click); quest = keyPressed(); if (quest && shouldQuit()) return; @@ -2943,14 +2943,14 @@ void MortevielleEngine::testKey(bool d) { if (d) prepareRoom(); quest = keyPressed(); - _mouse.getMousePosition(x, y, click); + _mouse->getMousePosition(x, y, click); if (shouldQuit()) return; } while (!(quest || (click) || (d && _anyone))); if (quest) gettKeyPressed(); setMouseClick(false); - _mouse.showMouse(); + _mouse->showMouse(); } /** @@ -3061,7 +3061,7 @@ void MortevielleEngine::getSearchDescription(int objId) { * @remarks Originally called 'mennor' */ void MortevielleEngine::menuUp() { - _menu.menuUp(_currMenu); + _menu->menuUp(_currMenu); } /** @@ -3070,7 +3070,7 @@ void MortevielleEngine::menuUp() { */ void MortevielleEngine::drawDiscussionBox() { draw(10, 80); - _screenSurface.drawBox(18, 79, 155, 92, 15); + _screenSurface->drawBox(18, 79, 155, 92, 15); } /** @@ -3101,7 +3101,7 @@ void MortevielleEngine::addObjectToInventory(int objectId) { if (_coreVar._inventory[i] == 0) { _coreVar._inventory[i] = objectId; - _menu.setInventoryText(); + _menu->setInventoryText(); } else // Inventory is full _crep = 139; @@ -3112,8 +3112,8 @@ void MortevielleEngine::addObjectToInventory(int objectId) { * @remarks Originally called 'quelquun' */ void MortevielleEngine::interactNPC() { - if (_menu._menuDisplayed) - _menu.eraseMenu(); + if (_menu->_menuDisplayed) + _menu->eraseMenu(); endSearch(); _crep = 997; @@ -3123,9 +3123,9 @@ L1: _crep = 138; handleDescriptionText(2, _crep); if (_crep == 138) - _soundManager.startSpeech(5, 2, 1); + _soundManager->startSpeech(5, 2, 1); else - _soundManager.startSpeech(4, 4, 1); + _soundManager->startSpeech(4, 4, 1); if (_openObjCount == 0) _coreVar._faithScore += 2; @@ -3134,12 +3134,12 @@ L1: else _coreVar._faithScore += 3 * (_coreVar._faithScore / 10); exitRoom(); - _menu.setDestinationText(LANDING); + _menu->setDestinationText(LANDING); int charIdx = convertBitIndexToCharacterIndex(_currBitIndex); _caff = 69 + charIdx; _crep = _caff; _currMenu = MENU_DISCUSS; - _currAction = (_menu._discussMenu[charIdx]._menuId << 8) | _menu._discussMenu[charIdx]._actionId; + _currAction = (_menu->_discussMenu[charIdx]._menuId << 8) | _menu->_discussMenu[charIdx]._actionId; _syn = true; _col = true; } else { @@ -3150,15 +3150,15 @@ L1: } else { handleDescriptionText(2, 136); int rand = (getRandomNumber(0, 4)) - 2; - _soundManager.startSpeech(3, rand, 1); + _soundManager->startSpeech(3, rand, 1); clearDescriptionBar(); displayAloneText(); resetRoomVariables(MANOR_FRONT); prepareDisplayText(); } } - if (_menu._menuDisplayed) - _menu.drawMenu(); + if (_menu->_menuDisplayed) + _menu->drawMenu(); } /** @@ -3206,25 +3206,25 @@ void MortevielleEngine::displayStatusArrow() { touch = '\0'; do { - _mouse.moveMouse(qust, touch); + _mouse->moveMouse(qust, touch); if (shouldQuit()) return; if (getMouseClick()) - inRect = (_mouse._pos.x < 256 * kResolutionScaler) && (_mouse._pos.y < 176) && (_mouse._pos.y > 12); + inRect = (_mouse->_pos.x < 256 * kResolutionScaler) && (_mouse->_pos.y < 176) && (_mouse->_pos.y > 12); prepareRoom(); } while (!(qust || inRect || _anyone)); if (qust && (touch == '\103')) - _dialogManager.show(_hintPctMessage); + _dialogManager->show(_hintPctMessage); } while (!((touch == '\73') || ((touch == '\104') && (_x != 0) && (_y != 0)) || (_anyone) || (inRect))); if (touch == '\73') _keyPressedEsc = true; if (inRect) { - _x = _mouse._pos.x; - _y = _mouse._pos.y; + _x = _mouse->_pos.x; + _y = _mouse->_pos.y; } } @@ -3292,7 +3292,7 @@ void MortevielleEngine::displayLookScreen(int objId) { int mdes = _caff; _caff = objId; - if (((_caff > 29) && (_caff < 33)) || (_caff == 144) || (_caff == 147) || (_caff == 149) || (_currAction == _menu._opcodeSLook)) { + if (((_caff > 29) && (_caff < 33)) || (_caff == 144) || (_caff == 147) || (_caff == 149) || (_currAction == _menu->_opcodeSLook)) { drawPictureWithText(); if ((_caff > 29) && (_caff < 33)) handleDescriptionText(2, _caff); @@ -3305,7 +3305,7 @@ void MortevielleEngine::displayLookScreen(int objId) { } else { _obpart = true; _crep = _caff + 400; - _menu.setSearchMenu(); + _menu->setSearchMenu(); } } @@ -3357,10 +3357,10 @@ int MortevielleEngine::checkLeaveSecretPassage() { * @remarks Originally called 'fenat' */ void MortevielleEngine::displayStatusInDescriptionBar(char stat) { - _mouse.hideMouse(); - _screenSurface.writeCharacter(Common::Point(306, 193), stat, 12); - _screenSurface.drawBox(300, 191, 16, 8, 15); - _mouse.showMouse(); + _mouse->hideMouse(); + _screenSurface->writeCharacter(Common::Point(306, 193), stat, 12); + _screenSurface->drawBox(300, 191, 16, 8, 15); + _mouse->showMouse(); } /** diff --git a/engines/neverhood/configure.engine b/engines/neverhood/configure.engine index 0767a631f9..46910e293e 100644 --- a/engines/neverhood/configure.engine +++ b/engines/neverhood/configure.engine @@ -1,3 +1,3 @@ # This file is included from the main "configure" script # add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps] -add_engine neverhood "Neverhood" no +add_engine neverhood "Neverhood" yes diff --git a/engines/neverhood/graphics.cpp b/engines/neverhood/graphics.cpp index 490959020f..e976844c16 100644 --- a/engines/neverhood/graphics.cpp +++ b/engines/neverhood/graphics.cpp @@ -299,11 +299,11 @@ void unpackSpriteRle(const byte *source, int width, int height, byte *dest, int } source += copy; } - dest += destPitch; if (replaceColors) for (int xc = 0; xc < width; xc++) if (dest[xc] == oldColor) dest[xc] = newColor; + dest += destPitch; } } rows = READ_LE_UINT16(source); diff --git a/engines/neverhood/neverhood.cpp b/engines/neverhood/neverhood.cpp index 6b1f2d9346..1119bfbb08 100644 --- a/engines/neverhood/neverhood.cpp +++ b/engines/neverhood/neverhood.cpp @@ -45,7 +45,7 @@ namespace Neverhood { -NeverhoodEngine::NeverhoodEngine(OSystem *syst, const NeverhoodGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) { +NeverhoodEngine::NeverhoodEngine(OSystem *syst, const NeverhoodGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc), _console(nullptr) { // Setup mixer if (!_mixer->isReady()) { warning("Sound initialization failed."); diff --git a/engines/neverhood/sound.cpp b/engines/neverhood/sound.cpp index 5821fd6df3..04043692f8 100644 --- a/engines/neverhood/sound.cpp +++ b/engines/neverhood/sound.cpp @@ -214,7 +214,7 @@ void SoundItem::setSoundParams(bool playOnceAfterRandomCountdown, int16 minCount _minCountdown = minCountdown; if (maxCountdown > 0) _maxCountdown = maxCountdown; - if (firstMinCountdown >= firstMaxCountdown) + if (firstMinCountdown > firstMaxCountdown) _currCountdown = firstMinCountdown; else if (firstMinCountdown > 0 && firstMaxCountdown > 0 && firstMinCountdown < firstMaxCountdown) _currCountdown = _vm->_rnd->getRandomNumberRng(firstMinCountdown, firstMaxCountdown); diff --git a/engines/teenagent/callbacks.cpp b/engines/teenagent/callbacks.cpp index 3e6e40a8fa..4761cabc78 100644 --- a/engines/teenagent/callbacks.cpp +++ b/engines/teenagent/callbacks.cpp @@ -1808,6 +1808,10 @@ bool TeenAgentEngine::processCallback(uint16 addr) { displayMessage(dsAddr_uninterestingHaystackMsg); // "I don't see anything interesting about this haystack" break; + case 0x6663: + displayMessage(dsAddr_uninterestingHaystackMsg); // "I don't see anything interesting about this haystack" + break; + case 0x666a: displayMessage(dsAddr_moreComplicatedMsg); // "It's more complicated than that" break; diff --git a/engines/wintermute/detection_tables.h b/engines/wintermute/detection_tables.h index 24f85239c1..e7f2ed90a9 100644 --- a/engines/wintermute/detection_tables.h +++ b/engines/wintermute/detection_tables.h @@ -28,6 +28,7 @@ static const PlainGameDescriptor wintermuteGames[] = { {"5ld", "Five Lethal Demons"}, {"5ma", "Five Magical Amulets"}, {"actualdest", "Actual Destination"}, + {"bickadoodle", "Bickadoodle"}, {"bookofgron", "Book of Gron Part One"}, {"bthreshold", "Beyond the Threshold"}, {"carolreed4", "Carol Reed 4 - East Side Story"}, @@ -58,6 +59,7 @@ static const PlainGameDescriptor wintermuteGames[] = { {"reversion1", "Reversion: The Escape"}, {"reversion2", "Reversion: The Meeting"}, {"rosemary", "Rosemary"}, + {"securanote", "Securanote"}, {"shaban", "Shaban"}, {"shinestar", "The Shine of a Star"}, {"spaceinvaders", "Space Invaders"}, @@ -67,6 +69,7 @@ static const PlainGameDescriptor wintermuteGames[] = { {"tradestory", "The Trader of Stories"}, {"twc", "the white chamber"}, {"wintermute", "Wintermute engine game"}, + {"wtetris", "Wilma Tetris"}, {0, 0} }; @@ -111,6 +114,16 @@ static const ADGameDescription gameDescriptions[] = { ADGF_UNSTABLE, GUIO0() }, + // Bickadoodle + { + "bickadoodle", + "", + AD_ENTRY1s("data.dcp", "84db4d1594cac95e25614985775d10a8", 35303844), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, // Book of Gron Part One { "bookofgron", @@ -282,6 +295,19 @@ static const ADGameDescription gameDescriptions[] = { ADGF_UNSTABLE, GUIO0() }, + // Dirty Split (Czech) + { + "dirtysplit", + "", + { + {"czech.dcp", 0, "08a71446467cf8f9444cfea446b46ad6", 127697934}, + {"data.dcp", 0, "8b4b81b718bf65f30a67fc0b1e329eb5", 88577623}, + }, + Common::CZ_CZE, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, // Dirty Split (English) { "dirtysplit", @@ -292,6 +318,20 @@ static const ADGameDescription gameDescriptions[] = { ADGF_UNSTABLE, GUIO0() }, + // Dirty Split (French) + { + "dirtysplit", + "", + { + {"french.dcp", 0, "a0508dedebd0fe478d0158fa4c2a1136", 125534323}, + {"data.dcp", 0, "e6d70c7f5d181b761cfcf974adf9186a", 88577623}, + AD_LISTEND + }, + Common::FR_FRA, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, // Dirty Split (German) { "dirtysplit", @@ -302,6 +342,32 @@ static const ADGameDescription gameDescriptions[] = { ADGF_UNSTABLE, GUIO0() }, + // Dirty Split (Italian) + { + "dirtysplit", + "", + { + {"italian.dcp", 0, "8108807fbd8af70be1ec452d0fd1131b", 125513726}, + {"data.dcp", 0, "35a150e22af274185883fdbb142c6fb1", 88577623}, + }, + Common::IT_ITA, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, + // Dirty Split (Spanish) + { + "dirtysplit", + "", + { + {"spanish.dcp", 0, "b3982c0a5e85b42e1e38240fef004aa4", 164428596}, + {"data.dcp", 0, "63766d6c68b9f00b632ea1736fc8a95c", 88577621}, + }, + Common::ES_ESP, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, // Des Reves Elastiques Avec Mille Insectes Nommes Georges { "dreaming", @@ -342,6 +408,16 @@ static const ADGameDescription gameDescriptions[] = { ADGF_UNSTABLE, GUIO0() }, + // Escape from the Mansion + { + "escapemansion", + "1.3", + AD_ENTRY1s("data.dcp", "1e5d231b56c8a228cd15cb690f50253e", 29261972), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, // Framed { "framed", @@ -930,6 +1006,16 @@ static const ADGameDescription gameDescriptions[] = { ADGF_UNSTABLE, GUIO0() }, + // Securanote + { + "securanote", + "", + AD_ENTRY1s("data.dcp", "5213d3e59b9e95b7fbd5c56f7de5341a", 2625554), + Common::EN_ANY, + Common::kPlatformIOS, + ADGF_UNSTABLE, + GUIO0() + }, // Shaban { "shaban", @@ -1012,6 +1098,16 @@ static const ADGameDescription gameDescriptions[] = { ADGF_UNSTABLE, GUIO0() }, + // Wilma Tetris + { + "wtetris", + "", + AD_ENTRY1s("data.dcp", "946e3a0496e6c12fb344c9ed861ff015", 2780093), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, AD_TABLE_END_MARKER }; |