diff options
author | Eugene Sandulenko | 2013-08-08 01:14:24 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2013-09-06 14:51:11 +0300 |
commit | 1d55aa0c6ecade00b1b31932a86dd2f97b377882 (patch) | |
tree | 2b26bf245f5fba5ff5d717e19817a998814f0a24 /engines | |
parent | ea91b8f7998cc4a06f4f5d8732a1b9b0309d95d2 (diff) | |
download | scummvm-rg350-1d55aa0c6ecade00b1b31932a86dd2f97b377882.tar.gz scummvm-rg350-1d55aa0c6ecade00b1b31932a86dd2f97b377882.tar.bz2 scummvm-rg350-1d55aa0c6ecade00b1b31932a86dd2f97b377882.zip |
FULLPIPE: Attempt to fix crash on SC_1 startup. Domino is missing
Diffstat (limited to 'engines')
-rw-r--r-- | engines/fullpipe/fullpipe.cpp | 15 | ||||
-rw-r--r-- | engines/fullpipe/fullpipe.h | 2 | ||||
-rw-r--r-- | engines/fullpipe/gameloader.cpp | 3 | ||||
-rw-r--r-- | engines/fullpipe/gfx.cpp | 21 | ||||
-rw-r--r-- | engines/fullpipe/scene.cpp | 14 | ||||
-rw-r--r-- | engines/fullpipe/stateloader.cpp | 21 | ||||
-rw-r--r-- | engines/fullpipe/statics.cpp | 16 |
7 files changed, 53 insertions, 39 deletions
diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp index 2a5ceb1671..b71021bc66 100644 --- a/engines/fullpipe/fullpipe.cpp +++ b/engines/fullpipe/fullpipe.cpp @@ -133,24 +133,17 @@ Common::Error FullpipeEngine::run() { _isSaveAllowed = false; - if (!loadGam("fullpipe.gam")) - return Common::kNoGameDataFoundError; - - EntranceInfo ent; - + int scene = 0; if (ConfMan.hasKey("boot_param")) - ent._sceneId = ConfMan.getInt("boot_param"); - else - ent._sceneId = 3896; + scene = ConfMan.getInt("boot_param"); - sceneSwitcher(&ent); + if (!loadGam("fullpipe.gam", scene)) + return Common::kNoGameDataFoundError; #if 0 loadAllScenes(); #endif - _currentScene->draw(); - _gameContinue = true; while (_gameContinue) { diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h index 85538e7cb2..257a45841a 100644 --- a/engines/fullpipe/fullpipe.h +++ b/engines/fullpipe/fullpipe.h @@ -98,7 +98,7 @@ public: CGameLoader *_gameLoader; GameProject *_gameProject; - bool loadGam(const char *fname); + bool loadGam(const char *fname, int scene = 0); CGameVar *getGameLoaderGameVar(); CInputController *getGameLoaderInputController(); diff --git a/engines/fullpipe/gameloader.cpp b/engines/fullpipe/gameloader.cpp index 46cd557396..7d1d938f74 100644 --- a/engines/fullpipe/gameloader.cpp +++ b/engines/fullpipe/gameloader.cpp @@ -254,10 +254,13 @@ void CGameLoader::applyPicAniInfos(Scene *sc, PicAniInfo **picAniInfo, int picAn if (picAniInfoCount <= 0) return; + debug(0, "CGameLoader::applyPicAniInfos(sc, ptr, %d)", picAniInfoCount); + PictureObject *pict; StaticANIObject *ani; for (int i = 0; i < picAniInfoCount; i++) { + debug(0, "PicAniInfo: id: %d type: %d", picAniInfo[i]->objectId, picAniInfo[i]->type); if (picAniInfo[i]->type & 2) { pict = sc->getPictureObjectById(picAniInfo[i]->objectId, picAniInfo[i]->field_8); if (pict) { diff --git a/engines/fullpipe/gfx.cpp b/engines/fullpipe/gfx.cpp index 8996337e2f..003d619612 100644 --- a/engines/fullpipe/gfx.cpp +++ b/engines/fullpipe/gfx.cpp @@ -381,7 +381,7 @@ Common::Point *Picture::getDimensions(Common::Point *p) { void Picture::getDibInfo() { int off = _dataSize & ~0xf; - debug(0, "Picture::getDibInfo: _dataSize: %d", _dataSize); + debug(9, "Picture::getDibInfo: _dataSize: %d", _dataSize); if (!_dataSize) { warning("Picture::getDibInfo(): Empty data size"); @@ -409,7 +409,7 @@ void Picture::draw(int x, int y, int style, int angle) { int x1 = x; int y1 = y; - debug(0, "Picture::draw(%d, %d, %d, %d)", x, y, style, angle); + debug(0, "Picture::draw(%d, %d, %d, %d) (%s)", x, y, style, angle, _memfilename); if (x != -1) x1 = x; @@ -430,10 +430,8 @@ void Picture::draw(int x, int y, int style, int angle) { byte *pal = _paletteData; if (!pal) { + warning("Picture:draw: using global palette"); pal = g_fullpipe->_globalPalette; - - if (!pal) - error("Picture::draw(): Both global and local palettes are empty"); } switch (style) { @@ -447,8 +445,9 @@ void Picture::draw(int x, int y, int style, int angle) { default: if (angle) drawRotated(x1, y1, angle); - else + else { _bitmap->putDib(x1, y1, (int32 *)pal); + } } } @@ -531,7 +530,10 @@ void Bitmap::putDibRB(int32 *palette) { uint16 *srcPtr2; uint16 *srcPtr; - debug(0, "Bitmap::putDibRB()"); + if (!palette) + error("Bitmap::putDibRB(): Both global and local palettes are empty"); + + debug(8, "Bitmap::putDibRB()"); endx = _width + _x - 1; endy = _height + _y - 1; @@ -642,7 +644,7 @@ void Bitmap::putDibCB(int32 *palette) { endx = _width + _x - 1; endy = _height + _y - 1; - debug(0, "Bitmap::putDibCB(): %d, %d, %d, %d [%d, %d]", _x, _y, endx, endy, _width, _height); + debug(8, "Bitmap::putDibCB(): %d, %d, %d, %d [%d, %d]", _x, _y, endx, endy, _width, _height); if (_x > 799 || endx < 0 || _y > 599 || endy < 0) return; @@ -655,6 +657,9 @@ void Bitmap::putDibCB(int32 *palette) { cb05_format = (_type == MKTAG('C', 'B', '\05', 'e')); + if (!palette && !cb05_format) + error("Bitmap::putDibCB(): Both global and local palettes are empty"); + bpp = cb05_format ? 2 : 1; pitch = (bpp * _width + 3) & 0xFFFFFFFC; diff --git a/engines/fullpipe/scene.cpp b/engines/fullpipe/scene.cpp index 13a25b78e5..f72e3ba21b 100644 --- a/engines/fullpipe/scene.cpp +++ b/engines/fullpipe/scene.cpp @@ -419,7 +419,7 @@ void Scene::drawContent(int minPri, int maxPri, bool drawBg) { g_fullpipe->_globalPalette = _palette->_data; } - debug(0, "Scene::drawContent(>%d, <%d, %d)", minPri, maxPri, drawBg); + debug(8, "Scene::drawContent(>%d, <%d, %d)", minPri, maxPri, drawBg); if (_picObjList.size() > 2) { // We need to z-sort them objectList_sortByPriority(_picObjList); @@ -431,11 +431,11 @@ void Scene::drawContent(int minPri, int maxPri, bool drawBg) { if (maxPri == -1) maxPri = 60000; - debug(0, "-> Scene::drawContent(>%d, <%d, %d)", minPri, maxPri, drawBg); + debug(8, "-> Scene::drawContent(>%d, <%d, %d)", minPri, maxPri, drawBg); Common::Point point; - debug(0, "_bigPict: %d objlist: %d", _bigPictureArray1Count, _picObjList.size()); + debug(8, "_bigPict: %d objlist: %d", _bigPictureArray1Count, _picObjList.size()); if (drawBg && _bigPictureArray1Count && _picObjList.size()) { _bigPictureArray[0][0]->getDimensions(&point); @@ -443,11 +443,11 @@ void Scene::drawContent(int minPri, int maxPri, bool drawBg) { int width = point.x; int height = point.y; - debug(0, "w: %d h:%d", width, height); + debug(8, "w: %d h:%d", width, height); ((PictureObject *)_picObjList[0])->getDimensions(&point); - debug(0, "w2: %d h2:%d", point.x, point.y); + debug(8, "w2: %d h2:%d", point.x, point.y); int bgStX = g_fullpipe->_sceneRect.left % point.x; @@ -505,14 +505,14 @@ void Scene::drawContent(int minPri, int maxPri, bool drawBg) { for (uint i = 1; i < _picObjList.size(); i++) { PictureObject *obj = (PictureObject *)_picObjList[i]; - debug(0, "pri: %d", obj->_priority); + debug(8, "pri: %d", obj->_priority); if (obj->_priority < minPri || obj->_priority >= maxPri) continue; int objX = obj->_ox; int objY = obj->_oy; - debug(0, "obj: %d %d", objX, objY); + debug(8, "obj: %d %d", objX, objY); obj->getDimensions(&point); diff --git a/engines/fullpipe/stateloader.cpp b/engines/fullpipe/stateloader.cpp index cd931b136c..bdfeb92b36 100644 --- a/engines/fullpipe/stateloader.cpp +++ b/engines/fullpipe/stateloader.cpp @@ -35,7 +35,7 @@ namespace Fullpipe { -bool FullpipeEngine::loadGam(const char *fname) { +bool FullpipeEngine::loadGam(const char *fname, int scene) { _gameLoader = new CGameLoader(); if (!_gameLoader->loadFile(fname)) @@ -43,7 +43,7 @@ bool FullpipeEngine::loadGam(const char *fname) { _currSoundListCount = 0; initObjectStates(); - // set_g_messageQueueCallback1(messageQueueCallback1); + // set_g_messageQueueCallback1(messageQueueCallback1); // substituted with direct call addMessageHandlerByIndex(global_messageHandler1, 0, 4); @@ -57,7 +57,7 @@ bool FullpipeEngine::loadGam(const char *fname) { ((MemoryObject *)((PictureObject *)*p)->_picture)->load(); } - // _sceneSwitcher = sceneSwitcher; + // _sceneSwitcher = sceneSwitcher; // substituted with direct call // _preloadCallback = gameLoaderPreloadCallback // _readSavegameCallback = gameLoaderReadSavegameCallback; @@ -80,12 +80,17 @@ bool FullpipeEngine::loadGam(const char *fname) { setMusicAllowed(_gameLoader->_gameVar->getSubVarAsInt("MUSIC_ALLOWED")); - if (_flgPlayIntro) { - _gameLoader->loadScene(SC_INTRO1); - _gameLoader->gotoScene(SC_INTRO1, TrubaUp); + if (scene) { + _gameLoader->loadScene(scene); + _gameLoader->gotoScene(scene, TrubaLeft); } else { - _gameLoader->loadScene(SC_1); - _gameLoader->gotoScene(SC_1, TrubaLeft); + if (_flgPlayIntro) { + _gameLoader->loadScene(SC_INTRO1); + _gameLoader->gotoScene(SC_INTRO1, TrubaUp); + } else { + _gameLoader->loadScene(SC_1); + _gameLoader->gotoScene(SC_1, TrubaLeft); + } } if (!_currentScene) diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp index 6939005b22..e64c3d2dfc 100644 --- a/engines/fullpipe/statics.cpp +++ b/engines/fullpipe/statics.cpp @@ -272,18 +272,23 @@ void StaticANIObject::draw() { Common::Point point; Common::Rect rect; - debug(0, "StaticANIObject::draw()"); + debug(0, "StaticANIObject::draw() (%s) [%d]", transCyrillic((byte *)_objectName), _id); if (_shadowsOn && g_fullpipe->_currentScene && g_fullpipe->_currentScene->_shadows && (getCurrDimensions(point)->x != 1 || getCurrDimensions(point)->y != 1)) { DynamicPhase *dyn; - if (!_movement || _flags & 0x20 ) + if (!_movement || _flags & 0x20) dyn = _statics; else dyn = _movement->_currDynamicPhase; + if (!dyn) { + warning("HACK: StaticANIObject::draw(): dyn is missing"); + return; + } + if (dyn->getDynFlags() & 4) { rect = *dyn->_rect; @@ -410,6 +415,8 @@ bool StaticANIObject::setPicAniInfo(PicAniInfo *picAniInfo) { return false; } + debug(0, "StaticANIObject::setPicAniInfo() (%s [%d])", transCyrillic((byte *)_objectName), _id); + if (picAniInfo->type & 3) { setOXY(picAniInfo->ox, picAniInfo->oy); _priority = picAniInfo->priority; @@ -421,10 +428,11 @@ bool StaticANIObject::setPicAniInfo(PicAniInfo *picAniInfo) { if (picAniInfo->type & 1) { _messageQueueId = picAniInfo->type >> 16; - if (picAniInfo->staticsId) + if (picAniInfo->staticsId) { _statics = getStaticsById(picAniInfo->staticsId); - else + } else { _statics = 0; + } if (picAniInfo->movementId) { _movement = getMovementById(picAniInfo->movementId); |