From f59512c47ea21c851535eeabf822aabdfde9167f Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 17 May 2013 00:18:09 +0300 Subject: RECORDER: Implement Events Recorder --- engines/advancedDetector.cpp | 9 ++++- engines/advancedDetector.h | 3 ++ engines/cge/cge.cpp | 1 - engines/dreamweb/dreamweb.cpp | 1 - engines/sword25/gfx/image/renderedimage.cpp | 57 +---------------------------- engines/sword25/gfx/image/renderedimage.h | 3 -- engines/wintermute/wintermute.cpp | 1 - 7 files changed, 12 insertions(+), 63 deletions(-) (limited to 'engines') diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp index b1d1008b60..9023548c83 100644 --- a/engines/advancedDetector.cpp +++ b/engines/advancedDetector.cpp @@ -29,7 +29,7 @@ #include "common/system.h" #include "common/textconsole.h" #include "common/translation.h" - +#include "gui/EventRecorder.h" #include "engines/advancedDetector.h" #include "engines/obsolete.h" @@ -301,6 +301,7 @@ Common::Error AdvancedMetaEngine::createInstance(OSystem *syst, Engine **engine) return Common::kUserCanceled; debug(2, "Running %s", gameDescriptor.description().c_str()); + initSubSystems(agdDesc); if (!createInstance(syst, engine, agdDesc)) return Common::kNoGameDataFoundError; else @@ -606,3 +607,9 @@ AdvancedMetaEngine::AdvancedMetaEngine(const void *descs, uint descItemSize, con _maxScanDepth = 1; _directoryGlobs = NULL; } + +void AdvancedMetaEngine::initSubSystems(const ADGameDescription *gameDesc) const { + if (gameDesc) { + g_eventRec.processGameDescription(gameDesc); + } +} diff --git a/engines/advancedDetector.h b/engines/advancedDetector.h index 3eec33abe5..71d2c4a446 100644 --- a/engines/advancedDetector.h +++ b/engines/advancedDetector.h @@ -280,6 +280,9 @@ protected: return 0; } +private: + void initSubSystems(const ADGameDescription *gameDesc) const; + protected: /** * Detect games in specified directory. diff --git a/engines/cge/cge.cpp b/engines/cge/cge.cpp index 6cc0c45963..af7e91f7eb 100644 --- a/engines/cge/cge.cpp +++ b/engines/cge/cge.cpp @@ -25,7 +25,6 @@ #include "common/debug.h" #include "common/debug-channels.h" #include "common/error.h" -#include "common/EventRecorder.h" #include "common/file.h" #include "common/fs.h" #include "engines/advancedDetector.h" diff --git a/engines/dreamweb/dreamweb.cpp b/engines/dreamweb/dreamweb.cpp index c3ede46df2..08838a784a 100644 --- a/engines/dreamweb/dreamweb.cpp +++ b/engines/dreamweb/dreamweb.cpp @@ -23,7 +23,6 @@ #include "common/config-manager.h" #include "common/debug-channels.h" #include "common/events.h" -#include "common/EventRecorder.h" #include "common/file.h" #include "common/func.h" #include "common/system.h" diff --git a/engines/sword25/gfx/image/renderedimage.cpp b/engines/sword25/gfx/image/renderedimage.cpp index c8a6666046..81a29c727f 100644 --- a/engines/sword25/gfx/image/renderedimage.cpp +++ b/engines/sword25/gfx/image/renderedimage.cpp @@ -41,6 +41,7 @@ #include "sword25/gfx/renderobjectmanager.h" #include "common/system.h" +#include "graphics/thumbnail.h" namespace Sword25 { @@ -509,60 +510,4 @@ void RenderedImage::checkForTransparency() { } } -/** - * Scales a passed surface, creating a new surface with the result - * @param srcImage Source image to scale - * @param scaleFactor Scale amount. Must be between 0 and 1.0 (but not zero) - * @remarks Caller is responsible for freeing the returned surface - */ -Graphics::Surface *RenderedImage::scale(const Graphics::Surface &srcImage, int xSize, int ySize) { - Graphics::Surface *s = new Graphics::Surface(); - s->create(xSize, ySize, srcImage.format); - - int *horizUsage = scaleLine(xSize, srcImage.w); - int *vertUsage = scaleLine(ySize, srcImage.h); - - // Loop to create scaled version - for (int yp = 0; yp < ySize; ++yp) { - const byte *srcP = (const byte *)srcImage.getBasePtr(0, vertUsage[yp]); - byte *destP = (byte *)s->getBasePtr(0, yp); - - for (int xp = 0; xp < xSize; ++xp) { - const byte *tempSrcP = srcP + (horizUsage[xp] * srcImage.format.bytesPerPixel); - for (int byteCtr = 0; byteCtr < srcImage.format.bytesPerPixel; ++byteCtr) { - *destP++ = *tempSrcP++; - } - } - } - - // Delete arrays and return surface - delete[] horizUsage; - delete[] vertUsage; - return s; -} - -/** - * Returns an array indicating which pixels of a source image horizontally or vertically get - * included in a scaled image - */ -int *RenderedImage::scaleLine(int size, int srcSize) { - int scale = 100 * size / srcSize; - assert(scale > 0); - int *v = new int[size]; - Common::fill(v, &v[size], 0); - - int distCtr = 0; - int *destP = v; - for (int distIndex = 0; distIndex < srcSize; ++distIndex) { - distCtr += scale; - while (distCtr >= 100) { - assert(destP < &v[size]); - *destP++ = distIndex; - distCtr -= 100; - } - } - - return v; -} - } // End of namespace Sword25 diff --git a/engines/sword25/gfx/image/renderedimage.h b/engines/sword25/gfx/image/renderedimage.h index a25b258592..116f97de26 100644 --- a/engines/sword25/gfx/image/renderedimage.h +++ b/engines/sword25/gfx/image/renderedimage.h @@ -104,8 +104,6 @@ public: return true; } - static Graphics::Surface *scale(const Graphics::Surface &srcImage, int xSize, int ySize); - void setIsTransparent(bool isTransparent) { _isTransparent = isTransparent; } virtual bool isSolid() const { return !_isTransparent; } @@ -119,7 +117,6 @@ private: Graphics::Surface *_backSurface; void checkForTransparency(); - static int *scaleLine(int size, int srcSize); }; } // End of namespace Sword25 diff --git a/engines/wintermute/wintermute.cpp b/engines/wintermute/wintermute.cpp index 89a6f1b3e0..19848b002e 100644 --- a/engines/wintermute/wintermute.cpp +++ b/engines/wintermute/wintermute.cpp @@ -26,7 +26,6 @@ #include "common/debug.h" #include "common/debug-channels.h" #include "common/error.h" -#include "common/EventRecorder.h" #include "common/file.h" #include "common/fs.h" #include "common/tokenizer.h" -- cgit v1.2.3 From 9878c89b9753227bc73cd5914a69e6f817c302e8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 25 Jun 2013 07:14:29 +0200 Subject: HOPKINS: Add some comments --- engines/hopkins/hopkins.cpp | 2 ++ engines/hopkins/script.cpp | 2 ++ 2 files changed, 4 insertions(+) (limited to 'engines') diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 81dbcabd57..2aaf44c5d3 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1138,12 +1138,14 @@ bool HopkinsEngine::runFull() { break; case 30: + // Shooting _linesMan->setMaxLineIdx(15); _globals->_characterMaxPosY = 440; _objectsMan->sceneControl2("IM30", "IM30", "ANIM30", "IM30", 24, false); break; case 31: + // Shooting target _objectsMan->sceneControl("IM31", "IM31", "ANIM31", "IM31", 10, true); break; diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 3d298b2e9e..7e150624b8 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -1217,6 +1217,7 @@ int ScriptManager::handleOpcode(const byte *dataP) { break; case 88: + // Shooting target - Shooting at target if (_vm->_globals->_saveData->_data[svField183] == 1) { _vm->_objectsMan->setBobAnimDataIdx(1, 0); _vm->_objectsMan->setBobAnimDataIdx(2, 0); @@ -1294,6 +1295,7 @@ int ScriptManager::handleOpcode(const byte *dataP) { break; case 90: + // Shooting target - Using the level _vm->_soundMan->playSoundFile("SOUND52.WAV"); if (!_vm->_globals->_saveData->_data[svField186]) { _vm->_animMan->playSequence("CIB5A.SEQ", 1, 12, 1, false, false); -- cgit v1.2.3 From 0634f516968a2869895c942cb17859e738e4d802 Mon Sep 17 00:00:00 2001 From: johndoe123 Date: Tue, 25 Jun 2013 22:49:01 +0200 Subject: NEVERHOOD: Fix bug in Module 1100, scene 2 which made the "Klayman, up here" scene was unreachable. Sound bug still present, though. --- engines/neverhood/modules/module1100.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'engines') diff --git a/engines/neverhood/modules/module1100.cpp b/engines/neverhood/modules/module1100.cpp index 0c09ed5242..dbd8c60210 100644 --- a/engines/neverhood/modules/module1100.cpp +++ b/engines/neverhood/modules/module1100.cpp @@ -64,6 +64,7 @@ Module1100::~Module1100() { void Module1100::createScene(int sceneNum, int which) { static const uint32 kSmackerFileHashList06[] = {0x10880805, 0x1088081D, 0}; static const uint32 kSmackerFileHashList07[] = {0x00290321, 0x01881000, 0}; + static const byte kNavigationTypes02[] = {1, 0, 4, 1}; debug(1, "Module1100::createScene(%d, %d)", sceneNum, which); _sceneNum = sceneNum; switch (_sceneNum) { @@ -80,9 +81,9 @@ void Module1100::createScene(int sceneNum, int which) { case 2: _vm->gameState().sceneNum = 2; if (getGlobalVar(V_ROBOT_TARGET)) { - createNavigationScene(0x004B84F0, which); + createNavigationScene(0x004B84F0, which, kNavigationTypes02); } else { - createNavigationScene(0x004B8490, which); + createNavigationScene(0x004B8490, which, kNavigationTypes02); } break; case 3: -- cgit v1.2.3 From e26fb8e7d239052d9645aa0bfb75500ddc3aa132 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Wed, 26 Jun 2013 01:59:31 +0200 Subject: WINTERMUTE: Add detection for J.U.L.I.A. (Greenlight Demo) --- engines/wintermute/detection_tables.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'engines') diff --git a/engines/wintermute/detection_tables.h b/engines/wintermute/detection_tables.h index ad4256e6b9..09426c9307 100644 --- a/engines/wintermute/detection_tables.h +++ b/engines/wintermute/detection_tables.h @@ -324,6 +324,17 @@ static const ADGameDescription gameDescriptions[] = { ADGF_DEMO, GUIO0() }, + // J.U.L.I.A. (English) (Greenlight Demo) + { + "julia", + "Greenlight Demo", + AD_ENTRY1s("data.dcp", "4befd448d36b0dae9c3ab1aa7cb8b78d", 7271886), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE | + ADGF_DEMO, + GUIO0() + }, // Mirage { "mirage", -- cgit v1.2.3 From 3d373281b440d5d139fbb01ef1ffa0ad0a76b3e8 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 26 Jun 2013 12:40:54 +0300 Subject: NEVERHOOD: Stop sound updates while the main menu is active --- engines/neverhood/menumodule.cpp | 2 ++ engines/neverhood/neverhood.cpp | 11 ++++++++--- engines/neverhood/neverhood.h | 5 ++++- 3 files changed, 14 insertions(+), 4 deletions(-) (limited to 'engines') diff --git a/engines/neverhood/menumodule.cpp b/engines/neverhood/menumodule.cpp index 368bfd60a7..accdaca63f 100644 --- a/engines/neverhood/menumodule.cpp +++ b/engines/neverhood/menumodule.cpp @@ -73,12 +73,14 @@ MenuModule::MenuModule(NeverhoodEngine *vm, Module *parentModule, int which) _savedPaletteData = _vm->_screen->getPaletteData(); _vm->_mixer->pauseAll(true); + _vm->toggleSoundUpdate(false); createScene(MAIN_MENU, -1); } MenuModule::~MenuModule() { _vm->_mixer->pauseAll(false); + _vm->toggleSoundUpdate(true); _vm->_screen->setPaletteData(_savedPaletteData); } diff --git a/engines/neverhood/neverhood.cpp b/engines/neverhood/neverhood.cpp index 57fce58b94..d60d8b760f 100644 --- a/engines/neverhood/neverhood.cpp +++ b/engines/neverhood/neverhood.cpp @@ -105,7 +105,8 @@ Common::Error NeverhoodEngine::run() { _gameModule = new GameModule(this); _isSaveAllowed = true; - + _updateSound = true; + if (isDemo()) { // Adjust this navigation list for the demo version NavigationList *navigationList = _staticData->getNavigationList(0x004B67E8); @@ -186,8 +187,12 @@ void NeverhoodEngine::mainLoop() { _screen->update(); nextFrameTime = _screen->getNextFrameTime(); }; - _soundMan->update(); - _audioResourceMan->updateMusic(); + + if (_updateSound) { + _soundMan->update(); + _audioResourceMan->updateMusic(); + } + _system->updateScreen(); _system->delayMillis(10); } diff --git a/engines/neverhood/neverhood.h b/engines/neverhood/neverhood.h index 18f2cc9f64..39bc9cef2c 100644 --- a/engines/neverhood/neverhood.h +++ b/engines/neverhood/neverhood.h @@ -134,7 +134,10 @@ public: int16 getMouseY() const { return _mouseY; } NPoint getMousePos(); -public: + void toggleSoundUpdate(bool state) { _updateSound = state; } + +private: + bool _updateSound; }; -- cgit v1.2.3 From 63c462efcef09dabf70f8b8ffb6117e23614b122 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 26 Jun 2013 20:11:00 +0200 Subject: HOPKINS: Remove erroneous static keyword, get rid of g_vm --- engines/hopkins/hopkins.cpp | 3 --- engines/hopkins/hopkins.h | 3 --- engines/hopkins/saveload.cpp | 2 +- engines/hopkins/saveload.h | 2 +- 4 files changed, 2 insertions(+), 8 deletions(-) (limited to 'engines') diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 2aaf44c5d3..b773808c50 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -35,12 +35,9 @@ namespace Hopkins { -HopkinsEngine *g_vm; - HopkinsEngine::HopkinsEngine(OSystem *syst, const HopkinsGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc), _randomSource("Hopkins") { DebugMan.addDebugChannel(kDebugPath, "Path", "Pathfinding debug level"); - g_vm = this; _animMan = new AnimationManager(this); _computer = new ComputerManager(this); _dialog = new DialogsManager(this); diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 777fd1c335..398e41a4d2 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -183,9 +183,6 @@ public: virtual void syncSoundSettings(); }; -// Global reference to the HopkinsEngine object -extern HopkinsEngine *g_vm; - } // End of namespace Hopkins #endif /* HOPKINS_HOPKINS_H */ diff --git a/engines/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp index 45b4885c90..fd36480324 100644 --- a/engines/hopkins/saveload.cpp +++ b/engines/hopkins/saveload.cpp @@ -216,7 +216,7 @@ Common::Error SaveLoadManager::loadGame(int slot) { bool SaveLoadManager::readSavegameHeader(int slot, hopkinsSavegameHeader &header) { // Try and open the save file for reading Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading( - g_vm->generateSaveName(slot)); + _vm->generateSaveName(slot)); if (!saveFile) return false; diff --git a/engines/hopkins/saveload.h b/engines/hopkins/saveload.h index 221a445fd2..6fee814180 100644 --- a/engines/hopkins/saveload.h +++ b/engines/hopkins/saveload.h @@ -63,7 +63,7 @@ public: static bool readSavegameHeader(Common::InSaveFile *in, hopkinsSavegameHeader &header); void writeSavegameHeader(Common::OutSaveFile *out, hopkinsSavegameHeader &header); - static bool readSavegameHeader(int slot, hopkinsSavegameHeader &header); + bool readSavegameHeader(int slot, hopkinsSavegameHeader &header); Common::Error saveGame(int slot, const Common::String &saveName); Common::Error loadGame(int slot); -- cgit v1.2.3 From 6716fa39a6fb2a3925576288c256688c5aadd7e9 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Wed, 26 Jun 2013 21:33:30 +0200 Subject: HOPKINS: Change some variable names for consistency This silences a GCC warning about a 'saveFile' variable shadowing a saveFile() method. --- engines/hopkins/saveload.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'engines') diff --git a/engines/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp index fd36480324..98fb15046e 100644 --- a/engines/hopkins/saveload.cpp +++ b/engines/hopkins/saveload.cpp @@ -43,12 +43,12 @@ SaveLoadManager::SaveLoadManager(HopkinsEngine *vm) { } bool SaveLoadManager::save(const Common::String &file, const void *buf, size_t n) { - Common::OutSaveFile *f = g_system->getSavefileManager()->openForSaving(file); + Common::OutSaveFile *savefile = g_system->getSavefileManager()->openForSaving(file); - if (f) { - size_t bytesWritten = f->write(buf, n); - f->finalize(); - delete f; + if (savefile) { + size_t bytesWritten = savefile->write(buf, n); + savefile->finalize(); + delete savefile; return bytesWritten == n; } else @@ -69,13 +69,13 @@ void SaveLoadManager::initSaves() { } void SaveLoadManager::load(const Common::String &file, byte *buf) { - Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading(file); - if (f == NULL) - error("Error openinig file - %s", file.c_str()); + Common::InSaveFile *savefile = g_system->getSavefileManager()->openForLoading(file); + if (savefile == NULL) + error("Error opening file - %s", file.c_str()); - int32 filesize = f->size(); - f->read(buf, filesize); - delete f; + int32 filesize = savefile->size(); + savefile->read(buf, filesize); + delete savefile; } bool SaveLoadManager::readSavegameHeader(Common::InSaveFile *in, hopkinsSavegameHeader &header) { @@ -215,13 +215,13 @@ Common::Error SaveLoadManager::loadGame(int slot) { bool SaveLoadManager::readSavegameHeader(int slot, hopkinsSavegameHeader &header) { // Try and open the save file for reading - Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading( + Common::InSaveFile *savefile = g_system->getSavefileManager()->openForLoading( _vm->generateSaveName(slot)); - if (!saveFile) + if (!savefile) return false; - bool result = readSavegameHeader(saveFile, header); - delete saveFile; + bool result = readSavegameHeader(savefile, header); + delete savefile; return result; } -- cgit v1.2.3 From 63624f8bfa3f79302317589c9c3adbc852563a6c Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 28 Jun 2013 11:19:46 +0300 Subject: NEVERHOOD: Fix scene entrance when restoring in the Aqua (music) house This looks to be a logic error in the constructor of module 2400, since all the other modules do not create scenes with the global entrance number when they are instantiated without an entrance (i.e. when loading). With that logic error, all the code that handled Kleymen's entrance to a scene after restoring was incorrectly skipped --- engines/neverhood/modules/module2400.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/neverhood/modules/module2400.cpp b/engines/neverhood/modules/module2400.cpp index 47f842b939..8d3b763f72 100644 --- a/engines/neverhood/modules/module2400.cpp +++ b/engines/neverhood/modules/module2400.cpp @@ -30,7 +30,7 @@ Module2400::Module2400(NeverhoodEngine *vm, Module *parentModule, int which) _vm->_soundMan->addMusic(0x202D1010, 0xB110382D); if (which < 0) - createScene(_vm->gameState().sceneNum, _vm->gameState().which); + createScene(_vm->gameState().sceneNum, -1); else createScene(0, 0); -- cgit v1.2.3 From 7564be51d76bc77e82c586559f2f79d67238bfb0 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 28 Jun 2013 13:23:18 +0300 Subject: NEVERHOOD: Fix graphics glitch when opening the menu --- engines/neverhood/gamemodule.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'engines') diff --git a/engines/neverhood/gamemodule.cpp b/engines/neverhood/gamemodule.cpp index 96e8cc13a6..b3589837df 100644 --- a/engines/neverhood/gamemodule.cpp +++ b/engines/neverhood/gamemodule.cpp @@ -786,6 +786,7 @@ void GameModule::openMainMenu() { createModule(1000, 0); } _vm->_screen->saveParams(); + _vm->_screen->update(); _mainMenuRequested = false; createMenuModule(); } -- cgit v1.2.3 From 02f11ec76f1ac5e81f95d6f07e7a10fb34567a3d Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 28 Jun 2013 13:48:16 +0300 Subject: NEVERHOOD: Add missing music when entering the Hall of Records building The "Everybody Way Oh" theme should be played in both of the first two rooms of the Hall of Records building --- engines/neverhood/modules/module2200.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'engines') diff --git a/engines/neverhood/modules/module2200.cpp b/engines/neverhood/modules/module2200.cpp index 08ed274eb3..04e3f0bfee 100644 --- a/engines/neverhood/modules/module2200.cpp +++ b/engines/neverhood/modules/module2200.cpp @@ -50,6 +50,7 @@ void Module2200::createScene(int sceneNum, int which) { switch (_sceneNum) { case 0: _vm->gameState().sceneNum = 0; + _vm->_soundMan->startMusic(0x601C908C, 0, 2); _childObject = new Scene2201(_vm, this, which); break; case 1: -- cgit v1.2.3 From 5a8aa67e503c115bc38e14f4b9fac7c334736c9d Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 28 Jun 2013 15:33:37 +0300 Subject: NEVERHOOD: Remove superfluous description from a console command --- engines/neverhood/console.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/neverhood/console.cpp b/engines/neverhood/console.cpp index 7b5add65c7..a4dd50ce4b 100644 --- a/engines/neverhood/console.cpp +++ b/engines/neverhood/console.cpp @@ -79,7 +79,7 @@ bool Console::Cmd_Cheat(int argc, const char **argv) { DebugPrintf(" music - shows the correct index in the radio music puzzle, module 2800, scene 1\n"); DebugPrintf(" radio - enables the radio, module 3000, scene 9 - same as pulling the rightmost cord in the flytrap room\n"); DebugPrintf(" symbols - solves the symbols puzzle, module 1600, scene 8. Only available in that room\n"); - DebugPrintf(" tubes - shows the correct test tube combination in module 2800, scenes 7 and 10, can be used anywhere\n"); + DebugPrintf(" tubes - shows the correct test tube combination in module 2800, scenes 7 and 10\n"); return true; } -- cgit v1.2.3 From 9f7033120b9715aee7e1ea4233a77e12a0db96a6 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 28 Jun 2013 15:37:48 +0300 Subject: NEVERHOOD: Use the ScummVM dialogs for saving/loading An option has been added to use the original ones, if needed --- engines/neverhood/detection.cpp | 16 ++++++++- engines/neverhood/menumodule.cpp | 77 ++++++++++++++++++++++++++++++++++------ engines/neverhood/menumodule.h | 2 ++ engines/neverhood/neverhood.cpp | 3 ++ 4 files changed, 87 insertions(+), 11 deletions(-) (limited to 'engines') diff --git a/engines/neverhood/detection.cpp b/engines/neverhood/detection.cpp index 5f860f8519..3de087051a 100644 --- a/engines/neverhood/detection.cpp +++ b/engines/neverhood/detection.cpp @@ -24,6 +24,7 @@ #include "engines/advancedDetector.h" #include "common/file.h" +#include "common/translation.h" #include "neverhood/neverhood.h" @@ -143,6 +144,13 @@ static const NeverhoodGameDescription gameDescriptions[] = { } // End of namespace Neverhood +static const ExtraGuiOption neverhoodExtraGuiOption = { + _s("Use original save/load screens"), + _s("Use the original save/load screens, instead of the ScummVM ones"), + "originalsaveload", + false +}; + class NeverhoodMetaEngine : public AdvancedMetaEngine { public: NeverhoodMetaEngine() : AdvancedMetaEngine(Neverhood::gameDescriptions, sizeof(Neverhood::NeverhoodGameDescription), neverhoodGames) { @@ -160,7 +168,7 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; - + virtual const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const; SaveStateList listSaves(const char *target) const; virtual int getMaximumSaveSlot() const; void removeSaveState(const char *target, int slot) const; @@ -194,6 +202,12 @@ bool NeverhoodMetaEngine::createInstance(OSystem *syst, Engine **engine, const A return gd != 0; } +const ExtraGuiOptions NeverhoodMetaEngine::getExtraGuiOptions(const Common::String &target) const { + ExtraGuiOptions options; + options.push_back(neverhoodExtraGuiOption); + return options; +} + SaveStateList NeverhoodMetaEngine::listSaves(const char *target) const { Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); Neverhood::NeverhoodEngine::SaveHeader header; diff --git a/engines/neverhood/menumodule.cpp b/engines/neverhood/menumodule.cpp index accdaca63f..8814401f5e 100644 --- a/engines/neverhood/menumodule.cpp +++ b/engines/neverhood/menumodule.cpp @@ -20,6 +20,11 @@ * */ +#include "common/config-manager.h" +#include "common/translation.h" + +#include "gui/saveload.h" + #include "neverhood/menumodule.h" #include "neverhood/gamemodule.h" @@ -193,24 +198,26 @@ uint32 MenuModule::handleMessage(int messageNum, const MessageParam ¶m, Enti } void MenuModule::createLoadGameMenu() { - _savegameSlot = -1; - _savegameList = new SavegameList(); - loadSavegameList(); + refreshSaveGameList(); _childObject = new LoadGameMenu(_vm, this, _savegameList); } void MenuModule::createSaveGameMenu() { - _savegameSlot = -1; - _savegameList = new SavegameList(); - loadSavegameList(); + refreshSaveGameList(); _childObject = new SaveGameMenu(_vm, this, _savegameList); } void MenuModule::createDeleteGameMenu() { + refreshSaveGameList(); + _childObject = new DeleteGameMenu(_vm, this, _savegameList); +} + +void MenuModule::refreshSaveGameList() { _savegameSlot = -1; + delete _savegameList; + _savegameList = NULL; _savegameList = new SavegameList(); loadSavegameList(); - _childObject = new DeleteGameMenu(_vm, this, _savegameList); } void MenuModule::handleLoadGameMenuAction(bool doLoad) { @@ -848,6 +855,36 @@ void SavegameListBox::pageDown() { } } +int GameStateMenu::scummVMSaveLoadDialog(bool isSave, Common::String &saveDesc) { + const EnginePlugin *plugin = NULL; + EngineMan.findGame(ConfMan.get("gameid"), &plugin); + GUI::SaveLoadChooser *dialog; + Common::String desc; + int slot; + + if (isSave) { + dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), true); + + slot = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName()); + desc = dialog->getResultString(); + + if (desc.empty()) + desc = dialog->createDefaultSaveDescription(slot); + + if (desc.size() > 29) + desc = Common::String(desc.c_str(), 29); + + saveDesc = desc; + } else { + dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"), false); + slot = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName()); + } + + delete dialog; + + return slot; +} + GameStateMenu::GameStateMenu(NeverhoodEngine *vm, Module *parentModule, SavegameList *savegameList, const uint32 *buttonFileHashes, const NRect *buttonCollisionBounds, uint32 backgroundFileHash, uint32 fontFileHash, @@ -857,8 +894,29 @@ GameStateMenu::GameStateMenu(NeverhoodEngine *vm, Module *parentModule, Savegame uint32 textFileHash1, uint32 textFileHash2) : Scene(vm, parentModule), _currWidget(NULL), _savegameList(savegameList) { + bool isSave = (textEditCursorFileHash != 0); + _fontSurface = new FontSurface(_vm, fontFileHash, 32, 7, 32, 11, 17); - + + if (!ConfMan.getBool("originalsaveload")) { + Common::String saveDesc; + int saveCount = savegameList->size(); + int slot = scummVMSaveLoadDialog(isSave, saveDesc); + + if (slot >= 0) { + if (!isSave) { + ((MenuModule*)_parentModule)->setLoadgameInfo(slot); + } else { + ((MenuModule*)_parentModule)->setSavegameInfo(saveDesc, + slot, slot >= saveCount); + } + leaveScene(0); + } else { + leaveScene(1); + } + return; + } + setBackground(backgroundFileHash); setPalette(backgroundFileHash); insertScreenMouse(mouseFileHash, mouseRect); @@ -871,7 +929,7 @@ GameStateMenu::GameStateMenu(NeverhoodEngine *vm, Module *parentModule, Savegame _textEditWidget = new TextEditWidget(_vm, textEditX, textEditY, this, 29, _fontSurface, textEditBackgroundFileHash, textEditRect); - if (textEditCursorFileHash != 0) + if (isSave) _textEditWidget->setCursor(textEditCursorFileHash, 2, 13); else _textEditWidget->setReadOnly(true); @@ -886,7 +944,6 @@ GameStateMenu::GameStateMenu(NeverhoodEngine *vm, Module *parentModule, Savegame SetUpdateHandler(&Scene::update); SetMessageHandler(&GameStateMenu::handleMessage); - } GameStateMenu::~GameStateMenu() { diff --git a/engines/neverhood/menumodule.h b/engines/neverhood/menumodule.h index 08858ad204..6ee990de67 100644 --- a/engines/neverhood/menumodule.h +++ b/engines/neverhood/menumodule.h @@ -45,6 +45,7 @@ public: void setLoadgameInfo(uint index); void setSavegameInfo(const Common::String &description, uint index, bool newSavegame); void setDeletegameInfo(uint index); + void refreshSaveGameList(); protected: int _sceneNum; byte *_savedPaletteData; @@ -229,6 +230,7 @@ protected: Common::String _savegameDescription; uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); virtual void performAction(); + int scummVMSaveLoadDialog(bool isSave, Common::String &saveDesc); }; class SaveGameMenu : public GameStateMenu { diff --git a/engines/neverhood/neverhood.cpp b/engines/neverhood/neverhood.cpp index d60d8b760f..3769117f7f 100644 --- a/engines/neverhood/neverhood.cpp +++ b/engines/neverhood/neverhood.cpp @@ -77,6 +77,9 @@ Common::Error NeverhoodEngine::run() { _gameState.sceneNum = 0; _gameState.which = 0; + // Assign default values to the config manager, in case settings are missing + ConfMan.registerDefault("originalsaveload", "false"); + _staticData = new StaticData(); _staticData->load("neverhood.dat"); _gameVars = new GameVars(); -- cgit v1.2.3 From 0658a88737a205b5edacb662a3161e2acd8b7d51 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 28 Jun 2013 18:09:35 +0300 Subject: NEVERHOOD: Fix incorrect checks for the waterfall sounds Some of the "wall broken" checks were inverse, resulting in the waterfall sound being incorrectly heard when the wall was broken. Also, simplified some of the "wall broken" checks --- engines/neverhood/modules/module3000.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'engines') diff --git a/engines/neverhood/modules/module3000.cpp b/engines/neverhood/modules/module3000.cpp index 373bfb57f6..bc6b7790b4 100644 --- a/engines/neverhood/modules/module3000.cpp +++ b/engines/neverhood/modules/module3000.cpp @@ -49,7 +49,7 @@ Module3000::Module3000(NeverhoodEngine *vm, Module *parentModule, int which) _isWallBroken = getGlobalVar(V_WALL_BROKEN) != 0; - if (_isWallBroken) { + if (!_isWallBroken) { _vm->_soundMan->setSoundVolume(0x90F0D1C3, 0); _vm->_soundMan->playSoundLooping(0x90F0D1C3); } @@ -77,11 +77,12 @@ void Module3000::createScene(int sceneNum, int which) { static const byte kNavigationTypes06[] = {5}; debug(1, "Module3000::createScene(%d, %d)", sceneNum, which); _vm->gameState().sceneNum = sceneNum; + _isWallBroken = getGlobalVar(V_WALL_BROKEN) != 0; switch (_vm->gameState().sceneNum) { case 1: if (!getGlobalVar(V_BOLT_DOOR_OPEN)) { createNavigationScene(0x004B7C80, which); - } else if (getGlobalVar(V_WALL_BROKEN)) { + } else if (_isWallBroken) { createNavigationScene(0x004B7CE0, which); } else { createNavigationScene(0x004B7CB0, which); @@ -89,11 +90,11 @@ void Module3000::createScene(int sceneNum, int which) { break; case 2: _vm->_soundMan->playTwoSounds(0x81293110, 0x40030A51, 0xC862CA15, 0); - if (_isWallBroken) { + if (!_isWallBroken) { _soundVolume = 90; _vm->_soundMan->setSoundVolume(0x90F0D1C3, 90); } - if (getGlobalVar(V_WALL_BROKEN)) { + if (_isWallBroken) { createNavigationScene(0x004B7D58, which); } else { createNavigationScene(0x004B7D10, which); @@ -102,7 +103,7 @@ void Module3000::createScene(int sceneNum, int which) { case 3: if (getGlobalVar(V_STAIRS_DOWN)) createNavigationScene(0x004B7E60, which); - else if (getGlobalVar(V_WALL_BROKEN)) + else if (_isWallBroken) createNavigationScene(0x004B7DA0, which); else createNavigationScene(0x004B7E00, which); @@ -150,12 +151,12 @@ void Module3000::createScene(int sceneNum, int which) { // NOTE: Newly introduced sceneNums case 1001: if (!getGlobalVar(V_BOLT_DOOR_OPEN)) - if (getGlobalVar(V_WALL_BROKEN)) + if (_isWallBroken) createSmackerScene(0x00940021, true, true, false); else createSmackerScene(0x01140021, true, true, false); else - if (getGlobalVar(V_WALL_BROKEN)) + if (_isWallBroken) createSmackerScene(0x001011B1, true, true, false); else createSmackerScene(0x001021B1, true, true, false); @@ -299,7 +300,7 @@ void Module3000::updateScene() { } else if (frameNumber == 10) { _vm->_soundMan->playTwoSounds(0x81293110, 0x40030A51, 0xC862CA15, 0); } - if (_isWallBroken && _soundVolume < 90 && frameNumber % 2) { + if (!_isWallBroken && _soundVolume < 90 && frameNumber % 2) { if (frameNumber == 0) _soundVolume = 40; else @@ -313,7 +314,7 @@ void Module3000::updateScene() { if (navigationScene()->isWalkingForward()) { uint32 frameNumber = navigationScene()->getFrameNumber(); int navigationIndex = navigationScene()->getNavigationIndex(); - if (_isWallBroken && _soundVolume > 1 && frameNumber % 2) { + if (!_isWallBroken && _soundVolume > 1 && frameNumber % 2) { _soundVolume--; _vm->_soundMan->setSoundVolume(0x90F0D1C3, _soundVolume); } @@ -338,7 +339,7 @@ void Module3000::updateScene() { if (frameNumber == 40) { _vm->_soundMan->playTwoSounds(0x81293110, 0x40030A51, 0xC862CA15, 0); } - if (_isWallBroken && _soundVolume < 90 && frameNumber % 2) { + if (!_isWallBroken && _soundVolume < 90 && frameNumber % 2) { if (frameNumber == 0) _soundVolume = 40; else -- cgit v1.2.3 From 7c18021c52985aabc4574c633ba6569bbddd648b Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Fri, 28 Jun 2013 19:32:59 +0200 Subject: NEVERHOOD: Handle invalid save_slot more gracefully on startup If the specificed savegame doesn't exist, start the game from the beginning. Before, it would just hang. The error handling is still quite primitive, though. --- engines/neverhood/neverhood.cpp | 7 ++++--- engines/neverhood/neverhood.h | 4 ++-- engines/neverhood/saveload.cpp | 19 +++++++++++-------- 3 files changed, 17 insertions(+), 13 deletions(-) (limited to 'engines') diff --git a/engines/neverhood/neverhood.cpp b/engines/neverhood/neverhood.cpp index 3769117f7f..e7c9f32d45 100644 --- a/engines/neverhood/neverhood.cpp +++ b/engines/neverhood/neverhood.cpp @@ -123,9 +123,10 @@ Common::Error NeverhoodEngine::run() { (*navigationList)[5].middleFlag = 1; } - if (ConfMan.hasKey("save_slot")) - loadGameState(ConfMan.getInt("save_slot")); - else + if (ConfMan.hasKey("save_slot")) { + if (loadGameState(ConfMan.getInt("save_slot")).getCode() != Common::kNoError) + _gameModule->startup(); + } else _gameModule->startup(); mainLoop(); diff --git a/engines/neverhood/neverhood.h b/engines/neverhood/neverhood.h index 39bc9cef2c..773e80df7d 100644 --- a/engines/neverhood/neverhood.h +++ b/engines/neverhood/neverhood.h @@ -122,8 +122,8 @@ public: Common::Error loadGameState(int slot); Common::Error saveGameState(int slot, const Common::String &description); Common::Error removeGameState(int slot); - void savegame(const char *filename, const char *description); - void loadgame(const char *filename); + bool savegame(const char *filename, const char *description); + bool loadgame(const char *filename); const char *getSavegameFilename(int num); static Common::String getSavegameFilename(const Common::String &target, int num); static kReadSaveHeaderError readSaveHeader(Common::SeekableReadStream *in, bool loadThumbnail, SaveHeader &header); diff --git a/engines/neverhood/saveload.cpp b/engines/neverhood/saveload.cpp index 578d9858ff..ae93a0cea4 100644 --- a/engines/neverhood/saveload.cpp +++ b/engines/neverhood/saveload.cpp @@ -61,12 +61,12 @@ NeverhoodEngine::kReadSaveHeaderError NeverhoodEngine::readSaveHeader(Common::Se return ((in->eos() || in->err()) ? kRSHEIoError : kRSHENoError); } -void NeverhoodEngine::savegame(const char *filename, const char *description) { +bool NeverhoodEngine::savegame(const char *filename, const char *description) { Common::OutSaveFile *out; if (!(out = g_system->getSavefileManager()->openForSaving(filename))) { warning("Can't create file '%s', game not saved", filename); - return; + return false; } TimeDate curTime; @@ -99,13 +99,14 @@ void NeverhoodEngine::savegame(const char *filename, const char *description) { out->finalize(); delete out; + return true; } -void NeverhoodEngine::loadgame(const char *filename) { +bool NeverhoodEngine::loadgame(const char *filename) { Common::InSaveFile *in; if (!(in = g_system->getSavefileManager()->openForLoading(filename))) { warning("Can't open file '%s', game not loaded", filename); - return; + return false; } SaveHeader header; @@ -115,7 +116,7 @@ void NeverhoodEngine::loadgame(const char *filename) { if (errorCode != kRSHENoError) { warning("Error loading savegame '%s'", filename); delete in; - return; + return false; } g_engine->setTotalPlayTime(header.playTime * 1000); @@ -128,18 +129,20 @@ void NeverhoodEngine::loadgame(const char *filename) { _gameModule->requestRestoreGame(); delete in; - + return true; } Common::Error NeverhoodEngine::loadGameState(int slot) { const char *fileName = getSavegameFilename(slot); - loadgame(fileName); + if (!loadgame(fileName)) + return Common::kReadingFailed; return Common::kNoError; } Common::Error NeverhoodEngine::saveGameState(int slot, const Common::String &description) { const char *fileName = getSavegameFilename(slot); - savegame(fileName, description.c_str()); + if (!savegame(fileName, description.c_str())) + return Common::kWritingFailed; return Common::kNoError; } -- cgit v1.2.3 From 114eff979d281341f9a7661a58b0ea2114fcfc7d Mon Sep 17 00:00:00 2001 From: sylvaintv Date: Sun, 30 Jun 2013 01:18:07 +0200 Subject: TOON: Fix bug #3611869 - Drew sometimes ends up stuck walking forever Canceled old character setFacing when a new one is issued during the character rotation. Bug #3611869: "TOON: Drew sometimes ends up stuck walking forever" --- engines/toon/character.cpp | 9 +++++++++ engines/toon/character.h | 1 + 2 files changed, 10 insertions(+) (limited to 'engines') diff --git a/engines/toon/character.cpp b/engines/toon/character.cpp index 479f4965f3..83c9e3ec70 100644 --- a/engines/toon/character.cpp +++ b/engines/toon/character.cpp @@ -58,6 +58,7 @@ Character::Character(ToonEngine *vm) : _vm(vm) { _animSpecialDefaultId = 0; _currentPathNode = 0; _currentWalkStamp = 0; + _currentFacingStamp = 0; _visible = true; _speed = 150; // 150 = nominal drew speed _lastWalkTime = 0; @@ -99,6 +100,9 @@ void Character::setFacing(int32 facing) { if (_blockingWalk) { _flags |= 2; + _currentFacingStamp++; + int32 localFacingStamp = _currentFacingStamp; + int32 dir = 0; _lastWalkTime = _vm->_system->getMillis(); @@ -127,6 +131,11 @@ void Character::setFacing(int32 facing) { else playWalkAnim(0, 0); _vm->doFrame(); + + if (_currentFacingStamp != localFacingStamp) { + // another setFacing was started in doFrame, we need to cancel this one. + return; + } }; _flags &= ~2; diff --git a/engines/toon/character.h b/engines/toon/character.h index d33c314bf7..b248e7ccf2 100644 --- a/engines/toon/character.h +++ b/engines/toon/character.h @@ -143,6 +143,7 @@ protected: Common::Array _currentPath; uint32 _currentPathNode; int32 _currentWalkStamp; + int32 _currentFacingStamp; }; } // End of namespace Toon -- cgit v1.2.3 From 9a88fe848576e63b2fa2ab79e087ae34c21bb5d1 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sun, 30 Jun 2013 18:59:13 +0200 Subject: GOB: Add hypothetical 32bpp support --- engines/gob/surface.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'engines') diff --git a/engines/gob/surface.cpp b/engines/gob/surface.cpp index 6b65eb6ab9..839378a412 100644 --- a/engines/gob/surface.cpp +++ b/engines/gob/surface.cpp @@ -45,7 +45,7 @@ static void plotPixel(int x, int y, int color, void *data) { Pixel::Pixel(byte *vidMem, uint8 bpp, byte *min, byte *max) : _vidMem(vidMem), _bpp(bpp), _min(min), _max(max) { - assert((_bpp == 1) || (_bpp == 2)); + assert((_bpp == 1) || (_bpp == 2) || (_bpp == 4)); assert(_vidMem >= _min); assert(_vidMem < _max); } @@ -91,6 +91,8 @@ uint32 Pixel::get() const { return *((byte *) _vidMem); if (_bpp == 2) return *((uint16 *) _vidMem); + if (_bpp == 4) + return *((uint32 *) _vidMem); return 0; } @@ -103,6 +105,8 @@ void Pixel::set(uint32 p) { *((byte *) _vidMem) = (byte) p; if (_bpp == 2) *((uint16 *) _vidMem) = (uint16) p; + if (_bpp == 4) + *((uint32 *) _vidMem) = (uint32) p; } bool Pixel::isValid() const { @@ -113,7 +117,7 @@ bool Pixel::isValid() const { ConstPixel::ConstPixel(const byte *vidMem, uint8 bpp, const byte *min, const byte *max) : _vidMem(vidMem), _bpp(bpp), _min(min), _max(max) { - assert((_bpp == 1) || (_bpp == 2)); + assert((_bpp == 1) || (_bpp == 2) || (_bpp == 4)); assert(_vidMem >= _min); assert(_vidMem < _max); } @@ -159,6 +163,8 @@ uint32 ConstPixel::get() const { return *((const byte *) _vidMem); if (_bpp == 2) return *((const uint16 *) _vidMem); + if (_bpp == 4) + return *((const uint32 *) _vidMem); return 0; } @@ -172,7 +178,7 @@ Surface::Surface(uint16 width, uint16 height, uint8 bpp, byte *vidMem) : _width(width), _height(height), _bpp(bpp), _vidMem(vidMem) { assert((_width > 0) && (_height > 0)); - assert((_bpp == 1) || (_bpp == 2)); + assert((_bpp == 1) || (_bpp == 2) || (_bpp == 4)); if (!_vidMem) { _vidMem = new byte[_bpp * _width * _height]; @@ -187,7 +193,7 @@ Surface::Surface(uint16 width, uint16 height, uint8 bpp, const byte *vidMem) : _width(width), _height(height), _bpp(bpp), _vidMem(0) { assert((_width > 0) && (_height > 0)); - assert((_bpp == 1) || (_bpp == 2)); + assert((_bpp == 1) || (_bpp == 2) || (_bpp == 4)); _vidMem = new byte[_bpp * _width * _height]; _ownVidMem = true; @@ -504,7 +510,7 @@ void Surface::fillRect(uint16 left, uint16 top, uint16 right, uint16 bottom, uin return; } - assert(_bpp == 2); + assert((_bpp == 2) || (_bpp == 4)); // Otherwise, we have to fill by pixel -- cgit v1.2.3 From 04dc01109faa46ab026fbbd0a709fb4cdba9587e Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 1 Jul 2013 02:35:02 +0300 Subject: NEVERHOOD: Fix the second tape sprite in the whale room The second tape is now correctly faced to the right --- engines/neverhood/modules/module2100.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/neverhood/modules/module2100.cpp b/engines/neverhood/modules/module2100.cpp index b664e93dde..7f9ca94430 100644 --- a/engines/neverhood/modules/module2100.cpp +++ b/engines/neverhood/modules/module2100.cpp @@ -210,7 +210,7 @@ Scene2101::Scene2101(NeverhoodEngine *vm, Module *parentModule, int which) _ssFloorButton = insertSprite(this, 0x72427010, 0x32423010, 200, 0); _asTape1 = insertSprite(this, 18, 1100, 412, 443, 0x9148A011); addCollisionSprite(_asTape1); - _asTape2 = insertSprite(this, 11, 1100, 441, 443, 0x9148A011); + _asTape2 = insertSprite(this, 11, 1100, 441, 443, 0x9048A093); addCollisionSprite(_asTape2); if (which < 0) { -- cgit v1.2.3 From 507e8ec8f38f0ce54bae95776b718efa0dbf159a Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 1 Jul 2013 03:04:24 +0300 Subject: NEVERHOOD: Slight cleanup to the navigation scene code --- engines/neverhood/navigationscene.cpp | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'engines') diff --git a/engines/neverhood/navigationscene.cpp b/engines/neverhood/navigationscene.cpp index 33e2a264a8..073d18f47b 100644 --- a/engines/neverhood/navigationscene.cpp +++ b/engines/neverhood/navigationscene.cpp @@ -25,6 +25,11 @@ namespace Neverhood { +enum AreaType { + kAreaCanMoveForward = 0, + kAreaCannotMoveForward = 1 +}; + NavigationScene::NavigationScene(NeverhoodEngine *vm, Module *parentModule, uint32 navigationListId, int navigationIndex, const byte *itemsTypes) : Scene(vm, parentModule), _itemsTypes(itemsTypes), _navigationIndex(navigationIndex), _smackerDone(false), _isWalkingForward(false), _isTurning(false), _smackerFileHash(0), _interactive(true), _leaveSceneAfter(false) { @@ -49,7 +54,6 @@ NavigationScene::NavigationScene(NeverhoodEngine *vm, Module *parentModule, uint _vm->_screen->setSmackerDecoder(_smackerPlayer->getSmackerDecoder()); sendMessage(_parentModule, 0x100A, _navigationIndex); - } NavigationScene::~NavigationScene() { @@ -121,34 +125,29 @@ uint32 NavigationScene::handleMessage(int messageNum, const MessageParam ¶m, } void NavigationScene::createMouseCursor() { - const NavigationItem &navigationItem = (*_navigationList)[_navigationIndex]; uint32 mouseCursorFileHash; int areaType; - if (_mouseCursor) { + if (_mouseCursor) deleteSprite((Sprite**)&_mouseCursor); - } mouseCursorFileHash = navigationItem.mouseCursorFileHash; if (mouseCursorFileHash == 0) mouseCursorFileHash = 0x63A40028; - if (_itemsTypes) { + if (_itemsTypes) areaType = _itemsTypes[_navigationIndex]; - } else if (navigationItem.middleSmackerFileHash != 0 || navigationItem.middleFlag) { - areaType = 0; - } else { - areaType = 1; - } + else if (navigationItem.middleSmackerFileHash != 0 || navigationItem.middleFlag) + areaType = kAreaCanMoveForward; + else + areaType = kAreaCannotMoveForward; insertNavigationMouse(mouseCursorFileHash, areaType); sendPointMessage(_mouseCursor, 0x4002, _vm->getMousePos()); - } void NavigationScene::handleNavigation(const NPoint &mousePos) { - const NavigationItem &navigationItem = (*_navigationList)[_navigationIndex]; bool oldIsWalkingForward = _isWalkingForward; bool oldIsTurning = _isTurning; @@ -210,7 +209,6 @@ void NavigationScene::handleNavigation(const NPoint &mousePos) { if (oldIsWalkingForward != _isWalkingForward) _vm->_soundMan->setTwoSoundsPlayFlag(_isWalkingForward); - } } // End of namespace Neverhood -- cgit v1.2.3 From 5de6a876a93fd3a56ca50c26cfa1124a30909574 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 1 Jul 2013 04:42:13 +0300 Subject: NEVERHOOD: Fix display of the dynamites on shelves in the dynamite room --- engines/neverhood/modules/module1200.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/neverhood/modules/module1200.cpp b/engines/neverhood/modules/module1200.cpp index 3e67ddb35a..ae84d59113 100644 --- a/engines/neverhood/modules/module1200.cpp +++ b/engines/neverhood/modules/module1200.cpp @@ -133,7 +133,7 @@ SsScene1201Tnt::SsScene1201Tnt(NeverhoodEngine *vm, uint32 elemIndex, uint32 poi if (x < 300) loadSprite(kScene1201TntFileHashList1[elemIndex], kSLFDefDrawOffset | kSLFDefPosition, 50); else - loadSprite(kScene1201TntFileHashList2[elemIndex], kSLFCenteredDrawOffset | kSLFSetPosition, 50, x, y); + loadSprite(kScene1201TntFileHashList2[elemIndex], kSLFCenteredDrawOffset | kSLFSetPosition, 50, x, y - 20); setClipRect(0, 0, 640, clipY2); } -- cgit v1.2.3 From 318200cd86b437e388adbb97b75cce3874b3736f Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 1 Jul 2013 05:07:14 +0300 Subject: NEVERHOOD: Fix sound effect heard when the castle elevator door opens The condition where the elevator door opening sound is heard is triggered twice. Now, we prevent it being triggered a second time. --- engines/neverhood/modules/module1300.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/neverhood/modules/module1300.cpp b/engines/neverhood/modules/module1300.cpp index cc5c22085c..062434f064 100644 --- a/engines/neverhood/modules/module1300.cpp +++ b/engines/neverhood/modules/module1300.cpp @@ -800,7 +800,7 @@ void AsScene1306Elevator::update() { if (_isUp && _countdown != 0 && (--_countdown == 0)) stGoingDown(); AnimatedSprite::update(); - if (_currFrameIndex == 7) { + if (_currFrameIndex == 7 && _asElevatorDoor->getVisible()) { playSound(1); _asElevatorDoor->setVisible(false); } -- cgit v1.2.3 From 7804c9cc7f0ec3a8259e3876c781a6906d001422 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 1 Jul 2013 12:10:59 +0300 Subject: NEVERHOOD: Fix mouse cursor in the statue screen with the ladder button The mouse cursor resource hash used in that scene was incorrect, resulting in broken palette --- engines/neverhood/modules/module2800.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/neverhood/modules/module2800.cpp b/engines/neverhood/modules/module2800.cpp index 3d76d05762..7ab732b4ac 100644 --- a/engines/neverhood/modules/module2800.cpp +++ b/engines/neverhood/modules/module2800.cpp @@ -3120,7 +3120,7 @@ Scene2822::Scene2822(NeverhoodEngine *vm, Module *parentModule, int which) addBackground(_background); _background->getSurface()->getDrawRect().y = -10; setPalette(0xD542022E); - insertPuzzleMouse(0x0028D089, 20, 620); + insertPuzzleMouse(0x2022AD5C, 20, 620); _ssButton = insertStaticSprite(0x1A4D4120, 1100); _ssButton->setVisible(false); loadSound(2, 0x19044E72); -- cgit v1.2.3 From 1b7681e9e27971872b0459d4afea21a0f45c85df Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 1 Jul 2013 12:46:01 +0300 Subject: NEVERHOOD: Fix cursor glitch before looking down the lowered bridge The navigation scene type used was wrong, resulting in cursor glitches when moving the mouse cursor at the screen edges --- engines/neverhood/modules/module3000.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/neverhood/modules/module3000.cpp b/engines/neverhood/modules/module3000.cpp index bc6b7790b4..f483e0c95f 100644 --- a/engines/neverhood/modules/module3000.cpp +++ b/engines/neverhood/modules/module3000.cpp @@ -73,7 +73,7 @@ Module3000::~Module3000() { } void Module3000::createScene(int sceneNum, int which) { - static const byte kNavigationTypes05[] = {3, 0}; + static const byte kNavigationTypes05[] = {2, 0}; static const byte kNavigationTypes06[] = {5}; debug(1, "Module3000::createScene(%d, %d)", sceneNum, which); _vm->gameState().sceneNum = sceneNum; -- cgit v1.2.3 From b1dcd252b3b3eb4c91ba9b334541bdd97a95ef14 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 1 Jul 2013 15:08:01 +0200 Subject: KYRA: Fix (a few) font checks for systems with unsigend char. Thanks to wjp for reporting those. This only affects games with SJIS font use. --- engines/kyra/kyra_rpg.cpp | 2 +- engines/kyra/screen.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'engines') diff --git a/engines/kyra/kyra_rpg.cpp b/engines/kyra/kyra_rpg.cpp index f8eb7d00cd..4f7adcc6e5 100644 --- a/engines/kyra/kyra_rpg.cpp +++ b/engines/kyra/kyra_rpg.cpp @@ -213,7 +213,7 @@ void KyraRpgEngine::drawDialogueButtons() { screen()->printText(_dialogueButtonString[i], (x + 37 - (screen()->getTextWidth(_dialogueButtonString[i])) / 2) & ~3, ((_dialogueButtonYoffs + _dialogueButtonPosY[i]) + 2) & ~7, _dialogueHighlightedButton == i ? 0xC1 : 0xE1, 0); } else { - int sjisYOffset = (_flags.lang == Common::JA_JPN && _dialogueButtonString[i][0] < 0) ? 2 : 0; + int sjisYOffset = (_flags.lang == Common::JA_JPN && (_dialogueButtonString[i][0] & 0x80)) ? 2 : 0; gui_drawBox(x, (_dialogueButtonYoffs + _dialogueButtonPosY[i]), _dialogueButtonWidth, guiSettings()->buttons.height, guiSettings()->colors.frame1, guiSettings()->colors.frame2, guiSettings()->colors.fill); screen()->printText(_dialogueButtonString[i], x + (_dialogueButtonWidth >> 1) - (screen()->getTextWidth(_dialogueButtonString[i])) / 2, (_dialogueButtonYoffs + _dialogueButtonPosY[i]) + 2 - sjisYOffset, _dialogueHighlightedButton == i ? _dialogueButtonLabelColor1 : _dialogueButtonLabelColor2, 0); diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index 419b630714..054397a34a 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -1256,7 +1256,7 @@ int Screen::getTextWidth(const char *str) { while (1) { if (_sjisMixedFontMode) - setFont(*str < 0 ? FID_SJIS_FNT : curFont); + setFont((*str & 0x80) ? FID_SJIS_FNT : curFont); uint c = fetchChar(str); @@ -1296,7 +1296,7 @@ void Screen::printText(const char *str, int x, int y, uint8 color1, uint8 color2 while (1) { if (_sjisMixedFontMode) - setFont(*str < 0 ? FID_SJIS_FNT : curFont); + setFont((*str & 0x80) ? FID_SJIS_FNT : curFont); uint8 charHeightFnt = getFontHeight(); -- cgit v1.2.3 From 72a523059f4a3c8c4baa77f504b3adecb87d3359 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 2 Jul 2013 03:32:34 +0300 Subject: SAGA: Fix odd memcmp() conditions, as reported by clang Thanks to LordHoto for pointing those out - they followed the incorrect paradigm of previous code --- engines/saga/sndres.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'engines') diff --git a/engines/saga/sndres.cpp b/engines/saga/sndres.cpp index 49d24753a1..ca843af465 100644 --- a/engines/saga/sndres.cpp +++ b/engines/saga/sndres.cpp @@ -249,11 +249,11 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff if (!memcmp(header, "Creative", 8)) { resourceType = kSoundVOC; - } else if (!memcmp(header, "RIFF", 4) != 0) { + } else if (!memcmp(header, "RIFF", 4)) { resourceType = kSoundWAV; - } else if (!memcmp(header, "FORM", 4) != 0) { + } else if (!memcmp(header, "FORM", 4)) { resourceType = kSoundAIFF; - } else if (!memcmp(header, "ajkg", 4) != 0) { + } else if (!memcmp(header, "ajkg", 4)) { resourceType = kSoundShorten; } -- cgit v1.2.3 From b60b3bbecd45d17f95d45512023f5e33a6e96e0e Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 3 Jul 2013 04:41:06 +0300 Subject: NEVERHOOD: Fix save slot selection My initial suggestion to fix the issue was made in 163023a, which broke the save slot selection logic. The actual save slot selection problem was fixed in commit 2ca36ab --- engines/neverhood/menumodule.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'engines') diff --git a/engines/neverhood/menumodule.cpp b/engines/neverhood/menumodule.cpp index 8814401f5e..da7abd41e1 100644 --- a/engines/neverhood/menumodule.cpp +++ b/engines/neverhood/menumodule.cpp @@ -766,9 +766,7 @@ void SavegameListBox::onClick() { mousePos.y -= _y + _rect.y1; if (mousePos.x >= 0 && mousePos.x <= _rect.x2 - _rect.x1 && mousePos.y >= 0 && mousePos.y <= _rect.y2 - _rect.y1) { - // We add 1 to the char height to ensure that the correct entry is chosen if the - // user clicks at the bottom the text entry - int newIndex = _firstVisibleItem + mousePos.y / (_fontSurface->getCharHeight() + 1); + int newIndex = _firstVisibleItem + mousePos.y / _fontSurface->getCharHeight(); if (newIndex <= _lastVisibleItem) { _currIndex = newIndex; refresh(); -- cgit v1.2.3 From 0146b00148631a36cfe9b89a7edaf88a571946eb Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 3 Jul 2013 05:48:55 +0300 Subject: NEVERHOOD: Fix typo in variable name --- engines/neverhood/modules/module2700.cpp | 6 +++--- engines/neverhood/modules/module2700.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'engines') diff --git a/engines/neverhood/modules/module2700.cpp b/engines/neverhood/modules/module2700.cpp index 19655d128b..e9ea10bd16 100644 --- a/engines/neverhood/modules/module2700.cpp +++ b/engines/neverhood/modules/module2700.cpp @@ -83,7 +83,7 @@ static const uint32 kScene2725StaticSprites[] = { }; Module2700::Module2700(NeverhoodEngine *vm, Module *parentModule, int which) - : Module(vm, parentModule), _soundIndex(0), _raidoMusicInitialized(false) { + : Module(vm, parentModule), _soundIndex(0), _radioMusicInitialized(false) { _vm->_soundMan->addMusic(0x42212411, 0x04020210); _vm->_soundMan->startMusic(0x04020210, 24, 2); @@ -500,7 +500,7 @@ void Module2700::updateScene() { } else { switch (_sceneNum) { case 21: - if (!_raidoMusicInitialized) { + if (!_radioMusicInitialized) { _vm->_soundMan->stopMusic(0x04020210, 0, 1); _vm->gameModule()->initRadioPuzzle(); _musicFileHash = getGlobalVar(V_GOOD_RADIO_MUSIC_NAME); @@ -508,7 +508,7 @@ void Module2700::updateScene() { _vm->_soundMan->startMusic(_musicFileHash, 0, 2); _vm->_soundMan->addSound(0x42212411, 0x44014282); _vm->_soundMan->setSoundParams(0x44014282, true, 120, 360, 72, 0); - _raidoMusicInitialized = true; + _radioMusicInitialized = true; } break; } diff --git a/engines/neverhood/modules/module2700.h b/engines/neverhood/modules/module2700.h index 003666bb7f..158bb609e9 100644 --- a/engines/neverhood/modules/module2700.h +++ b/engines/neverhood/modules/module2700.h @@ -39,7 +39,7 @@ public: protected: int _sceneNum; int _soundIndex; - bool _raidoMusicInitialized; + bool _radioMusicInitialized; uint32 _scene2711StaticSprites[6]; uint32 _musicFileHash; void createScene(int sceneNum, int which); -- cgit v1.2.3 From e457fc2a268be4ef5e32a51ec58f15aeb476ec8a Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 3 Jul 2013 05:49:25 +0300 Subject: NEVERHOOD: Add a new console command, "playsound" --- engines/neverhood/console.cpp | 19 +++++++++++++++++++ engines/neverhood/console.h | 1 + 2 files changed, 20 insertions(+) (limited to 'engines') diff --git a/engines/neverhood/console.cpp b/engines/neverhood/console.cpp index a4dd50ce4b..e676da3727 100644 --- a/engines/neverhood/console.cpp +++ b/engines/neverhood/console.cpp @@ -25,6 +25,7 @@ #include "neverhood/neverhood.h" #include "neverhood/gamemodule.h" #include "neverhood/scene.h" +#include "neverhood/sound.h" #include "neverhood/modules/module1600.h" namespace Neverhood { @@ -34,6 +35,7 @@ Console::Console(NeverhoodEngine *vm) : GUI::Debugger(), _vm(vm) { DCmd_Register("dumpvars", WRAP_METHOD(Console, Cmd_Dumpvars)); DCmd_Register("room", WRAP_METHOD(Console, Cmd_Room)); DCmd_Register("surfaces", WRAP_METHOD(Console, Cmd_Surfaces)); + DCmd_Register("playsound", WRAP_METHOD(Console, Cmd_PlaySound)); } Console::~Console() { @@ -169,4 +171,21 @@ bool Console::Cmd_Dumpvars(int argc, const char **argv) { return true; } +bool Console::Cmd_PlaySound(int argc, const char **argv) { + if (argc < 2) { + DebugPrintf("Usage: %s \n", argv[0]); + } else { + uint32 soundHash = strtol(argv[1], NULL, 0); + AudioResourceManSoundItem *soundItem = new AudioResourceManSoundItem(_vm, soundHash); + soundItem->setVolume(100); + soundItem->playSound(false); + while (soundItem->isPlaying()) { + _vm->_system->delayMillis(10); + } + delete soundItem; + } + + return true; +} + } // End of namespace Neverhood diff --git a/engines/neverhood/console.h b/engines/neverhood/console.h index 40c11b50e3..62d65bd693 100644 --- a/engines/neverhood/console.h +++ b/engines/neverhood/console.h @@ -41,6 +41,7 @@ private: bool Cmd_Surfaces(int argc, const char **argv); bool Cmd_Cheat(int argc, const char **argv); bool Cmd_Dumpvars(int argc, const char **argv); + bool Cmd_PlaySound(int argc, const char **argv); }; } // End of namespace Neverhood -- cgit v1.2.3 From 2b980e86e3db2ebc2279761ba29c0be4f24e03dc Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 4 Jul 2013 13:28:41 +0300 Subject: NEVERHOOD: Move the TODO into our wiki It can now be found at http://wiki.scummvm.org/index.php/Neverhood/TODO --- engines/neverhood/todo.txt | 45 --------------------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 engines/neverhood/todo.txt (limited to 'engines') diff --git a/engines/neverhood/todo.txt b/engines/neverhood/todo.txt deleted file mode 100644 index 9d781e06ec..0000000000 --- a/engines/neverhood/todo.txt +++ /dev/null @@ -1,45 +0,0 @@ -NOTE: -------- -Some of the TODOs should be done AFTER the whole game logic is implemented -else the game disasm and reimplemtation code become even more different -(unless I decide it's ok to do it :) - -TODOs which can be done any time: ------------------------------------ -- Cleanup -- Clean up staticdata structs to look more like the ones in create_neverhood - (e.g. by using template classes etc.) - - Or use a common base class and manage all stuff in one single table and cast stuff accordingly - -TODOs which should be done only after the game logic is finished: -------------------------------------------------------------------- -- Maybe rework organization of files (e.g. put ALL Sprites into one separate file, same with Modules and Scenes) - - This would solve the problem of how to organize stuff which is used several times, and less headers would have to be included - - The move special scenes (SmackerScene) into the scenes file - -DONE: -------- -- Implement game menus -- Rework sound system (I don't like that SoundResources need to be explicitly initialized in Scene constructors) - - Should be just a handle object which initializes itself - - Play routine should fill the handle so it can be stopped/queried later - - Basically like ScummVM own sound handles -- RE and implement yet unknown music/sound stuff -- Implement clever sprite redrawing code (dirty rectangles, microtiles etc.), only redraw what's neccessary -- Rework the resource system - - The current system can be simplified a lot - - Also resource purging needs to be implemented -- Maybe merge CollisionMan with Scene (since it's so far never used independently) -- Give placeholder stuff (e.g. sub?????, _flag??? etc.) better fitting names -- Use CursorMan for the mouse cursor (instead of using it like a normal sprite) - - This whould make it neccessary to call _system->updateScreen more often else - the mouse movement would be choppy - -TODOs which are experimental: -------------------------------- -NOTE: Since they affect the whole game, they really should be only implemented once the full game logic is implemented. -These are nothing more than wild ideas for now, any might never be implemented. -- Use states instead of separate callback methods -- Try to move more stuff to neverhood.dat -- Try to use more template functions instead of manually creating functions - (Can be coupled with the above to move parameters to the dat and only use IDs) -- cgit v1.2.3