diff options
author | johndoe123 | 2013-03-02 21:25:38 +0000 |
---|---|---|
committer | Willem Jan Palenstijn | 2013-05-08 20:47:43 +0200 |
commit | 583f9abaf98f64895546b75573e9442ca47426e3 (patch) | |
tree | 81b2cb6521b700fa767ad14bcb891a1f16b5fe6d /engines | |
parent | 9b6d813d412a636b1c02511065ab1466e0f6c5e0 (diff) | |
download | scummvm-rg350-583f9abaf98f64895546b75573e9442ca47426e3.tar.gz scummvm-rg350-583f9abaf98f64895546b75573e9442ca47426e3.tar.bz2 scummvm-rg350-583f9abaf98f64895546b75573e9442ca47426e3.zip |
NEVERHOOD: Fix some logic bugs and minor changes
- Fix video speed in the very last scene (Scene1317)
- Fix back door not opening in Scene1401
- Fix projector not moving in Scene1402
- Fix projector not appearing in Scene1403
- Fix wrong Klaymen walking in Scene2205
- Fix wrong scene change in Module2300
- Fix symbols not appearing in Scene3011
- Define out some remaining logic debug code
- Remove some obsolete comments
- Reduce debug output
- Use a List instead of an Array when building the microtiles rectangles
Diffstat (limited to 'engines')
-rw-r--r-- | engines/neverhood/blbarchive.cpp | 2 | ||||
-rw-r--r-- | engines/neverhood/gamemodule.cpp | 70 | ||||
-rw-r--r-- | engines/neverhood/menumodule.cpp | 2 | ||||
-rw-r--r-- | engines/neverhood/microtiles.cpp | 4 | ||||
-rw-r--r-- | engines/neverhood/microtiles.h | 6 | ||||
-rw-r--r-- | engines/neverhood/module1300.cpp | 1 | ||||
-rw-r--r-- | engines/neverhood/module1400.cpp | 8 | ||||
-rw-r--r-- | engines/neverhood/module2200.cpp | 5 | ||||
-rw-r--r-- | engines/neverhood/module2300.cpp | 2 | ||||
-rw-r--r-- | engines/neverhood/module2800.cpp | 1 | ||||
-rw-r--r-- | engines/neverhood/module3000.cpp | 12 | ||||
-rw-r--r-- | engines/neverhood/resource.cpp | 1 | ||||
-rw-r--r-- | engines/neverhood/resourceman.cpp | 1 | ||||
-rw-r--r-- | engines/neverhood/screen.cpp | 6 | ||||
-rw-r--r-- | engines/neverhood/smackerplayer.cpp | 2 | ||||
-rw-r--r-- | engines/neverhood/smackerscene.cpp | 8 | ||||
-rw-r--r-- | engines/neverhood/sound.h | 8 |
17 files changed, 40 insertions, 99 deletions
diff --git a/engines/neverhood/blbarchive.cpp b/engines/neverhood/blbarchive.cpp index 748d04c7ca..9f5f46487c 100644 --- a/engines/neverhood/blbarchive.cpp +++ b/engines/neverhood/blbarchive.cpp @@ -153,7 +153,7 @@ Common::SeekableReadStream *BlbArchive::createStream(uint index) { Common::SeekableReadStream *BlbArchive::createStream(BlbArchiveEntry *entry) { return new SafeMutexedSeekableSubReadStream(&_fd, entry->offset, entry->offset + entry->diskSize, - DisposeAfterUse::NO,_mutex); + DisposeAfterUse::NO, _mutex); } } // End of namespace Neverhood diff --git a/engines/neverhood/gamemodule.cpp b/engines/neverhood/gamemodule.cpp index 1246a5b962..99aea5d938 100644 --- a/engines/neverhood/gamemodule.cpp +++ b/engines/neverhood/gamemodule.cpp @@ -84,7 +84,6 @@ GameModule::GameModule(NeverhoodEngine *vm) } GameModule::~GameModule() { - _vm->_soundMan->deleteSoundGroup(0x002D0031); delete _childObject; _childObject = NULL; @@ -196,7 +195,8 @@ void GameModule::initMemoryPuzzle() { } setSubVar(VA_IS_PUZZLE_INIT, 0xC8606803, 1); - // DEBUG>>> Some debug code: Leave two matching tiles open + // DEBUG Enable to autosolve all tiles and leave only two matching tiles open +#if 0 for (int i = 0; i < 48; i++) setSubVar(VA_IS_TILE_MATCH, i, 1); int debugIndex = 0; @@ -207,7 +207,7 @@ void GameModule::initMemoryPuzzle() { break; } } - // <<<DEBUG +#endif } } @@ -345,8 +345,9 @@ uint32 GameModule::handleMessage(int messageNum, const MessageParam ¶m, Enti } void GameModule::startup() { -#if 0 - createModule(1500, 0); // Logos and intro video // Real game start +#if 1 + // Logos and intro video // Real game start + createModule(1500, 0); #else // DEBUG>>> /* @@ -395,63 +396,7 @@ void GameModule::startup() { #if 1 _vm->gameState().which = 0; _vm->gameState().sceneNum = 0; - createModule(1000, -1); -#endif -#if 0 - _vm->gameState().sceneNum = 5; - _vm->gameState().which = 0; - createModule(2800, -1); -#endif -#if 0 - _vm->gameState().sceneNum = 0; - createModule(2000, -1); -#endif -#if 0 - _vm->gameState().sceneNum = 5; - createModule(2200, -1); -#endif -#if 0 - _vm->gameState().sceneNum = 7; - createModule(2200, -1); -#endif -#if 0 - _vm->gameState().sceneNum = 1; - createModule(1000, -1); -#endif -#if 0 - _vm->gameState().sceneNum = 8; - _vm->gameState().which = 1; - createModule(1600, -1); -#endif -#if 0 - _vm->gameState().sceneNum = 6; - createModule(1900, -1); -#endif -#if 0 - _vm->gameState().sceneNum = 0; - createModule(2100, 3); -#endif -#if 0 - _vm->gameState().sceneNum = 8; - createModule(2600, -1); -#endif -#if 0 - _vm->gameState().which = 0; - _vm->gameState().sceneNum = 1; - createModule(2700, -1); -#endif -#if 0 - _vm->gameState().sceneNum = 1; - createModule(2800, -1); -#endif -#if 0 - _vm->gameState().which = 0; - _vm->gameState().sceneNum = 0; - createModule(2500, -1); -#endif -#if 0 - _vm->gameState().sceneNum = 1; - createModule(2300, -1); + createModule(2400, 0); #endif #endif @@ -739,6 +684,7 @@ void GameModule::updateModule() { createModule(2300, 1); break; case 2300: + debug("module 23000 _moduleResult : %d", _moduleResult); if (_moduleResult == 2) createModule(1200, 0); else if (_moduleResult == 0) diff --git a/engines/neverhood/menumodule.cpp b/engines/neverhood/menumodule.cpp index 619acadd8c..d4882c395a 100644 --- a/engines/neverhood/menumodule.cpp +++ b/engines/neverhood/menumodule.cpp @@ -583,7 +583,7 @@ void TextEditWidget::onClick() { _cursorPos = 0; else { int newCursorPos = mousePos.x / _fontSurface->getCharWidth(); - if (mousePos.x % _fontSurface->getCharWidth() > _fontSurface->getCharWidth() / 2 && newCursorPos <= (int)_entryString.size())//### + if (mousePos.x % _fontSurface->getCharWidth() > _fontSurface->getCharWidth() / 2 && newCursorPos <= (int)_entryString.size()) ++newCursorPos; _cursorPos = MIN((int)_entryString.size(), newCursorPos); } diff --git a/engines/neverhood/microtiles.cpp b/engines/neverhood/microtiles.cpp index ee64fdadc5..e19be52b5a 100644 --- a/engines/neverhood/microtiles.cpp +++ b/engines/neverhood/microtiles.cpp @@ -108,9 +108,9 @@ void MicroTileArray::updateBoundingBox(BoundingBox &boundingBox, byte x0, byte y setBoundingBox(boundingBox, x0, y0, x1, y1); } -RectArray *MicroTileArray::getRectangles() { +RectangleList *MicroTileArray::getRectangles() { - RectArray *rects = new RectArray(); + RectangleList *rects = new RectangleList(); int x, y; int x0, y0, x1, y1; diff --git a/engines/neverhood/microtiles.h b/engines/neverhood/microtiles.h index 2ad6796903..29af3d956a 100644 --- a/engines/neverhood/microtiles.h +++ b/engines/neverhood/microtiles.h @@ -25,7 +25,7 @@ #define NEVERHOOD_MICROTILES_H #include "common/scummsys.h" -#include "common/array.h" +#include "common/list.h" #include "common/util.h" #include "common/rect.h" @@ -37,7 +37,7 @@ const BoundingBox FullBoundingBox = 0x00001F1F; const BoundingBox EmptyBoundingBox = 0x00000000; const int TileSize = 32; -typedef Common::Array<Common::Rect> RectArray; +typedef Common::List<Common::Rect> RectangleList; class MicroTileArray { public: @@ -45,7 +45,7 @@ public: ~MicroTileArray(); void addRect(Common::Rect r); void clear(); - RectArray *getRectangles(); + RectangleList *getRectangles(); protected: BoundingBox *_tiles; int16 _tilesW, _tilesH; diff --git a/engines/neverhood/module1300.cpp b/engines/neverhood/module1300.cpp index 94937c4c7f..162d710f46 100644 --- a/engines/neverhood/module1300.cpp +++ b/engines/neverhood/module1300.cpp @@ -1701,6 +1701,7 @@ Scene1317::Scene1317(NeverhoodEngine *vm, Module *parentModule) SetMessageHandler(&Scene1317::handleMessage); _smackerPlayer = addSmackerPlayer(new SmackerPlayer(_vm, this, 0x08982841, true, false)); + _vm->_screen->setSmackerDecoder(_smackerPlayer->getSmackerDecoder()); insertScreenMouse(0x08284011); showMouse(false); _smackerFileHash = 0; diff --git a/engines/neverhood/module1400.cpp b/engines/neverhood/module1400.cpp index d96703b6f2..8aa0632e90 100644 --- a/engines/neverhood/module1400.cpp +++ b/engines/neverhood/module1400.cpp @@ -339,7 +339,7 @@ uint32 AsScene1401BackDoor::handleMessage(int messageNum, const MessageParam &pa break; case 0x4808: _countdown = 168; - if (_isOpen) + if (!_isOpen) stOpenDoor(); break; } @@ -743,7 +743,7 @@ uint32 Scene1401::handleMessage(int messageNum, const MessageParam ¶m, Entit if (_asProjector && _asProjector->getX() > 404 && _asProjector->getX() < 504) sendMessage(_asProjector , 0x4839, 0); } else if (sender == _ssButton) - sendMessage(_ssButton, 0x4808, 0); + sendMessage(_asBackDoor, 0x4808, 0); break; case 0x4826: if (sender == _asProjector) { @@ -968,7 +968,7 @@ uint32 Scene1402::handleMessage(int messageNum, const MessageParam ¶m, Entit break; case 0x4826: if (sender == _asProjector) { - if (sendMessage(_asProjector, 0x408C, _klaymen->getX() > _asProjector->getX() ? 1 : 0) != 0) { + if (sendMessage(_asProjector, 0x480C, _klaymen->getX() > _asProjector->getX() ? 1 : 0) != 0) { sendEntityMessage(_klaymen, 0x1014, _asProjector); setMessageList2(0x004B0BB8); } else @@ -1309,7 +1309,7 @@ Scene1403::Scene1403(NeverhoodEngine *vm, Module *parentModule, int which) } _klaymen->setRepl(64, 0); - if (getGlobalVar(V_PROJECTOR_LOCATION) == 4) { + if (getGlobalVar(V_PROJECTOR_LOCATION) == 0) { _asProjector = insertSprite<AsCommonProjector>(this, _klaymen, (Sprite*)NULL); addCollisionSprite(_asProjector); if (getGlobalVar(V_PROJECTOR_SLOT) == 4) { diff --git a/engines/neverhood/module2200.cpp b/engines/neverhood/module2200.cpp index 2e6549a230..ddcfb3685c 100644 --- a/engines/neverhood/module2200.cpp +++ b/engines/neverhood/module2200.cpp @@ -47,6 +47,7 @@ Module2200::~Module2200() { } void Module2200::createScene(int sceneNum, int which) { + debug("Module2200::createScene(%d, %d)", sceneNum, which); _sceneNum = sceneNum; switch (_sceneNum) { case 0: @@ -1221,7 +1222,6 @@ Scene2205::Scene2205(NeverhoodEngine *vm, Module *parentModule, int which) SetUpdateHandler(&Scene2205::update); setHitRects(0x004B0620); - loadDataResource(0x00144822); if (getGlobalVar(V_LIGHTS_ON)) { _isLightOn = true; setBackground(0x0008028D); @@ -1263,6 +1263,9 @@ Scene2205::Scene2205(NeverhoodEngine *vm, Module *parentModule, int which) _klaymen->setClipRect(_ssDoorFrame->getDrawRect().x, 0, 640, 480); _klaymen->setSoundFlag(true); + + loadDataResource(0x00144822); + } void Scene2205::update() { diff --git a/engines/neverhood/module2300.cpp b/engines/neverhood/module2300.cpp index 937ba9a4f3..bf0e866b2f 100644 --- a/engines/neverhood/module2300.cpp +++ b/engines/neverhood/module2300.cpp @@ -140,7 +140,7 @@ void Module2300::updateScene() { break; case 2: if (_moduleResult == 1) - leaveModule(3); + leaveModule(1); else createScene(1, 5); break; diff --git a/engines/neverhood/module2800.cpp b/engines/neverhood/module2800.cpp index 5fececd568..d81445cf50 100644 --- a/engines/neverhood/module2800.cpp +++ b/engines/neverhood/module2800.cpp @@ -284,7 +284,6 @@ void Module2800::updateScene() { createScene(9, 4); break; case 9: - debug("scene 9 _moduleResult = %d", _moduleResult); if (_moduleResult == 1) createScene(11, 0); else if (_moduleResult == 2) diff --git a/engines/neverhood/module3000.cpp b/engines/neverhood/module3000.cpp index 6bf95e3c9a..d08ff9d6ae 100644 --- a/engines/neverhood/module3000.cpp +++ b/engines/neverhood/module3000.cpp @@ -756,7 +756,6 @@ Scene3009::Scene3009(NeverhoodEngine *vm, Module *parentModule, int which) _isTurning(false), _lockSymbolsPart1Countdown(1), _lockSymbolsPart2Countdown(1) { _cannonTargetStatus = getGlobalVar(V_CANNON_TARGET_STATUS); - debug("_cannonTargetStatus = %d", _cannonTargetStatus); _vm->gameModule()->initCannonSymbolsPuzzle(); @@ -809,11 +808,12 @@ Scene3009::Scene3009(NeverhoodEngine *vm, Module *parentModule, int which) SetMessageHandler(&Scene3009::handleMessage); SetUpdateHandler(&Scene3009::update); - // DEBUG: Set the correct code + // DEBUG Enable to set the correct code +#if 0 for (int i = 0; i < 6; i++) setSubVar(VA_CURR_CANNON_SYMBOLS, i, _correctSymbols[i]); sendMessage(this, 0x2003, 0); - //setGlobalVar(V_ROBOT_TARGET, 1); +#endif } @@ -1224,10 +1224,12 @@ Scene3010::Scene3010(NeverhoodEngine *vm, Module *parentModule, int which) int initCountdown = 0; - // DEBUG: Enable all buttons + // DEBUG Enable to activate all buttons +#if 0 setSubVar(VA_LOCKS_DISABLED, kScene3010ButtonNameHashes[0], 1); setSubVar(VA_LOCKS_DISABLED, kScene3010ButtonNameHashes[1], 1); setSubVar(VA_LOCKS_DISABLED, kScene3010ButtonNameHashes[2], 1); +#endif setBackground(0x80802626); setPalette(0x80802626); @@ -1448,7 +1450,7 @@ void AsScene3011Symbol::change(int symbolIndex, bool isNoisy) { } Scene3011::Scene3011(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule), _updateStatus(0), _buttonClicked(false), _currentSymbolIndex(0) { + : Scene(vm, parentModule), _updateStatus(0), _buttonClicked(false), _currentSymbolIndex(0), _countdown(0) { _vm->gameModule()->initCodeSymbolsPuzzle(); _noisySymbolIndex = getGlobalVar(V_NOISY_SYMBOL_INDEX); diff --git a/engines/neverhood/resource.cpp b/engines/neverhood/resource.cpp index 2fce4ba18e..22a802807b 100644 --- a/engines/neverhood/resource.cpp +++ b/engines/neverhood/resource.cpp @@ -355,7 +355,6 @@ DataResource::~DataResource() { void DataResource::load(uint32 fileHash) { if (_resourceHandle.fileHash() == fileHash) return; - debug("DataResource::load(%08X)", fileHash); const byte *data = NULL; uint32 dataSize = 0; unload(); diff --git a/engines/neverhood/resourceman.cpp b/engines/neverhood/resourceman.cpp index 9e5f9ae52f..f662130ea8 100644 --- a/engines/neverhood/resourceman.cpp +++ b/engines/neverhood/resourceman.cpp @@ -58,7 +58,6 @@ void ResourceMan::addArchive(const Common::String &filename) { _entries[archiveEntry->fileHash] = newEntry; } } - debug("_entries.size() = %d", _entries.size()); } ResourceFileEntry *ResourceMan::findEntrySimple(uint32 fileHash) { diff --git a/engines/neverhood/screen.cpp b/engines/neverhood/screen.cpp index 3e57422cea..25b4109980 100644 --- a/engines/neverhood/screen.cpp +++ b/engines/neverhood/screen.cpp @@ -86,18 +86,18 @@ void Screen::update() { renderItem._refresh = true; } - RectArray *updateRects = _microTiles->getRectangles(); + RectangleList *updateRects = _microTiles->getRectangles(); for (RenderQueue::iterator it = _renderQueue->begin(); it != _renderQueue->end(); ++it) { RenderItem &renderItem = (*it); - for (RectArray::iterator ri = updateRects->begin(); ri != updateRects->end(); ++ri) + for (RectangleList::iterator ri = updateRects->begin(); ri != updateRects->end(); ++ri) blitRenderItem(renderItem, *ri); } SWAP(_renderQueue, _prevRenderQueue); _renderQueue->clear(); - for (Common::Array<Common::Rect>::iterator ri = updateRects->begin(); ri != updateRects->end(); ++ri) { + for (RectangleList::iterator ri = updateRects->begin(); ri != updateRects->end(); ++ri) { Common::Rect &r = *ri; _vm->_system->copyRectToScreen((const byte*)_backScreen->getBasePtr(r.left, r.top), _backScreen->pitch, r.left, r.top, r.width(), r.height()); } diff --git a/engines/neverhood/smackerplayer.cpp b/engines/neverhood/smackerplayer.cpp index 7c14edf48b..b67c8db9fc 100644 --- a/engines/neverhood/smackerplayer.cpp +++ b/engines/neverhood/smackerplayer.cpp @@ -100,7 +100,7 @@ SmackerPlayer::~SmackerPlayer() { } void SmackerPlayer::open(uint32 fileHash, bool keepLastFrame) { - debug("SmackerPlayer::open(%08X)", fileHash); + debug(0, "SmackerPlayer::open(%08X)", fileHash); _fileHash = fileHash; _keepLastFrame = keepLastFrame; diff --git a/engines/neverhood/smackerscene.cpp b/engines/neverhood/smackerscene.cpp index 20eebe2bc7..115aafe5be 100644 --- a/engines/neverhood/smackerscene.cpp +++ b/engines/neverhood/smackerscene.cpp @@ -28,7 +28,7 @@ SmackerScene::SmackerScene(NeverhoodEngine *vm, Module *parentModule, bool doubl : Scene(vm, parentModule), _doubleSurface(doubleSurface), _canSkip(canSkip), _canAbort(canAbort), _videoPlayedBefore(false), _fileHashListIndex(-1), _fileHashList(NULL), _playNextVideoFlag(false) { - debug("SmackerScene::SmackerScene(%d, %d, %d)", doubleSurface, canSkip, canAbort); + debug(0, "SmackerScene::SmackerScene(%d, %d, %d)", doubleSurface, canSkip, canAbort); // NOTE: Merged from SmackerScene::init, maybe split again if needed (incl. parameter flags) @@ -53,18 +53,18 @@ SmackerScene::~SmackerScene() { } void SmackerScene::setFileHash(uint32 fileHash) { - debug("SmackerScene::setFileHash(%08X)", fileHash); + debug(0, "SmackerScene::setFileHash(%08X)", fileHash); _fileHash[0] = fileHash; _fileHashList = _fileHash; } void SmackerScene::setFileHashList(const uint32 *fileHashList) { - debug("SmackerScene::setFileHashList(...)"); + debug(0, "SmackerScene::setFileHashList(...)"); _fileHashList = fileHashList; } void SmackerScene::nextVideo() { - debug("SmackerScene::nextVideo()"); + debug(0, "SmackerScene::nextVideo()"); _fileHashListIndex++; diff --git a/engines/neverhood/sound.h b/engines/neverhood/sound.h index e0e45e9ad1..d3318998db 100644 --- a/engines/neverhood/sound.h +++ b/engines/neverhood/sound.h @@ -124,14 +124,6 @@ protected: SoundResource *_soundResource; }; -// TODO Give this a better name - -/* -template<class T> -class SoundManItems : public Common::Array<T> { -}; -*/ - class SoundMan { public: SoundMan(NeverhoodEngine *vm); |